bug 821098 - browser_pluginnotification.js should not call Services.perms.removeAll...
[gecko.git] / configure.in
blobad0169e381389b760e72a01dee471facee6a883b
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)
1429     AC_MSG_CHECKING([for --build-id option to ld])
1430     _SAVE_LDFLAGS=$LDFLAGS
1431     LDFLAGS="$LDFLAGS -Wl,--build-id"
1432     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1433                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1434                   AC_MSG_RESULT([no])
1435                   LDFLAGS=$_SAVE_LDFLAGS)
1438     # Check for -mssse3 on $CC
1439     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1440     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1441     _SAVE_CFLAGS=$CFLAGS
1442     CFLAGS="$CFLAGS -mssse3"
1443     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1444                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1445                      AC_MSG_RESULT([no]))
1446     CFLAGS=$_SAVE_CFLAGS
1447     AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
1449     # Turn on GNU-specific warnings:
1450     # -Wall - turn on a lot of warnings
1451     # -pedantic - this is turned on below
1452     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1453     # -Wdeclaration-after-statement - MSVC doesn't like these
1454     # -Werror=return-type - catches missing returns, zero false positives
1455     # -Wtype-limits - catches overflow bugs, few false positives
1456     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1457     #
1458     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1459     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1460     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1461     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1462     
1463     # Turn off the following warnings that -Wall/-pedantic turn on:
1464     # -Wno-unused - lots of violations in third-party code
1465     # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1466     #
1467     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1468     MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1470     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1471        # Don't use -Wcast-align with ICC or clang
1472        case "$CPU_ARCH" in
1473            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1474            hppa | ia64 | sparc | arm)
1475            ;;
1476            *)
1477         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1478            ;;
1479        esac
1480     fi
1482     dnl Turn pedantic on but disable the warnings for long long
1483     _PEDANTIC=1
1485     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1486     _USE_CPP_INCLUDE_FLAG=1
1488 elif test "$SOLARIS_SUNPRO_CC"; then
1489     DSO_CFLAGS=''
1490     if test "$CPU_ARCH" = "sparc"; then
1491         # for Sun Studio on Solaris/SPARC
1492         DSO_PIC_CFLAGS='-xcode=pic32'
1493     else
1494         DSO_PIC_CFLAGS='-KPIC'
1495     fi
1496     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1497 else
1498     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1499     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1501     DSO_LDOPTS='-shared'
1502     if test "$GNU_LD"; then
1503         # Don't allow undefined symbols in libraries
1504         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1505     fi
1507     DSO_CFLAGS=''
1508     DSO_PIC_CFLAGS='-KPIC'
1509     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1512 if test "$GNU_CXX"; then
1513     # FIXME: Let us build with strict aliasing. bug 414641.
1514     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1516     # Turn on GNU-specific warnings:
1517     # -Wall - turn on a lot of warnings
1518     # -pedantic - this is turned on below
1519     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1520     # -Woverloaded-virtual - ???
1521     # -Werror=return-type - catches missing returns, zero false positives
1522     # -Wtype-limits - catches overflow bugs, few false positives
1523     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1524     #
1525     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1526     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1527     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1528     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1530     # Turn off the following warnings that -Wall/-pedantic turn on:
1531     # -Wno-ctor-dtor-privacy - ???
1532     # -Wno-overlength-strings - we exceed the minimum maximum length frequently 
1533     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1534     # -Wno-variadic-macros - ???
1535     #
1536     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1537     MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1538     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1539     MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1541     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1542        # Don't use -Wcast-align with ICC or clang
1543        case "$CPU_ARCH" in
1544            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1545            hppa | ia64 | sparc | arm)
1546            ;;
1547            *)
1548         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1549            ;;
1550        esac
1551     fi
1553     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1554     _USE_CPP_INCLUDE_FLAG=1
1556     # Recent clang and gcc support C++11 deleted functions without warnings if
1557     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1558     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1559     # unused.  But clang's warning can be disabled, so when compiling with clang
1560     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1561     # deleted function syntax.
1562     if test "$CLANG_CXX"; then
1563         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1564         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1565     fi
1567 else
1568     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1571 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1572 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1573 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1574 dnl normal behavior.
1575 dnl ========================================================
1576 MKSHLIB_FORCE_ALL=
1577 MKSHLIB_UNFORCE_ALL=
1579 if test "$COMPILE_ENVIRONMENT"; then
1580 if test "$GNU_CC"; then
1581   AC_MSG_CHECKING(whether ld has archive extraction flags)
1582   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1583    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1584     ac_cv_mkshlib_force_and_unforce="no"
1585     exec 3<&0 <<LOOP_INPUT
1586         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1587         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1588         force="-Wl,-all";              unforce="-Wl,-none"
1589 LOOP_INPUT
1590     while read line
1591     do
1592       eval $line
1593       LDFLAGS=$force
1594       LIBS=$unforce
1595       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1596     done
1597     exec 0<&3 3<&-
1598     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1599    ])
1600   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1601     AC_MSG_RESULT(no)
1602   else
1603     AC_MSG_RESULT(yes)
1604     eval $ac_cv_mkshlib_force_and_unforce
1605     MKSHLIB_FORCE_ALL=$force
1606     MKSHLIB_UNFORCE_ALL=$unforce
1607   fi
1608 fi # GNU_CC
1609 fi # COMPILE_ENVIRONMENT
1611 dnl ========================================================
1612 dnl Checking for 64-bit OS
1613 dnl ========================================================
1614 if test "$COMPILE_ENVIRONMENT"; then
1615 AC_LANG_SAVE
1616 AC_LANG_C
1617 AC_MSG_CHECKING(for 64-bit OS)
1618 AC_TRY_COMPILE([$configure_static_assert_macros],
1619                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1620                result="yes", result="no")
1621 AC_MSG_RESULT("$result")
1622 if test "$result" = "yes"; then
1623     AC_DEFINE(HAVE_64BIT_OS)
1624     HAVE_64BIT_OS=1
1626 AC_SUBST(HAVE_64BIT_OS)
1627 AC_LANG_RESTORE
1628 fi # COMPILE_ENVIRONMENT
1630 dnl ========================================================
1631 dnl Enable high-memory support on OS/2 by default.
1632 dnl ========================================================
1633 MOZ_OS2_HIGH_MEMORY=1
1634 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1635 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1636     MOZ_OS2_HIGH_MEMORY=,
1637     MOZ_OS2_HIGH_MEMORY=1 )
1638 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1640 dnl ========================================================
1641 dnl = Use profiling compile flags
1642 dnl ========================================================
1643 MOZ_ARG_ENABLE_BOOL(profiling,
1644 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1645     MOZ_PROFILING=1,
1646     MOZ_PROFILING= )
1648 # For profiling builds keep the symbol information
1649 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1650     case "$OS_TARGET" in
1651     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1652         STRIP_FLAGS="--strip-debug"
1653         ;;
1654     esac
1657 dnl ========================================================
1658 dnl = Use incremental GC
1659 dnl ========================================================
1660 JSGC_INCREMENTAL=1
1661 MOZ_ARG_DISABLE_BOOL(gcincremental,
1662 [  --disable-gcincremental Disable incremental GC],
1663     JSGC_INCREMENTAL= )
1664 if test -n "$JSGC_INCREMENTAL"; then
1665     AC_DEFINE(JSGC_INCREMENTAL)
1668 dnl ========================================================
1669 dnl = Use generational GC
1670 dnl ========================================================
1671 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1672 [  --enable-gcgenerational Enable generational GC],
1673     JSGC_GENERATIONAL=1,
1674     JSGC_GENERATIONAL= )
1675 if test -n "$JSGC_GENERATIONAL"; then
1676     AC_DEFINE(JSGC_GENERATIONAL)
1679 dnl ========================================================
1680 dnl = Perform moving GC stack rooting analysis
1681 dnl ========================================================
1682 MOZ_ARG_ENABLE_BOOL(root-analysis,
1683 [  --enable-root-analysis  Enable moving GC stack root analysis],
1684     JSGC_ROOT_ANALYSIS=1,
1685     JSGC_ROOT_ANALYSIS= )
1686 if test -n "$JSGC_ROOT_ANALYSIS"; then
1687     AC_DEFINE(JSGC_ROOT_ANALYSIS)
1690 dnl ========================================================
1691 dnl = Use exact stack rooting for GC
1692 dnl ========================================================
1693 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1694 [  --enable-exact-rooting  Enable use of exact stack roots for GC],
1695     JSGC_USE_EXACT_ROOTING=1,
1696     JSGC_USE_EXACT_ROOTING= )
1697 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1698     AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1701 dnl ========================================================
1702 dnl = Use Valgrind
1703 dnl ========================================================
1704 MOZ_ARG_ENABLE_BOOL(valgrind,
1705 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1706     MOZ_VALGRIND=1,
1707     MOZ_VALGRIND= )
1708 if test -n "$MOZ_VALGRIND"; then
1709     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1710         AC_MSG_ERROR(
1711             [--enable-valgrind specified but Valgrind is not installed]))
1712     AC_DEFINE(MOZ_VALGRIND)
1714 AC_SUBST(MOZ_VALGRIND)
1716 dnl ========================================================
1717 dnl = Enable DMDV
1718 dnl ========================================================
1719 MOZ_ARG_ENABLE_BOOL(dmdv,
1720 [  --enable-dmdv           Enable DMDV; also disables jemalloc (default=no)],
1721     MOZ_DMDV=1,
1722     MOZ_DMDV= )
1723 if test -n "$MOZ_DMDV"; then
1724     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1725         AC_MSG_ERROR(
1726             [--enable-dmdv specified but Valgrind is not installed]))
1727     AC_DEFINE(MOZ_DMDV)
1729 AC_SUBST(MOZ_DMDV)
1731 dnl ========================================================
1732 dnl jprof
1733 dnl ========================================================
1734 MOZ_ARG_ENABLE_BOOL(jprof,
1735 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1736     MOZ_JPROF=1,
1737     MOZ_JPROF= )
1738 if test -n "$MOZ_JPROF"; then
1739     MOZ_PROFILING=1
1740     AC_DEFINE(MOZ_JPROF)
1743 dnl ========================================================
1744 dnl SPS Profiler
1745 dnl ========================================================
1746 MOZ_ENABLE_PROFILER_SPS=1
1748 case "${OS_TARGET}" in
1749 Android)
1750     case "${CPU_ARCH}" in
1751     x86 | arm) ;;
1752     *)
1753         MOZ_ENABLE_PROFILER_SPS=
1754     esac
1755     ;;
1756 Linux)
1757     case "${CPU_ARCH}" in
1758     x86 | x86_64) ;;
1759     *)
1760         MOZ_ENABLE_PROFILER_SPS=
1761     esac
1762     ;;
1763 WINNT|Darwin) ;;
1765     MOZ_ENABLE_PROFILER_SPS=
1766     ;;
1767 esac
1769 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1770     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1773 dnl ========================================================
1774 dnl shark
1775 dnl ========================================================
1776 MOZ_ARG_ENABLE_BOOL(shark,
1777 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1778     MOZ_SHARK=1,
1779     MOZ_SHARK= )
1780 if test -n "$MOZ_SHARK"; then
1781     MOZ_PROFILING=1
1782     AC_DEFINE(MOZ_SHARK)
1785 dnl ========================================================
1786 dnl callgrind
1787 dnl ========================================================
1788 MOZ_ARG_ENABLE_BOOL(callgrind,
1789 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1790     MOZ_CALLGRIND=1,
1791     MOZ_CALLGRIND= )
1792 if test -n "$MOZ_CALLGRIND"; then
1793     MOZ_PROFILING=1
1794     AC_DEFINE(MOZ_CALLGRIND)
1797 dnl ========================================================
1798 dnl vtune
1799 dnl ========================================================
1800 MOZ_ARG_ENABLE_BOOL(vtune,
1801 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1802     MOZ_VTUNE=1,
1803     MOZ_VTUNE= )
1804 if test -n "$MOZ_VTUNE"; then
1805     MOZ_PROFILING=1
1806     AC_DEFINE(MOZ_VTUNE)
1809 dnl ========================================================
1810 dnl Profiling
1811 dnl ========================================================
1812 if test -n "$MOZ_PROFILING"; then
1813     AC_DEFINE(MOZ_PROFILING)
1816 dnl ========================================================
1817 dnl System overrides of the defaults for host
1818 dnl ========================================================
1819 case "$host" in
1820 *mingw*)
1821     if test -n "$_WIN32_MSVC"; then
1822         HOST_AR=lib
1823         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1824         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1825         HOST_RANLIB='echo ranlib'
1826     else
1827         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1828     fi
1829     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1830     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1831     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1832     HOST_BIN_SUFFIX=.exe
1833     case "$host" in
1834     *mingw*)
1835         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1836         ;;
1837     esac
1839     case "${host_cpu}" in
1840     i*86)
1841         if test -n "$_WIN32_MSVC"; then
1842             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1843         fi
1844         ;;
1845     x86_64)
1846         if test -n "$_WIN32_MSVC"; then
1847             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1848         fi
1849         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1850         ;;
1851     esac
1852     ;;
1854 *-darwin*)
1855     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1856     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1857     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1858     ;;
1860 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1861     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1862     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1863     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1864     ;;
1866 *os2*)
1867     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1868     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1869     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1870     HOST_BIN_SUFFIX=.exe
1871     MOZ_FIX_LINK_PATHS=
1872     ;;
1875     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1876     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1877     ;;
1878 esac
1880 dnl Check for using a custom <stdint.h> implementation
1881 dnl ========================================================
1882 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1883 if test "$MOZ_CUSTOM_STDINT_H"; then
1884   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1885   AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1886 else
1887   AC_MSG_RESULT(none specified)
1890 dnl Get mozilla version from central milestone file
1891 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1892 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1894 dnl Get version of various core apps from the version files.
1895 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1897 if test -z "$FIREFOX_VERSION"; then
1898     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1901 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1902 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1903 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1905 MOZ_DOING_LTO(lto_is_enabled)
1907 dnl ========================================================
1908 dnl System overrides of the defaults for target
1909 dnl ========================================================
1911 case "$target" in
1912 *-aix*)
1913     AC_DEFINE(AIX)
1914     if test ! "$GNU_CC"; then
1915         if test ! "$HAVE_64BIT_OS"; then
1916             # Compiling with Visual Age C++ object model compat is the
1917             # default. To compile with object model ibm, add
1918             # AIX_OBJMODEL=ibm to .mozconfig.
1919             if test "$AIX_OBJMODEL" = "ibm"; then
1920                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1921             else
1922                 AIX_OBJMODEL=compat
1923             fi
1924         else
1925             AIX_OBJMODEL=compat
1926         fi
1927         AC_SUBST(AIX_OBJMODEL)
1928         DSO_LDOPTS='-qmkshrobj=1'
1929         DSO_CFLAGS='-qflag=w:w'
1930         DSO_PIC_CFLAGS=
1931         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1932         MOZ_FIX_LINK_PATHS=
1933         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1934         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1935         if test "$COMPILE_ENVIRONMENT"; then
1936             AC_LANG_SAVE
1937             AC_LANG_CPLUSPLUS
1938             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1939             AC_TRY_COMPILE([],
1940                 [#if (__IBMCPP__ < 900)
1941                  #error "Bad compiler"
1942                  #endif],
1943                 _BAD_COMPILER=,_BAD_COMPILER=1)
1944             if test -n "$_BAD_COMPILER"; then
1945                 AC_MSG_RESULT([no])
1946                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1947             else
1948                 AC_MSG_RESULT([yes])
1949             fi
1950             AC_LANG_RESTORE
1951             TARGET_COMPILER_ABI="ibmc"
1952             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1953             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1954         fi
1955     fi
1956     case "${target_os}" in
1957     aix4.1*)
1958         DLL_SUFFIX='_shr.a'
1959         ;;
1960     esac
1961     if test "$COMPILE_ENVIRONMENT"; then
1962         MOZ_CHECK_HEADERS(sys/inttypes.h)
1963     fi
1964     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1965     ;;
1967 *-darwin*)
1968     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1969     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1970     MOZ_OPTIMIZE_FLAGS="-O3"
1971     _PEDANTIC=
1972     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1973     if test "$HAVE_64BIT_OS"; then
1974         MOZ_MEMORY=1
1975     fi
1976     DLL_SUFFIX=".dylib"
1977     DSO_LDOPTS=''
1978     STRIP_FLAGS="$STRIP_FLAGS -x -S"
1979     # Check whether we're targeting OS X or iOS
1980     AC_CACHE_CHECK(for iOS target,
1981                    ac_cv_ios_target,
1982                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1983 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1984 #error not iOS
1985 #endif],
1986                                    [],
1987                                    ac_cv_ios_target="yes",
1988                                    ac_cv_ios_target="no")])
1989     if test "$ac_cv_ios_target" = "yes"; then
1990         AC_DEFINE(XP_IOS)
1991         AC_DEFINE(XP_DARWIN)
1992         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1993     else
1994         AC_DEFINE(XP_MACOSX)
1995         AC_DEFINE(XP_DARWIN)
1996         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1997         # The ExceptionHandling framework is needed for Objective-C exception
1998         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1999         # builds.
2000         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2001     fi
2002     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2005     if test "x$lto_is_enabled" = "xyes"; then
2006         echo "Skipping -dead_strip because lto is enabled."
2007     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2008     dnl ===================================================================
2009     elif test "x$enable_dtrace" = "xyes"; then
2010         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2011     else
2012         dnl check for the presence of the -dead_strip linker flag
2013         AC_MSG_CHECKING([for -dead_strip option to ld])
2014         _SAVE_LDFLAGS=$LDFLAGS
2015         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2016         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2017         if test -n "$_HAVE_DEAD_STRIP" ; then
2018             AC_MSG_RESULT([yes])
2019             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2020         else
2021             AC_MSG_RESULT([no])
2022         fi
2024         LDFLAGS=$_SAVE_LDFLAGS
2025     fi
2027     dnl With newer linkers we need to pass -allow_heap_execute because of
2028     dnl Microsoft Silverlight (5.1.10411.0 at least).
2029     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
2030     _SAVE_LDFLAGS=$LDFLAGS
2031     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
2032     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
2033                 _HAVE_ALLOW_HEAP_EXECUTE=)
2034     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
2035         AC_MSG_RESULT([yes])
2036         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
2037     else
2038         AC_MSG_RESULT([no])
2039     fi
2040     LDFLAGS=$_SAVE_LDFLAGS
2042     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2043     ;;
2045 ia64*-hpux*)
2046     DLL_SUFFIX=".so"
2047     if test ! "$GNU_CC"; then
2048        DSO_LDOPTS='-b'
2049        DSO_CFLAGS=""
2050        DSO_PIC_CFLAGS=
2051        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2052        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2053        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2054     else
2055        DSO_LDOPTS='-b -E'
2056        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2057        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2058     fi
2059     MOZ_FIX_LINK_PATHS=
2060     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2061     AC_DEFINE(_LARGEFILE64_SOURCE)
2062     ;;
2064 *-hpux*)
2065     DLL_SUFFIX=".sl"
2066     if test ! "$GNU_CC"; then
2067         DSO_LDOPTS='-b -Wl,+s'
2068         DSO_CFLAGS=""
2069         DSO_PIC_CFLAGS="+Z"
2070         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2071         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2072         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2073     else
2074         DSO_LDOPTS='-b -E +s'
2075         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2076         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2077     fi
2078     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2079     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2080     ;;
2082 *-android*|*-linuxandroid*)
2083     AC_DEFINE(NO_PW_GECOS)
2084     no_x=yes
2085     if test -n "$gonkdir"; then
2086         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2087         MOZ_B2G_RIL=1
2088         MOZ_B2G_BT=1
2089         MOZ_B2G_FM=1
2090     else
2091         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2092         MOZ_LINKER=1
2093     fi
2094     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2096     MOZ_GFX_OPTIMIZE_MOBILE=1
2097     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2098     ;;
2100 *-*linux*)
2101     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2102     # Similarly for GNU_CXX and INTEL_CXX.
2103     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2104         # -Os has been broken on Intel's C/C++ compilers for quite a
2105         # while; Intel recommends against using it.
2106         MOZ_OPTIMIZE_FLAGS="-O2"
2107         MOZ_DEBUG_FLAGS="-g"
2108     elif test "$GNU_CC" -o "$GNU_CXX"; then
2109         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2110         case $GCC_VERSION in
2111         4.1.*|4.2.*|4.5.*)
2112             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2113             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2114         esac
2115         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2116         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2117         MOZ_DEBUG_FLAGS="-g"
2118     fi
2120     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2122     MOZ_MEMORY=1
2124     case "${target_cpu}" in
2125     alpha*)
2126         CFLAGS="$CFLAGS -mieee"
2127         CXXFLAGS="$CXXFLAGS -mieee"
2128     ;;
2129     i*86)
2130         USE_ELF_DYNSTR_GC=1
2131     ;;
2132     mips*)
2133         MOZ_DEBUG_FLAGS="-g" # We want inlining
2134     ;;
2135     esac
2137     if test -z "$MC"; then
2138         MC=mc.exe
2139     fi
2140     ;;
2141 *-mingw*)
2142     DSO_CFLAGS=
2143     DSO_PIC_CFLAGS=
2144     DLL_SUFFIX=.dll
2145     RC=rc.exe
2146     MC=mc.exe
2147     # certain versions of cygwin's makedepend barf on the
2148     # #include <string> vs -I./dist/include/string issue so don't use it
2149     if test -n "$GNU_CC"; then
2150         CC="$CC -mwindows"
2151         CXX="$CXX -mwindows"
2152         CPP="$CPP -mwindows"
2153         CFLAGS="$CFLAGS -mms-bitfields"
2154         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2155         DSO_LDOPTS='-shared'
2156         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2157         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2158         RC='$(WINDRES)'
2159         # Use temp file for windres (bug 213281)
2160         RCFLAGS='-O coff --use-temp-file'
2161         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2162         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2163         MOZ_FIX_LINK_PATHS=
2164         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2165         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2166         DLL_PREFIX=
2167         IMPORT_LIB_SUFFIX=dll.a
2168         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2170         # We use mix of both POSIX and Win32 printf format across the tree, so format
2171         # warnings are useless on mingw.
2172         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2173         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2174     else
2175         TARGET_COMPILER_ABI=msvc
2176         HOST_CC='$(CC)'
2177         HOST_CXX='$(CXX)'
2178         HOST_LD='$(LD)'
2179         if test "$AS_BIN"; then
2180             AS="$(basename "$AS_BIN")"
2181         fi
2182         AR='lib'
2183         AR_FLAGS='-NOLOGO -OUT:"$@"'
2184         AR_EXTRACT=
2185         RANLIB='echo not_ranlib'
2186         STRIP='echo not_strip'
2187         PKG_SKIP_STRIP=1
2188         XARGS=xargs
2189         ZIP=zip
2190         UNZIP=unzip
2191         DOXYGEN=:
2192         ASM_SUFFIX=asm
2193         OBJ_SUFFIX=obj
2194         LIB_SUFFIX=lib
2195         DLL_PREFIX=
2196         LIB_PREFIX=
2197         IMPORT_LIB_SUFFIX=lib
2198         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2199         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2200         MKSHLIB_FORCE_ALL=
2201         MKSHLIB_UNFORCE_ALL=
2202         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2203         _USE_CPP_INCLUDE_FLAG=1
2204         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2205         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2206         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2207         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2208         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2209         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2210         # MSVC warning C4800 warns when a value is implicitly cast to bool,
2211         # because this also forces narrowing to a single byte, which can be a
2212         # perf hit.  But this matters so little in practice (and often we want
2213         # that behavior) that it's better to turn it off.
2214         CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800"
2215         # make 'foo == bar;' error out
2216         CFLAGS="$CFLAGS -we4553"
2217         CXXFLAGS="$CXXFLAGS -we4553"
2218         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2219         MOZ_DEBUG_FLAGS='-Zi'
2220         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2221         WARNINGS_AS_ERRORS='-WX'
2222         MOZ_OPTIMIZE_FLAGS='-O1'
2223         MOZ_FIX_LINK_PATHS=
2224         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2225         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2226         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2227         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2228         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2229         dnl For profile-guided optimization
2230         PROFILE_GEN_CFLAGS="-GL"
2231         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2232         dnl XXX: PGO builds can fail with warnings treated as errors,
2233         dnl specifically "no profile data available" appears to be
2234         dnl treated as an error sometimes. This might be a consequence
2235         dnl of using WARNINGS_AS_ERRORS in some modules, combined
2236         dnl with the linker doing most of the work in the whole-program
2237         dnl optimization/PGO case. I think it's probably a compiler bug,
2238         dnl but we work around it here.
2239         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2240         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2241         dnl Probably also a compiler bug, but what can you do?
2242         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2243         LDFLAGS="$LDFLAGS -DYNAMICBASE"
2244     fi
2245     AC_DEFINE(HAVE_SNPRINTF)
2246     AC_DEFINE(_WINDOWS)
2247     AC_DEFINE(WIN32)
2248     AC_DEFINE(XP_WIN)
2249     AC_DEFINE(XP_WIN32)
2250     AC_DEFINE(HW_THREADS)
2251     AC_DEFINE(STDC_HEADERS)
2252     AC_DEFINE(NEW_H, <new>)
2253     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2254     TARGET_MD_ARCH=win32
2255     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2256     BIN_SUFFIX='.exe'
2257     MOZ_USER_DIR="Mozilla"
2259     dnl Hardcode to win95 for now - cls
2260     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2262     dnl set NO_X11 defines here as the general check is skipped on win32
2263     no_x=yes
2264     AC_DEFINE(NO_X11)
2266     case "$host" in
2267     *-mingw*)
2268         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2269         L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2270         ;;
2271     esac
2273     case "$host" in
2274     *-mingw*)
2275         if test -z "$MOZ_TOOLS"; then
2276             AC_MSG_ERROR([MOZ_TOOLS is not set])
2277         fi
2278         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2279         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2280             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2281         fi
2282         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2283         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2284             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2285         fi
2286         ;;
2287     esac
2289     case "$host_os" in
2290     cygwin*|msvc*|mks*)
2291         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.])
2292         ;;
2293     esac
2295     case "$target" in
2296     i*86-*)
2297         if test "$HAVE_64BIT_OS"; then
2298             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2299         fi
2301         if test -n "$GNU_CC"; then
2302             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2303             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2304             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
2305         else
2306             AC_DEFINE(HAVE_STDCALL)
2307             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2308             LDFLAGS="$LDFLAGS -SAFESEH"
2309         fi
2311         AC_DEFINE(_X86_)
2312         ;;
2313     x86_64-*)
2314         if test -n "$_WIN32_MSVC"; then
2315             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2316         fi
2317         AC_DEFINE(_AMD64_)
2318         ;;
2319     *)
2320         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2321         ;;
2322     esac
2324     if test "$HAVE_64BIT_OS"; then
2325         AC_DEFINE(_WIN64)
2326     fi
2327     ;;
2329 *-netbsd*)
2330     DSO_CFLAGS=''
2331     CFLAGS="$CFLAGS -Dunix"
2332     CXXFLAGS="$CXXFLAGS -Dunix"
2333     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2334         DLL_SUFFIX=".so"
2335         DSO_PIC_CFLAGS='-fPIC -DPIC'
2336         DSO_LDOPTS='-shared'
2337         BIN_FLAGS='-Wl,--export-dynamic'
2338     else
2339         DSO_PIC_CFLAGS='-fPIC -DPIC'
2340         DLL_SUFFIX=".so.1.0"
2341         DSO_LDOPTS='-shared'
2342     fi
2343     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2344     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2345     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2346     if test "$LIBRUNPATH"; then
2347         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2348     fi
2349     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2350     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2351     ;;
2353 *-openbsd*)
2354     if test "$SO_VERSION"; then
2355         DLL_SUFFIX=".so.$SO_VERSION"
2356     else
2357         DLL_SUFFIX=".so.1.0"
2358     fi
2359     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2360     DSO_CFLAGS=''
2361     DSO_PIC_CFLAGS='-fPIC'
2362     DSO_LDOPTS='-shared -fPIC'
2363     if test "$LIBRUNPATH"; then
2364         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2365     fi
2366     ;;
2368 *-os2*)
2369     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2370     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2371     AC_DEFINE(OS2)
2372     AC_DEFINE(XP_OS2)
2373     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2374     AC_DEFINE(TCPV40HDRS)
2375     DLL_PREFIX=
2376     LIB_PREFIX=
2377     LIB_SUFFIX=lib
2378     BIN_SUFFIX=".exe"
2379     DLL_SUFFIX=".dll"
2380     IMPORT_LIB_SUFFIX=lib
2381     DSO_PIC_CFLAGS=
2382     AR=emxomfar
2383     AR_FLAGS='r $@'
2384     CFLAGS="$CFLAGS -Zomf"
2385     CXXFLAGS="$CXXFLAGS -Zomf"
2386     DSO_LDOPTS='-Zdll'
2387     BIN_FLAGS='-Zlinker /ST:0x100000'
2388     IMPLIB='emximp -o'
2389     FILTER='true'
2390     LDFLAGS='-Zmap'
2391     WARNINGS_AS_ERRORS='-Werror'
2392     MOZ_DEBUG_FLAGS="-g -fno-inline"
2393     MOZ_OPTIMIZE_FLAGS="-O2"
2394     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2395     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2396     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2397     TARGET_MD_ARCH=os2
2398     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2399     RC=rc.exe
2400     MC=mc.exe
2401     RCFLAGS='-n'
2402     MOZ_USER_DIR="Mozilla"
2403     ZIP="$ZIP -X"
2405     if test "$MOZTOOLS"; then
2406         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2407     else
2408         AC_MSG_ERROR([MOZTOOLS is not set])
2409     fi
2410     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2411         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2412         LDFLAGS="$LDFLAGS -Zhigh-mem"
2413         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2414         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2415     fi
2417     # GCC for OS/2 currently predefines these, but we don't want them
2418     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2419     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2421     AC_CACHE_CHECK(for __declspec(dllexport),
2422         ac_os2_declspec,
2423         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2424                         [return 0;],
2425                         ac_os2_declspec="yes",
2426                         ac_os2_declspec="no")])
2427     if test "$ac_os2_declspec" != "yes"; then
2428         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2429     fi
2430     ;;
2432 *-solaris*)
2433     AC_DEFINE(SOLARIS)
2434     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2435     MOZ_FIX_LINK_PATHS=
2436     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2437     # libraries one level up (e.g. libnspr4.so)
2438     if test "$SOLARIS_SUNPRO_CC"; then
2439        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2440        LIBS="-lCrun -lCstd -lc $LIBS"
2441        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2442        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2443        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2444        LDFLAGS="-xildoff $LDFLAGS"
2445        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2446            _SAVE_LDFLAGS=$LDFLAGS
2447            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2448            AC_TRY_LINK([#include <stdio.h>],
2449                        [printf("Hello World\n");],
2450                        ,
2451                        [LDFLAGS=$_SAVE_LDFLAGS])
2452        fi
2453        MOZ_OPTIMIZE_FLAGS="-xO4"
2454        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2455        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2456        MKSHLIB_FORCE_ALL='-z allextract'
2457        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2458        DSO_LDOPTS='-G'
2459        AR_LIST="$AR t"
2460        AR_EXTRACT="$AR x"
2461        AR_DELETE="$AR d"
2462        AR='$(CXX) -xar'
2463        AR_FLAGS='-o $@'
2464        AS='/usr/ccs/bin/as'
2465        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2466        AS_DASH_C_FLAG=''
2467        TARGET_COMPILER_ABI="sunc"
2468        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2469        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2470        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2471        AC_LANG_SAVE
2472        AC_LANG_CPLUSPLUS
2473        AC_TRY_COMPILE([],
2474            [#if (__SUNPRO_CC < 0x590)
2475            #error "Denied"
2476            #endif],
2477            _BAD_COMPILER=,_BAD_COMPILER=1)
2478        if test -n "$_BAD_COMPILER"; then
2479            _res="no"
2480            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2481        else
2482            _res="yes"
2483        fi
2484        AC_TRY_COMPILE([],
2485            [#if (__SUNPRO_CC >= 0x5100)
2486            #error "Sun C++ 5.10 or above"
2487            #endif],
2488            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2489        if test "$_ABOVE_SS12U1"; then
2490            # disable xannotate
2491            CXXFLAGS="$CXXFLAGS -xannotate=no"
2492        fi
2493        AC_MSG_RESULT([$_res])
2494        AC_LANG_RESTORE
2495     else
2496        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2497        LIBS="-lc $LIBS"
2498        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2499        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2500        ASFLAGS="$ASFLAGS -fPIC"
2501        DSO_LDOPTS='-shared'
2502        WARNINGS_AS_ERRORS='-Werror'
2503        _WARNINGS_CFLAGS=''
2504        _WARNINGS_CXXFLAGS=''
2505        if test "$OS_RELEASE" = "5.3"; then
2506            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2507        fi
2508     fi
2509     if test "$OS_RELEASE" = "5.5.1"; then
2510         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2511     fi
2512     ;;
2514 *-sunos*)
2515     DSO_LDOPTS='-Bdynamic'
2516     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2517     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2518     AC_DEFINE(SUNOS4)
2519     AC_DEFINE(SPRINTF_RETURNS_STRING)
2520     case "$(target_os)" in
2521     sunos4.1*)
2522         DLL_SUFFIX='.so.1.0'
2523         ;;
2524     esac
2525     ;;
2527 *-os2*)
2528     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2529     ;;
2531 esac
2533 AC_SUBST(MOZ_LINKER)
2534 if test -n "$MOZ_LINKER"; then
2535   AC_DEFINE(MOZ_LINKER)
2537 AC_SUBST(MOZ_ENABLE_SZIP)
2539 dnl Only one oddball right now (QNX), but this gives us flexibility
2540 dnl if any other platforms need to override this in the future.
2541 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2543 dnl ========================================================
2544 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2545 dnl by now will not have any way to link most binaries (tests
2546 dnl as well as viewer, apprunner, etc.), because some symbols
2547 dnl will be left out of the "composite" .so's by ld as unneeded.
2548 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2549 dnl they can link in the static libs that provide the missing
2550 dnl symbols.
2551 dnl ========================================================
2552 NO_LD_ARCHIVE_FLAGS=
2553 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2554     NO_LD_ARCHIVE_FLAGS=1
2556 case "$target" in
2557 *-os2*)
2558     NO_LD_ARCHIVE_FLAGS=
2559     ;;
2560 *-aix4.3*|*-aix5*)
2561     NO_LD_ARCHIVE_FLAGS=
2562     ;;
2563 *-mingw*)
2564     if test -z "$GNU_CC"; then
2565         NO_LD_ARCHIVE_FLAGS=
2566     fi
2567     ;;
2568 esac
2569 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2571 dnl ========================================================
2572 dnl = Flags to strip unused symbols from .so components and
2573 dnl = to export jemalloc symbols when linking a program
2574 dnl ========================================================
2575 case "$target" in
2576     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2577         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2578         ;;
2579     *-solaris*)
2580         if test -z "$GNU_CC"; then
2581          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2582         else
2583          if test -z "$GCC_USE_GNU_LD"; then
2584           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2585          else
2586           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2587          fi
2588         fi
2589         ;;
2590     *-darwin*)
2591         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2592         ;;
2593     *-mingw*)
2594         if test -n "$GNU_CC"; then
2595            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2596         fi
2597         ;;
2598 esac
2600 if test -z "$COMPILE_ENVIRONMENT"; then
2601     SKIP_COMPILER_CHECKS=1
2602     SKIP_LIBRARY_CHECKS=1
2605 MOZ_COMPILER_OPTS
2606 if test -z "$SKIP_COMPILER_CHECKS"; then
2607 dnl Checks for typedefs, structures, and compiler characteristics.
2608 dnl ========================================================
2609 AC_HEADER_STDC
2610 AC_C_CONST
2611 AC_TYPE_MODE_T
2612 AC_TYPE_OFF_T
2613 AC_TYPE_PID_T
2614 AC_TYPE_SIZE_T
2615 AC_LANG_CPLUSPLUS
2616 AC_MSG_CHECKING(for __stdcall)
2617 AC_CACHE_VAL(ac_cv___stdcall,
2618  [AC_TRY_COMPILE([template <typename Method> struct foo;
2619                   template <> struct foo<void (*)()> {};
2620                   template <> struct foo<void (__stdcall*)()> {};],
2621                  [],
2622                  [ac_cv___stdcall=true],
2623                  [ac_cv___stdcall=false])])
2624 if test "$ac_cv___stdcall" = true ; then
2625   AC_DEFINE(HAVE_STDCALL)
2626   AC_MSG_RESULT(yes)
2627 else
2628   AC_MSG_RESULT(no)
2630 AC_LANG_C
2631 AC_MSG_CHECKING(for ssize_t)
2632 AC_CACHE_VAL(ac_cv_type_ssize_t,
2633  [AC_TRY_COMPILE([#include <stdio.h>
2634                   #include <sys/types.h>],
2635                  [ssize_t foo = 0;],
2636                  [ac_cv_type_ssize_t=true],
2637                  [ac_cv_type_ssize_t=false])])
2638 if test "$ac_cv_type_ssize_t" = true ; then
2639   AC_DEFINE(HAVE_SSIZE_T)
2640   AC_MSG_RESULT(yes)
2641 else
2642   AC_MSG_RESULT(no)
2644 AC_STRUCT_ST_BLKSIZE
2645 AC_MSG_CHECKING(for siginfo_t)
2646 AC_CACHE_VAL(ac_cv_siginfo_t,
2647  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2648                   #include <signal.h>],
2649                  [siginfo_t* info;],
2650                  [ac_cv_siginfo_t=true],
2651                  [ac_cv_siginfo_t=false])])
2652 if test "$ac_cv_siginfo_t" = true ; then
2653   AC_DEFINE(HAVE_SIGINFO_T)
2654   AC_MSG_RESULT(yes)
2655 else
2656   AC_MSG_RESULT(no)
2659 dnl Check for int64, uint, and uint_t.
2660 dnl ========================================================
2661 AC_MSG_CHECKING(for int64)
2662 AC_CACHE_VAL(ac_cv_int64,
2663  [AC_TRY_COMPILE([#include <stdio.h>
2664                   #include <sys/types.h>],
2665                  [int64 foo = 0;],
2666                  [ac_cv_int64=true],
2667                  [ac_cv_int64=false])])
2668 if test "$ac_cv_int64" = true ; then
2669   AC_DEFINE(HAVE_INT64)
2670   AC_MSG_RESULT(yes)
2671 else
2672   AC_MSG_RESULT(no)
2674 AC_MSG_CHECKING(for uint)
2675 AC_CACHE_VAL(ac_cv_uint,
2676  [AC_TRY_COMPILE([#include <stdio.h>
2677                   #include <sys/types.h>],
2678                  [uint foo = 0;],
2679                  [ac_cv_uint=true],
2680                  [ac_cv_uint=false])])
2681 if test "$ac_cv_uint" = true ; then
2682   AC_DEFINE(HAVE_UINT)
2683   AC_MSG_RESULT(yes)
2684 else
2685   AC_MSG_RESULT(no)
2687 AC_MSG_CHECKING(for uint_t)
2688 AC_CACHE_VAL(ac_cv_uint_t,
2689  [AC_TRY_COMPILE([#include <stdio.h>
2690                   #include <sys/types.h>],
2691                  [uint_t foo = 0;],
2692                  [ac_cv_uint_t=true],
2693                  [ac_cv_uint_t=false])])
2694 if test "$ac_cv_uint_t" = true ; then
2695   AC_DEFINE(HAVE_UINT_T)
2696   AC_MSG_RESULT(yes)
2697 else
2698   AC_MSG_RESULT(no)
2701 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2702 dnl are defined when compiling C++ but not C.  Since the result of this
2703 dnl test is used only in C++, do it in C++.
2704 AC_LANG_CPLUSPLUS
2706 AC_MSG_CHECKING(for uname.domainname)
2707 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2708     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2709         [ struct utsname *res; char *domain;
2710             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2711         [ac_cv_have_uname_domainname_field=true],
2712         [ac_cv_have_uname_domainname_field=false])])
2714 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2715     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2716     AC_MSG_RESULT(yes)
2717 else
2718     AC_MSG_RESULT(no)
2721 AC_MSG_CHECKING(for uname.__domainname)
2722 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2723     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2724         [ struct utsname *res; char *domain;
2725             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2726         [ac_cv_have_uname_us_domainname_field=true],
2727         [ac_cv_have_uname_us_domainname_field=false])])
2729 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2730     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2731     AC_MSG_RESULT(yes)
2732 else
2733     AC_MSG_RESULT(no)
2736 dnl Check whether we can use gcc's c++0x mode
2737 AC_LANG_CPLUSPLUS
2739 if test "$GNU_CXX"; then
2740     _SAVE_CXXFLAGS=$CXXFLAGS
2741     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2743     AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2744         ac_cv_cxx0x_headers_bug,
2745         [AC_TRY_COMPILE([#include <memory>], [],
2746                         ac_cv_cxx0x_headers_bug="no",
2747                         ac_cv_cxx0x_headers_bug="yes")])
2748     CXXFLAGS="$_SAVE_CXXFLAGS"
2749     if test "$ac_cv_cxx0x_headers_bug" = "no"; then
2750         CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2751     fi
2754 dnl Check for usable char16_t (2 bytes, unsigned)
2755 dnl (we might not need the unsignedness check anymore)
2756 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2757     ac_cv_have_usable_char16_t,
2758     [AC_TRY_COMPILE([$configure_static_assert_macros],
2759                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2760                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2761                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2762                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2763                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2764                     ac_cv_have_usable_char16_t="yes",
2765                     ac_cv_have_usable_char16_t="no")])
2766 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2767     AC_DEFINE(HAVE_CPP_CHAR16_T)
2768     HAVE_CPP_CHAR16_T=1
2769 elif test "$GNU_CXX"; then
2770     CXXFLAGS="$_SAVE_CXXFLAGS"
2773 dnl Check for usable wchar_t (2 bytes, unsigned)
2774 dnl (we really don't need the unsignedness check anymore)
2775 dnl ========================================================
2777 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2778     ac_cv_have_usable_wchar_v2,
2779     [AC_TRY_COMPILE([#include <stddef.h>
2780                      $configure_static_assert_macros],
2781                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2782                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2783                     ac_cv_have_usable_wchar_v2="yes",
2784                     ac_cv_have_usable_wchar_v2="no")])
2785 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2786     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2787     HAVE_CPP_2BYTE_WCHAR_T=1
2788 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2789 dnl This is really gcc-only
2790 dnl Do this test using CXX only since some versions of gcc
2791 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2792 dnl only have short-wchar support for c++.
2793 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2795     _SAVE_CXXFLAGS=$CXXFLAGS
2796     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2798     AC_CACHE_CHECK(for compiler -fshort-wchar option,
2799         ac_cv_have_usable_wchar_option_v2,
2800         [AC_TRY_LINK([#include <stddef.h>
2801                       $configure_static_assert_macros],
2802                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2803                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2804                      ac_cv_have_usable_wchar_option_v2="yes",
2805                      ac_cv_have_usable_wchar_option_v2="no")])
2807     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2808         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2809         HAVE_CPP_2BYTE_WCHAR_T=1
2810         if test "$OS_TARGET" = Android; then
2811             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
2812             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
2813             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
2814             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
2815         else
2816             WCHAR_CFLAGS="-fshort-wchar"
2817         fi
2818     else
2819         CXXFLAGS=$_SAVE_CXXFLAGS
2820     fi
2823 AC_LANG_C
2825 dnl Check for .hidden assembler directive and visibility attribute.
2826 dnl Borrowed from glibc configure.in
2827 dnl ===============================================================
2828 if test "$GNU_CC"; then
2829   AC_CACHE_CHECK(for visibility(hidden) attribute,
2830                  ac_cv_visibility_hidden,
2831                  [cat > conftest.c <<EOF
2832                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2834                   ac_cv_visibility_hidden=no
2835                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2836                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2837                       ac_cv_visibility_hidden=yes
2838                     fi
2839                   fi
2840                   rm -f conftest.[cs]
2841                  ])
2842   if test "$ac_cv_visibility_hidden" = "yes"; then
2843     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2845     AC_CACHE_CHECK(for visibility(default) attribute,
2846                    ac_cv_visibility_default,
2847                    [cat > conftest.c <<EOF
2848                     int foo __attribute__ ((visibility ("default"))) = 1;
2850                     ac_cv_visibility_default=no
2851                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2852                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2853                         ac_cv_visibility_default=yes
2854                       fi
2855                     fi
2856                     rm -f conftest.[cs]
2857                    ])
2858     if test "$ac_cv_visibility_default" = "yes"; then
2859       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2861       AC_CACHE_CHECK(for visibility pragma support,
2862                      ac_cv_visibility_pragma,
2863                      [cat > conftest.c <<EOF
2864 #pragma GCC visibility push(hidden)
2865                       int foo_hidden = 1;
2866 #pragma GCC visibility push(default)
2867                       int foo_default = 1;
2869                       ac_cv_visibility_pragma=no
2870                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2871                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2872                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2873                             ac_cv_visibility_pragma=yes
2874                           fi
2875                         fi
2876                       fi
2877                       rm -f conftest.[cs]
2878                     ])
2879       if test "$ac_cv_visibility_pragma" = "yes"; then
2880         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2881                        ac_cv_have_visibility_class_bug,
2882                        [cat > conftest.c <<EOF
2883 #pragma GCC visibility push(hidden)
2884 struct __attribute__ ((visibility ("default"))) TestStruct {
2885   static void Init();
2887 __attribute__ ((visibility ("default"))) void TestFunc() {
2888   TestStruct::Init();
2891                        ac_cv_have_visibility_class_bug=no
2892                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2893                          ac_cv_have_visibility_class_bug=yes
2894                        else
2895                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2896                            ac_cv_have_visibility_class_bug=yes
2897                          fi
2898                        fi
2899                        rm -rf conftest.{c,S}
2900                        ])
2902         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2903                        ac_cv_have_visibility_builtin_bug,
2904                        [cat > conftest.c <<EOF
2905 #pragma GCC visibility push(hidden)
2906 #pragma GCC visibility push(default)
2907 #include <string.h>
2908 #pragma GCC visibility pop
2910 __attribute__ ((visibility ("default"))) void Func() {
2911   char c[[100]];
2912   memset(c, 0, sizeof(c));
2915                        ac_cv_have_visibility_builtin_bug=no
2916                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2917                          ac_cv_have_visibility_builtin_bug=yes
2918                        else
2919                          if test `grep -c "@PLT" conftest.S` = 0; then
2920                            ac_cv_visibility_builtin_bug=yes
2921                          fi
2922                        fi
2923                        rm -f conftest.{c,S}
2924                        ])
2925         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2926                 "$ac_cv_have_visibility_class_bug" = "no"; then
2927           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2928           WRAP_SYSTEM_INCLUDES=1
2929           STL_FLAGS='-I$(DIST)/stl_wrappers'
2930           WRAP_STL_INCLUDES=1
2931         else
2932           VISIBILITY_FLAGS='-fvisibility=hidden'
2933         fi # have visibility pragma bug
2934       fi   # have visibility pragma
2935     fi     # have visibility(default) attribute
2936   fi       # have visibility(hidden) attribute
2937 fi         # GNU_CC
2939 # visibility hidden flag for Sun Studio on Solaris
2940 if test "$SOLARIS_SUNPRO_CC"; then
2941 VISIBILITY_FLAGS='-xldscope=hidden'
2942 fi         # Sun Studio on Solaris
2944 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2945 AC_SUBST(VISIBILITY_FLAGS)
2947 MOZ_GCC_PR49911
2948 MOZ_GCC_PR39608
2949 MOZ_LLVM_PR8927
2951 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2952 dnl ========================================================
2953 if test "$GNU_CC"; then
2954   CFLAGS_save="${CFLAGS}"
2955   CFLAGS="${CFLAGS} -Werror"
2956   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2957                  ac_cv_force_align_arg_pointer,
2958                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2959                                  [],
2960                                  ac_cv_force_align_arg_pointer="yes",
2961                                  ac_cv_force_align_arg_pointer="no")])
2962   CFLAGS="${CFLAGS_save}"
2963   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2964     HAVE_GCC_ALIGN_ARG_POINTER=1
2965   else
2966     HAVE_GCC_ALIGN_ARG_POINTER=
2967   fi
2969 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2971 dnl Checks for header files.
2972 dnl ========================================================
2973 AC_HEADER_DIRENT
2974 case "$target_os" in
2975 freebsd*|openbsd*)
2976 # for stuff like -lXshm
2977     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2978     ;;
2979 esac
2980 MOZ_CHECK_COMMON_HEADERS
2982 dnl These are all the places some variant of statfs can be hiding.
2983 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2985 dnl Quota support
2986 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2987 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2989 dnl SCTP support - needs various network include headers
2990 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2992 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2994 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2995 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2996                    ac_cv_sockaddr_in_sin_len,
2997                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2998                                     #include <sys/types.h>
2999                                     #endif
3000                                     #include <netinet/in.h>
3001                                     struct sockaddr_in x;
3002                                     void *foo = (void*) &x.sin_len;],
3003                                    [],
3004                                    [ac_cv_sockaddr_in_sin_len=true],
3005                                    [ac_cv_sockaddr_in_sin_len=false])])
3006 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
3007   AC_DEFINE(HAVE_SIN_LEN)
3008 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
3009   AC_DEFINE(HAVE_SCONN_LEN)
3012 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
3013                ac_cv_sockaddr_in6_sin6_len,
3014                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3015                                 #include <sys/types.h>
3016                                 #endif
3017                                 #include <netinet/in.h>
3018                                 struct sockaddr_in6 x;
3019                                 void *foo = (void*) &x.sin6_len;],
3020                                [],
3021                                [ac_cv_sockaddr_in6_sin6_len=true],
3022                                [ac_cv_sockaddr_in6_sin6_len=false])])
3023 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
3024   AC_DEFINE(HAVE_SIN6_LEN)
3027 AC_CACHE_CHECK(for sockaddr.sa_len,
3028                ac_cv_sockaddr_sa_len,
3029                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
3030                                 #include <sys/types.h>
3031                                 #endif
3032                                 #include <sys/socket.h>
3033                                 struct sockaddr x;
3034                                 void *foo = (void*) &x.sa_len;],
3035                                [],
3036                                [ac_cv_sockaddr_sa_len=true],
3037                                [ac_cv_sockaddr_sa_len=false])])
3038 if test "$ac_cv_sockaddr_sa_len" = true ; then
3039   AC_DEFINE(HAVE_SA_LEN)
3042 dnl Check whether the compiler supports the new-style C++ standard
3043 dnl library headers (i.e. <new>) or needs the old "new.h"
3044 AC_LANG_CPLUSPLUS
3045 NEW_H=new.h
3046 MOZ_CHECK_HEADER(new, [NEW_H=new])
3047 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3048 AC_LANG_C
3050 AC_ARG_ENABLE(dtrace,
3051               [  --enable-dtrace         build with dtrace support if available (default=no)],
3052               [enable_dtrace="yes"],)
3053 if test "x$enable_dtrace" = "xyes"; then
3054   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3055   if test -n "$HAVE_DTRACE"; then
3056       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3057   else
3058       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3059   fi
3061 AC_SUBST(HAVE_DTRACE)
3063 case $target in
3064 *-aix4.3*|*-aix5*)
3065         ;;
3067         MOZ_CHECK_HEADERS(sys/cdefs.h)
3068         ;;
3069 esac
3071 MOZ_LINUX_PERF_EVENT
3073 dnl Checks for libraries.
3074 dnl ========================================================
3075 case $target in
3076 *-hpux11.*)
3077         ;;
3079         AC_CHECK_LIB(c_r, gethostbyname_r)
3080         ;;
3081 esac
3083 dnl We don't want to link with libdl even if it's present on OS X, since
3084 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3085 dnl in libc.
3086 dnl We don't want to link against libm or libpthread on Darwin since
3087 dnl they both are just symlinks to libSystem and explicitly linking
3088 dnl against libSystem causes issues when debugging (see bug 299601).
3089 case $target in
3090 *-darwin*)
3091     ;;
3092 *-os2*)
3093     ;;
3095     AC_SEARCH_LIBS(dlopen, dl,
3096         MOZ_CHECK_HEADER(dlfcn.h,
3097         AC_DEFINE(HAVE_DLOPEN)))
3098     ;;
3099 esac
3101 _SAVE_CFLAGS="$CFLAGS"
3102 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3103 AC_CHECK_FUNCS(dladdr memmem)
3104 CFLAGS="$_SAVE_CFLAGS"
3106 if test ! "$GNU_CXX"; then
3108     case $target in
3109     *-aix*)
3110         AC_CHECK_LIB(C_r, demangle)
3111         ;;
3112      *)
3113         AC_CHECK_LIB(C, demangle)
3114         ;;
3115      esac
3118 dnl OS/2 has socket in libc.
3119 case $target in
3120 *-os2*)
3121     ;;
3123     AC_CHECK_LIB(socket, socket)
3124 esac
3126 XLDFLAGS="$X_LIBS"
3127 XLIBS="$X_EXTRA_LIBS"
3129 dnl ========================================================
3130 dnl Checks for X libraries.
3131 dnl Ordering is important.
3132 dnl Xt is dependent upon SM as of X11R6
3133 dnl ========================================================
3134 if test "$no_x" = "yes"; then
3135     AC_DEFINE(NO_X11)
3136 else
3137     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3138         XLIBS="-lX11 $XLIBS"
3139         _SAVE_LDFLAGS="$LDFLAGS"
3140         LDFLAGS="$XLDFLAGS $LDFLAGS"
3141         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3142                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3143         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3144                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3146         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3147         unset ac_cv_lib_Xt_XtFree
3148             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3149             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3150         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3151                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3152         ])
3154     # AIX needs the motif library linked before libXt to prevent
3155     # crashes in plugins linked against Motif - Bug #98892
3156     case "${target_os}" in
3157     aix*)
3158         XT_LIBS="-lXm $XT_LIBS"
3159         ;;
3160     esac
3162     dnl ========================================================
3163     dnl = Check for XShm
3164     dnl ========================================================
3165     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3166         $XLIBS $XEXT_LIBS)
3168     dnl ========================================================
3169     dnl = Check for Xss
3170     dnl ========================================================
3171     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3172         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3173             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3174              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3176         LDFLAGS="$_SAVE_LDFLAGS"
3177 fi # $no_x
3179 AC_SUBST(XCFLAGS)
3180 AC_SUBST(XLDFLAGS)
3181 AC_SUBST(XLIBS)
3182 AC_SUBST(XEXT_LIBS)
3183 AC_SUBST(XT_LIBS)
3184 AC_SUBST(XSS_LIBS)
3186 dnl ========================================================
3187 dnl = pthread support
3188 dnl = Start by checking whether the system support pthreads
3189 dnl ========================================================
3190 case "$target_os" in
3191 darwin*)
3192     USE_PTHREADS=1
3193     ;;
3195     MOZ_CHECK_PTHREADS(pthreads,
3196         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3197         MOZ_CHECK_PTHREADS(pthread,
3198             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3199             MOZ_CHECK_PTHREADS(c_r,
3200                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3201                 MOZ_CHECK_PTHREADS(c,
3202                     USE_PTHREADS=1
3203                 )
3204             )
3205         )
3206     )
3207     ;;
3208 esac
3210 dnl ========================================================
3211 dnl Check the command line for --with-pthreads
3212 dnl ========================================================
3213 MOZ_ARG_WITH_BOOL(pthreads,
3214 [  --with-pthreads         Force use of system pthread library with NSPR ],
3215 [ if test "$USE_PTHREADS"x = x; then
3216     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3217 fi],
3218     USE_PTHREADS=
3219     _PTHREAD_LDFLAGS=
3222 dnl ========================================================
3223 dnl Do the platform specific pthread hackery
3224 dnl ========================================================
3225 if test "$USE_PTHREADS"x != x
3226 then
3227         dnl
3228         dnl See if -pthread is supported.
3229         dnl
3230         rm -f conftest*
3231         ac_cv_have_dash_pthread=no
3232         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3233         echo 'int main() { return 0; }' | cat > conftest.c
3234         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3235         if test $? -eq 0; then
3236                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3237                         ac_cv_have_dash_pthread=yes
3238                 case "$target_os" in
3239                 freebsd*)
3240 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3241                 ;;
3242                 *)
3243                             CFLAGS="$CFLAGS -pthread"
3244                             CXXFLAGS="$CXXFLAGS -pthread"
3245                 ;;
3246                 esac
3247                 fi
3248         fi
3249         rm -f conftest*
3250     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3252         dnl
3253         dnl See if -pthreads is supported.
3254         dnl
3255     ac_cv_have_dash_pthreads=no
3256     if test "$ac_cv_have_dash_pthread" = "no"; then
3257             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3258         echo 'int main() { return 0; }' | cat > conftest.c
3259             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3260         if test $? -eq 0; then
3261                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3262                             ac_cv_have_dash_pthreads=yes
3263                             CFLAGS="$CFLAGS -pthreads"
3264                             CXXFLAGS="$CXXFLAGS -pthreads"
3265                     fi
3266             fi
3267             rm -f conftest*
3268         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3269     fi
3271         case "$target" in
3272             *-*-freebsd*)
3273                         AC_DEFINE(_REENTRANT)
3274                         AC_DEFINE(_THREAD_SAFE)
3275                         dnl -pthread links in -lpthread, so don't specify it explicitly.
3276                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3277                                 _PTHREAD_LDFLAGS="-pthread"
3278                         fi
3279                         ;;
3281             *-*-openbsd*|*-*-bsdi*)
3282                         AC_DEFINE(_REENTRANT)
3283                         AC_DEFINE(_THREAD_SAFE)
3284                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3285                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3286                 _PTHREAD_LDFLAGS="-pthread"
3287                         fi
3288                         ;;
3290             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3291                         AC_DEFINE(_REENTRANT)
3292                         ;;
3294             *-aix4.3*|*-aix5*)
3295                         AC_DEFINE(_REENTRANT)
3296                         ;;
3298             *-hpux11.*)
3299                         AC_DEFINE(_REENTRANT)
3300                         ;;
3302             *-*-solaris*)
3303                         AC_DEFINE(_REENTRANT)
3304                         if test "$SOLARIS_SUNPRO_CC"; then
3305                                 CFLAGS="$CFLAGS -mt"
3306                                 CXXFLAGS="$CXXFLAGS -mt"
3307                         fi
3308                         ;;
3309         esac
3310     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3314 dnl Checks for library functions.
3315 dnl ========================================================
3316 AC_PROG_GCC_TRADITIONAL
3317 AC_FUNC_MEMCMP
3318 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove rint stat64 lstat64 truncate64 setbuf isatty)
3319 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3320 AC_CHECK_FUNCS(flockfile getpagesize)
3321 AC_CHECK_FUNCS(localtime_r strtok_r)
3323 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3324 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3325                ac_cv_clock_monotonic,
3326                [for libs in "" -lrt; do
3327                     _SAVE_LIBS="$LIBS"
3328                     LIBS="$LIBS $libs"
3329                     AC_TRY_LINK([#include <time.h>],
3330                                  [ struct timespec ts;
3331                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3332                                  ac_cv_clock_monotonic=$libs
3333                                  LIBS="$_SAVE_LIBS"
3334                                  break,
3335                                  ac_cv_clock_monotonic=no)
3336                     LIBS="$_SAVE_LIBS"
3337                 done])
3338 if test "$ac_cv_clock_monotonic" != "no"; then
3339     HAVE_CLOCK_MONOTONIC=1
3340     REALTIME_LIBS=$ac_cv_clock_monotonic
3341     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3342     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3343     AC_SUBST(REALTIME_LIBS)
3346 dnl check for wcrtomb/mbrtowc
3347 dnl =======================================================================
3348 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3349 AC_LANG_SAVE
3350 AC_LANG_CPLUSPLUS
3351 AC_CACHE_CHECK(for wcrtomb,
3352     ac_cv_have_wcrtomb,
3353     [AC_TRY_LINK([#include <wchar.h>],
3354                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3355                  ac_cv_have_wcrtomb="yes",
3356                  ac_cv_have_wcrtomb="no")])
3357 if test "$ac_cv_have_wcrtomb" = "yes"; then
3358     AC_DEFINE(HAVE_WCRTOMB)
3360 AC_CACHE_CHECK(for mbrtowc,
3361     ac_cv_have_mbrtowc,
3362     [AC_TRY_LINK([#include <wchar.h>],
3363                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3364                  ac_cv_have_mbrtowc="yes",
3365                  ac_cv_have_mbrtowc="no")])
3366 if test "$ac_cv_have_mbrtowc" = "yes"; then
3367     AC_DEFINE(HAVE_MBRTOWC)
3369 AC_LANG_RESTORE
3372 AC_CACHE_CHECK(
3373     [for res_ninit()],
3374     ac_cv_func_res_ninit,
3375     [AC_TRY_LINK([
3376         #ifdef linux
3377         #define _BSD_SOURCE 1
3378         #endif
3379         #include <resolv.h>
3380         ],
3381         [int foo = res_ninit(&_res);],
3382         [ac_cv_func_res_ninit=yes],
3383         [ac_cv_func_res_ninit=no])
3384     ])
3386 if test "$ac_cv_func_res_ninit" = "yes"; then
3387     AC_DEFINE(HAVE_RES_NINIT)
3388 dnl must add the link line we do something as foolish as this... dougt
3389 dnl else
3390 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3391 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3394 AC_LANG_CPLUSPLUS
3395 AC_CACHE_CHECK(
3396     [for gnu_get_libc_version()],
3397     ac_cv_func_gnu_get_libc_version,
3398     [AC_TRY_LINK([
3399         #ifdef HAVE_GNU_LIBC_VERSION_H
3400         #include <gnu/libc-version.h>
3401         #endif
3402         ],
3403         [const char *glibc_version = gnu_get_libc_version();],
3404         [ac_cv_func_gnu_get_libc_version=yes],
3405         [ac_cv_func_gnu_get_libc_version=no]
3406         )]
3407     )
3409 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3410     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3413 case $target_os in
3414     darwin*|mingw*|os2*)
3415         ;;
3416     *)
3418 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3419     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3420         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3421 _SAVE_LIBS=$LIBS
3422 LIBS="$LIBS $_ICONV_LIBS"
3423 AC_CACHE_CHECK(
3424     [for iconv()],
3425     ac_cv_func_iconv,
3426     [AC_TRY_LINK([
3427         #include <stdlib.h>
3428         #include <iconv.h>
3429         ],
3430         [
3431             iconv_t h = iconv_open("", "");
3432             iconv(h, NULL, NULL, NULL, NULL);
3433             iconv_close(h);
3434         ],
3435         [ac_cv_func_iconv=yes],
3436         [ac_cv_func_iconv=no]
3437         )]
3438     )
3439 if test "$ac_cv_func_iconv" = "yes"; then
3440     AC_DEFINE(HAVE_ICONV)
3441     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3442     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3443     LIBICONV="$_ICONV_LIBS"
3444     AC_CACHE_CHECK(
3445         [for iconv() with const input],
3446         ac_cv_func_const_iconv,
3447         [AC_TRY_COMPILE([
3448             #include <stdlib.h>
3449             #include <iconv.h>
3450             ],
3451             [
3452                 const char *input = "testing";
3453                 iconv_t h = iconv_open("", "");
3454                 iconv(h, &input, NULL, NULL, NULL);
3455                 iconv_close(h);
3456             ],
3457             [ac_cv_func_const_iconv=yes],
3458             [ac_cv_func_const_iconv=no]
3459             )]
3460         )
3461     if test "$ac_cv_func_const_iconv" = "yes"; then
3462         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3463     fi
3465 LIBS=$_SAVE_LIBS
3467     ;;
3468 esac
3470 AM_LANGINFO_CODESET
3472 AC_LANG_C
3474 dnl **********************
3475 dnl *** va_copy checks ***
3476 dnl **********************
3477 dnl we currently check for all three va_copy possibilities, so we get
3478 dnl all results in config.log for bug reports.
3479 AC_MSG_CHECKING(for an implementation of va_copy())
3480 AC_CACHE_VAL(ac_cv_va_copy,[
3481     AC_TRY_RUN([
3482         #include <stdarg.h>
3483         void f (int i, ...) {
3484             va_list args1, args2;
3485             va_start (args1, i);
3486             va_copy (args2, args1);
3487             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3488                 exit (1);
3489             va_end (args1); va_end (args2);
3490         }
3491         int main() { f (0, 42); return 0; }],
3492         ac_cv_va_copy=yes,
3493         ac_cv_va_copy=no,
3494         ac_cv_va_copy=no
3495     )
3497 AC_MSG_RESULT($ac_cv_va_copy)
3498 AC_MSG_CHECKING(for an implementation of __va_copy())
3499 AC_CACHE_VAL(ac_cv___va_copy,[
3500     AC_TRY_RUN([
3501         #include <stdarg.h>
3502         void f (int i, ...) {
3503             va_list args1, args2;
3504             va_start (args1, i);
3505             __va_copy (args2, args1);
3506             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3507                 exit (1);
3508             va_end (args1); va_end (args2);
3509         }
3510         int main() { f (0, 42); return 0; }],
3511         ac_cv___va_copy=yes,
3512         ac_cv___va_copy=no,
3513         ac_cv___va_copy=no
3514     )
3516 AC_MSG_RESULT($ac_cv___va_copy)
3517 AC_MSG_CHECKING(whether va_lists can be copied by value)
3518 AC_CACHE_VAL(ac_cv_va_val_copy,[
3519     AC_TRY_RUN([
3520         #include <stdarg.h>
3521         void f (int i, ...) {
3522             va_list args1, args2;
3523             va_start (args1, i);
3524             args2 = args1;
3525             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3526                 exit (1);
3527             va_end (args1); va_end (args2);
3528         }
3529         int main() { f (0, 42); return 0; }],
3530         ac_cv_va_val_copy=yes,
3531         ac_cv_va_val_copy=no,
3532         ac_cv_va_val_copy=yes
3533     )
3535 if test "x$ac_cv_va_copy" = "xyes"; then
3536     AC_DEFINE(VA_COPY, va_copy)
3537     AC_DEFINE(HAVE_VA_COPY)
3538 elif test "x$ac_cv___va_copy" = "xyes"; then
3539     AC_DEFINE(VA_COPY, __va_copy)
3540     AC_DEFINE(HAVE_VA_COPY)
3543 if test "x$ac_cv_va_val_copy" = "xno"; then
3544    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3546 AC_MSG_RESULT($ac_cv_va_val_copy)
3548 dnl ===================================================================
3549 dnl ========================================================
3550 dnl Put your C++ language/feature checks below
3551 dnl ========================================================
3552 AC_LANG_CPLUSPLUS
3554 ARM_ABI_PREFIX=
3555 if test "$GNU_CC"; then
3556   if test "$CPU_ARCH" = "arm" ; then
3557     AC_CACHE_CHECK(for ARM EABI,
3558         ac_cv_gcc_arm_eabi,
3559         [AC_TRY_COMPILE([],
3560                         [
3561 #if defined(__ARM_EABI__)
3562   return 0;
3563 #else
3564 #error Not ARM EABI.
3565 #endif
3566                         ],
3567                         ac_cv_gcc_arm_eabi="yes",
3568                         ac_cv_gcc_arm_eabi="no")])
3569     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3570         HAVE_ARM_EABI=1
3571         ARM_ABI_PREFIX=eabi-
3572     else
3573         ARM_ABI_PREFIX=oabi-
3574     fi
3575   fi
3577   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3580 dnl Check for support of modern template specialization syntax
3581 dnl Test code and requirement from scc@netscape.com.
3582 dnl Autoconf cut-and-paste job by waterson@netscape.com
3583 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3584                ac_cv_cpp_modern_specialize_template_syntax,
3585                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3586                                class Y {};
3587                                template <> struct X<Y> { double a; };,
3588                                X<int> int_x;
3589                                X<Y> y_x;,
3590                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3591                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3592 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3593   AC_MSG_ERROR([The C++ compiler does not support template specialization])
3596 dnl Some compilers support only full specialization, and some don't.
3597 AC_CACHE_CHECK(whether partial template specialization works,
3598                ac_cv_cpp_partial_specialization,
3599                [AC_TRY_COMPILE(template <class T> class Foo {};
3600                                template <class T> class Foo<T*> {};,
3601                                return 0;,
3602                                ac_cv_cpp_partial_specialization=yes,
3603                                ac_cv_cpp_partial_specialization=no)])
3604 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3605   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3608 dnl Check to see if we can resolve ambiguity with |using|.
3609 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3610                ac_cv_cpp_ambiguity_resolving_using,
3611                [AC_TRY_COMPILE(class X {
3612                                  public: int go(const X&) {return 3;}
3613                                          int jo(const X&) {return 3;}
3614                                };
3615                                class Y : public X {
3616                                  public:  int go(int) {return 2;}
3617                                           int jo(int) {return 2;}
3618                                           using X::jo;
3619                                  private: using X::go;
3620                                };,
3621                                X x; Y y; y.jo(x);,
3622                                ac_cv_cpp_ambiguity_resolving_using=yes,
3623                                ac_cv_cpp_ambiguity_resolving_using=no)])
3624 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3625    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3628 dnl See if a dynamic_cast to void* gives the most derived object.
3629 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3630                ac_cv_cpp_dynamic_cast_void_ptr,
3631                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3632                             class Y { int j; public: virtual ~Y() { } };
3633                             class Z : public X, public Y { int k; };
3635                             int main() {
3636                                  Z mdo;
3637                                  X *subx = (X*)&mdo;
3638                                  Y *suby = (Y*)&mdo;
3639                                  return !((((void*)&mdo != (void*)subx) &&
3640                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3641                                           (((void*)&mdo != (void*)suby) &&
3642                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3643                             }],
3644                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3645                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3646                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3647 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3648    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3652 dnl note that this one is reversed - if the test fails, then
3653 dnl we require implementations of unused virtual methods. Which
3654 dnl really blows because it means we'll have useless vtable
3655 dnl bloat.
3656 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3657                ac_cv_cpp_unused_required,
3658                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3659                                X x;,
3660                                ac_cv_cpp_unused_required=no,
3661                                ac_cv_cpp_unused_required=yes)])
3662 if test "$ac_cv_cpp_unused_required" = yes ; then
3663    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3667 dnl Some compilers have trouble comparing a constant reference to a templatized
3668 dnl class to zero, and require an explicit operator==() to be defined that takes
3669 dnl an int. This test separates the strong from the weak.
3671 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3672                ac_cv_trouble_comparing_to_zero,
3673                [AC_TRY_COMPILE([#include <algorithm>
3674                                 template <class T> class Foo {};
3675                                 class T2;
3676                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3677                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3678                                [Foo<int> f; return (0 != f);],
3679                                ac_cv_trouble_comparing_to_zero=no,
3680                                ac_cv_trouble_comparing_to_zero=yes)])
3681 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3682   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3685 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3686 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3687 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3688 # linking XUL.
3689 _SAVE_LDFLAGS=$LDFLAGS
3690 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3691 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3692                ac_cv_thread_keyword,
3693                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3694                             [return tlsIsMainThread;],
3695                             ac_cv_thread_keyword=yes,
3696                             ac_cv_thread_keyword=no)])
3697 LDFLAGS=$_SAVE_LDFLAGS
3698 # The custom dynamic linker doesn't support TLS variables
3699 MOZ_TLS=
3700 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3701   # mips builds fail with TLS variables because of a binutils bug.
3702   # See bug 528687
3703   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3704   case "${target}" in
3705     mips*-*)
3706       :
3707       ;;
3708     *-android*|*-linuxandroid*)
3709       :
3710       ;;
3711     *-openbsd*)
3712       :
3713       ;;
3714     *)
3715       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3716       MOZ_TLS=1
3717       ;;
3718   esac
3721 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3722 if test -n "$MOZ_LINKER"; then
3723   if test "$CPU_ARCH" = arm; then
3724     dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3725     ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3726     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3727     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3728       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3729       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3730     fi
3731   fi
3734 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3735 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3736 dnl We however want to avoid these text relocations, and this can be done
3737 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3738 dnl doesn't contain anything at all, beside placeholders for some sections,
3739 dnl and crtbegin only contains a finalizer function that calls
3740 dnl __cxa_finalize. The custom linker actually takes care of calling
3741 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3742 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3743 dnl link crtbegin and crtend at all.
3744 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3745   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3746     ac_cv_crt_has_text_relocations,
3747     [echo 'int foo() { return 0; }' > conftest.cpp
3748      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3749         test -s conftest${DLL_SUFFIX}; then
3750        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3751          ac_cv_crt_has_text_relocations=yes
3752        else
3753          ac_cv_crt_has_text_relocations=no
3754        fi
3755      else
3756        AC_ERROR([couldn't compile a simple C file])
3757      fi
3758      rm -rf conftest*])
3759   if test "$ac_cv_crt_has_text_relocations" = yes; then
3760     dnl While we want libraries to skip the CRT files, we don't want
3761     dnl executables to be treated the same way. We thus set the flag
3762     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3763     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3764     dnl Using LDFLAGS in nspr is safe, since we only really build
3765     dnl libraries there.
3766     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3767     NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3768   fi
3771 dnl Check for the existence of various allocation headers/functions
3773 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3774 MALLOC_H=
3776 for file in $MALLOC_HEADERS; do
3777   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3778   if test "$MALLOC_H" != ""; then
3779     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3780     break
3781   fi
3782 done
3784 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3785 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3787 AC_CHECK_FUNCS(malloc_usable_size)
3789 dnl See if compiler supports some gcc-style attributes
3791 AC_CACHE_CHECK(for __attribute__((always_inline)),
3792                ac_cv_attribute_always_inline,
3793                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3794                                [],
3795                                ac_cv_attribute_always_inline=yes,
3796                                ac_cv_attribute_always_inline=no)])
3798 AC_CACHE_CHECK(for __attribute__((malloc)),
3799                ac_cv_attribute_malloc,
3800                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3801                                [],
3802                                ac_cv_attribute_malloc=yes,
3803                                ac_cv_attribute_malloc=no)])
3805 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3806                ac_cv_attribute_warn_unused,
3807                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3808                                [],
3809                                ac_cv_attribute_warn_unused=yes,
3810                                ac_cv_attribute_warn_unused=no)])
3812 dnl End of C++ language/feature checks
3813 AC_LANG_C
3815 dnl ========================================================
3816 dnl =  Internationalization checks
3817 dnl ========================================================
3819 dnl Internationalization and Locale support is different
3820 dnl on various UNIX platforms.  Checks for specific i18n
3821 dnl features go here.
3823 dnl check for LC_MESSAGES
3824 AC_CACHE_CHECK(for LC_MESSAGES,
3825                 ac_cv_i18n_lc_messages,
3826                 [AC_TRY_COMPILE([#include <locale.h>],
3827                                 [int category = LC_MESSAGES;],
3828                                 ac_cv_i18n_lc_messages=yes,
3829                                 ac_cv_i18n_lc_messages=no)])
3830 if test "$ac_cv_i18n_lc_messages" = yes; then
3831    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3834 AC_HAVE_FUNCS(localeconv)
3835 fi # ! SKIP_COMPILER_CHECKS
3837 TARGET_XPCOM_ABI=
3838 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3839     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3842 dnl Mozilla specific options
3843 dnl ========================================================
3844 dnl The macros used for command line options
3845 dnl are defined in build/autoconf/altoptions.m4.
3847 dnl If the compiler supports these attributes, define them as
3848 dnl convenience macros.
3849 if test "$ac_cv_attribute_malloc" = yes ; then
3850   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3851 else
3852   AC_DEFINE(NS_ATTR_MALLOC,)
3855 if test "$ac_cv_attribute_warn_unused" = yes ; then
3856   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3857 else
3858   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3861 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3862 dnl features that Windows actually does support.
3864 if test -n "$SKIP_COMPILER_CHECKS"; then
3865    dnl Windows has malloc.h
3866    AC_DEFINE(MALLOC_H, [<malloc.h>])
3867    AC_DEFINE(HAVE_FORCEINLINE)
3868    AC_DEFINE(HAVE_LOCALECONV)
3869 fi # SKIP_COMPILER_CHECKS
3871 dnl ========================================================
3872 dnl =
3873 dnl = Check for external package dependencies
3874 dnl =
3875 dnl ========================================================
3876 MOZ_ARG_HEADER(External Packages)
3878 MOZ_ARG_WITH_STRING(libxul-sdk,
3879 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3880   LIBXUL_SDK_DIR=$withval)
3882 if test "$LIBXUL_SDK_DIR" = "yes"; then
3883     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3884 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3885     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3887     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3888         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3889     fi
3892 AC_SUBST(LIBXUL_SDK)
3894 if test -n "$LIBXUL_SDK"; then
3895     LIBXUL_DIST="$LIBXUL_SDK"
3896 else
3897     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3899 AC_SUBST(LIBXUL_DIST)
3901 SYSTEM_LIBXUL=
3903 MOZ_ARG_WITH_BOOL(system-libxul,
3904 [  --with-system-libxul    Use system installed libxul SDK],
3905     SYSTEM_LIBXUL=1)
3907 dnl ========================================================
3908 dnl = If NSPR was not detected in the system,
3909 dnl = use the one in the source tree (mozilla/nsprpub)
3910 dnl ========================================================
3911 MOZ_ARG_WITH_BOOL(system-nspr,
3912 [  --with-system-nspr      Use system installed NSPR],
3913     _USE_SYSTEM_NSPR=1 )
3915 if test -n "$_USE_SYSTEM_NSPR"; then
3916     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])])
3919 if test -n "$MOZ_NATIVE_NSPR"; then
3920     _SAVE_CFLAGS=$CFLAGS
3921     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3922     AC_TRY_COMPILE([#include "prtypes.h"],
3923                 [#ifndef PR_STATIC_ASSERT
3924                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3925                  #endif],
3926                 [MOZ_NATIVE_NSPR=1],
3927                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3928     AC_TRY_COMPILE([#include "prtypes.h"],
3929                 [#ifndef PR_UINT64
3930                  #error PR_UINT64 not defined or requires including prtypes.h
3931                  #endif],
3932                 [MOZ_NATIVE_NSPR=1],
3933                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3934     CFLAGS=$_SAVE_CFLAGS
3935 else
3936     if test -z "$LIBXUL_SDK"; then
3937         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3938         if test -n "$GNU_CC"; then
3939             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3940         else
3941             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3942         fi
3943     else
3944         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3945         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3946     fi
3949 dnl system libevent Support
3950 dnl ========================================================
3951 MOZ_ARG_WITH_STRING(system-libevent,
3952 [  --with-system-libevent[=PFX]
3953                           Use system libevent [installed at prefix PFX]],
3954     LIBEVENT_DIR=$withval)
3956 _SAVE_CFLAGS=$CFLAGS
3957 _SAVE_LDFLAGS=$LDFLAGS
3958 _SAVE_LIBS=$LIBS
3959 if test "$LIBEVENT_DIR" = yes; then
3960     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3961         MOZ_NATIVE_LIBEVENT=1,
3962         LIBEVENT_DIR=/usr)
3964 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3965     MOZ_NATIVE_LIBEVENT=
3966 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3967     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3968     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3969     MOZ_CHECK_HEADER(event.h,
3970         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3971              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3972          fi],
3973         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3974     AC_CHECK_LIB(event, event_init,
3975                  [MOZ_NATIVE_LIBEVENT=1
3976                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3977                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3978                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3980 CFLAGS=$_SAVE_CFLAGS
3981 LDFLAGS=$_SAVE_LDFLAGS
3982 LIBS=$_SAVE_LIBS
3984 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3985 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3986 AC_SUBST(MOZ_LIBEVENT_LIBS)
3988 dnl ========================================================
3989 dnl = If NSS was not detected in the system,
3990 dnl = use the one in the source tree (mozilla/security/nss)
3991 dnl ========================================================
3993 MOZ_ARG_WITH_BOOL(system-nss,
3994 [  --with-system-nss       Use system installed NSS],
3995     _USE_SYSTEM_NSS=1 )
3997 if test -n "$_USE_SYSTEM_NSS"; then
3998     AM_PATH_NSS(3.14.1, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4001 if test -n "$MOZ_NATIVE_NSS"; then
4002    NSS_LIBS="$NSS_LIBS -lcrmf"
4003 else
4004    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4005    NSS_DEP_LIBS="\
4006         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4007         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4008         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4009         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4010         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4012    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4013        NSS_LIBS="\
4014         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4015         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4016         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4017         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4018         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4019    else
4020        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4021    fi
4024 dnl ======================
4025 dnl Detect yasm
4026 dnl ======================
4028 AC_MSG_CHECKING([for YASM assembler])
4029 AC_CHECK_PROGS(YASM, yasm, "")
4031 if test -n "$YASM"; then
4032   dnl Pull out yasm's version string
4033   YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
4034   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4035   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4036   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4037   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4040 if test -z "$SKIP_LIBRARY_CHECKS"; then
4041 dnl system JPEG support
4042 dnl ========================================================
4043 MOZ_ARG_WITH_STRING(system-jpeg,
4044 [  --with-system-jpeg[=PFX]
4045                           Use system libjpeg [installed at prefix PFX]],
4046     JPEG_DIR=$withval)
4048 _SAVE_CFLAGS=$CFLAGS
4049 _SAVE_LDFLAGS=$LDFLAGS
4050 _SAVE_LIBS=$LIBS
4051 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4052     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4053     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4055 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4056     MOZ_NATIVE_JPEG=
4057 else
4058     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
4061 if test "$MOZ_NATIVE_JPEG" = 1; then
4062     AC_TRY_COMPILE([ #include <stdio.h>
4063                      #include <sys/types.h>
4064                      #include <jpeglib.h> ],
4065                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4066                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4067                      #endif
4068                      #ifndef JCS_EXTENSIONS
4069                      #error "libjpeg-turbo JCS_EXTENSIONS required"
4070                      #endif
4071                      ],
4072                    MOZ_NATIVE_JPEG=1,
4073                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
4075 CFLAGS=$_SAVE_CFLAGS
4076 LDFLAGS=$_SAVE_LDFLAGS
4077 LIBS=$_SAVE_LIBS
4079 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
4080     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
4081     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
4083 fi # SKIP_LIBRARY_CHECKS
4085 dnl system ZLIB support
4086 dnl ========================================================
4087 MOZ_ZLIB_CHECK([1.2.3])
4089 if test "$MOZ_NATIVE_ZLIB" != 1; then
4090     MOZ_ZLIB_CFLAGS=
4091     MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
4094 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
4095     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4098 if test -z "$SKIP_LIBRARY_CHECKS"; then
4099 dnl system BZIP2 Support
4100 dnl ========================================================
4101 MOZ_ARG_WITH_STRING(system-bz2,
4102 [  --with-system-bz2[=PFX]
4103                           Use system libbz2 [installed at prefix PFX]],
4104     BZ2_DIR=$withval)
4106 _SAVE_CFLAGS=$CFLAGS
4107 _SAVE_LDFLAGS=$LDFLAGS
4108 _SAVE_LIBS=$LIBS
4109 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4110     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4111     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4113 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4114     MOZ_NATIVE_BZ2=
4115 else
4116     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
4117         [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
4119 CFLAGS=$_SAVE_CFLAGS
4120 LDFLAGS=$_SAVE_LDFLAGS
4121 LIBS=$_SAVE_LIBS
4123 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
4124     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
4125     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4128 dnl system PNG Support
4129 dnl ========================================================
4130 MOZ_ARG_WITH_STRING(system-png,
4131 [  --with-system-png[=PFX]
4132                           Use system libpng [installed at prefix PFX]],
4133     PNG_DIR=$withval)
4135 _SAVE_CFLAGS=$CFLAGS
4136 _SAVE_LDFLAGS=$LDFLAGS
4137 _SAVE_LIBS=$LIBS
4138 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4139     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4140     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4142 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4143     MOZ_NATIVE_PNG=
4144 else
4145     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
4146                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4147     AC_CHECK_LIB(png, png_get_acTL, ,
4148                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
4150 if test "$MOZ_NATIVE_PNG" = 1; then
4151     AC_TRY_COMPILE([ #include <stdio.h>
4152                      #include <sys/types.h>
4153                      #include <png.h> ],
4154                    [ #if PNG_LIBPNG_VER < $MOZPNG
4155                      #error "Insufficient libpng version ($MOZPNG required)."
4156                      #endif
4157                      #ifndef PNG_UINT_31_MAX
4158                      #error "Insufficient libpng version."
4159                      #endif ],
4160                    MOZ_NATIVE_PNG=1,
4161                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4163 CFLAGS=$_SAVE_CFLAGS
4164 LDFLAGS=$_SAVE_LDFLAGS
4165 LIBS=$_SAVE_LIBS
4167 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
4168     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
4169     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
4172 fi # SKIP_LIBRARY_CHECKS
4174 dnl system HunSpell Support
4175 dnl ========================================================
4176 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4177 [  --enable-system-hunspell
4178                           Use system hunspell (located with pkgconfig)],
4179     MOZ_NATIVE_HUNSPELL=1 )
4181 if test -n "$MOZ_NATIVE_HUNSPELL"; then
4182     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4185 AC_SUBST(MOZ_NATIVE_HUNSPELL)
4187 dnl ========================================================
4188 dnl system libffi Support
4189 dnl ========================================================
4190 MOZ_ARG_ENABLE_BOOL(system-ffi,
4191 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
4192     MOZ_NATIVE_FFI=1 )
4194 if test -n "$MOZ_NATIVE_FFI"; then
4195     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4196     # for non-GCC compilers.
4197     if test -z "$GNU_CC"; then
4198         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4199     else
4200         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4201     fi
4202     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4205 dnl ========================================================
4206 dnl Java SDK support
4207 dnl ========================================================
4209 JAVA_BIN_PATH=
4210 MOZ_ARG_WITH_STRING(java-bin-path,
4211 [  --with-java-bin-path=dir
4212                           Location of Java binaries (java, javac, jar)],
4213     JAVA_BIN_PATH=$withval)
4215 dnl ========================================================
4216 dnl =
4217 dnl = Application
4218 dnl =
4219 dnl ========================================================
4221 MOZ_ARG_HEADER(Application)
4223 ENABLE_TESTS=1
4224 ENABLE_SYSTEM_EXTENSION_DIRS=1
4225 MOZ_BRANDING_DIRECTORY=
4226 MOZ_OFFICIAL_BRANDING=
4227 MOZ_FEEDS=1
4228 MOZ_FLEXBOX=1
4229 MOZ_WEBAPP_RUNTIME=
4230 MOZ_JSDEBUGGER=1
4231 MOZ_AUTH_EXTENSION=1
4232 MOZ_OGG=1
4233 MOZ_RAW=
4234 MOZ_SYDNEYAUDIO=
4235 MOZ_SPEEX_RESAMPLER=1
4236 MOZ_SOUNDTOUCH=1
4237 MOZ_CUBEB=
4238 MOZ_VORBIS=
4239 MOZ_TREMOR=
4240 MOZ_WAVE=1
4241 MOZ_SAMPLE_TYPE_FLOAT32=
4242 MOZ_SAMPLE_TYPE_S16=
4243 MOZ_MEDIA=
4244 MOZ_OPUS=1
4245 MOZ_WEBM=1
4246 MOZ_DASH=1
4247 MOZ_WEBRTC=1
4248 MOZ_PEERCONNECTION=
4249 MOZ_SRTP=
4250 MOZ_WEBRTC_SIGNALING=
4251 MOZ_WEBRTC_IN_LIBXUL=
4252 MOZ_SCTP=
4253 MOZ_MEDIA_PLUGINS=
4254 MOZ_MEDIA_NAVIGATOR=
4255 MOZ_OMX_PLUGIN=
4256 MOZ_VP8=
4257 MOZ_VP8_ERROR_CONCEALMENT=
4258 MOZ_VP8_ENCODER=
4259 VPX_AS=
4260 VPX_ASFLAGS=
4261 VPX_AS_DASH_C_FLAG=
4262 VPX_AS_CONVERSION=
4263 VPX_ASM_SUFFIX=
4264 VPX_X86_ASM=
4265 VPX_ARM_ASM=
4266 LIBJPEG_TURBO_AS=
4267 LIBJPEG_TURBO_ASFLAGS=
4268 LIBJPEG_TURBO_X86_ASM=
4269 LIBJPEG_TURBO_X64_ASM=
4270 LIBJPEG_TURBO_ARM_ASM=
4271 MOZ_PANGO=1
4272 MOZ_PERMISSIONS=1
4273 MOZ_PLACES=1
4274 MOZ_PREF_EXTENSIONS=1
4275 MOZ_PROFILELOCKING=1
4276 MOZ_PSM=1
4277 MOZ_REFLOW_PERF=
4278 MOZ_SAFE_BROWSING=
4279 MOZ_HELP_VIEWER=
4280 MOZ_SPELLCHECK=1
4281 MOZ_ANDROID_OMTC=
4282 MOZ_ONLY_TOUCH_EVENTS=
4283 MOZ_TOOLKIT_SEARCH=1
4284 MOZ_UI_LOCALE=en-US
4285 MOZ_UNIVERSALCHARDET=1
4286 MOZ_URL_CLASSIFIER=
4287 MOZ_XUL=1
4288 MOZ_ZIPWRITER=1
4289 NS_PRINTING=1
4290 MOZ_PDF_PRINTING=
4291 MOZ_DISABLE_DOMCRYPTO=
4292 NSS_DISABLE_DBM=
4293 NECKO_WIFI=1
4294 NECKO_COOKIES=1
4295 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4296 USE_ARM_KUSER=
4297 BUILD_CTYPES=1
4298 MOZ_USE_NATIVE_POPUP_WINDOWS=
4299 MOZ_ANDROID_HISTORY=
4300 MOZ_WEBSMS_BACKEND=
4301 MOZ_GRAPHITE=1
4302 ACCESSIBILITY=1
4303 MOZ_SYS_MSG=
4304 MOZ_TIME_MANAGER=
4305 MOZ_PAY=
4306 MOZ_AUDIO_CHANNEL_MANAGER=
4308 case "$target_os" in
4309     mingw*)
4310         NS_ENABLE_TSF=1
4311         AC_DEFINE(NS_ENABLE_TSF)
4312         ;;
4313 esac
4315 case "${target}" in
4316     *-android*|*-linuxandroid*)
4317         if test "$CPU_ARCH" = "arm" ; then
4318           USE_ARM_KUSER=1
4319         fi
4321         NSS_DISABLE_DBM=1
4322         if test -z "$gonkdir"; then
4323           NECKO_WIFI=
4324         else
4325           NECKO_WIFI=1
4326         fi
4327         MOZ_THEME_FASTSTRIPE=1
4328         MOZ_TREE_FREETYPE=1
4329         MOZ_MEMORY=1
4330         MOZ_RAW=1
4331         ;;
4333 esac
4335 MOZ_ARG_ENABLE_STRING(application,
4336 [  --enable-application=APP
4337                           Options include:
4338                             browser (Firefox)
4339                             xulrunner
4340                             tools/update-packaging (AUS-related packaging tools)],
4341 [ MOZ_BUILD_APP=$enableval ] )
4343 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4344 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4345   XULRUNNER_STUB_NAME=$withval)
4347 if test -z "$XULRUNNER_STUB_NAME"; then
4348   case "$target_os" in
4349   darwin*)
4350     XULRUNNER_STUB_NAME=xulrunner
4351     ;;
4352   *)
4353     XULRUNNER_STUB_NAME=xulrunner-stub
4354   esac
4356 AC_SUBST(XULRUNNER_STUB_NAME)
4358 AC_MSG_CHECKING([for application to build])
4359 if test -z "$MOZ_BUILD_APP"; then
4360   AC_MSG_RESULT([browser])
4361   MOZ_BUILD_APP=browser
4362 else
4363   # default mobile to be mobile/xul
4364   if test "$MOZ_BUILD_APP" = "mobile" ; then
4365     MOZ_BUILD_APP=mobile/xul
4366   fi
4367   # We have a valid application only if it has a build.mk file in its top
4368   # directory.
4369   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4370     AC_MSG_RESULT([none])
4371     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4372   else
4373     AC_MSG_RESULT([$MOZ_BUILD_APP])
4374   fi
4377 # The app update channel is 'default' when not supplied. The value is used in
4378 # the application's confvars.sh so it must be set before confvars.sh is called.
4379 MOZ_ARG_ENABLE_STRING([update-channel],
4380 [  --enable-update-channel=CHANNEL
4381                           Select application update channel (default=default)],
4382     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4384 if test -z "$MOZ_UPDATE_CHANNEL"; then
4385     MOZ_UPDATE_CHANNEL=default
4387 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4388 AC_SUBST(MOZ_UPDATE_CHANNEL)
4390 # Allow the application to influence configure with a confvars.sh script.
4392 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4393 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4394   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4395   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4396 else
4397   AC_MSG_RESULT([no])
4400 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4401 MOZ_ARG_WITH_STRING(app-name,
4402 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4403 WITH_APP_NAME=$withval,
4406 if test -n "$WITH_APP_NAME" ; then
4407     MOZ_APP_NAME="$WITH_APP_NAME"
4410 MOZ_ARG_WITH_STRING(app-basename,
4411 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4412 WITH_APP_BASENAME=$withval,
4415 if test -n "$WITH_APP_BASENAME" ; then
4416     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4419 # Now is a good time to test for logic errors, define mismatches, etc.
4420 case "$MOZ_BUILD_APP" in
4421 xulrunner)
4422   if test "$LIBXUL_SDK"; then
4423     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4424   fi
4425   ;;
4426 esac
4428 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4429 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4430 # MOZ_BUILD_APP.
4431 case "$MOZ_BUILD_APP" in
4432 browser)
4433   AC_DEFINE(MOZ_PHOENIX)
4434   ;;
4436 xulrunner)
4437   AC_DEFINE(MOZ_XULRUNNER)
4438   ;;
4439 b2g)
4440   AC_DEFINE(MOZ_B2G)
4441   ;;
4442 esac
4444 AC_SUBST(MOZ_BUILD_APP)
4445 AC_SUBST(MOZ_PHOENIX)
4446 AC_SUBST(MOZ_XULRUNNER)
4447 AC_SUBST(MOZ_B2G)
4449 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4451 dnl ========================================================
4452 dnl Check android sdk version depending on mobile target
4453 dnl ========================================================
4455 if test -z "$gonkdir" ; then
4456     # Minimum Android SDK API Level we require.
4457     case "$MOZ_BUILD_APP" in
4458     mobile/xul)
4459         android_min_api_level=13
4460         ;;
4461     mobile/android)
4462         android_min_api_level=16
4463         ;;
4464     esac
4466     MOZ_ANDROID_SDK($android_min_api_level)
4469 dnl ========================================================
4470 dnl =
4471 dnl = Toolkit Options
4472 dnl =
4473 dnl ========================================================
4474 MOZ_ARG_HEADER(Toolkit Options)
4476     dnl ========================================================
4477     dnl = Select the default toolkit
4478     dnl ========================================================
4479         MOZ_ARG_ENABLE_STRING(default-toolkit,
4480         [  --enable-default-toolkit=TK
4481                           Select default toolkit
4482                           Platform specific defaults:
4483                             Mac OS X - cairo-cocoa
4484                             OS/2 - cairo-os2
4485                             Win32 - cairo-windows
4486                             * - cairo-gtk2
4487                             * - cairo-qt],
4488     [ _DEFAULT_TOOLKIT=$enableval ],
4489     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4491     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4492         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4493         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4494         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4495         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4496         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4497         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4498         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4499         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4500     then
4501         dnl nglayout only supports building with one toolkit,
4502         dnl so ignore everything after the first comma (",").
4503         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4504     else
4505         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4506     fi
4508 MOZ_ARG_WITHOUT_BOOL(x,
4509 [  --without-x              Build without X11],
4510     WITHOUT_X11=1)
4512 dnl ========================================================
4513 dnl = Enable the toolkit as needed                         =
4514 dnl ========================================================
4516 MOZ_WIDGET_GTK=
4518 case "$MOZ_WIDGET_TOOLKIT" in
4520 cairo-windows)
4521     MOZ_WIDGET_TOOLKIT=windows
4522     MOZ_WEBGL=1
4523     MOZ_PDF_PRINTING=1
4524     MOZ_INSTRUMENT_EVENT_LOOP=1
4525     ;;
4527 cairo-gtk2|cairo-gtk2-x11)
4528     MOZ_WIDGET_TOOLKIT=gtk2
4529     MOZ_ENABLE_GTK2=1
4530     MOZ_ENABLE_XREMOTE=1
4531     MOZ_WEBGL=1
4532     MOZ_GL_DEFAULT_PROVIDER=GLX
4534     AC_DEFINE(MOZ_X11)
4535     MOZ_X11=1
4536     USE_FC_FREETYPE=1
4538     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4539     TK_LIBS='$(MOZ_GTK2_LIBS)'
4540     AC_DEFINE(MOZ_WIDGET_GTK2)
4541     MOZ_WIDGET_GTK=2
4542     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4543     MOZ_PDF_PRINTING=1
4544     MOZ_INSTRUMENT_EVENT_LOOP=1
4545     ;;
4547 cairo-qt)
4548     MOZ_WIDGET_TOOLKIT=qt
4549     MOZ_ENABLE_QT=1
4550     if test -z "$WITHOUT_X11"; then
4551       MOZ_ENABLE_XREMOTE=1
4552       MOZ_GL_DEFAULT_PROVIDER=GLX
4553       MOZ_X11=1
4554       AC_DEFINE(MOZ_X11)
4555       XT_LIBS=
4556     fi
4558     MOZ_WEBGL=1
4559     USE_ELF_DYNSTR_GC=
4560     USE_FC_FREETYPE=1
4561     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4562     TK_LIBS='$(MOZ_QT_LIBS)'
4563     AC_DEFINE(MOZ_WIDGET_QT)
4564     MOZ_PDF_PRINTING=1
4565     ;;
4567 cairo-os2)
4568     MOZ_WIDGET_TOOLKIT=os2
4569     USE_FC_FREETYPE=1
4570     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4571     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4572     MOZ_PDF_PRINTING=1
4573     ;;
4575 cairo-cocoa)
4576     MOZ_WIDGET_TOOLKIT=cocoa
4577     AC_DEFINE(MOZ_WIDGET_COCOA)
4578     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4579     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4580     TK_CFLAGS="-DNO_X11"
4581     CFLAGS="$CFLAGS $TK_CFLAGS"
4582     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4583     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4584     MOZ_USER_DIR="Mozilla"
4585     MOZ_FS_LAYOUT=bundle
4586     MOZ_WEBGL=1
4587     MOZ_INSTRUMENT_EVENT_LOOP=1
4588     ;;
4590 cairo-uikit)
4591     MOZ_WIDGET_TOOLKIT=uikit
4592     AC_DEFINE(MOZ_WIDGET_UIKIT)
4593     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4594     TK_CFLAGS="-DNO_X11"
4595     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4596     CFLAGS="$CFLAGS $TK_CFLAGS"
4597     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4598     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4599     MOZ_USER_DIR="Mozilla"
4600     MOZ_FS_LAYOUT=bundle
4601     ;;
4603 cairo-android)
4604     AC_DEFINE(MOZ_WIDGET_ANDROID)
4605     MOZ_WIDGET_TOOLKIT=android
4606     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4607     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4608     MOZ_WEBGL=1
4609     MOZ_PDF_PRINTING=1
4610     MOZ_INSTRUMENT_EVENT_LOOP=1
4611     if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4612         MOZ_OLD_LINKER=1
4613     fi
4614     ;;
4616 cairo-gonk)
4617     AC_DEFINE(MOZ_WIDGET_GONK)
4618     AC_DEFINE(MOZ_TOUCH)
4619     MOZ_WIDGET_TOOLKIT=gonk
4620     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4621     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4622     MOZ_WEBGL=1
4623     MOZ_PDF_PRINTING=1
4624     MOZ_TOUCH=1
4625     ;;
4627 esac
4629 AC_SUBST(MOZ_OLD_LINKER)
4630 AC_SUBST(MOZ_PDF_PRINTING)
4631 if test "$MOZ_PDF_PRINTING"; then
4632    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4633    AC_DEFINE(MOZ_PDF_PRINTING)
4636 if test "$MOZ_ENABLE_XREMOTE"; then
4637     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4640 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4641    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4644 if test "$COMPILE_ENVIRONMENT"; then
4645   if test "$MOZ_ENABLE_GTK2"; then
4646     if test "$MOZ_X11"; then
4647       GDK_PACKAGES=gdk-x11-2.0
4648     fi
4650     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4651   fi
4653 fi # COMPILE_ENVIRONMENT
4655 AC_SUBST(MOZ_FS_LAYOUT)
4657 dnl ========================================================
4658 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4659 dnl their usage and use them in spidermonkey.
4660 dnl ========================================================
4661 MOZ_ARG_WITH_BOOL(arm-kuser,
4662 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4663     USE_ARM_KUSER=1,)
4664 if test -n "$USE_ARM_KUSER"; then
4665    AC_DEFINE(USE_ARM_KUSER)
4668 dnl ========================================================
4669 dnl = startup-notification support module
4670 dnl ========================================================
4672 if test "$MOZ_ENABLE_GTK2"
4673 then
4674     MOZ_ENABLE_STARTUP_NOTIFICATION=
4676     MOZ_ARG_ENABLE_BOOL(startup-notification,
4677     [  --enable-startup-notification
4678                           Enable startup-notification support (default: disabled) ],
4679         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4680         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4681     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4682     then
4683         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4684                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4685         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4686             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4687             then
4688                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4689             fi
4690             MOZ_ENABLE_STARTUP_NOTIFICATION=
4691         ])
4692     fi
4694     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4695         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4696     fi
4698     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4700 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4701 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4702 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4704 dnl ========================================================
4705 dnl = QT support
4706 dnl ========================================================
4707 if test "$MOZ_ENABLE_QT"
4708 then
4709     MOZ_ARG_WITH_STRING(qtdir,
4710     [  --with-qtdir=\$dir       Specify Qt directory ],
4711     [ QTDIR=$withval])
4713     if test -z "$QTDIR"; then
4714         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4715         PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
4716                       MOZ_ENABLE_QT5=1,
4717                       MOZ_ENABLE_QT5=)
4718         if test "$MOZ_ENABLE_QT5"; then
4719             echo "Using qt5"
4720             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4721             MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4722         fi
4724         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4725         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4726     else
4727         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4729         MOZ_QT_CFLAGS="-DQT_SHARED"
4730         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4731         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4732         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4733         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4734         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4735         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4736         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4737         HOST_MOC="$QTDIR/bin/moc"
4738         HOST_RCC="$QTDIR/bin/rcc"
4740         # QtWidgets was introduced only in Qt5
4741         if test -d $QTDIR/include/QtWidgets; then
4742             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4743             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4744             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
4745         fi
4746     fi
4747     if test -z "$HOST_MOC"; then
4748         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4749 incorrect])
4750     fi
4751     if test -z "$HOST_RCC"; then
4752         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4753 incorrect])
4754     fi
4756     MOC=$HOST_MOC
4757     RCC=$HOST_RCC
4759     MOZ_ENABLE_QMSYSTEM2=
4760     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4761                       MOZ_ENABLE_QMSYSTEM2=1,
4762                       MOZ_ENABLE_QMSYSTEM2=)
4764     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4765       MOZ_ENABLE_QMSYSTEM2=1
4766       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4767       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4768       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4769     fi
4771     MOZ_ENABLE_QTNETWORK=
4772     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4773                       MOZ_ENABLE_QTNETWORK=1,
4774                       MOZ_ENABLE_QTNETWORK=)
4776     if test "$MOZ_ENABLE_QTNETWORK"; then
4777       MOZ_ENABLE_QTNETWORK=1
4778       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4779     fi
4781     MOZ_ENABLE_QTMOBILITY=
4782     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4783                       MOZ_ENABLE_QTMOBILITY=1,
4784                       MOZ_ENABLE_QTMOBILITY=)
4785     if test "$MOZ_ENABLE_QTMOBILITY"; then
4786        MOZ_ENABLE_QTMOBILITY=1
4787        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4788        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4789     else
4790        AC_CHECK_LIB(QtSensors, main, [
4791           MOZ_ENABLE_QTMOBILITY=1
4792           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4793           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4794           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4795           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4796           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4797        ])
4798     fi
4799     if test "$MOZ_ENABLE_QTMOBILITY"; then
4800        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4801     fi
4804 AC_SUBST(GTK_CONFIG)
4805 AC_SUBST(TK_CFLAGS)
4806 AC_SUBST(TK_LIBS)
4808 AC_SUBST(MOZ_ENABLE_GTK2)
4809 AC_SUBST(MOZ_ENABLE_QT)
4810 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4811 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4812 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4813 AC_SUBST(MOZ_ENABLE_XREMOTE)
4814 AC_SUBST(MOZ_GTK2_CFLAGS)
4815 AC_SUBST(MOZ_GTK2_LIBS)
4816 AC_SUBST(MOZ_WIDGET_GTK)
4817 AC_SUBST(MOZ_QT_CFLAGS)
4818 AC_SUBST(MOZ_QT_LIBS)
4820 AC_SUBST(MOC)
4821 AC_SUBST(RCC)
4823 AC_SUBST(MOZ_X11)
4825 dnl ========================================================
4826 dnl =
4827 dnl = Components & Features
4828 dnl =
4829 dnl ========================================================
4830 MOZ_ARG_HEADER(Components and Features)
4832 dnl ========================================================
4833 dnl = Localization
4834 dnl ========================================================
4835 MOZ_ARG_ENABLE_STRING(ui-locale,
4836 [  --enable-ui-locale=ab-CD
4837                           Select the user interface locale (default: en-US)],
4838     MOZ_UI_LOCALE=$enableval )
4839 AC_SUBST(MOZ_UI_LOCALE)
4841 dnl ========================================================
4842 dnl = Trademarked Branding
4843 dnl ========================================================
4844 MOZ_ARG_ENABLE_BOOL(official-branding,
4845 [  --enable-official-branding
4846                           Enable Official mozilla.org Branding
4847                           Do not distribute builds with
4848                           --enable-official-branding unless you have
4849                           permission to use trademarks per
4850                           http://www.mozilla.org/foundation/trademarks/ .],
4852   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4853     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4854   else
4855     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4856     MOZ_OFFICIAL_BRANDING=1
4857   fi
4858 ], MOZ_OFFICIAL_BRANDING=)
4860 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4861 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4862   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4865 MOZ_ARG_WITH_STRING(branding,
4866 [  --with-branding=dir     Use branding from the specified directory.],
4867     MOZ_BRANDING_DIRECTORY=$withval)
4869 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4870 if test -z "$REAL_BRANDING_DIRECTORY"; then
4871   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4874 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4875   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4878 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4880 dnl ========================================================
4881 dnl = Distribution ID
4882 dnl ========================================================
4883 MOZ_ARG_WITH_STRING(distribution-id,
4884 [  --with-distribution-id=ID
4885                           Set distribution-specific id (default=org.mozilla)],
4886 [ val=`echo $withval`
4887     MOZ_DISTRIBUTION_ID="$val"])
4889 if test -z "$MOZ_DISTRIBUTION_ID"; then
4890    MOZ_DISTRIBUTION_ID="org.mozilla"
4893 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4894 AC_SUBST(MOZ_DISTRIBUTION_ID)
4897 dnl ========================================================
4898 dnl complex text support off by default
4899 dnl ========================================================
4900 MOZ_ARG_DISABLE_BOOL(pango,
4901 [  --disable-pango         Disable usage of Pango ],
4902     MOZ_PANGO=,
4903     MOZ_PANGO=1)
4905 dnl ========================================================
4906 dnl = Pango
4907 dnl ========================================================
4908 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
4909 then
4910     AC_SUBST(MOZ_PANGO)
4912     if test "$MOZ_PANGO"
4913     then
4914         PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4916         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4917         AC_SUBST(MOZ_PANGO_CFLAGS)
4918         AC_SUBST(MOZ_PANGO_LIBS)
4919         AC_DEFINE(MOZ_PANGO)
4920     else
4921         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4922         AC_SUBST(FT2_CFLAGS)
4923         AC_SUBST(FT2_LIBS)
4924     fi
4927 dnl ========================================================
4928 dnl = GnomeVFS, GIO and GConf support module
4929 dnl ========================================================
4931 if test "$MOZ_X11"
4932 then
4933     dnl build the GIO extension by default only when the
4934     dnl GTK2 toolkit is in use.
4935     if test "$MOZ_ENABLE_GTK2"
4936     then
4937         MOZ_ENABLE_GIO=1
4938         MOZ_ENABLE_GCONF=1
4939     fi
4941     dnl ========================================================
4942     dnl = GnomeVFS support module
4943     dnl ========================================================
4944     MOZ_ARG_ENABLE_BOOL(gnomevfs,
4945     [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
4946         MOZ_ENABLE_GNOMEVFS=force,
4947         MOZ_ENABLE_GNOMEVFS=)
4949     if test "$MOZ_ENABLE_GNOMEVFS"
4950     then
4951         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4952             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4953             MOZ_ENABLE_GNOMEVFS=1
4954             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4955         ],[
4956             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4957             then
4958                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4959             fi
4960             MOZ_ENABLE_GNOMEVFS=
4961         ])
4962     fi
4964     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4965     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4966     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4968     dnl ========================================================
4969     dnl = GIO support module
4970     dnl ========================================================
4971     MOZ_ARG_DISABLE_BOOL(gio,
4972     [  --disable-gio           Disable GIO support],
4973         MOZ_ENABLE_GIO=,
4974         MOZ_ENABLE_GIO=force)
4976     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
4977     then
4978         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4979                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4980         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4981             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4982             MOZ_ENABLE_GIO=1
4983             AC_DEFINE(MOZ_ENABLE_GIO)
4984         ],[
4985             if test "$MOZ_ENABLE_GIO" = "force"
4986             then
4987                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4988             fi
4989             MOZ_ENABLE_GIO=
4990         ])
4991     fi
4993     AC_SUBST(MOZ_ENABLE_GIO)
4994     AC_SUBST(MOZ_GIO_CFLAGS)
4995     AC_SUBST(MOZ_GIO_LIBS)
4997     dnl ========================================================
4998     dnl = GConf support module
4999     dnl ========================================================
5000     MOZ_ARG_DISABLE_BOOL(gconf,
5001     [  --disable-gconf      Disable Gconf support ],
5002         MOZ_ENABLE_GCONF=,
5003         MOZ_ENABLE_GCONF=force)
5005     if test "$MOZ_ENABLE_GCONF"
5006     then
5007         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5008             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5009             MOZ_ENABLE_GCONF=1
5010         ],[
5011             if test "$MOZ_ENABLE_GCONF" = "force"
5012             then
5013                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5014             fi
5015             MOZ_ENABLE_GCONF=
5016         ])
5017     fi
5019     if test "$MOZ_ENABLE_GCONF"; then
5020         AC_DEFINE(MOZ_ENABLE_GCONF)
5021     fi
5023     AC_SUBST(MOZ_ENABLE_GCONF)
5024     AC_SUBST(MOZ_GCONF_CFLAGS)
5025     AC_SUBST(MOZ_GCONF_LIBS)
5028 dnl ========================================================
5029 dnl = libproxy support
5030 dnl ========================================================
5032 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5033 then
5034     MOZ_ENABLE_LIBPROXY=
5036     MOZ_ARG_ENABLE_BOOL(libproxy,
5037     [  --enable-libproxy         Enable libproxy support ],
5038     MOZ_ENABLE_LIBPROXY=1,
5039     MOZ_ENABLE_LIBPROXY=)
5041     if test "$MOZ_ENABLE_LIBPROXY"
5042     then
5043         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5044         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5045     fi
5047 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5048 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5049 AC_SUBST(MOZ_LIBPROXY_LIBS)
5051 dnl ========================================================
5052 dnl = GNOME component (mozgnome)
5053 dnl ========================================================
5055 if test "$MOZ_ENABLE_GTK2"
5056 then
5057     MOZ_ENABLE_GNOME_COMPONENT=1
5059 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5061 dnl ========================================================
5062 dnl = libgnomeui support module
5063 dnl ========================================================
5065 if test "$MOZ_ENABLE_GTK2"
5066 then
5067     MOZ_ARG_ENABLE_BOOL(gnomeui,
5068     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
5069         MOZ_ENABLE_GNOMEUI=force,
5070         MOZ_ENABLE_GNOMEUI=)
5072     if test "$MOZ_ENABLE_GNOMEUI"
5073     then
5074         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5075         [
5076             MOZ_ENABLE_GNOMEUI=1
5077         ],[
5078             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5079             then
5080                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5081             fi
5082             MOZ_ENABLE_GNOMEUI=
5083         ])
5084     fi
5086     if test "$MOZ_ENABLE_GNOMEUI"; then
5087         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5088     fi
5091 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5092 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5094 dnl ========================================================
5095 dnl = dbus support
5096 dnl ========================================================
5098 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5099 then
5100     MOZ_ENABLE_DBUS=1
5102     MOZ_ARG_DISABLE_BOOL(dbus,
5103     [  --disable-dbus          Disable dbus support ],
5104         MOZ_ENABLE_DBUS=,
5105         MOZ_ENABLE_DBUS=1)
5107     if test "$MOZ_ENABLE_DBUS"
5108     then
5109         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5110         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5111         AC_DEFINE(MOZ_ENABLE_DBUS)
5112     fi
5114 AC_SUBST(MOZ_ENABLE_DBUS)
5115 AC_SUBST(MOZ_DBUS_CFLAGS)
5116 AC_SUBST(MOZ_DBUS_LIBS)
5117 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5118 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5120 dnl ========================================================
5121 dnl = Enable Android History instead of Places
5122 dnl ========================================================
5123 if test -n "$MOZ_ANDROID_HISTORY"; then
5124     if test -z "$MOZ_PLACES"; then
5125         AC_DEFINE(MOZ_ANDROID_HISTORY)
5126     else
5127         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5128     fi
5131 dnl ========================================================
5132 dnl = Build with the Android compositor
5133 dnl ========================================================
5134 if test -n "$MOZ_ANDROID_OMTC"; then
5135      dnl Do this if defined in confvars.sh
5136      AC_DEFINE(MOZ_ANDROID_OMTC)
5139 dnl ========================================================
5140 dnl = Disable WebSMS backend
5141 dnl ========================================================
5142 MOZ_ARG_DISABLE_BOOL(websms-backend,
5143 [  --disable-websms-backend
5144                            Disable WebSMS backend],
5145     MOZ_WEBSMS_BACKEND=,
5146     MOZ_WEBSMS_BACKEND=1)
5148 if test -n "$MOZ_WEBSMS_BACKEND"; then
5149     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5152 dnl ========================================================
5153 dnl = Build Personal Security Manager
5154 dnl ========================================================
5155 MOZ_ARG_DISABLE_BOOL(crypto,
5156 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5157     MOZ_PSM=,
5158     MOZ_PSM=1 )
5160 dnl ========================================================
5161 dnl = JS Debugger XPCOM component (js/jsd)
5162 dnl ========================================================
5163 MOZ_ARG_DISABLE_BOOL(jsd,
5164 [  --disable-jsd           Disable JavaScript debug library],
5165     MOZ_JSDEBUGGER=,
5166     MOZ_JSDEBUGGER=1)
5169 dnl ========================================================
5170 dnl = Enable IPDL's "expensive" unit tests
5171 dnl ========================================================
5172 MOZ_IPDL_TESTS=
5174 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5175 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5176     MOZ_IPDL_TESTS=1,
5177     MOZ_IPDL_TESTS=)
5179 if test -n "$MOZ_IPDL_TESTS"; then
5180     AC_DEFINE(MOZ_IPDL_TESTS)
5183 AC_SUBST(MOZ_IPDL_TESTS)
5185 dnl ========================================================
5186 dnl = Turns off code necessary for e10s compatibility
5187 dnl ========================================================
5188 dnl This is a temporary flag to be removed in bug 662601 when
5189 dnl it's no longer needed
5191 MOZ_E10S_COMPAT=
5193 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5194 [  --enable-e10s-compat     Turns off code for e10s compat],
5195     MOZ_E10S_COMPAT=1,
5196     MOZ_E10S_COMPAT=)
5198 if test -n "$MOZ_E10S_COMPAT"; then
5199     AC_DEFINE(MOZ_E10S_COMPAT)
5202 dnl ========================================================
5203 dnl = Disable building dbm
5204 dnl ========================================================
5205 MOZ_ARG_DISABLE_BOOL(dbm,
5206 [  --disable-dbm           Disable building dbm],
5207     NSS_DISABLE_DBM=1,
5208     NSS_DISABLE_DBM=)
5210 dnl bi-directional support always on
5211 IBMBIDI=1
5212 AC_DEFINE(IBMBIDI)
5214 dnl ========================================================
5215 dnl accessibility support on by default on all platforms
5216 dnl ========================================================
5217 MOZ_ARG_DISABLE_BOOL(accessibility,
5218 [  --disable-accessibility Disable accessibility support],
5219     ACCESSIBILITY=,
5220     ACCESSIBILITY=1 )
5221 if test "$ACCESSIBILITY"; then
5222     case "$target" in
5223     *-mingw*)
5224         if test -z "$MIDL"; then
5225             if test "$GCC" != "yes"; then
5226                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5227             else
5228                 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.])
5229             fi
5230         fi
5231     esac
5232     AC_DEFINE(ACCESSIBILITY)
5235 dnl ========================================================
5236 dnl Disable printing
5237 dnl ========================================================
5238 MOZ_ARG_DISABLE_BOOL(printing,
5239 [  --disable-printing      Disable printing support],
5240     NS_PRINTING=,
5241     NS_PRINTING=1)
5243 if test "$NS_PRINTING"; then
5244     AC_DEFINE(NS_PRINTING)
5245     AC_DEFINE(NS_PRINT_PREVIEW)
5248 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5249 dnl --enable-webrtc to override.  Can disable for everything in
5250 dnl the master list above.
5251 if test -n "$MOZ_WEBRTC"; then
5252     case "$target" in
5253     *-android*|*-linuxandroid*)
5254         dnl Make sure doesn't get matched by *-linux*
5255         MOZ_WEBRTC=
5256         ;;
5257     *-linux*|*-mingw*|*-darwin*)
5258         dnl Leave enabled
5259         ;;
5260     *)
5261         dnl default to disabled for all others
5262         MOZ_WEBRTC=
5263         ;;
5264     esac
5267 dnl ========================================================
5268 dnl = Disable WebRTC code
5269 dnl ========================================================
5270 MOZ_ARG_DISABLE_BOOL(webrtc,
5271 [  --disable-webrtc        Disable support for WebRTC],
5272     MOZ_WEBRTC=,
5273     MOZ_WEBRTC=1)
5275 if test -n "$MOZ_WEBRTC"; then
5276     AC_DEFINE(MOZ_WEBRTC)
5277     MOZ_MEDIA=1
5278     MOZ_RAW=1
5279     MOZ_VP8=1
5280     MOZ_VP8_ENCODER=1
5281     MOZ_VP8_ERROR_CONCEALMENT=1
5283     dnl OpenSLES is only available in Android 2.3 and later; we'll change this
5284     dnl hard dependency to a dynamic load with graceful runtime failure before
5285     dnl we make --enable-webrtc on by default in Android (bug 815905)
5286     dnl
5287     if test "$OS_TARGET" = "Android"; then
5288        LDFLAGS="$LDFLAGS -lOpenSLES"
5289     fi
5290     case "$target" in
5291     *-android*|*-linuxandroid*)
5292        LDFLAGS="$LDFLAGS -lOpenSLES"
5293        ;;
5294     esac
5296 dnl enable once Signaling lands
5297     MOZ_WEBRTC_SIGNALING=1
5298     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5299     if test "${OS_TARGET}" = "WINNT"; then
5300         MOZ_WEBRTC_IN_LIBXUL=1
5301     fi
5302 dnl enable once PeerConnection lands
5303     MOZ_PEERCONNECTION=1
5304     AC_DEFINE(MOZ_PEERCONNECTION)
5305     MOZ_SCTP=1
5306     MOZ_SRTP=1
5307     AC_DEFINE(MOZ_SCTP)
5308     AC_DEFINE(MOZ_SRTP)
5311 AC_SUBST(MOZ_WEBRTC)
5312 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5313 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5314 AC_SUBST(MOZ_PEERCONNECTION)
5315 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5316 AC_SUBST(MOZ_SCTP)
5317 AC_SUBST(MOZ_SRTP)
5319 case "$target_cpu" in
5320 arm*)
5321     MOZ_SAMPLE_TYPE_S16=1
5322     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5323     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5326     MOZ_SAMPLE_TYPE_FLOAT32=1
5327     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5328     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5330 esac
5332 dnl ========================================================
5333 dnl = Enable Raw Codecs
5334 dnl ========================================================
5335 MOZ_ARG_ENABLE_BOOL(raw,
5336 [  --enable-raw           Enable support for RAW media],
5337     MOZ_RAW=1,
5338     MOZ_RAW=)
5340 if test -n "$MOZ_RAW"; then
5341     AC_DEFINE(MOZ_RAW)
5342     MOZ_MEDIA=1
5345 AC_SUBST(MOZ_RAW)
5347 dnl ========================================================
5348 dnl = Disable Ogg Codecs
5349 dnl ========================================================
5350 MOZ_ARG_DISABLE_BOOL(ogg,
5351 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5352     MOZ_OGG=,
5353     MOZ_OGG=1)
5355 if test -n "$MOZ_OGG"; then
5356     AC_DEFINE(MOZ_OGG)
5357     MOZ_SYDNEYAUDIO=1
5358     MOZ_CUBEB=1
5359     MOZ_MEDIA=1
5361     dnl Checks for __attribute__(aligned()) directive
5362     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5363         [ac_cv_c_attribute_aligned],
5364         [ac_cv_c_attribute_aligned=0
5365          CFLAGS_save="${CFLAGS}"
5366          CFLAGS="${CFLAGS} -Werror"
5367          for ac_cv_c_attr_align_try in 64 32 16 8; do
5368            echo "trying $ac_cv_c_attr_align_try"
5369            AC_TRY_COMPILE([],
5370                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5371                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5372            if test "$ac_cv_c_attribute_aligned" != 0; then
5373              break;
5374            fi
5375          done
5376            CFLAGS="${CFLAGS_save}"])
5377     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5378       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5379                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5380     fi
5383 dnl ========================================================
5384 dnl = Disable Opus audio codec support
5385 dnl ========================================================
5386 MOZ_ARG_DISABLE_BOOL(opus,
5387 [  --disable-opus          Disable support for Opus audio],
5388     MOZ_OPUS=,
5389     MOZ_OPUS=1)
5391 dnl ========================================================
5392 dnl = Disable VP8 decoder support
5393 dnl ========================================================
5394 MOZ_ARG_DISABLE_BOOL(webm,
5395 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5396     MOZ_WEBM=,
5397     MOZ_WEBM=1)
5399 if test -n "$MOZ_WEBM"; then
5400     AC_DEFINE(MOZ_WEBM)
5401     MOZ_VP8=1
5404 dnl ========================================================
5405 dnl = Disable DASH-WebM support
5406 dnl ========================================================
5407 MOZ_ARG_DISABLE_BOOL(dash,
5408 [  --disable-dash          Disable support for DASH-WebM],
5409     MOZ_DASH=,
5410     MOZ_DASH=1)
5412 if test -n "$MOZ_DASH"; then
5413     if test -n "$MOZ_WEBM"; then
5414         AC_DEFINE(MOZ_DASH)
5415     else
5416         dnl Fail if WebM is not enabled as well as DASH.
5417         AC_MSG_ERROR([WebM is currently disabled and must be enabled for DASH
5418                      to work.])
5419     fi
5422 dnl ========================================================
5423 dnl = Enable media plugin support
5424 dnl ========================================================
5425 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5426   dnl Enable support on android by default
5427   MOZ_MEDIA_PLUGINS=1
5430 MOZ_ARG_ENABLE_BOOL(media-plugins,
5431 [  --enable-media-plugins  Enable support for media plugins],
5432     MOZ_MEDIA_PLUGINS=1,
5433     MOZ_MEDIA_PLUGINS=)
5435 if test -n "$MOZ_MEDIA_PLUGINS"; then
5436   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5439 dnl ========================================================
5440 dnl = Enable getUserMedia support
5441 dnl ========================================================
5442 MOZ_ARG_ENABLE_BOOL(media-navigator,
5443 [  --enable-media-navigator  Enable support for getUserMedia],
5444     MOZ_MEDIA_NAVIGATOR=1,
5445     MOZ_MEDIA_NAVIGATOR=)
5447 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5448   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5451 dnl ========================================================
5452 dnl = Enable building OMX media plugin (B2G or Android)
5453 dnl ========================================================
5454 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5455   dnl Enable support on android by default
5456   MOZ_OMX_PLUGIN=1
5459 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5460 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5461     MOZ_OMX_PLUGIN=1,
5462     MOZ_OMX_PLUGIN=)
5464 if test -n "$MOZ_OMX_PLUGIN"; then
5465     if test "$OS_TARGET" = "Android"; then
5466         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5467         AC_DEFINE(MOZ_OMX_PLUGIN)
5468     else
5469        dnl fail if we're not building on Gonk or Android
5470        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5471     fi
5474 dnl system libvpx Support
5475 dnl ========================================================
5476 MOZ_ARG_WITH_BOOL(system-libvpx,
5477 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5478     MOZ_NATIVE_LIBVPX=1)
5480 MOZ_LIBVPX_CFLAGS=
5481 MOZ_LIBVPX_LIBS=
5483 if test -n "$MOZ_VP8"; then
5484     AC_DEFINE(MOZ_VP8)
5485     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5486         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5487     fi
5488     if test -n "$MOZ_VP8_ENCODER" ; then
5489         AC_DEFINE(MOZ_VP8_ENCODER)
5490     fi
5492     if test -n "$MOZ_NATIVE_LIBVPX"; then
5493         dnl ============================
5494         dnl === libvpx Version check ===
5495         dnl ============================
5496         dnl Check to see if we have a system libvpx package.
5497         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5499         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5500          [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.])])
5502         _SAVE_LIBS=$LIBS
5503         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5504          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5505         LIBS=$_SAVE_LIBS
5506     fi
5509 AC_SUBST(MOZ_NATIVE_LIBVPX)
5510 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5511 AC_SUBST(MOZ_LIBVPX_LIBS)
5513 if test "$MOZ_WEBM"; then
5514     MOZ_SYDNEYAUDIO=1
5515     MOZ_CUBEB=1
5516     MOZ_MEDIA=1
5517     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5518         MOZ_VORBIS=1
5519     else
5520         MOZ_TREMOR=1
5521     fi
5524 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5526     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5527     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5528     dnl We currently require gcc on all arm platforms.
5529     VPX_AS=$YASM
5530     VPX_ASM_SUFFIX=asm
5531     VPX_NEED_OBJ_INT_EXTRACT=
5533     dnl See if we have assembly on this platform.
5534     case "$OS_ARCH:$CPU_ARCH" in
5535     Darwin:x86)
5536       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5537       VPX_X86_ASM=1
5538     ;;
5539     Darwin:x86_64)
5540       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5541       VPX_X86_ASM=1
5542     ;;
5543     WINNT:x86_64)
5544       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5545       VPX_X86_ASM=1
5546     ;;
5547     WINNT:x86)
5548       dnl Check for yasm 1.1 or greater.
5549       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5550         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.])
5551       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5552         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.])
5553       else
5554         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5555         VPX_X86_ASM=1
5556         dnl The encoder needs obj_int_extract to get asm offsets.
5557       fi
5558     ;;
5559     *:arm*)
5560       if test -n "$GNU_AS" ; then
5561         VPX_AS=$AS
5562         dnl These flags are a lie; they're just used to enable the requisite
5563         dnl opcodes; actual arch detection is done at runtime.
5564         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5565         VPX_DASH_C_FLAG="-c"
5566         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5567         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5568         VPX_ARM_ASM=1
5569       fi
5570     ;;
5571     *:x86)
5572       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5573         VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5574         VPX_X86_ASM=1
5575       fi
5576     ;;
5577     *:x86_64)
5578       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5579         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5580         VPX_X86_ASM=1
5581       fi
5582     ;;
5583     esac
5585     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5586       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.])
5587     fi
5589     if test -n "$MOZ_VP8_ENCODER" -a \
5590             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5591       dnl We prefer to get asm offsets using inline assembler, which the above
5592       dnl compilers can do. When we're not using one of those, we have to fall
5593       dnl back to obj_int_extract, which reads them from a compiled object
5594       dnl file. Unfortunately, that only works if we're compiling on a system
5595       dnl with the header files for the appropriate object file format.
5596       VPX_NEED_OBJ_INT_EXTRACT=1
5597     fi
5599     if test -n "$VPX_X86_ASM"; then
5600       AC_DEFINE(VPX_X86_ASM)
5601     elif test -n "$VPX_ARM_ASM"; then
5602       AC_DEFINE(VPX_ARM_ASM)
5603     else
5604       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5605     fi
5608 dnl ========================================================
5609 dnl = Disable Wave decoder support
5610 dnl ========================================================
5611 MOZ_ARG_DISABLE_BOOL(wave,
5612 [  --disable-wave          Disable Wave decoder support],
5613     MOZ_WAVE=,
5614     MOZ_WAVE=1)
5616 if test -n "$MOZ_WAVE"; then
5617     AC_DEFINE(MOZ_WAVE)
5618     MOZ_SYDNEYAUDIO=1
5619     MOZ_CUBEB=1
5620     MOZ_MEDIA=1
5623 dnl ========================================================
5624 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5625 dnl ========================================================
5627 if test -n "$MOZ_SYDNEYAUDIO"; then
5628     AC_DEFINE(MOZ_SYDNEYAUDIO)
5631 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5632     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5635 if test -n "$MOZ_SOUNDTOUCH"; then
5636     AC_DEFINE(MOZ_SOUNDTOUCH)
5639 if test -n "$MOZ_CUBEB"; then
5640     case "$target" in
5641     *-android*|*-linuxandroid*)
5642         if test -n "$gonkdir"; then
5643             AC_DEFINE(MOZ_CUBEB)
5644         fi
5645         dnl No Android implementation of libcubeb yet.
5646         ;;
5647     *-linux*)
5648         AC_DEFINE(MOZ_CUBEB)
5649         ;;
5650     *-mingw*)
5651         AC_DEFINE(MOZ_CUBEB)
5652         ;;
5653     *-darwin*)
5654         AC_DEFINE(MOZ_CUBEB)
5655         ;;
5656     *-openbsd*)
5657         AC_DEFINE(MOZ_CUBEB)
5658         ;;
5659     *)
5660         dnl Other targets will be enabled soon.
5661         ;;
5662     esac
5665 if test -n "$MOZ_MEDIA"; then
5666     AC_DEFINE(MOZ_MEDIA)
5669 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5670     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/])
5673 if test -n "$MOZ_VORBIS"; then
5674     AC_DEFINE(MOZ_VORBIS)
5677 if test -n "$MOZ_TREMOR"; then
5678     AC_DEFINE(MOZ_TREMOR)
5681 if test -n "$MOZ_OPUS"; then
5682     AC_DEFINE(MOZ_OPUS)
5685 dnl ========================================================
5686 dnl = Check alsa availability on Linux if using sydneyaudio
5687 dnl ========================================================
5689 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5690 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5691     MOZ_ALSA=1
5694 MOZ_ARG_ENABLE_BOOL(alsa,
5695 [  --enable-alsa          Enable Alsa support (default on Linux)],
5696 MOZ_ALSA=1,
5697 MOZ_ALSA=)
5699 if test -n "$MOZ_ALSA"; then
5700     AC_DEFINE(MOZ_CUBEB)
5701     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5702          [echo "$MOZ_ALSA_PKG_ERRORS"
5703           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.)])])
5706 AC_SUBST(MOZ_ALSA)
5707 AC_SUBST(MOZ_ALSA_CFLAGS)
5708 AC_SUBST(MOZ_ALSA_LIBS)
5710 dnl ========================================================
5711 dnl = Enable PulseAudio
5712 dnl ========================================================
5714 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5715 [  --enable-pulseaudio          Enable PulseAudio support (experimental)],
5716 MOZ_PULSEAUDIO=1,
5717 MOZ_PULSEAUDIO=)
5719 if test -n "$MOZ_PULSEAUDIO"; then
5720     AC_DEFINE(MOZ_CUBEB)
5721     PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5722          [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5723           AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
5726 AC_SUBST(MOZ_PULSEAUDIO)
5727 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5728 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5730 dnl ========================================================
5731 dnl = Enable GStreamer
5732 dnl ========================================================
5733 MOZ_ARG_ENABLE_BOOL(gstreamer,
5734 [  --enable-gstreamer           Enable GStreamer support],
5735 MOZ_GSTREAMER=1,
5736 MOZ_GSTREAMER=)
5738 if test "$MOZ_GSTREAMER"; then
5739     # API version, eg 0.10, 1.0 etc
5740     GST_API_VERSION=0.10
5741     # core/base release number
5742     # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5743     # introduced
5744     GST_VERSION=0.10.33
5745     PKG_CHECK_MODULES(GSTREAMER,
5746                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5747                       gstreamer-app-$GST_API_VERSION
5748                       gstreamer-plugins-base-$GST_API_VERSION)
5749     if test -n "$GSTREAMER_LIBS"; then
5750        _SAVE_LDFLAGS=$LDFLAGS
5751        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5752        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5753        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5754           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5755        else
5756           AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5757        fi
5758        LDFLAGS=$_SAVE_LDFLAGS
5759     else
5760        AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5761     fi
5763 AC_SUBST(GSTREAMER_CFLAGS)
5764 AC_SUBST(GSTREAMER_LIBS)
5765 AC_SUBST(MOZ_GSTREAMER)
5767 if test -n "$MOZ_GSTREAMER"; then
5768    AC_DEFINE(MOZ_GSTREAMER)
5769    MOZ_MEDIA=1
5773 dnl ========================================================
5774 dnl Permissions System
5775 dnl ========================================================
5776 MOZ_ARG_DISABLE_BOOL(permissions,
5777 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5778     MOZ_PERMISSIONS=,
5779     MOZ_PERMISSIONS=1
5782 dnl ========================================================
5783 dnl NegotiateAuth
5784 dnl ========================================================
5785 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5786 [  --disable-negotiateauth Disable GSS-API negotiation ],
5787     MOZ_AUTH_EXTENSION=,
5788     MOZ_AUTH_EXTENSION=1 )
5790 dnl ========================================================
5791 dnl Pref extensions (autoconfig)
5792 dnl ========================================================
5793 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5794 [  --disable-pref-extensions
5795                           Disable pref extensions such as autoconfig],
5796   MOZ_PREF_EXTENSIONS=,
5797   MOZ_PREF_EXTENSIONS=1 )
5799 dnl ========================================================
5800 dnl Searching of system directories for extensions.
5801 dnl Note: this switch is meant to be used for test builds
5802 dnl whose behavior should not depend on what happens to be
5803 dnl installed on the local machine.
5804 dnl ========================================================
5805 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5806 [  --disable-system-extension-dirs
5807                           Disable searching system- and account-global
5808                           directories for extensions of any kind; use
5809                           only profile-specific extension directories],
5810   ENABLE_SYSTEM_EXTENSION_DIRS=,
5811   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5812 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5813   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5816 dnl ========================================================
5817 dnl = Universalchardet
5818 dnl ========================================================
5819 MOZ_ARG_DISABLE_BOOL(universalchardet,
5820 [  --disable-universalchardet
5821                           Disable universal encoding detection],
5822   MOZ_UNIVERSALCHARDET=,
5823   MOZ_UNIVERSALCHARDET=1 )
5825 if test -n "${JAVA_BIN_PATH}"; then
5826   dnl Look for javac and jar in the specified path.
5827   JAVA_PATH="$JAVA_BIN_PATH"
5828 else
5829   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5830   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5833 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5834 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5835 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5837 if test -n "${JAVA_BIN_PATH}" -o \
5838   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5839   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5840     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}])
5841   fi
5844 dnl ========================================================
5845 dnl = ANGLE OpenGL->D3D translator for WebGL
5846 dnl = * only applies to win32
5847 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5848 dnl ========================================================
5849 MOZ_ANGLE_RENDERER=
5850 MOZ_DIRECTX_SDK_PATH=
5851 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5852 MOZ_D3DX9_VERSION=
5853 MOZ_D3DX9_CAB=
5854 MOZ_D3DCOMPILER_CAB=
5855 MOZ_D3DX9_DLL=
5856 MOZ_D3DCOMPILER_DLL=
5857 case "$target_os" in
5858 *mingw*)
5859     MOZ_ANGLE_RENDERER=1
5860     ;;
5861 esac
5863 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5864 case "${target_cpu}" in
5865 i*86)
5866   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5867   ;;
5868 x86_64)
5869   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5870   ;;
5871 esac
5873 MOZ_ARG_DISABLE_BOOL(webgl,
5874 [  --disable-webgl     Disable building of the WebGL implementation],
5875     MOZ_WEBGL_DISABLED=1,
5876     MOZ_WEBGL_DISABLED=)
5878 if test -n "$MOZ_WEBGL_DISABLED"; then
5879   MOZ_WEBGL=
5880   MOZ_ANGLE_RENDERER=
5883 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5884   # Get the SDK path from the registry.
5885   # First try to get the June 2010 SDK
5886   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5887   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5888     # Otherwise just take whatever comes first
5889     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5890   fi
5892   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5893     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.])
5894   else
5895     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'`
5896   fi
5898   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5899      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5900          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5901     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5902   else
5903     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.])
5904   fi
5906   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5907   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'`
5909   if test -z "$MOZ_D3DX9_VERSION" ; then
5910         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.])
5911   fi
5913   MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5914   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5916   if test -z "$MOZ_D3DX9_CAB" -o -z "$MOZ_D3DCOMPILER_CAB"; then
5917     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.])
5918   fi
5920   MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5921   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5924 dnl ========================================================
5925 dnl = Breakpad crash reporting (on by default on supported platforms)
5926 dnl ========================================================
5928 case $target in
5929 i?86-*-mingw*|x86_64-*-mingw*)
5930   MOZ_CRASHREPORTER=1
5931   ;;
5932 i?86-apple-darwin*|x86_64-apple-darwin*)
5933   MOZ_CRASHREPORTER=1
5934   ;;
5935 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5936   if test "$MOZ_ENABLE_GTK2"; then
5937     MOZ_CRASHREPORTER=1
5938   fi
5939   ;;
5940 *-android*|*-linuxandroid*)
5941   MOZ_CRASHREPORTER=1
5942   ;;
5943 *solaris*)
5944   MOZ_CRASHREPORTER=1
5945   ;;
5946 esac
5948 MOZ_ARG_DISABLE_BOOL(crashreporter,
5949 [  --disable-crashreporter Disable breakpad crash reporting],
5950     MOZ_CRASHREPORTER=,
5951     MOZ_CRASHREPORTER=1)
5953 if test -n "$MOZ_CRASHREPORTER"; then
5954    AC_DEFINE(MOZ_CRASHREPORTER)
5956   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5957     test -z "$SKIP_LIBRARY_CHECKS"; then
5958     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5959     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5960     AC_SUBST(MOZ_GTHREAD_LIBS)
5962     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.])])
5963   fi
5965   if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
5966     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
5967   fi
5969   if test "$OS_ARCH" = "WINNT" -a -z "$HAVE_64BIT_OS"; then
5970     MOZ_CRASHREPORTER_INJECTOR=1
5971     AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5972   fi
5975 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5976 [  --with-crashreporter-enable-percent=NN
5977                           Enable sending crash reports by default on NN% of users. (default=100)],
5978 [ val=`echo $withval | sed 's/[^0-9]//g'`
5979     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5981 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5982    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5984 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5986 dnl ========================================================
5987 dnl = libjpeg-turbo configuration
5988 dnl ========================================================
5989 MOZ_LIBJPEG_TURBO=
5990 if test -z "$MOZ_NATIVE_JPEG"; then
5991     MOZ_LIBJPEG_TURBO=1
5994 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5995 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
5996     MOZ_LIBJPEG_TURBO=,
5997     MOZ_LIBJPEG_TURBO=1)
5999 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6000     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6003 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6004 dnl files.
6006 if test -n "$MOZ_LIBJPEG_TURBO"; then
6008   dnl Do we support libjpeg-turbo on this platform?
6009   case "$OS_ARCH:$OS_TEST" in
6010   Darwin:i?86)
6011     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6012     LIBJPEG_TURBO_X86_ASM=1
6013   ;;
6014   Darwin:x86_64)
6015     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6016     LIBJPEG_TURBO_X64_ASM=1
6017   ;;
6018   WINNT:x86|WINNT:i?86)
6019     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6020     LIBJPEG_TURBO_X86_ASM=1
6021   ;;
6022   WINNT:x86_64)
6023     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6024     LIBJPEG_TURBO_X64_ASM=1
6025   ;;
6026   *:arm*)
6027     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6028     LIBJPEG_TURBO_ARM_ASM=1
6029   ;;
6030   *:x86|*:i?86)
6031     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6032       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6033       LIBJPEG_TURBO_X86_ASM=1
6034     fi
6035   ;;
6036   *:x86_64)
6037     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6038       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6039       LIBJPEG_TURBO_X64_ASM=1
6040     fi
6041   ;;
6042   esac
6046 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6047 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6048 dnl it doesn't exist or we have too old of a version.
6049 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6050     AC_MSG_CHECKING([for Yasm assembler])
6051     AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6053     if test -z "$LIBJPEG_TURBO_AS" ; then
6054         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.])
6055     fi
6057     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6058     dnl on Linux and 1.1 or newer everywhere else.
6059     if test "$OS_ARCH" = "Linux" ; then
6060         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
6061             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.])
6062         fi
6063     else
6064         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6065             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.])
6066         fi
6067     fi
6070 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6071 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6072 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6073     echo "Using $AS as the assembler for ARM code."
6074     LIBJPEG_TURBO_AS=$AS
6077 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6078     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6079 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6080     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6081 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6082     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6083 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6084     dnl Warn if we're not building the optimized routines, even though the user
6085     dnl didn't specify --disable-libjpeg-turbo.
6086     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6089 dnl ========================================================
6090 dnl = Enable compilation of specific extension modules
6091 dnl ========================================================
6093 MOZ_ARG_ENABLE_STRING(extensions,
6094 [  --enable-extensions     Enable extensions],
6095 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6096     if test "$option" = "yes" -o "$option" = "all"; then
6097         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6098     elif test "$option" = "no" -o "$option" = "none"; then
6099         MOZ_EXTENSIONS=""
6100     elif test "$option" = "default"; then
6101         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6102     elif test `echo "$option" | grep -c \^-` != 0; then
6103         option=`echo $option | sed 's/^-//'`
6104         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6105     else
6106         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6107     fi
6108 done],
6109     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6111 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6112     # Suppress warning on non-X11 platforms
6113     if test -n "$MOZ_X11"; then
6114         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6115     fi
6116     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6119 dnl Do not build gnomevfs with libxul based apps
6120 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6121     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6124 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6125     # Suppress warning on non-X11 platforms
6126     if test -n "$MOZ_X11"; then
6127         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6128     fi
6129     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6132 dnl Do not build gio with libxul based apps
6133 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6134     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6137 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6138     MOZ_GIO_COMPONENT=1
6139     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6141 AC_SUBST(MOZ_GIO_COMPONENT)
6143 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6144     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6145     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6148 dnl Remove dupes
6149 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6151 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6152 dnl when trying to build a nonexistent extension.
6153 for extension in $MOZ_EXTENSIONS; do
6154     if test ! -d "${srcdir}/extensions/${extension}"; then
6155         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6156     fi
6157 done
6159 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6160   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6163 dnl ========================================================
6164 dnl CSS3 Flexbox Support
6165 dnl ========================================================
6166 if test -n "$MOZ_FLEXBOX"; then
6167   AC_DEFINE(MOZ_FLEXBOX)
6170 dnl ========================================================
6171 dnl Build Freetype in the tree
6172 dnl ========================================================
6173 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6174 [  --enable-tree-freetype  Enable Tree FreeType],
6175     MOZ_TREE_FREETYPE=1,
6176     MOZ_TREE_FREETYPE= )
6177 if test -n "$MOZ_TREE_FREETYPE"; then
6178    if test -n "$_WIN32_MSVC"; then
6179       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6180    fi
6181    AC_DEFINE(MOZ_TREE_FREETYPE)
6182    AC_SUBST(MOZ_TREE_FREETYPE)
6183    MOZ_ENABLE_CAIRO_FT=1
6184    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6185    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6186    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6187    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6188    CAIRO_FT_OSLIBS=''
6189    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6190    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6191    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6192    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6193    AC_SUBST(CAIRO_FT_CFLAGS)
6196 dnl ========================================================
6197 dnl Installer
6198 dnl ========================================================
6199 dnl Abort Windows build if the required major version and
6200 dnl minimum minor version of Unicode NSIS isn't in the path
6201 dnl (unless in case of cross compiling, for which Unicode
6202 dnl is not yet sufficient).
6203 if test "$OS_ARCH" = "WINNT"; then
6204     REQ_NSIS_MAJOR_VER=2
6205     MIN_NSIS_MINOR_VER=33
6206     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6207     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6208       AC_MSG_RESULT([yes])
6209       changequote(,)
6210       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6211       changequote([,])
6212       if test ! "$MAKENSISU_VER" = ""; then
6213           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6214           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6215       fi
6216       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6217       if test "$MAKENSISU_VER" = "" || \
6218          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6219               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6220           AC_MSG_RESULT([no])
6221           if test -z "$CROSS_COMPILE"; then
6222             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.])
6223           else
6224             MAKENSISU=
6225           fi
6226       fi
6227     elif test -z "$CROSS_COMPILE"; then
6228       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.])
6229     else
6230       MAKENSISU=
6231     fi
6234 dnl ========================================================
6235 dnl Web App Runtime
6236 dnl ========================================================
6237 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6238 [  --disable-webapp-runtime  Disable Web App Runtime],
6239     MOZ_WEBAPP_RUNTIME=,
6240     MOZ_WEBAPP_RUNTIME=1)
6241 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6242     MOZ_WEBAPP_RUNTIME=
6244 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6245     MOZ_WEBAPP_RUNTIME=
6247 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6248 if test "$MOZ_WEBAPP_RUNTIME"; then
6249     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6252 AC_MSG_CHECKING([for tar archiver])
6253 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6254 if test -z "$TAR"; then
6255     AC_MSG_ERROR([no tar archiver found in \$PATH])
6257 AC_MSG_RESULT([$TAR])
6258 AC_SUBST(TAR)
6260 AC_MSG_CHECKING([for wget])
6261 AC_CHECK_PROGS(WGET, wget, "")
6262 AC_MSG_RESULT([$WGET])
6263 AC_SUBST(WGET)
6265 dnl ========================================================
6266 dnl Signing
6267 dnl ========================================================
6269 if test -n "$MOZ_SIGN_CMD"; then
6270     AC_DEFINE(MOZ_SIGNING)
6273 dnl ========================================================
6274 dnl Maintenance Service
6275 dnl ========================================================
6277 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6278 [  --enable-maintenance-service       Enable building of maintenanceservice],
6279     MOZ_MAINTENANCE_SERVICE=1,
6280     MOZ_MAINTENANCE_SERVICE= )
6282 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6283   if test "$OS_ARCH" = "WINNT"; then
6284     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6285   else
6286     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6287   fi
6290 dnl ========================================================
6291 dnl Verify MAR signatures
6292 dnl ========================================================
6294 MOZ_ARG_ENABLE_BOOL(verify-mar,
6295 [  --enable-verify-mar     Enable verifying MAR signatures],
6296     MOZ_VERIFY_MAR_SIGNATURE=1,
6297     MOZ_VERIFY_MAR_SIGNATURE= )
6299 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6300   if test "$OS_ARCH" = "WINNT"; then
6301     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6302   else
6303     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6304   fi
6307 dnl ========================================================
6308 dnl Enable building the signmar program.
6309 dnl This option is much different than the --enable-verify-mar option.
6310 dnl --enable-verify-mar is for enabling the verification check on MAR
6311 dnl files in the updater.  The --enable-signmar option is for building
6312 dnl the signmar program.
6313 dnl ========================================================
6315 MOZ_ARG_ENABLE_BOOL(signmar,
6316 [  --enable-signmar     Enable building the signmar program],
6317     MOZ_ENABLE_SIGNMAR=1,
6318     MOZ_ENABLE_SIGNMAR= )
6320 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6321   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6324 dnl ========================================================
6325 dnl Updater
6326 dnl ========================================================
6328 MOZ_ARG_DISABLE_BOOL(updater,
6329 [  --disable-updater       Disable building of updater],
6330     MOZ_UPDATER=,
6331     MOZ_UPDATER=1 )
6333 if test -n "$MOZ_UPDATER"; then
6334     AC_DEFINE(MOZ_UPDATER)
6337 # tools/update-packaging is not checked out by default.
6338 MOZ_ARG_ENABLE_BOOL(update-packaging,
6339 [  --enable-update-packaging
6340                           Enable tools/update-packaging],
6341     MOZ_UPDATE_PACKAGING=1,
6342     MOZ_UPDATE_PACKAGING= )
6343 AC_SUBST(MOZ_UPDATE_PACKAGING)
6345 dnl ========================================================
6346 dnl build the tests by default
6347 dnl ========================================================
6348 MOZ_ARG_DISABLE_BOOL(tests,
6349 [  --disable-tests         Do not build test libraries & programs],
6350     ENABLE_TESTS=,
6351     ENABLE_TESTS=1 )
6353 dnl ========================================================
6354 dnl parental controls (for Windows Vista)
6355 dnl ========================================================
6356 MOZ_ARG_DISABLE_BOOL(parental-controls,
6357 [  --disable-parental-controls
6358                           Do not build parental controls],
6359    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6360    MOZ_DISABLE_PARENTAL_CONTROLS=)
6361 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6362     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6365 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6367 dnl ========================================================
6368 dnl = Disable DOMCrypto
6369 dnl ========================================================
6370 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6371     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6374 dnl ========================================================
6375 dnl =
6376 dnl = Module specific options
6377 dnl =
6378 dnl ========================================================
6379 MOZ_ARG_HEADER(Individual module options)
6381 dnl ========================================================
6382 dnl = Disable feed handling components
6383 dnl ========================================================
6384 MOZ_ARG_DISABLE_BOOL(feeds,
6385 [  --disable-feeds         Disable feed handling and processing components],
6386     MOZ_FEEDS=,
6387     MOZ_FEEDS=1 )
6388 if test -n "$MOZ_FEEDS"; then
6389     AC_DEFINE(MOZ_FEEDS)
6390 else
6391     if test "$MOZ_BUILD_APP" = "browser"; then
6392         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6393     fi
6396 dnl ========================================================
6397 dnl Check for sqlite
6398 dnl ========================================================
6400 MOZ_NATIVE_SQLITE=
6401 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6402 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6403 MOZ_NATIVE_SQLITE=1,
6404 MOZ_NATIVE_SQLITE= )
6406 if test -z "$MOZ_NATIVE_SQLITE"
6407 then
6408     SQLITE_CFLAGS=
6409     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6410 else
6411     dnl ============================
6412     dnl === SQLite Version check ===
6413     dnl ============================
6414     dnl Check to see if the system SQLite package is new enough.
6415     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6417     dnl ==================================
6418     dnl === SQLITE_SECURE_DELETE check ===
6419     dnl ==================================
6420     dnl Check to see if the system SQLite package is compiled with
6421     dnl SQLITE_SECURE_DELETE enabled.
6422     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6423     _SAVE_CFLAGS="$CFLAGS"
6424     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6425     _SAVE_LIBS="$LIBS"
6426     LIBS="$LIBS $SQLITE_LIBS"
6427     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6428         AC_TRY_RUN([
6429             #include "sqlite3.h"
6431             int main(int argc, char **argv){
6432               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6433             }],
6434             ac_cv_sqlite_secure_delete=yes,
6435             ac_cv_sqlite_secure_delete=no,
6436             ac_cv_sqlite_secure_delete=no
6437         )
6438     ])
6439     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6440     CFLAGS="$_SAVE_CFLAGS"
6441     LIBS="$_SAVE_LIBS"
6442     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6443         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6444     fi
6446     dnl ===============================
6447     dnl === SQLITE_THREADSAFE check ===
6448     dnl ===============================
6449     dnl Check to see if the system SQLite package is compiled with
6450     dnl SQLITE_THREADSAFE enabled.
6451     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6452     _SAVE_CFLAGS="$CFLAGS"
6453     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6454     _SAVE_LIBS="$LIBS"
6455     LIBS="$LIBS $SQLITE_LIBS"
6456     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6457         AC_TRY_RUN([
6458             #include "sqlite3.h"
6460             int main(int argc, char **argv){
6461               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6462             }],
6463             ac_cv_sqlite_threadsafe=yes,
6464             ac_cv_sqlite_threadsafe=no,
6465             ac_cv_sqlite_threadsafe=no
6466         )
6467     ])
6468     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6469     CFLAGS="$_SAVE_CFLAGS"
6470     LIBS="$_SAVE_LIBS"
6471     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6472         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6473     fi
6475     dnl ================================
6476     dnl === SQLITE_ENABLE_FTS3 check ===
6477     dnl ================================
6478     dnl check to see if the system SQLite package is compiled with
6479     dnl SQLITE_ENABLE_FTS3 enabled.
6480     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6481     _SAVE_CFLAGS="$CFLAGS"
6482     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6483     _SAVE_LIBS="$LIBS"
6484     LIBS="$LIBS $SQLITE_LIBS"
6485     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6486         AC_TRY_RUN([
6487             #include "sqlite3.h"
6489             int main(int argc, char **argv){
6490               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6491             }],
6492             ac_cv_sqlite_enable_fts3=yes,
6493             ac_cv_sqlite_enable_fts3=no,
6494             ac_cv_sqlite_enable_fts3=no
6495         )
6496     ])
6497     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6498     CFLAGS="$_SAVE_CFLAGS"
6499     LIBS="$_SAVE_LIBS"
6500     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6501         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6502     fi
6504     dnl =========================================
6505     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6506     dnl =========================================
6507     dnl check to see if the system SQLite package is compiled with
6508     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6509     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6510     _SAVE_CFLAGS="$CFLAGS"
6511     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6512     _SAVE_LIBS="$LIBS"
6513     LIBS="$LIBS $SQLITE_LIBS"
6514     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6515         AC_TRY_RUN([
6516             #include "sqlite3.h"
6518             int main(int argc, char **argv){
6519               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6520             }],
6521             ac_cv_sqlite_enable_unlock_notify=yes,
6522             ac_cv_sqlite_enable_unlock_notify=no,
6523             ac_cv_sqlite_enable_unlock_notify=no
6524         )
6525     ])
6526     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6527     CFLAGS="$_SAVE_CFLAGS"
6528     LIBS="$_SAVE_LIBS"
6529     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6530         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6531     fi
6534 if test -n "$MOZ_NATIVE_SQLITE"; then
6535     AC_DEFINE(MOZ_NATIVE_SQLITE)
6537 AC_SUBST(MOZ_NATIVE_SQLITE)
6539 dnl ========================================================
6540 dnl = Enable help viewer (off by default)
6541 dnl ========================================================
6542 if test -n "$MOZ_HELP_VIEWER"; then
6543      dnl Do this if defined in confvars.sh
6544      AC_DEFINE(MOZ_HELP_VIEWER)
6547 dnl ========================================================
6548 dnl = Enable safe browsing (anti-phishing)
6549 dnl ========================================================
6550 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6551 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6552     MOZ_SAFE_BROWSING=1,
6553     MOZ_SAFE_BROWSING= )
6554 if test -n "$MOZ_SAFE_BROWSING"; then
6555     AC_DEFINE(MOZ_SAFE_BROWSING)
6557 AC_SUBST(MOZ_SAFE_BROWSING)
6559 dnl ========================================================
6560 dnl = Enable url-classifier
6561 dnl ========================================================
6562 dnl Implicitly enabled by default if building with safe-browsing
6563 if test -n "$MOZ_SAFE_BROWSING"; then
6564     MOZ_URL_CLASSIFIER=1
6566 MOZ_ARG_ENABLE_BOOL(url-classifier,
6567 [  --enable-url-classifier Enable url classifier module],
6568     MOZ_URL_CLASSIFIER=1,
6569     MOZ_URL_CLASSIFIER= )
6570 if test -n "$MOZ_URL_CLASSIFIER"; then
6571     AC_DEFINE(MOZ_URL_CLASSIFIER)
6573 AC_SUBST(MOZ_URL_CLASSIFIER)
6575 dnl ========================================================
6576 dnl = Disable zipwriter
6577 dnl ========================================================
6578 MOZ_ARG_DISABLE_BOOL(zipwriter,
6579 [  --disable-zipwriter     Disable zipwriter component],
6580     MOZ_ZIPWRITER=,
6581     MOZ_ZIPWRITER=1 )
6582 AC_SUBST(MOZ_ZIPWRITER)
6584 dnl ========================================================
6585 dnl = libconic
6586 dnl ========================================================
6587 dnl superseded by QtNetwork starting from 4.7
6588 MOZ_ENABLE_LIBCONIC=1
6590 if test -n "$MOZ_ENABLE_QT"; then
6591   if test "$MOZ_ENABLE_QTNETWORK"; then
6592     MOZ_ENABLE_LIBCONIC=
6593   fi
6596 MOZ_ARG_DISABLE_BOOL(libconic,
6597 [  --disable-libconic      Disable libconic],
6598     MOZ_ENABLE_LIBCONIC=,
6599     MOZ_ENABLE_LIBCONIC=1 )
6601 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6602     PKG_CHECK_MODULES(LIBCONIC, conic,
6603                       MOZ_ENABLE_LIBCONIC=1,
6604                       MOZ_ENABLE_LIBCONIC=)
6606 if test "$MOZ_ENABLE_LIBCONIC"; then
6607     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6610 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6611 AC_SUBST(LIBCONIC_CFLAGS)
6612 AC_SUBST(LIBCONIC_LIBS)
6614 dnl ========================================================
6615 dnl = Maemo checks
6616 dnl ========================================================
6618 MAEMO_SDK_TARGET_VER=-1
6620 MOZ_ARG_WITH_STRING(maemo-version,
6621 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6622                           Maemo SDK Version],
6623   MAEMO_SDK_TARGET_VER=$withval)
6625 case "$MAEMO_SDK_TARGET_VER" in
6627     MOZ_PLATFORM_MAEMO=5
6628     ;;
6631     MOZ_PLATFORM_MAEMO=6
6632     ;;
6635     dnl We aren't compiling for Maemo, move on.
6636     ;;
6638     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6639     ;;
6640 esac
6642 if test $MOZ_PLATFORM_MAEMO; then
6643    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6645    if test -z "$MOZ_ENABLE_DBUS"; then
6646        AC_MSG_ERROR([DBus is required when building for Maemo])
6647    fi
6649    MOZ_GFX_OPTIMIZE_MOBILE=1
6650    MOZ_GL_DEFAULT_PROVIDER=EGL
6651    MOZ_MAEMO_LIBLOCATION=
6653    if test $MOZ_PLATFORM_MAEMO = 5; then
6654       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6655       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6656           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6657       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6658                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6660       AC_SUBST(XCOMPOSITE_LIBS)
6662       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6663       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6664       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6665       if test -z "$_LIB_FOUND"; then
6666          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6667       fi
6670       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6671       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6672       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6673       if test -z "$_LIB_FOUND"; then
6674          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6675       fi
6677       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6678       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6679       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6680       if test -z "$_LIB_FOUND"; then
6681          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6682       fi
6684    fi
6685    if test $MOZ_PLATFORM_MAEMO = 6; then
6687       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6688                         _LIB_FOUND=1,
6689                         _LIB_FOUND=)
6690       if test "$_LIB_FOUND"; then
6691          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6692          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6693          MOZ_ENABLE_CONTENTMANAGER=1
6694          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6695       else
6696          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6697       fi
6698       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6700       dnl ========================================================
6701       dnl = Enable meego libcontentaction
6702       dnl ========================================================
6703       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6704       [  --enable-meegocontentaction           Enable meegocontentaction support],
6705          MOZ_MEEGOCONTENTACTION=1,
6706          MOZ_MEEGOCONTENTACTION=)
6708       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6710          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6711          if test "$_LIB_FOUND"; then
6712             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6713             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6714             MOZ_ENABLE_CONTENTACTION=1
6715             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6716             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6717          fi
6718       fi
6720       MOZ_ARG_ENABLE_BOOL(meegotouch,
6721       [  --enable-meegotouch  Enable meegotouch support],
6722          MOZ_MEEGOTOUCHENABLED=1,
6723          MOZ_MEEGOTOUCHENABLED=)
6725       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6726           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6727           if test "$_LIB_FOUND"; then
6728               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6729               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6730               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6731           else
6732               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6733           fi
6734       fi
6735    fi
6737    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6738    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6739    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6740    if test "$_LIB_FOUND"; then
6741       MOZ_MAEMO_LIBLOCATION=1
6742       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6743    else
6744       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6745    fi
6746    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6748    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6749    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6750    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6751    if test "$_LIB_FOUND"; then
6752       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6753       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6754    else
6755       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6756    fi
6757    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6759    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6760    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6763 dnl ========================================================
6764 dnl GL provider
6765 dnl ========================================================
6766 MOZ_GL_PROVIDER=
6767 MOZ_ARG_WITH_STRING(gl-provider,
6768 [  --with-gl-provider=ID
6769                           Set GL provider backend type],
6770 [ val=`echo $withval`
6771     MOZ_GL_PROVIDER="$val"])
6773 if test -n "$MOZ_GL_PROVIDER"; then
6774 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6775 AC_SUBST(MOZ_GL_PROVIDER)
6776 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6778 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6779 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6781 dnl ========================================================
6782 dnl = faststripe theme
6783 dnl ========================================================
6784 MOZ_ARG_ENABLE_BOOL(faststripe,
6785 [  --enable-faststripe     Use faststripe theme],
6786     MOZ_THEME_FASTSTRIPE=1,
6787     MOZ_THEME_FASTSTRIPE= )
6788 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6790 dnl ========================================================
6791 dnl =
6792 dnl = Feature options that require extra sources to be pulled
6793 dnl =
6794 dnl ========================================================
6795 dnl MOZ_ARG_HEADER(Features that require extra sources)
6797 dnl ========================================================
6798 dnl =
6799 dnl = Debugging Options
6800 dnl =
6801 dnl ========================================================
6802 MOZ_ARG_HEADER(Debugging and Optimizations)
6804 dnl ========================================================
6805 dnl = Disable building with debug info.
6806 dnl = Debugging is OFF by default
6807 dnl ========================================================
6808 if test -z "$MOZ_DEBUG_FLAGS"; then
6809   MOZ_DEBUG_FLAGS="-g"
6812 MOZ_ARG_ENABLE_STRING(debug,
6813 [  --enable-debug[=DBG]    Enable building with developer debug info
6814                            (using compiler flags DBG)],
6815 [ if test "$enableval" != "no"; then
6816     MOZ_DEBUG=1
6817     if test -n "$enableval" -a "$enableval" != "yes"; then
6818         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6819         _MOZ_DEBUG_FLAGS_SET=1
6820     fi
6821   else
6822     MOZ_DEBUG=
6823   fi ],
6824   MOZ_DEBUG=)
6826 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6827 MOZ_ARG_WITH_STRING(debug-label,
6828 [  --with-debug-label=LABELS
6829                           Define DEBUG_<value> for each comma-separated
6830                           value given.],
6831 [ for option in `echo $withval | sed 's/,/ /g'`; do
6832     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6833 done])
6835 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6837 if test -n "$MOZ_DEBUG"; then
6838     AC_MSG_CHECKING([for valid debug flags])
6839     _SAVE_CFLAGS=$CFLAGS
6840     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6841     AC_TRY_COMPILE([#include <stdio.h>],
6842         [printf("Hello World\n");],
6843         _results=yes,
6844         _results=no)
6845     AC_MSG_RESULT([$_results])
6846     if test "$_results" = "no"; then
6847         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6848     fi
6849     CFLAGS=$_SAVE_CFLAGS
6852 dnl ========================================================
6853 dnl enable mobile optimizations
6854 dnl ========================================================
6855 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6856 [  --enable-mobile-optimize
6857                           Enable mobile optimizations],
6858     MOZ_GFX_OPTIMIZE_MOBILE=1)
6860 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6862 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6863     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6866 dnl ========================================================
6867 dnl = Enable code optimization. ON by default.
6868 dnl ========================================================
6869 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6870         MOZ_OPTIMIZE_FLAGS="-O"
6873 MOZ_ARG_ENABLE_STRING(optimize,
6874 [  --disable-optimize      Disable compiler optimization
6875   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6876 [ if test "$enableval" != "no"; then
6877     MOZ_OPTIMIZE=1
6878     if test -n "$enableval" -a "$enableval" != "yes"; then
6879         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6880         MOZ_OPTIMIZE=2
6881     fi
6882 else
6883     MOZ_OPTIMIZE=
6884 fi ], MOZ_OPTIMIZE=1)
6886 MOZ_SET_FRAMEPTR_FLAGS
6888 if test "$COMPILE_ENVIRONMENT"; then
6889 if test -n "$MOZ_OPTIMIZE"; then
6890     AC_MSG_CHECKING([for valid optimization flags])
6891     _SAVE_CFLAGS=$CFLAGS
6892     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6893     AC_TRY_COMPILE([#include <stdio.h>],
6894         [printf("Hello World\n");],
6895         _results=yes,
6896         _results=no)
6897     AC_MSG_RESULT([$_results])
6898     if test "$_results" = "no"; then
6899         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6900     fi
6901     CFLAGS=$_SAVE_CFLAGS
6903 fi # COMPILE_ENVIRONMENT
6905 AC_SUBST(MOZ_OPTIMIZE)
6906 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6907 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6908 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6909 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6910 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6911 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6913 dnl ========================================================
6914 dnl = Enable generation of debug symbols
6915 dnl ========================================================
6916 MOZ_ARG_ENABLE_STRING(debug-symbols,
6917 [  --enable-debug-symbols[=DBG]
6918                           Enable debugging symbols (using compiler flags DBG)],
6919 [ if test "$enableval" != "no"; then
6920       MOZ_DEBUG_SYMBOLS=1
6921       if test -n "$enableval" -a "$enableval" != "yes"; then
6922           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6923               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6924           else
6925               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6926           fi
6927       fi
6928   else
6929       MOZ_DEBUG_SYMBOLS=
6930   fi ],
6931   MOZ_DEBUG_SYMBOLS=1)
6933 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6934     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6935     export MOZ_DEBUG_SYMBOLS
6938 dnl ========================================================
6939 dnl = Enable any treating of compile warnings as errors
6940 dnl ========================================================
6941 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6942 [  --enable-warnings-as-errors
6943                           Enable treating of warnings as errors],
6944     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6945     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6946 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6947    WARNINGS_AS_ERRORS=''
6950 dnl ========================================================
6951 dnl = Disable runtime logging checks
6952 dnl ========================================================
6953 MOZ_ARG_DISABLE_BOOL(logging,
6954 [  --disable-logging       Disable logging facilities],
6955     NS_DISABLE_LOGGING=1,
6956     NS_DISABLE_LOGGING= )
6957 if test "$NS_DISABLE_LOGGING"; then
6958     AC_DEFINE(NS_DISABLE_LOGGING)
6959 else
6960     AC_DEFINE(MOZ_LOGGING)
6963 dnl ========================================================
6964 dnl = This will enable logging of addref, release, ctor, dtor.
6965 dnl ========================================================
6966 _ENABLE_LOGREFCNT=42
6967 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6968 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6969     _ENABLE_LOGREFCNT=1,
6970     _ENABLE_LOGREFCNT= )
6971 if test "$_ENABLE_LOGREFCNT" = "1"; then
6972     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6973 elif test -z "$_ENABLE_LOGREFCNT"; then
6974     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6977 dnl ========================================================
6978 dnl moz_dump_painting
6979 dnl ========================================================
6980 MOZ_ARG_ENABLE_BOOL(dump-painting,
6981 [  --enable-dump-painting          Enable paint debugging.],
6982     MOZ_DUMP_PAINTING=1,
6983     MOZ_DUMP_PAINTING= )
6984 if test -n "$MOZ_DUMP_PAINTING"; then
6985     AC_DEFINE(MOZ_DUMP_PAINTING)
6986     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6988 if test -n "$MOZ_DEBUG"; then
6989     AC_DEFINE(MOZ_DUMP_PAINTING)
6992 dnl ========================================================
6993 dnl = Enable trace malloc
6994 dnl ========================================================
6995 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6996 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6997 [  --enable-trace-malloc   Enable malloc tracing; also disables DMD and jemalloc],
6998     NS_TRACE_MALLOC=1,
6999     NS_TRACE_MALLOC= )
7000 if test "$NS_TRACE_MALLOC"; then
7001   # Please, Mr. Linker Man, don't take away our symbol names
7002   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7003   USE_ELF_DYNSTR_GC=
7004   AC_DEFINE(NS_TRACE_MALLOC)
7006 AC_SUBST(NS_TRACE_MALLOC)
7008 dnl ========================================================
7009 dnl = Enable DMD
7010 dnl ========================================================
7012 MOZ_ARG_ENABLE_BOOL(dmd,
7013 [  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc and disables DMDV],
7014     MOZ_DMD=1,
7015     MOZ_DMD= )
7017 if test "$NS_TRACE_MALLOC"; then        # trace-malloc disables DMD
7018     MOZ_DMD=
7020 if test "$MOZ_DMD"; then
7021     USE_ELF_DYNSTR_GC=
7022     AC_DEFINE(MOZ_DMD)
7024     if test "${CPU_ARCH}" = "arm"; then
7025         CFLAGS="$CFLAGS -funwind-tables"
7026         CXXFLAGS="$CXXFLAGS -funwind-tables"
7027     fi
7029     MOZ_MEMORY=1                        # DMD enables jemalloc
7030     MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
7031     MOZ_DMDV=                           # DMD disables DMDV
7033 AC_SUBST(MOZ_DMD)
7035 dnl ========================================================
7036 dnl = Enable jemalloc
7037 dnl ========================================================
7038 MOZ_ARG_ENABLE_BOOL(jemalloc,
7039 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7040     MOZ_MEMORY=1,
7041     MOZ_MEMORY=)
7043 if test "$NS_TRACE_MALLOC"; then
7044     MOZ_MEMORY=
7046 if test "$MOZ_DMDV"; then
7047     MOZ_MEMORY=
7050 if test "${OS_TARGET}" = "Android"; then
7051   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7052   :
7053 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7054   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7055   if test -z "$GNU_CC"; then
7056     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7057   else
7058     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7059   fi
7060 else
7061   dnl On other Unix systems, we only want to link executables against mozglue
7062   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7063   dnl On other Unix systems, where mozglue is a static library, jemalloc is
7064   dnl separated for the SDK, so we need to add it here.
7065   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
7066     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7067   fi
7068   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7069   if test -n "$GNU_CC"; then
7070     dnl And we need mozglue symbols to be exported.
7071     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7072   fi
7073   if test "$MOZ_LINKER" = 1; then
7074     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
7075   fi
7078 dnl ========================================================
7079 dnl = Enable dynamic replacement of malloc implementation
7080 dnl ========================================================
7081 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7082 [  --enable-replace-malloc   Enable ability to dynamically replace the malloc implementation],
7083     MOZ_REPLACE_MALLOC=1,
7084     MOZ_REPLACE_MALLOC= )
7086 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7087     dnl We don't want to enable jemalloc unconditionally because it may be a
7088     dnl deliberate choice not to enable it (bug 702250, for instance)
7089     AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7090 elif test -n "$MOZ_REPLACE_MALLOC"; then
7091     MOZ_NATIVE_JEMALLOC=
7093     dnl Replace-malloc Mac linkage quirks
7094     if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7095         AC_CACHE_CHECK([how to do weak dynamic linking],
7096             ac_cv_weak_dynamic_linking,
7097             [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7098              if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7099                 test -s conftest${DLL_SUFFIX}; then
7100                  dnl There are several ways the linker can put link edit rules in a binary:
7101                  dnl - classic info only (for OSX < 10.6)
7102                  dnl - dyld info only
7103                  dnl - both
7104                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7105                      _CLASSIC_INFO=
7106                  else
7107                      _CLASSIC_INFO=1
7108                  fi
7109                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7110                      _DYLD_INFO=1
7111                  else
7112                      _DYLD_INFO=
7113                  fi
7114                  dnl With classic info, we need to build with -flat_namespace.
7115                  dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7116                  dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7117                  dnl forgets to set the weak flag in the dyld info.
7118                  dnl See http://glandium.org/blog/?p=2764 for more details.
7119                  dnl
7120                  dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7121                  dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7122                  dnl - "flat namespace" when -flat_namespace alone is needed
7123                  dnl - "dummy library" when a dummy library and -flat_namespace are needed
7124                  dnl - "compiler support" when nothing is needed
7125                  if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7126                      if test -n "$_CLASSIC_INFO"; then
7127                          ac_cv_weak_dynamic_linking="flat namespace"
7128                      else
7129                          ac_cv_weak_dynamic_linking="compiler support"
7130                      fi
7131                  else
7132                      if test -n "$_DYLD_INFO"; then
7133                          ac_cv_weak_dynamic_linking="dummy library"
7134                      else
7135                          ac_cv_weak_dynamic_linking="flat namespace"
7136                      fi
7137                  fi
7138              else
7139                  AC_ERROR([couldn't compile a simple C file])
7140              fi
7141              rm -rf conftest*])
7142         MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7143     fi
7145 AC_SUBST(MOZ_REPLACE_MALLOC)
7146 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7148 dnl ========================================================
7149 dnl = Jemalloc build setup
7150 dnl ========================================================
7151 if test -z "$MOZ_MEMORY"; then
7152   if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7153     MOZ_NATIVE_JEMALLOC=1
7154     AC_CHECK_FUNCS(mallctl nallocm,,
7155       [MOZ_NATIVE_JEMALLOC=
7156        break])
7157     if test -n "$MOZ_NATIVE_JEMALLOC"; then
7158       MOZ_MEMORY=1
7159       AC_DEFINE(MOZ_MEMORY)
7160       AC_DEFINE(MOZ_JEMALLOC3)
7161       AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7162     fi
7163   fi
7164   case "${target}" in
7165     *-mingw*)
7166       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7167         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.])
7168       fi
7169       ;;
7170   esac
7171 else
7172   dnl Don't try to run compiler tests on Windows
7173   if test "$OS_ARCH" = "WINNT"; then
7174     if test -z "$HAVE_64BIT_OS"; then
7175       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7176     else
7177       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7178     fi
7179   else
7180     AC_CHECK_SIZEOF([int *], [4])
7181     case "${ac_cv_sizeof_int_p}" in
7182     4)
7183       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7184       ;;
7185     8)
7186       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7187       ;;
7188     *)
7189       AC_MSG_ERROR([Unexpected pointer size])
7190       ;;
7191     esac
7192   fi
7194   AC_DEFINE(MOZ_MEMORY)
7195   if test -n "$MOZ_JEMALLOC3"; then
7196     AC_DEFINE(MOZ_JEMALLOC3)
7197   fi
7198   if test "x$MOZ_DEBUG" = "x1"; then
7199     AC_DEFINE(MOZ_MEMORY_DEBUG)
7200   fi
7201   dnl The generic feature tests that determine how to compute ncpus are long and
7202   dnl complicated.  Therefore, simply define special cpp variables for the
7203   dnl platforms we have special knowledge of.
7204   case "${target}" in
7205   *-darwin*)
7206     AC_DEFINE(MOZ_MEMORY_DARWIN)
7207     ;;
7208   *-*freebsd*)
7209     AC_DEFINE(MOZ_MEMORY_BSD)
7210     ;;
7211   *-android*|*-linuxandroid*)
7212     AC_DEFINE(MOZ_MEMORY_LINUX)
7213     AC_DEFINE(MOZ_MEMORY_ANDROID)
7214     if test -z "$gonkdir"; then
7215       _WRAP_MALLOC=1
7216     else
7217       AC_DEFINE(MOZ_MEMORY_GONK)
7218     fi
7219     MOZ_GLUE_LDFLAGS=
7220     ;;
7221   *-*linux*)
7222     AC_DEFINE(MOZ_MEMORY_LINUX)
7223     ;;
7224   *-netbsd*)
7225     AC_DEFINE(MOZ_MEMORY_BSD)
7226     ;;
7227   *-solaris*)
7228     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7229     ;;
7230   *-mingw*)
7231     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7232     if test -z "$MOZ_DEBUG"; then
7233       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7234     else
7235       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7236     fi
7237     dnl Look for a broken crtdll.obj
7238     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7239     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7240     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7241       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7242       dnl Also pass this to NSPR/NSS
7243       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7244     else
7245       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7246     fi
7247     rm crtdll.obj
7249     export DLLFLAGS
7250     ;;
7251   *)
7252     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7253     ;;
7254   esac
7255 fi # MOZ_MEMORY
7256 AC_SUBST(MOZ_MEMORY)
7257 AC_SUBST(MOZ_JEMALLOC3)
7258 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7259 AC_SUBST(MOZ_GLUE_LDFLAGS)
7260 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7261 AC_SUBST(WIN32_CRT_LIBS)
7262 dnl Need to set this for make because NSS doesn't have configure
7263 AC_SUBST(DLLFLAGS)
7265 dnl We need to wrap dlopen and related functions on Android because we use
7266 dnl our own linker.
7267 if test "$OS_TARGET" = Android; then
7268     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7269     if test -n "$MOZ_OLD_LINKER"; then
7270         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7271     fi
7272     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7273     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7274     if test -z "$gonkdir"; then
7275         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7276     fi
7279 dnl ========================================================
7280 dnl = Use malloc wrapper lib
7281 dnl ========================================================
7282 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7283 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7284     _WRAP_MALLOC=1,
7285     _WRAP_MALLOC= )
7287 if test -n "$_WRAP_MALLOC"; then
7288     if test -n "$GNU_CC"; then
7289         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7290         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7291         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7292         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7293         dnl Wrap operator new and operator delete on Android.
7294         if test "$OS_TARGET" = "Android"; then
7295             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7296             dnl Wrap the nothrow variants too.
7297             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7298         fi
7299     else
7300         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7301     fi
7304 dnl ========================================================
7305 dnl = Location of malloc wrapper lib
7306 dnl ========================================================
7307 MOZ_ARG_WITH_STRING(wrap-malloc,
7308 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7309     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7311 dnl ========================================================
7312 dnl = Use JS Call tracing
7313 dnl ========================================================
7314 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7315 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7316     MOZ_TRACE_JSCALLS=1,
7317     MOZ_TRACE_JSCALLS= )
7318 if test -n "$MOZ_TRACE_JSCALLS"; then
7319     AC_DEFINE(MOZ_TRACE_JSCALLS)
7322 dnl ========================================================
7323 dnl = Use incremental GC
7324 dnl ========================================================
7325 JSGC_INCREMENTAL=1
7326 MOZ_ARG_DISABLE_BOOL(gcincremental,
7327 [  --disable-gcincremental Disable incremental GC],
7328     JSGC_INCREMENTAL= )
7329 if test -n "$JSGC_INCREMENTAL"; then
7330     AC_DEFINE(JSGC_INCREMENTAL)
7333 dnl ========================================================
7334 dnl ETW - Event Tracing for Windows
7335 dnl ========================================================
7336 MOZ_ARG_ENABLE_BOOL(ETW,
7337 [  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting],
7338     MOZ_ETW=1,
7339     MOZ_ETW= )
7340 if test -n "$MOZ_ETW"; then
7341     AC_DEFINE(MOZ_ETW)
7344 if test -n "$MOZ_ETW"; then
7345     if test -z "$MOZ_WINSDK_TARGETVER"; then
7346         AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7347     fi
7350 dnl ========================================================
7351 dnl Zealous JavaScript GC
7352 dnl ========================================================
7353 MOZ_ARG_ENABLE_BOOL(gczeal,
7354 [  --enable-gczeal         Enable zealous JavaScript GCing],
7355     JS_GC_ZEAL=1,
7356     JS_GC_ZEAL= )
7357 if test -n "$JS_GC_ZEAL"; then
7358     AC_DEFINE(JS_GC_ZEAL)
7361 dnl ========================================================
7362 dnl JS opt-mode assertions and minidump instrumentation
7363 dnl ========================================================
7364 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7365 [  --enable-js-diagnostics
7366                           Enable JS diagnostic assertions and breakpad data],
7367     JS_CRASH_DIAGNOSTICS=1,
7368     JS_CRASH_DIAGNOSTICS= )
7369 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7370     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7373 MOZ_CHECK_CCACHE
7375 dnl ========================================================
7376 dnl = Enable static checking using gcc-dehydra
7377 dnl ========================================================
7379 MOZ_ARG_WITH_STRING(static-checking,
7380 [  --with-static-checking=path/to/gcc_dehydra.so
7381                           Enable static checking of code using GCC-dehydra],
7382     DEHYDRA_PATH=$withval,
7383     DEHYDRA_PATH= )
7385 if test -n "$DEHYDRA_PATH"; then
7386     if test ! -f "$DEHYDRA_PATH"; then
7387         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7388     fi
7389     AC_DEFINE(NS_STATIC_CHECKING)
7391 AC_SUBST(DEHYDRA_PATH)
7393 dnl ========================================================
7394 dnl = Enable stripping of libs & executables
7395 dnl ========================================================
7396 MOZ_ARG_ENABLE_BOOL(strip,
7397 [  --enable-strip          Enable stripping of libs & executables ],
7398     ENABLE_STRIP=1,
7399     ENABLE_STRIP= )
7401 dnl ========================================================
7402 dnl = Enable stripping of libs & executables when packaging
7403 dnl ========================================================
7404 MOZ_ARG_ENABLE_BOOL(install-strip,
7405 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7406     PKG_SKIP_STRIP= ,
7407     PKG_SKIP_STRIP=1)
7409 dnl ========================================================
7410 dnl = --enable-elf-dynstr-gc
7411 dnl ========================================================
7412 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7413 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7414     USE_ELF_DYNSTR_GC=1,
7415     USE_ELF_DYNSTR_GC= )
7417 dnl ========================================================
7418 dnl = --disable-elf-hack
7419 dnl ========================================================
7421 USE_ELF_HACK=1
7422 MOZ_ARG_DISABLE_BOOL(elf-hack,
7423 [  --disable-elf-hack      Disable elf hacks],
7424     USE_ELF_HACK=,
7425     USE_ELF_HACK=1)
7427 # Disable elf hack for profiling because the built in profiler
7428 # doesn't read the segments properly with elf hack. This is
7429 # temporary and should be fixed soon in the profiler.
7430 if test "$MOZ_PROFILING" = 1; then
7431   USE_ELF_HACK=
7434 # Only enable elfhack where supported
7435 if test "$USE_ELF_HACK" = 1; then
7436     case "${HOST_OS_ARCH},${OS_ARCH}" in
7437     Linux,Linux)
7438         case "${CPU_ARCH}" in
7439         arm | x86 | x86_64)
7440             USE_ELF_HACK=1
7441             ;;
7442         *)
7443             USE_ELF_HACK=
7444             ;;
7445         esac
7446         ;;
7447     *)
7448         USE_ELF_HACK=
7449         ;;
7450     esac
7453 if test "$USE_ELF_HACK" = 1; then
7454     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7455     dnl memory addresses it maps to. The result is that by the time elfhack
7456     dnl kicks in, it is not possible to apply relocations because of that,
7457     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7458     dnl segment. It makes elfhack mostly useless, so considering the problems
7459     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7460     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7461     dnl the linker creates PT_GNU_RELRO segments.
7462     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7463         LINK_WITH_PT_GNU_RELRO,
7464         [echo "int main() {return 0;}" > conftest.${ac_ext}
7465          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7466             test -s conftest${ac_exeext}; then
7467             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7468                 LINK_WITH_PT_GNU_RELRO=yes
7469             else
7470                 LINK_WITH_PT_GNU_RELRO=no
7471             fi
7472          else
7473              dnl We really don't expect to get here, but just in case
7474              AC_ERROR([couldn't compile a simple C file])
7475          fi
7476          rm -rf conftest*])
7477     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7478         AC_MSG_WARN([Disabling elfhack])
7479         USE_ELF_HACK=
7480     fi
7483 dnl ========================================================
7484 dnl = libstdc++ compatibility hacks
7485 dnl ========================================================
7487 STDCXX_COMPAT=
7488 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7489 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7490     STDCXX_COMPAT=1)
7492 AC_SUBST(STDCXX_COMPAT)
7494 if test -n "$STDCXX_COMPAT"; then
7495    eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7496    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7497    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7500 dnl ========================================================
7501 dnl =
7502 dnl = Profiling and Instrumenting
7503 dnl =
7504 dnl ========================================================
7505 MOZ_ARG_HEADER(Profiling and Instrumenting)
7507 dnl ========================================================
7508 dnl = Enable runtime visual profiling logger
7509 dnl ========================================================
7510 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7511 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7512     MOZ_VISUAL_EVENT_TRACER=1,
7513     MOZ_VISUAL_EVENT_TRACER=)
7514 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7515     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7518 dnl ========================================================
7519 dnl Turn on reflow counting
7520 dnl ========================================================
7521 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7522 [  --enable-reflow-perf    Enable reflow performance tracing],
7523     MOZ_REFLOW_PERF=1,
7524     MOZ_REFLOW_PERF= )
7525 if test -n "$MOZ_REFLOW_PERF"; then
7526     AC_DEFINE(MOZ_REFLOW_PERF)
7529 dnl ========================================================
7530 dnl Enable code size metrics.
7531 dnl ========================================================
7532 MOZ_ARG_ENABLE_BOOL(codesighs,
7533 [  --enable-codesighs      Enable code size analysis tools],
7534     _ENABLE_CODESIGHS=1,
7535     _ENABLE_CODESIGHS= )
7536 if test -n "$_ENABLE_CODESIGHS"; then
7537     if test -d $srcdir/tools/codesighs; then
7538         MOZ_MAPINFO=1
7539     else
7540         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7541     fi
7544 dnl ========================================================
7545 dnl = Enable Radio Interface for B2G (Gonk usually)
7546 dnl ========================================================
7547 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7548 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7549     MOZ_B2G_RIL=1,
7550     MOZ_B2G_RIL= )
7551 if test -n "$MOZ_B2G_RIL"; then
7552     AC_DEFINE(MOZ_B2G_RIL)
7554 AC_SUBST(MOZ_B2G_RIL)
7556 dnl ========================================================
7557 dnl = Enable Radio FM for B2G (Gonk usually)
7558 dnl ========================================================
7559 if test -n "$MOZ_B2G_FM"; then
7560     AC_DEFINE(MOZ_B2G_FM)
7562 AC_SUBST(MOZ_B2G_FM)
7564 dnl ========================================================
7565 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7566 dnl ========================================================
7567 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7568 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7569     MOZ_B2G_BT=1,
7570     MOZ_B2G_BT= )
7571 if test -n "$MOZ_B2G_BT"; then
7572     AC_DEFINE(MOZ_B2G_BT)
7574 AC_SUBST(MOZ_B2G_BT)
7576 dnl ========================================================
7577 dnl = Enable Support for System Messages API
7578 dnl ========================================================
7579 if test -n "$MOZ_SYS_MSG"; then
7580     AC_DEFINE(MOZ_SYS_MSG)
7582 AC_SUBST(MOZ_SYS_MSG)
7584 dnl ========================================================
7585 dnl = Enable Support for Time Manager API
7586 dnl ========================================================
7587 if test -n "$MOZ_TIME_MANAGER"; then
7588     AC_DEFINE(MOZ_TIME_MANAGER)
7590 AC_SUBST(MOZ_TIME_MANAGER)
7592 dnl ========================================================
7593 dnl = Enable Camera Interface for B2G (Gonk usually)
7594 dnl ========================================================
7595 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7596 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7597     MOZ_B2G_CAMERA=1,
7598     MOZ_B2G_CAMERA= )
7599 if test -n "$MOZ_B2G_CAMERA"; then
7600    AC_DEFINE(MOZ_B2G_CAMERA)
7602 AC_SUBST(MOZ_B2G_CAMERA)
7604 dnl ========================================================
7605 dnl = Enable Support B2G-specific changes to the NSS
7606 dnl = certificate trust database.
7607 dnl ========================================================
7608 if test -n "$MOZ_B2G_CERTDATA"; then
7609     AC_DEFINE(MOZ_B2G_CERTDATA)
7611 AC_SUBST(MOZ_B2G_CERTDATA)
7613 dnl ========================================================
7614 dnl = Enable Support for Payment API
7615 dnl ========================================================
7616 if test -n "$MOZ_PAY"; then
7617     AC_DEFINE(MOZ_PAY)
7619 AC_SUBST(MOZ_PAY)
7621 dnl ========================================================
7622 dnl = Enable Support for AudioChannelManager API
7623 dnl ========================================================
7624 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7625     AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7627 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7629 dnl ========================================================
7630 dnl = Support for demangling undefined symbols
7631 dnl ========================================================
7632 if test -z "$SKIP_LIBRARY_CHECKS"; then
7633     AC_LANG_SAVE
7634     AC_LANG_CPLUSPLUS
7635     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7636     AC_LANG_RESTORE
7639 # Demangle only for debug or trace-malloc or DMD builds
7640 MOZ_DEMANGLE_SYMBOLS=
7641 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7642     MOZ_DEMANGLE_SYMBOLS=1
7643     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7645 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7647 dnl ========================================================
7648 dnl = Support for gcc stack unwinding (from gcc 3.3)
7649 dnl ========================================================
7650 if test -z "$SKIP_LIBRARY_CHECKS"; then
7651     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7654 dnl ========================================================
7655 dnl JIT observers
7656 dnl ========================================================
7658 MOZ_ARG_WITH_STRING(jitreport-granularity,
7659 [  --jitreport-granularity=N
7660                            Default granularity at which to report JIT code
7661                            to external tools
7662                              0 - no info
7663                              1 - code ranges for whole functions only
7664                              2 - per-line information
7665                              3 - per-op information],
7666   JITREPORT_GRANULARITY=$withval,
7667   JITREPORT_GRANULARITY=3)
7669 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7671 dnl ========================================================
7672 dnl =
7673 dnl = Misc. Options
7674 dnl =
7675 dnl ========================================================
7676 MOZ_ARG_HEADER(Misc. Options)
7678 dnl ========================================================
7679 dnl update xterm title
7680 dnl ========================================================
7681 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7682 [  --enable-xterm-updates  Update XTERM titles with current command.],
7683     MOZ_UPDATE_XTERM=1,
7684     MOZ_UPDATE_XTERM= )
7686 dnl =========================================================
7687 dnl = Chrome format
7688 dnl =========================================================
7689 MOZ_ARG_ENABLE_STRING([chrome-format],
7690 [  --enable-chrome-format=jar|flat|both|symlink|omni
7691                           Select FORMAT of chrome files (default=jar)],
7692     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7694 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7695     MOZ_CHROME_FILE_FORMAT=jar
7698 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7699     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7700     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7701     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7702     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7703     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7706 dnl =========================================================
7707 dnl Omnijar packaging (bug 552121)
7708 dnl =========================================================
7709 dnl Omnijar packaging is compatible with flat packaging.
7710 dnl In unpackaged builds, omnijar looks for files as if
7711 dnl things were flat packaged. After packaging, all files
7712 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7713 dnl is set to flat since putting files into jars is only
7714 dnl done during packaging with omnijar.
7715 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7716     MOZ_OMNIJAR=1
7717     AC_DEFINE(MOZ_OMNIJAR)
7718     if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7719         MOZ_CHROME_FILE_FORMAT=flat
7720     else
7721         MOZ_CHROME_FILE_FORMAT=symlink
7722     fi
7723 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7724     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7727 OMNIJAR_NAME=omni.ja
7728 AC_SUBST(OMNIJAR_NAME)
7729 AC_SUBST(MOZ_OMNIJAR)
7731 dnl ========================================================
7732 dnl = Define default location for MOZILLA_FIVE_HOME
7733 dnl ========================================================
7734 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7735 [  --with-default-mozilla-five-home
7736                           Set the default value for MOZILLA_FIVE_HOME],
7737 [ val=`echo $withval`
7738   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7740 dnl ========================================================
7741 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7742 dnl ========================================================
7743 MOZ_ARG_WITH_STRING(user-appdir,
7744 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7745 [ val=`echo $withval`
7746 if echo "$val" | grep "\/" >/dev/null; then
7747     AC_MSG_ERROR("Homedir must be single relative path.")
7748 else
7749     MOZ_USER_DIR="$val"
7750 fi])
7752 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7754 dnl ========================================================
7755 dnl = Doxygen configuration
7756 dnl ========================================================
7757 dnl Use commas to specify multiple dirs to this arg
7758 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7759 MOZ_ARG_WITH_STRING(doc-input-dirs,
7760 [  --with-doc-input-dirs=DIRS
7761                           Header/idl dirs to create docs from],
7762 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7763 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7765 dnl Use commas to specify multiple dirs to this arg
7766 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7767 MOZ_ARG_WITH_STRING(doc-include-dirs,
7768 [  --with-doc-include-dirs=DIRS
7769                           Include dirs to preprocess doc headers],
7770 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7771 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7773 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7774 MOZ_ARG_WITH_STRING(doc-output-dir,
7775 [  --with-doc-output-dir=DIR
7776                           Dir to generate docs into],
7777 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7778 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7780 if test -z "$SKIP_COMPILER_CHECKS"; then
7781 dnl ========================================================
7782 dnl =
7783 dnl = Compiler Options
7784 dnl =
7785 dnl ========================================================
7786 MOZ_ARG_HEADER(Compiler Options)
7788 dnl ========================================================
7789 dnl Check for gcc -pipe support
7790 dnl ========================================================
7791 AC_MSG_CHECKING([for -pipe support])
7792 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7793     dnl Any gcc that supports firefox supports -pipe.
7794     CFLAGS="$CFLAGS -pipe"
7795     CXXFLAGS="$CXXFLAGS -pipe"
7796     AC_MSG_RESULT([yes])
7797 else
7798     AC_MSG_RESULT([no])
7801 dnl ========================================================
7802 dnl Profile guided optimization (gcc checks)
7803 dnl ========================================================
7804 dnl Test for profiling options
7805 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7807 _SAVE_CFLAGS="$CFLAGS"
7808 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7810 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7811 AC_TRY_COMPILE([], [return 0;],
7812                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7813                  result="yes" ], result="no")
7814 AC_MSG_RESULT([$result])
7816 if test $result = "yes"; then
7817   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7818   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7819   PROFILE_USE_LDFLAGS="-fprofile-use"
7822 CFLAGS="$_SAVE_CFLAGS"
7824 if test -n "$INTEL_CC"; then
7825   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7826   PROFILE_GEN_LDFLAGS=
7827   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7828   PROFILE_USE_LDFLAGS=
7831 dnl Sun Studio on Solaris
7832 if test "$SOLARIS_SUNPRO_CC"; then
7833   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7834   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7835   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7836   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7839 AC_SUBST(PROFILE_GEN_CFLAGS)
7840 AC_SUBST(PROFILE_GEN_LDFLAGS)
7841 AC_SUBST(PROFILE_USE_CFLAGS)
7842 AC_SUBST(PROFILE_USE_LDFLAGS)
7844 AC_LANG_CPLUSPLUS
7846 dnl ========================================================
7847 dnl Test for -pedantic bustage
7848 dnl ========================================================
7849 MOZ_ARG_DISABLE_BOOL(pedantic,
7850 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7851 _PEDANTIC= )
7852 if test "$_PEDANTIC"; then
7853     _SAVE_CXXFLAGS=$CXXFLAGS
7854     CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7855     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7856     AC_TRY_COMPILE([$configure_static_assert_macros],
7857                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7858                    result="no", result="yes" )
7859     AC_MSG_RESULT([$result])
7860     CXXFLAGS="$_SAVE_CXXFLAGS"
7862     case "$result" in
7863     no)
7864         _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7865         _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7866         ;;
7867     yes)
7868         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7869         ;;
7870     esac
7873 dnl ========================================================
7874 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7875 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7876 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7877 dnl ========================================================
7878 _SAVE_CXXFLAGS=$CXXFLAGS
7879 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7880 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7881     ac_nscap_nonconst_opeq_bug,
7882     [AC_TRY_COMPILE([
7883                       template <class T>
7884                       class Pointer
7885                         {
7886                         public:
7887                           T* myPtr;
7888                         };
7890                       template <class T, class U>
7891                       int operator==(const Pointer<T>& rhs, U* lhs)
7892                         {
7893                           return rhs.myPtr == lhs;
7894                         }
7896                       template <class T, class U>
7897                       int operator==(const Pointer<T>& rhs, const U* lhs)
7898                         {
7899                           return rhs.myPtr == lhs;
7900                         }
7901                     ],
7902                     [
7903                       Pointer<int> foo;
7904                       const int* bar;
7905                       return foo == bar;
7906                     ],
7907                     ac_nscap_nonconst_opeq_bug="no",
7908                     ac_nscap_nonconst_opeq_bug="yes")])
7909 CXXFLAGS="$_SAVE_CXXFLAGS"
7911 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7912     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7914 fi # ! SKIP_COMPILER_CHECKS
7916 AC_DEFINE(CPP_THROW_NEW, [throw()])
7917 AC_LANG_C
7919 if test "$COMPILE_ENVIRONMENT"; then
7920 MOZ_EXPAND_LIBS
7921 fi # COMPILE_ENVIRONMENT
7923 dnl ========================================================
7924 dnl =
7925 dnl = Build depencency options
7926 dnl =
7927 dnl ========================================================
7928 MOZ_ARG_HEADER(Build dependencies)
7930 if test "$GNU_CC" -a "$GNU_CXX"; then
7931   _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7932 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7933 elif test "$SOLARIS_SUNPRO_CC"; then
7934   _DEPEND_CFLAGS=
7935 else
7936   dnl Don't override this for MSVC
7937   if test -z "$_WIN32_MSVC"; then
7938     _USE_CPP_INCLUDE_FLAG=
7939     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7940     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7941   else
7942     echo '#include <stdio.h>' > dummy-hello.c
7943     changequote(,)
7944     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7945     changequote([,])
7946     if test -z "$CL_INCLUDES_PREFIX"; then
7947         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7948     fi
7949     AC_SUBST(CL_INCLUDES_PREFIX)
7950     rm -f dummy-hello.c
7951   fi
7954 dnl ========================================================
7955 dnl =
7956 dnl = Static Build Options
7957 dnl =
7958 dnl ========================================================
7959 MOZ_ARG_HEADER(Static build options)
7961 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7962 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7963   ENABLE_SHARED_JS=1
7966 MOZ_ARG_ENABLE_BOOL(shared-js,
7967 [  --enable-shared-js
7968                           Create a shared JavaScript library.],
7969     ENABLE_SHARED_JS=1,
7970     ENABLE_SHARED_JS=)
7972 if test -n "$ENABLE_SHARED_JS"; then
7973   JS_SHARED_LIBRARY=1
7974   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7975 else
7976   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7977   AC_DEFINE(MOZ_STATIC_JS)
7979 AC_SUBST(JS_SHARED_LIBRARY)
7981 AC_SUBST(LIBXUL_LIBS)
7982 XPCOM_LIBS="$LIBXUL_LIBS"
7984 dnl ========================================================
7985 dnl =
7986 dnl = Standalone module options
7987 dnl =
7988 dnl ========================================================
7989 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7991 dnl Check for GLib.
7992 dnl ========================================================
7994 if test -z "$SKIP_PATH_CHECKS"; then
7995 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7996     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7997         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7998     fi
8002 if test -z "${GLIB_GMODULE_LIBS}" \
8003    -a -n "${GLIB_CONFIG}"\
8004     -a "${GLIB_CONFIG}" != no\
8005 ; then
8006     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8009 AC_SUBST(GLIB_CFLAGS)
8010 AC_SUBST(GLIB_LIBS)
8011 AC_SUBST(GLIB_GMODULE_LIBS)
8013 dnl ========================================================
8014 dnl Graphics checks.
8015 dnl ========================================================
8017 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8018 MOZ_ENABLE_SKIA=1
8019 else
8020 MOZ_ENABLE_SKIA=
8023 MOZ_ARG_ENABLE_BOOL(skia,
8024 [  --enable-skia   Enable use of Skia],
8025 MOZ_ENABLE_SKIA=1,
8026 MOZ_ENABLE_SKIA=)
8028 if test "$USE_FC_FREETYPE"; then
8029     if test "$COMPILE_ENVIRONMENT"; then
8030         dnl ========================================================
8031         dnl = Check for freetype2 and its functionality
8032         dnl ========================================================
8033         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8035         if test "$_HAVE_FREETYPE2"; then
8036             _SAVE_LIBS="$LIBS"
8037             _SAVE_CFLAGS="$CFLAGS"
8038             LIBS="$LIBS $FT2_LIBS"
8039             CFLAGS="$CFLAGS $FT2_CFLAGS"
8041             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8042                 ac_cv_member_FT_Bitmap_Size_y_ppem,
8043                 [AC_TRY_COMPILE([#include <ft2build.h>
8044                                  #include FT_FREETYPE_H],
8045                                 [FT_Bitmap_Size s;
8046                                  if (sizeof s.y_ppem) return 0;
8047                                  return 1],
8048                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8049                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8050             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8051                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8052             else
8053                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8054             fi
8055             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8056                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8057                                [FT_Bitmap_Size structure includes y_ppem field])
8059             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
8061             LIBS="$_SAVE_LIBS"
8062             CFLAGS="$_SAVE_CFLAGS"
8063         fi
8065         _SAVE_CPPFLAGS="$CPPFLAGS"
8066         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8067         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8068             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8069         CPPFLAGS="$_SAVE_CPPFLAGS"
8070     else
8071         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8072     fi
8074     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8075     [
8076         if test "$MOZ_PANGO"; then
8077             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8078             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8079         else
8080             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8081             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8082         fi
8083     ])
8086 dnl ========================================================
8087 dnl Check for pixman and cairo
8088 dnl ========================================================
8090 MOZ_TREE_CAIRO=1
8091 MOZ_ARG_ENABLE_BOOL(system-cairo,
8092 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8093 MOZ_TREE_CAIRO=,
8094 MOZ_TREE_CAIRO=1 )
8096 MOZ_TREE_PIXMAN=1
8097 MOZ_ARG_ENABLE_BOOL(system-pixman,
8098 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8099 MOZ_TREE_PIXMAN=,
8100 MOZ_TREE_PIXMAN=force,
8101 MOZ_TREE_PIXMAN=1 )
8103 # System cairo depends on system pixman
8104 if test "$MOZ_TREE_PIXMAN" = "force"; then
8105     if test -z "$MOZ_TREE_CAIRO"; then
8106         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8107     else
8108         MOZ_TREE_PIXMAN=1
8109     fi
8110 elif test -z "$MOZ_TREE_CAIRO"; then
8111     MOZ_TREE_PIXMAN=
8114 if test "$MOZ_TREE_PIXMAN"; then
8115     AC_DEFINE(MOZ_TREE_PIXMAN)
8116     MOZ_PIXMAN_CFLAGS=""
8117     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8118 else
8119     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8120     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8121     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8123 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8124 AC_SUBST(MOZ_PIXMAN_LIBS)
8126 # Check for headers defining standard int types.
8127 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8129 if test "$MOZ_TREE_CAIRO"; then
8130     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8131     AC_DEFINE(MOZ_TREE_CAIRO)
8133     # For now we assume that we will have a uint64_t available through
8134     # one of the above headers or mozstdint.h.
8135     AC_DEFINE(HAVE_UINT64_T)
8137     # Define macros for cairo-features.h
8138     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8139     if test "$MOZ_X11"; then
8140         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8141         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8142         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8143         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8144         MOZ_ENABLE_CAIRO_FT=1
8145         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8146     fi
8147     case "$MOZ_WIDGET_TOOLKIT" in
8148       qt)
8149         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8150         ;;
8151       cocoa | uikit)
8152         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8153         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8154         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8155         ;;
8156       windows)
8157         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8158         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8159         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8160             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8161             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8162             MOZ_ENABLE_D2D_SURFACE=1
8163             MOZ_ENABLE_DWRITE_FONT=1
8164         else
8165             WIN32_DWRITE_FONT_FEATURE=
8166             WIN32_D2D_SURFACE_FEATURE=
8167         fi
8169         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8171         dnl D3D10 Layers depend on D2D Surfaces.
8172         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8173           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8174         fi
8175         ;;
8176       os2)
8177         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8178         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8179         MOZ_ENABLE_CAIRO_FT=1
8180         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8181         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8182         CAIRO_FT_LIBS=""
8183         ;;
8184     esac
8185     if test "$USE_FC_FREETYPE"; then
8186         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8187     fi
8188     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8189     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8190     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8191     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8192     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8193     AC_SUBST(CAIRO_FT_CFLAGS)
8195     AC_SUBST(PS_SURFACE_FEATURE)
8196     AC_SUBST(PDF_SURFACE_FEATURE)
8197     AC_SUBST(SVG_SURFACE_FEATURE)
8198     AC_SUBST(XLIB_SURFACE_FEATURE)
8199     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8200     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8201     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8202     AC_SUBST(WIN32_SURFACE_FEATURE)
8203     AC_SUBST(OS2_SURFACE_FEATURE)
8204     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8205     AC_SUBST(FT_FONT_FEATURE)
8206     AC_SUBST(FC_FONT_FEATURE)
8207     AC_SUBST(WIN32_FONT_FEATURE)
8208     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8209     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8210     AC_SUBST(QUARTZ_FONT_FEATURE)
8211     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8212     AC_SUBST(QT_SURFACE_FEATURE)
8213     AC_SUBST(TEE_SURFACE_FEATURE)
8215     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8216     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8218     if test "$MOZ_X11"; then
8219         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8220     fi
8222     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8223 else
8224     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8225     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8226     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8227     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8228     if test "$MOZ_X11"; then
8229         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8230         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8231         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8232         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8233     fi
8236 AC_SUBST(MOZ_TREE_CAIRO)
8237 AC_SUBST(MOZ_CAIRO_CFLAGS)
8238 AC_SUBST(MOZ_CAIRO_LIBS)
8239 AC_SUBST(MOZ_CAIRO_OSLIBS)
8240 AC_SUBST(MOZ_TREE_PIXMAN)
8242 dnl ========================================================
8243 dnl qcms
8244 dnl ========================================================
8246 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8247 AC_SUBST(QCMS_LIBS)
8249 dnl ========================================================
8250 dnl HarfBuzz
8251 dnl ========================================================
8252 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8253 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8255 dnl ========================================================
8256 dnl SIL Graphite
8257 dnl ========================================================
8258 if test "$MOZ_GRAPHITE"; then
8259   MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8260   AC_DEFINE(MOZ_GRAPHITE)
8261 else
8262   MOZ_GRAPHITE_LIBS=
8264 AC_SUBST(MOZ_GRAPHITE)
8265 AC_SUBST(MOZ_GRAPHITE_LIBS)
8267 dnl ========================================================
8268 dnl OTS
8269 dnl ========================================================
8270 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8271 AC_SUBST(MOZ_OTS_LIBS)
8273 dnl ========================================================
8274 dnl Skia 
8275 dnl ========================================================
8276 if test "$MOZ_ENABLE_SKIA"; then
8277   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8278   AC_DEFINE(MOZ_ENABLE_SKIA)
8279 else
8280   MOZ_SKIA_LIBS=
8282 AC_SUBST(MOZ_ENABLE_SKIA)
8283 AC_SUBST(MOZ_SKIA_LIBS)
8285 dnl ========================================================
8286 dnl disable xul
8287 dnl ========================================================
8288 MOZ_ARG_DISABLE_BOOL(xul,
8289 [  --disable-xul           Disable XUL],
8290     MOZ_XUL= )
8291 if test "$MOZ_XUL"; then
8292   AC_DEFINE(MOZ_XUL)
8293 else
8294   dnl remove extensions that require XUL
8295   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8298 AC_SUBST(MOZ_XUL)
8300 dnl ========================================================
8301 dnl disable profile locking
8302 dnl   do no use this in applications that can have more than
8303 dnl   one process accessing the profile directory.
8304 dnl ========================================================
8305 MOZ_ARG_DISABLE_BOOL(profilelocking,
8306 [  --disable-profilelocking
8307                           Disable profile locking],
8308     MOZ_PROFILELOCKING=,
8309     MOZ_PROFILELOCKING=1 )
8310 if test "$MOZ_PROFILELOCKING"; then
8311   AC_DEFINE(MOZ_PROFILELOCKING)
8314 dnl ========================================================
8315 dnl necko configuration options
8316 dnl ========================================================
8319 dnl option to disable various necko protocols
8321 MOZ_ARG_ENABLE_STRING(necko-protocols,
8322 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8323                           Enable/disable specific protocol handlers],
8324 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8325     if test "$option" = "yes" -o "$option" = "all"; then
8326         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8327     elif test "$option" = "no" -o "$option" = "none"; then
8328         NECKO_PROTOCOLS=""
8329     elif test "$option" = "default"; then
8330         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8331     elif test `echo "$option" | grep -c \^-` != 0; then
8332         option=`echo $option | sed 's/^-//'`
8333         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8334     else
8335         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8336     fi
8337 done],
8338     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8339 dnl Remove dupes
8340 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8341 AC_SUBST(NECKO_PROTOCOLS)
8342 for p in $NECKO_PROTOCOLS; do
8343     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8344     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8345 done
8348 dnl option to disable necko's wifi scanner
8350 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8351 [  --disable-necko-wifi    Disable necko wifi scanner],
8352     NECKO_WIFI=,
8353     NECKO_WIFI=1)
8355 if test "$OS_ARCH" = "OS2"; then
8356   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8357   NECKO_WIFI=
8359 if test "$NECKO_WIFI" -a \
8360         "$OS_ARCH" != "Linux" -a \
8361         "$OS_ARCH" != "Darwin" -a \
8362         "$OS_ARCH" != "SunOS" -a \
8363         "$OS_ARCH" != "WINNT"; then
8364   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8367 if test "$NECKO_WIFI"; then
8368   AC_DEFINE(NECKO_WIFI)
8369   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8371 AC_SUBST(NECKO_WIFI)
8374 dnl option to disable cookies
8376 MOZ_ARG_DISABLE_BOOL(cookies,
8377 [  --disable-cookies       Disable cookie support],
8378     NECKO_COOKIES=,
8379     NECKO_COOKIES=1)
8380 AC_SUBST(NECKO_COOKIES)
8381 if test "$NECKO_COOKIES"; then
8382     AC_DEFINE(NECKO_COOKIES)
8383     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8387 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8389 MOZ_ARG_DISABLE_BOOL(ctypes,
8390 [  --disable-ctypes        Disable js-ctypes],
8391     BUILD_CTYPES=,
8392     BUILD_CTYPES=1)
8393 AC_SUBST(BUILD_CTYPES)
8394 if test "$BUILD_CTYPES"; then
8395     AC_DEFINE(BUILD_CTYPES)
8398 dnl Build Places if required
8399 if test "$MOZ_PLACES"; then
8400   AC_DEFINE(MOZ_PLACES)
8403 dnl Build Apps in the Cloud (AITC) if required
8404 AC_SUBST(MOZ_SERVICES_AITC)
8405 if test -n "$MOZ_SERVICES_AITC"; then
8406   AC_DEFINE(MOZ_SERVICES_AITC)
8409 dnl Build Common JS modules provided by services.
8410 AC_SUBST(MOZ_SERVICES_COMMON)
8411 if test -n "$MOZ_SERVICES_COMMON"; then
8412   AC_DEFINE(MOZ_SERVICES_COMMON)
8415 dnl Build Services crypto component (used by Sync)
8416 AC_SUBST(MOZ_SERVICES_CRYPTO)
8417 if test -n "$MOZ_SERVICES_CRYPTO"; then
8418   AC_DEFINE(MOZ_SERVICES_CRYPTO)
8421 dnl Build Firefox Health Reporter Service
8422 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8423 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8424   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8427 dnl Build Services metrics component
8428 AC_SUBST(MOZ_SERVICES_METRICS)
8429 if test -n "$MOZ_SERVICES_METRICS"; then
8430   AC_DEFINE(MOZ_SERVICES_METRICS)
8433 dnl Build Notifications if required
8434 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8435 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8436   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8439 dnl Build Sync Services if required
8440 AC_SUBST(MOZ_SERVICES_SYNC)
8441 if test -n "$MOZ_SERVICES_SYNC"; then
8442   AC_DEFINE(MOZ_SERVICES_SYNC)
8445 dnl ========================================================
8446 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8447     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8450 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8451   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8454 if test "$MOZ_APP_COMPONENT_MODULES"; then
8455   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8458 dnl ========================================================
8459 dnl =
8460 dnl = Maintainer debug option (no --enable equivalent)
8461 dnl =
8462 dnl ========================================================
8464 AC_SUBST(AR)
8465 AC_SUBST(AR_FLAGS)
8466 AC_SUBST(AR_LIST)
8467 AC_SUBST(AR_EXTRACT)
8468 AC_SUBST(AR_DELETE)
8469 AC_SUBST(AS)
8470 AC_SUBST(ASFLAGS)
8471 AC_SUBST(AS_DASH_C_FLAG)
8472 AC_SUBST(LD)
8473 AC_SUBST(RC)
8474 AC_SUBST(RCFLAGS)
8475 AC_SUBST(MC)
8476 AC_SUBST(WINDRES)
8477 AC_SUBST(IMPLIB)
8478 AC_SUBST(FILTER)
8479 AC_SUBST(BIN_FLAGS)
8480 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8481 AC_SUBST(MOZ_UPDATE_XTERM)
8482 AC_SUBST(MOZ_PLATFORM_MAEMO)
8483 AC_SUBST(MOZ_AUTH_EXTENSION)
8484 AC_SUBST(MOZ_PERMISSIONS)
8485 AC_SUBST(MOZ_PREF_EXTENSIONS)
8486 AC_SUBST(MOZ_JS_LIBS)
8487 AC_SUBST(MOZ_PSM)
8488 AC_SUBST(MOZ_DEBUG)
8489 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8490 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8491 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8492 AC_SUBST(MOZ_DEBUG_FLAGS)
8493 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8494 AC_SUBST(WARNINGS_AS_ERRORS)
8495 AC_SUBST(MOZ_EXTENSIONS)
8496 AC_SUBST(MOZ_JSDEBUGGER)
8497 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8498 AC_SUBST(MOZ_JPROF)
8499 AC_SUBST(MOZ_SHARK)
8500 AC_SUBST(MOZ_CALLGRIND)
8501 AC_SUBST(MOZ_VTUNE)
8502 AC_SUBST(MOZ_ETW)
8503 AC_SUBST(MOZ_PROFILING)
8504 AC_SUBST(LIBICONV)
8505 AC_SUBST(MOZ_PLACES)
8506 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8507 AC_SUBST(MOZ_FEEDS)
8508 AC_SUBST(NS_PRINTING)
8509 AC_SUBST(MOZ_WEBGL)
8510 AC_SUBST(MOZ_HELP_VIEWER)
8511 AC_SUBST(TOOLCHAIN_PREFIX)
8513 AC_SUBST(JAVA)
8514 AC_SUBST(JAVAC)
8515 AC_SUBST(JAR)
8517 AC_SUBST(MOZ_PROFILELOCKING)
8519 AC_SUBST(ENABLE_TESTS)
8520 AC_SUBST(ENABLE_MARIONETTE)
8521 AC_SUBST(IBMBIDI)
8522 AC_SUBST(MOZ_UNIVERSALCHARDET)
8523 AC_SUBST(ACCESSIBILITY)
8524 AC_SUBST(MOZ_SPELLCHECK)
8525 AC_SUBST(MOZ_ANDROID_OMTC)
8526 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8527 AC_SUBST(MOZ_CRASHREPORTER)
8528 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8529 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8530 AC_SUBST(MOZ_STUB_INSTALLER)
8531 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8532 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8533 AC_SUBST(MOZ_UPDATER)
8534 AC_SUBST(MOZ_ANGLE_RENDERER)
8535 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8536 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8537 AC_SUBST(MOZ_D3DX9_VERSION)
8538 AC_SUBST(MOZ_D3DX9_CAB)
8539 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8540 AC_SUBST(MOZ_D3DX9_DLL)
8541 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8542 AC_SUBST(MOZ_METRO)
8544 AC_SUBST(MOZ_ANDROID_HISTORY)
8545 AC_SUBST(MOZ_WEBSMS_BACKEND)
8546 AC_SUBST(ENABLE_STRIP)
8547 AC_SUBST(PKG_SKIP_STRIP)
8548 AC_SUBST(STRIP_FLAGS)
8549 AC_SUBST(USE_ELF_DYNSTR_GC)
8550 AC_SUBST(USE_ELF_HACK)
8551 AC_SUBST(INCREMENTAL_LINKER)
8552 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8553 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8555 AC_SUBST(MOZ_FIX_LINK_PATHS)
8556 AC_SUBST(XPCOM_LIBS)
8557 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8558 AC_SUBST(XPCOM_GLUE_LDOPTS)
8559 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8560 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8561 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8563 AC_SUBST(USE_DEPENDENT_LIBS)
8565 AC_SUBST(MOZ_BUILD_ROOT)
8566 AC_SUBST(MOZ_OS2_TOOLS)
8568 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8569 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8570 AC_SUBST(MOZ_LINKER_EXTRACT)
8571 AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8573 if test -n "$MOZ_PER_WINDOW_PRIVATE_BROWSING" ; then
8574     AC_DEFINE(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8577 dnl ========================================================
8578 dnl = Mac bundle name prefix
8579 dnl ========================================================
8580 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8581 [  --with-macbundlename-prefix=prefix
8582                           Prefix for MOZ_MACBUNDLE_NAME],
8583 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8585 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8586 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8587   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8590 if test "$MOZ_DEBUG"; then
8591   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8592 else
8593   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8595 AC_SUBST(MOZ_MACBUNDLE_NAME)
8597 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8598 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8599 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8600 if test "$MOZ_DEBUG"; then
8601   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8604 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8605 AC_SUBST(MOZ_MACBUNDLE_ID)
8607 # The following variables are available to branding and application
8608 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8609 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8610 # impacts profile location and user-visible fields.
8611 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8612 # versions of a given application (e.g. Aurora and Firefox both use
8613 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8614 # for application.ini's "Name" field, which controls profile location in
8615 # the absence of a "Profile" field (see below), and various system
8616 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8617 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8618 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8619 # builds (e.g. Aurora for Firefox).
8620 # - MOZ_APP_VERSION: Defines the application version number.
8621 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8622 # defaults to a lowercase form of MOZ_APP_BASENAME.
8623 # - MOZ_APP_PROFILE: When set, used for application.ini's
8624 # "Profile" field, which controls profile location.
8625 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8626 # crash reporter server url.
8627 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8628 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8630 if test -z "$MOZ_APP_NAME"; then
8631    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8634 # For extensions and langpacks, we require a max version that is compatible
8635 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8636 # 10.0a1 and 10.0a2 aren't affected
8637 # 10.0 becomes 10.0.*
8638 # 10.0.1 becomes 10.0.*
8639 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8640 if test -z "$IS_ALPHA"; then
8641   changequote(,)
8642   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8643   changequote([,])
8644 else
8645   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8648 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8649 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8650 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8652 AC_SUBST(MOZ_APP_NAME)
8653 AC_SUBST(MOZ_APP_DISPLAYNAME)
8654 AC_SUBST(MOZ_APP_BASENAME)
8655 AC_SUBST(MOZ_APP_VENDOR)
8656 AC_SUBST(MOZ_APP_PROFILE)
8657 AC_SUBST(MOZ_APP_ID)
8658 AC_SUBST(MAR_CHANNEL_ID)
8659 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8660 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8661 AC_SUBST(MOZ_EXTENSION_MANAGER)
8662 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8663 AC_SUBST(MOZ_APP_UA_NAME)
8664 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8665 AC_SUBST(MOZ_APP_VERSION)
8666 AC_SUBST(MOZ_APP_MAXVERSION)
8667 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8668 AC_SUBST(FIREFOX_VERSION)
8669 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8670 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8671   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8673 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8674 AC_SUBST(MOZ_UA_BUILDID)
8676 # We can't use the static application.ini data when building against
8677 # a libxul SDK.
8678 if test -n "$LIBXUL_SDK"; then
8679     MOZ_APP_STATIC_INI=
8681 AC_SUBST(MOZ_APP_STATIC_INI)
8683 AC_SUBST(MOZ_PKG_SPECIAL)
8685 AC_SUBST(MOZILLA_OFFICIAL)
8687 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8688 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8690 if test "$MOZ_TELEMETRY_REPORTING"; then
8691     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8692     # Those lines will remain commented until we are ready to enable
8693     # telemetry by default on Nightly & Aurora channels.
8694     #
8695     # Enable Telemetry by default for nightly and aurora channels
8696     # if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \
8697     #     "$MOZ_UPDATE_CHANNEL" = "aurora"; then
8698     #     AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8699     # fi
8702 dnl win32 options
8703 AC_SUBST(MOZ_MAPINFO)
8704 AC_SUBST(MOZ_BROWSE_INFO)
8705 AC_SUBST(MOZ_TOOLS_DIR)
8706 AC_SUBST(WIN32_REDIST_DIR)
8707 AC_SUBST(MAKENSISU)
8709 dnl Echo the CFLAGS to remove extra whitespace.
8710 CFLAGS=`echo \
8711         $_WARNINGS_CFLAGS \
8712         $CFLAGS`
8714 CXXFLAGS=`echo \
8715         $_WARNINGS_CXXFLAGS \
8716         $CXXFLAGS`
8718 COMPILE_CFLAGS=`echo \
8719     $_DEFINES_CFLAGS \
8720         $_DEPEND_CFLAGS \
8721     $COMPILE_CFLAGS`
8723 COMPILE_CXXFLAGS=`echo \
8724     $_DEFINES_CXXFLAGS \
8725         $_DEPEND_CFLAGS \
8726     $COMPILE_CXXFLAGS`
8728 AC_SUBST(SYSTEM_LIBXUL)
8729 AC_SUBST(MOZ_NATIVE_JPEG)
8730 AC_SUBST(MOZ_NATIVE_PNG)
8731 AC_SUBST(MOZ_NATIVE_BZ2)
8733 AC_SUBST(MOZ_FLEXBOX)
8734 AC_SUBST(MOZ_JPEG_CFLAGS)
8735 AC_SUBST(MOZ_JPEG_LIBS)
8736 AC_SUBST(MOZ_BZ2_CFLAGS)
8737 AC_SUBST(MOZ_BZ2_LIBS)
8738 AC_SUBST(MOZ_PNG_CFLAGS)
8739 AC_SUBST(MOZ_PNG_LIBS)
8741 AC_SUBST(NSPR_CFLAGS)
8742 AC_SUBST(NSPR_LIBS)
8743 AC_SUBST(MOZ_NATIVE_NSPR)
8745 AC_SUBST(NSS_CFLAGS)
8746 AC_SUBST(NSS_LIBS)
8747 AC_SUBST(NSS_DEP_LIBS)
8748 AC_SUBST(MOZ_NATIVE_NSS)
8749 AC_SUBST(NSS_DISABLE_DBM)
8751 OS_CFLAGS="$CFLAGS"
8752 OS_CXXFLAGS="$CXXFLAGS"
8753 OS_CPPFLAGS="$CPPFLAGS"
8754 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8755 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8756 OS_LDFLAGS="$LDFLAGS"
8757 OS_LIBS="$LIBS"
8758 AC_SUBST(OS_CFLAGS)
8759 AC_SUBST(OS_CXXFLAGS)
8760 AC_SUBST(OS_CPPFLAGS)
8761 AC_SUBST(OS_COMPILE_CFLAGS)
8762 AC_SUBST(OS_COMPILE_CXXFLAGS)
8763 AC_SUBST(OS_LDFLAGS)
8764 AC_SUBST(OS_LIBS)
8765 AC_SUBST(CROSS_COMPILE)
8766 AC_SUBST(WCHAR_CFLAGS)
8768 AC_SUBST(HOST_CC)
8769 AC_SUBST(HOST_CXX)
8770 AC_SUBST(HOST_CFLAGS)
8771 AC_SUBST(HOST_CXXFLAGS)
8772 AC_SUBST(HOST_LDFLAGS)
8773 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8774 AC_SUBST(HOST_AR)
8775 AC_SUBST(HOST_AR_FLAGS)
8776 AC_SUBST(HOST_LD)
8777 AC_SUBST(HOST_RANLIB)
8778 AC_SUBST(HOST_NSPR_MDCPUCFG)
8779 AC_SUBST(HOST_BIN_SUFFIX)
8780 AC_SUBST(HOST_OS_ARCH)
8782 AC_SUBST(TARGET_CPU)
8783 AC_SUBST(TARGET_VENDOR)
8784 AC_SUBST(TARGET_OS)
8785 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8786 AC_SUBST(TARGET_MD_ARCH)
8787 AC_SUBST(TARGET_XPCOM_ABI)
8788 AC_SUBST(OS_TARGET)
8789 AC_SUBST(OS_ARCH)
8790 AC_SUBST(OS_RELEASE)
8791 AC_SUBST(OS_TEST)
8792 AC_SUBST(CPU_ARCH)
8793 AC_SUBST(INTEL_ARCHITECTURE)
8795 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8797 AC_SUBST(WRAP_LDFLAGS)
8798 AC_SUBST(MKSHLIB)
8799 AC_SUBST(MKCSHLIB)
8800 AC_SUBST(MKSHLIB_FORCE_ALL)
8801 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8802 AC_SUBST(DSO_CFLAGS)
8803 AC_SUBST(DSO_PIC_CFLAGS)
8804 AC_SUBST(DSO_LDOPTS)
8805 AC_SUBST(LIB_PREFIX)
8806 AC_SUBST(DLL_PREFIX)
8807 AC_SUBST(DLL_SUFFIX)
8808 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8809 AC_SUBST(LIB_SUFFIX)
8810 AC_SUBST(OBJ_SUFFIX)
8811 AC_SUBST(BIN_SUFFIX)
8812 AC_SUBST(ASM_SUFFIX)
8813 AC_SUBST(IMPORT_LIB_SUFFIX)
8814 AC_SUBST(USE_N32)
8815 AC_SUBST(CC_VERSION)
8816 AC_SUBST(CXX_VERSION)
8817 AC_SUBST(MSMANIFEST_TOOL)
8818 AC_SUBST(NS_ENABLE_TSF)
8819 AC_SUBST(MOZ_NSS_PATCH)
8820 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8821 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8823 AC_SUBST(MOZ_MEDIA)
8824 AC_SUBST(MOZ_SYDNEYAUDIO)
8825 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8826 AC_SUBST(MOZ_SOUNDTOUCH)
8827 AC_SUBST(MOZ_CUBEB)
8828 AC_SUBST(MOZ_WAVE)
8829 AC_SUBST(MOZ_VORBIS)
8830 AC_SUBST(MOZ_TREMOR)
8831 AC_SUBST(MOZ_OPUS)
8832 AC_SUBST(MOZ_WEBM)
8833 AC_SUBST(MOZ_DASH)
8834 AC_SUBST(MOZ_MEDIA_PLUGINS)
8835 AC_SUBST(MOZ_OMX_PLUGIN)
8836 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8837 AC_SUBST(MOZ_VP8_ENCODER)
8838 AC_SUBST(MOZ_VP8)
8839 AC_SUBST(MOZ_OGG)
8840 AC_SUBST(VPX_AS)
8841 AC_SUBST(VPX_ASFLAGS)
8842 AC_SUBST(VPX_DASH_C_FLAG)
8843 AC_SUBST(VPX_AS_CONVERSION)
8844 AC_SUBST(VPX_ASM_SUFFIX)
8845 AC_SUBST(VPX_X86_ASM)
8846 AC_SUBST(VPX_ARM_ASM)
8847 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8848 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8849 AC_SUBST(LIBJPEG_TURBO_AS)
8850 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8851 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8852 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8853 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8855 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8857 AC_MSG_CHECKING([for posix_fallocate])
8858 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8859   #include <fcntl.h>],
8860                  [posix_fallocate(0, 0, 0);],
8861                  [ac_cv___posix_fallocate=true],
8862                  [ac_cv___posix_fallocate=false])
8864 if test "$ac_cv___posix_fallocate" = true ; then
8865   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8866   AC_MSG_RESULT(yes)
8867 else
8868   AC_MSG_RESULT(no)
8871 dnl Check for missing components
8872 if test "$COMPILE_ENVIRONMENT"; then
8873 if test "$MOZ_X11"; then
8874     if test "$WITHOUT_X11"; then
8875         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8876     fi
8877     dnl ====================================================
8878     dnl = Check if X headers exist
8879     dnl ====================================================
8880     _SAVE_CFLAGS=$CFLAGS
8881     CFLAGS="$CFLAGS $XCFLAGS"
8882     AC_TRY_COMPILE([
8883         #include <stdio.h>
8884         #include <stdlib.h>
8885         #include <X11/Xlib.h>
8886         #include <X11/Intrinsic.h>
8887         #include <X11/extensions/XShm.h>
8888     ],
8889     [
8890         Display *dpy = 0;
8891         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8892             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8893             exit(1);
8894         }
8895     ], [],
8896     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8897     CFLAGS="$_SAVE_CFLAGS"
8899     if test -n "$MISSING_X"; then
8900         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8901     fi
8903 fi # MOZ_X11
8905 dnl Check for headers, etc. needed by WebGL.
8906 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8907     MOZ_CHECK_HEADER(GL/glx.h)
8908     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8909         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))])
8910     fi
8911 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8912 fi # COMPILE_ENVIRONMENT
8914 dnl Set various defines and substitutions
8915 dnl ========================================================
8917 if test "$OS_ARCH" = "Darwin"; then
8918   AC_DEFINE(XP_UNIX)
8919 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8920   AC_DEFINE(XP_UNIX)
8923 if test "$MOZ_DEBUG"; then
8924     AC_DEFINE(MOZ_REFLOW_PERF)
8925     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8928 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8929     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8930     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8931     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8932     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8933     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8934     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8935     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8936     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8939 AC_SUBST(MOZILLA_VERSION)
8941 AC_SUBST(ac_configure_args)
8943 dnl Spit out some output
8944 dnl ========================================================
8946 dnl The following defines are used by xpcom
8947 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8948 CPP_THROW_NEW
8949 HAVE_CPP_2BYTE_WCHAR_T
8950 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8951 HAVE_CPP_CHAR16_T
8952 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8953 HAVE_CPP_PARTIAL_SPECIALIZATION
8954 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8955 NEED_CPP_UNUSED_IMPLEMENTATIONS
8956 NEW_H
8957 HAVE_GETPAGESIZE
8958 HAVE_ICONV
8959 HAVE_ICONV_WITH_CONST_INPUT
8960 HAVE_MBRTOWC
8961 HAVE_WCRTOMB
8962 HAVE_STATVFS64
8963 HAVE_STATVFS
8964 HAVE_STATFS64
8965 HAVE_STATFS
8966 HAVE_SYS_STATVFS_H
8967 HAVE_SYS_STATFS_H
8968 HAVE_SYS_VFS_H
8969 HAVE_SYS_MOUNT_H
8972 AC_CONFIG_HEADER(
8973 netwerk/necko-config.h
8974 xpcom/xpcom-config.h
8975 xpcom/xpcom-private.h
8978 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8979 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8980 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8981 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8982 # (apparently) only need this hack when egrep's "pattern" is particularly long
8983 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
8984 # bug 655339.
8985 case "$host" in
8986 *-apple-darwin11*)
8987     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8988     ;;
8990     FIXED_EGREP="egrep"
8991     ;;
8992 esac
8994 dnl Load the list of Makefiles to generate.
8995 dnl   To add new Makefiles, edit allmakefiles.sh.
8996 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8997 . ${srcdir}/allmakefiles.sh
8999 echo $MAKEFILES > unallmakefiles
9001 AC_OUTPUT($MAKEFILES)
9003 # target_arch is from {ia32|x64|arm}
9004 case "$CPU_ARCH" in
9005 x86_64 | ia64)
9006     WEBRTC_TARGET_ARCH=x64
9007     ;;
9009 arm*)
9010     WEBRTC_TARGET_ARCH=arm
9011     ;;
9013 x86)
9014     WEBRTC_TARGET_ARCH=ia32
9015     ;;
9018 # unsupported arch for webrtc
9019     WEBRTC_TARGET_ARCH=unknown
9020     MOZ_WEBRTC=
9021     ;;
9023 esac
9025 # Generate Makefiles for WebRTC directly from .gyp files
9026 if test "${OS_TARGET}" = "WINNT"; then
9027    if test "$HAVE_64BIT_OS"; then
9028       OS_BITS=64
9029    else
9030       OS_BITS=32
9031    fi
9032    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
9034 elif test "${OS_TARGET}" = "Android"; then
9035    EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
9036    if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
9037       EXTRA_GYP_DEFINES+=" -D armv7=0 "
9038    else
9039       EXTRA_GYP_DEFINES+=" -D armv7=1 "
9040    fi
9043 if test -n "$MOZ_WEBRTC"; then
9044    AC_MSG_RESULT("generating WebRTC Makefiles...")
9046 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
9047 dnl so that regeneration via dependencies works correctly
9048    WEBRTC_CONFIG="-D build_with_mozilla=1 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
9050    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}"
9052    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9053      $GYP_WEBRTC_OPTIONS \
9054      --generator-output=${_objdir}/media/webrtc/trunk \
9055      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
9056    if test "$?" != 0; then
9057       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
9058    fi
9060    # XXX disable until we land the tranche with signaling
9061    if test -n "$MOZ_WEBRTC_SIGNALING"; then
9062      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
9063      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9064        $GYP_WEBRTC_OPTIONS \
9065        -D build_for_test=0 \
9066        --generator-output=${_objdir}/media/webrtc/signaling \
9067        ${srcdir}/media/webrtc/signaling/signaling.gyp
9068      if test "$?" != 0; then
9069         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
9070      fi
9072      AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
9073      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9074        $GYP_WEBRTC_OPTIONS \
9075        -D build_for_test=1 \
9076        --generator-output=${_objdir}/media/webrtc/signalingtest \
9077        ${srcdir}/media/webrtc/signaling/signaling.gyp
9078      if test "$?" != 0; then
9079        AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
9080      fi
9081    fi
9083    AC_MSG_RESULT("generating gtest Makefiles...")
9084    # Ok to pass some extra -D's that are ignored here
9085    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
9086      $GYP_WEBRTC_OPTIONS \
9087      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
9088      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
9089    if test "$?" != 0; then
9090       AC_MSG_ERROR([failed to generate gtest Makefiles])
9091    fi
9093    AC_MSG_RESULT("generating nrappkit Makefiles...")
9094    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9095      $GYP_WEBRTC_OPTIONS \
9096      --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
9097      ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
9098    if test "$?" != 0; then
9099       AC_MSG_ERROR([failed to generate nrappkit Makefiles])
9100    fi
9102    AC_MSG_RESULT("generating nICEr Makefiles...")
9103    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
9104      $GYP_WEBRTC_OPTIONS \
9105      --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
9106      ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
9107    if test "$?" != 0; then
9108       AC_MSG_ERROR([failed to generate nICEr Makefiles])
9109    fi
9112 # Generate a JSON config file for unittest harnesses etc to read
9113 # build configuration details from in a standardized way.
9114 OS_TARGET=${OS_TARGET} \
9115 TARGET_CPU=${TARGET_CPU} \
9116 MOZ_DEBUG=${MOZ_DEBUG} \
9117 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
9118 UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9119 MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
9120 MOZ_APP_NAME=${MOZ_APP_NAME} \
9121 MOZ_PER_WINDOW_PRIVATE_BROWSING=${MOZ_PER_WINDOW_PRIVATE_BROWSING} \
9122   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9123 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9124   rm ./mozinfo.json.tmp
9125 else
9126   mv -f ./mozinfo.json.tmp ./mozinfo.json
9129 # Run jemalloc configure script
9131 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9132   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
9133   if test -n "$MOZ_REPLACE_MALLOC"; then
9134     # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9135     ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9136     ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9137   fi
9138   if test -n "$MOZ_JEMALLOC3"; then
9139     case "${OS_ARCH}" in
9140       WINNT|Darwin)
9141         # We want jemalloc functions to be kept hidden on both Mac and Windows
9142         # See memory/build/mozmemory_wrap.h for details.
9143         ac_configure_args="$ac_configure_args --without-export"
9144         ;;
9145     esac
9146   elif test "${OS_ARCH}" = Darwin; then
9147     # When building as a replace-malloc lib, disabling the zone allocator
9148     # forces to use pthread_atfork.
9149     ac_configure_args="$ac_configure_args --disable-zone-allocator"
9150   fi
9151   _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9152   JEMALLOC_WRAPPER=
9153   if test -z "$MOZ_REPLACE_MALLOC"; then
9154     case "$OS_ARCH" in
9155       Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9156         MANGLE=$_MANGLE
9157         ;;
9158     esac
9159   elif test -z "$MOZ_JEMALLOC3"; then
9160     MANGLE=$_MANGLE
9161     JEMALLOC_WRAPPER=replace_
9162   fi
9163   if test -n "$MANGLE"; then
9164     MANGLED=
9165     if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9166       JEMALLOC_WRAPPER=__wrap_
9167     fi
9168     for mangle in ${MANGLE}; do
9169       if test -n "$MANGLED"; then
9170         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9171       else
9172         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9173       fi
9174     done
9175     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9176   fi
9177   unset CONFIG_FILES
9178   if test -z "$MOZ_TLS"; then
9179     ac_configure_args="$ac_configure_args --disable-tls"
9180   fi
9181   EXTRA_CFLAGS="$CFLAGS"
9182   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9183     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9184   done
9185   if test "$CROSS_COMPILE"; then
9186     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9187   fi
9188   _save_cache_file="$cache_file"
9189   cache_file=$_objdir/memory/jemalloc/src/config.cache
9190   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9191   cache_file="$_save_cache_file"
9192   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9195 # Run freetype configure script
9197 if test "$MOZ_TREE_FREETYPE"; then
9198    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9199    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9200    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9201    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9202    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9203    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9204    AC_OUTPUT_SUBDIRS(modules/freetype2)
9207 if test -z "$direct_nspr_config"; then
9208     dnl ========================================================
9209     dnl = Setup a nice relatively clean build environment for
9210     dnl = sub-configures.
9211     dnl ========================================================
9212     CC="$_SUBDIR_CC"
9213     CXX="$_SUBDIR_CXX"
9214     CFLAGS="$_SUBDIR_CFLAGS"
9215     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9216     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9217     LDFLAGS="$_SUBDIR_LDFLAGS"
9218     HOST_CC="$_SUBDIR_HOST_CC"
9219     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9220     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9221     RC=
9224 unset MAKEFILES
9225 unset CONFIG_FILES
9227 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9228 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9230 export WRAP_LDFLAGS
9232 if test -n "$_WRAP_MALLOC"; then
9233     # Avoid doubling wrap malloc arguments
9234     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9237 if test -z "$MOZ_NATIVE_NSPR"; then
9238     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9239     if test -z "$MOZ_DEBUG"; then
9240         ac_configure_args="$ac_configure_args --disable-debug"
9241     else
9242         ac_configure_args="$ac_configure_args --enable-debug"
9243     fi
9244     if test "$MOZ_OPTIMIZE" = "1"; then
9245         ac_configure_args="$ac_configure_args --enable-optimize"
9246     elif test -z "$MOZ_OPTIMIZE"; then
9247         ac_configure_args="$ac_configure_args --disable-optimize"
9248     fi
9249     if test -n "$HAVE_64BIT_OS"; then
9250         ac_configure_args="$ac_configure_args --enable-64bit"
9251     fi
9252     if test -n "$USE_ARM_KUSER"; then
9253         ac_configure_args="$ac_configure_args --with-arm-kuser"
9254     fi
9255     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9256     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9257       # dladdr is supported by the new linker, even when the system linker doesn't
9258       # support it. Trick nspr into using dladdr when it's not supported.
9259       _SAVE_CPPFLAGS="$CPPFLAGS"
9260       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9261     fi
9262     _SAVE_LDFLAGS="$LDFLAGS"
9263     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9264     AC_OUTPUT_SUBDIRS(nsprpub)
9265     LDFLAGS="$_SAVE_LDFLAGS"
9266     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9267       unset CPPFLAGS
9268       CPPFLAGS="$_SAVE_CFLAGS"
9269     fi
9270     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9273 dnl ========================================================
9274 dnl = Setup a nice relatively clean build environment for
9275 dnl = sub-configures.
9276 dnl ========================================================
9277 CC="$_SUBDIR_CC"
9278 CXX="$_SUBDIR_CXX"
9279 CFLAGS="$_SUBDIR_CFLAGS"
9280 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9281 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9282 LDFLAGS="$_SUBDIR_LDFLAGS"
9283 HOST_CC="$_SUBDIR_HOST_CC"
9284 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9285 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9288 # Run the SpiderMonkey 'configure' script.
9289 dist=$MOZ_BUILD_ROOT/dist
9290 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9291 ac_configure_args="$ac_configure_args --enable-threadsafe"
9292 if test "$BUILD_CTYPES"; then
9293     # Build js-ctypes on the platforms we can.
9294     ac_configure_args="$ac_configure_args --enable-ctypes"
9296 if test -z "$JS_SHARED_LIBRARY" ; then
9297     ac_configure_args="$ac_configure_args --disable-shared-js"
9299 if test -z "$MOZ_NATIVE_NSPR"; then
9300     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9301     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9303 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9304 ac_configure_args="$ac_configure_args --prefix=$dist"
9305 if test "$MOZ_MEMORY"; then
9306    ac_configure_args="$ac_configure_args --enable-jemalloc"
9308 if test -n "$MOZ_GLUE_LDFLAGS"; then
9309    export MOZ_GLUE_LDFLAGS
9311 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9312    export MOZ_GLUE_PROGRAM_LDFLAGS
9314 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9315    MOZ_ZLIB_LIBS=
9317 export MOZ_NATIVE_ZLIB
9318 export MOZ_ZLIB_CFLAGS
9319 export MOZ_ZLIB_LIBS
9320 export MOZ_APP_NAME
9321 export STLPORT_CPPFLAGS
9322 export STLPORT_LDFLAGS
9323 export STLPORT_LIBS
9324 AC_OUTPUT_SUBDIRS(js/src)
9325 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9327 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR