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