Bug 774835: Refactor nsHTMLReflowState::ApplyMinMaxConstraints to separate behavior...
[gecko.git] / configure.in
blob0059f24977969acac8cb1a27cef656a61a7d954b
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,'"$MOZ_BUILD_ROOT"'/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     OpenBSD:x86)
5458       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5459       VPX_X86_ASM=1
5460     ;;
5461     OpenBSD:x86_64)
5462       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5463       VPX_X86_ASM=1
5464     ;;
5465     Darwin:x86)
5466       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5467       VPX_X86_ASM=1
5468     ;;
5469     Darwin:x86_64)
5470       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5471       VPX_X86_ASM=1
5472     ;;
5473     WINNT:x86_64)
5474       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5475       VPX_X86_ASM=1
5476     ;;
5477     WINNT:x86)
5478       dnl Check for yasm 1.1 or greater.
5479       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5480         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.])
5481       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5482         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.])
5483       else
5484         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5485         VPX_X86_ASM=1
5486         dnl The encoder needs obj_int_extract to get asm offsets.
5487       fi
5488     ;;
5489     *:arm*)
5490       if test -n "$GNU_AS" ; then
5491         VPX_AS=$AS
5492         dnl These flags are a lie; they're just used to enable the requisite
5493         dnl opcodes; actual arch detection is done at runtime.
5494         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5495         VPX_DASH_C_FLAG="-c"
5496         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5497         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5498         VPX_ARM_ASM=1
5499       fi
5500     esac
5502     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5503       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.])
5504     fi
5506     if test -n "$MOZ_VP8_ENCODER" -a \
5507             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5508       dnl We prefer to get asm offsets using inline assembler, which the above
5509       dnl compilers can do. When we're not using one of those, we have to fall
5510       dnl back to obj_int_extract, which reads them from a compiled object
5511       dnl file. Unfortunately, that only works if we're compiling on a system
5512       dnl with the header files for the appropriate object file format.
5513       VPX_NEED_OBJ_INT_EXTRACT=1
5514     fi
5516     if test -n "$VPX_X86_ASM"; then
5517       AC_DEFINE(VPX_X86_ASM)
5518     elif test -n "$VPX_ARM_ASM"; then
5519       AC_DEFINE(VPX_ARM_ASM)
5520     else
5521       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5522     fi
5525 dnl ========================================================
5526 dnl = Disable Wave decoder support
5527 dnl ========================================================
5528 MOZ_ARG_DISABLE_BOOL(wave,
5529 [  --disable-wave          Disable Wave decoder support],
5530     MOZ_WAVE=,
5531     MOZ_WAVE=1)
5533 if test -n "$MOZ_WAVE"; then
5534     AC_DEFINE(MOZ_WAVE)
5535     MOZ_SYDNEYAUDIO=1
5536     MOZ_CUBEB=1
5537     MOZ_MEDIA=1
5540 dnl ========================================================
5541 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5542 dnl ========================================================
5544 if test -n "$MOZ_SYDNEYAUDIO"; then
5545     AC_DEFINE(MOZ_SYDNEYAUDIO)
5548 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5549     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5552 if test -n "$MOZ_CUBEB"; then
5553     case "$target" in
5554     *-android*|*-linuxandroid*)
5555         dnl No Android implementation of libcubeb yet.
5556         ;;
5557     *-linux*)
5558         AC_DEFINE(MOZ_CUBEB)
5559         ;;
5560     *-mingw*)
5561         AC_DEFINE(MOZ_CUBEB)
5562         ;;
5563     *-darwin*)
5564         AC_DEFINE(MOZ_CUBEB)
5565         ;;
5566     *-openbsd*)
5567         AC_DEFINE(MOZ_CUBEB)
5568         ;;
5569     *)
5570         dnl Other targets will be enabled soon.
5571         ;;
5572     esac
5575 if test -n "$MOZ_MEDIA"; then
5576     AC_DEFINE(MOZ_MEDIA)
5579 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5580     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/])
5583 if test -n "$MOZ_VORBIS"; then
5584     AC_DEFINE(MOZ_VORBIS)
5587 if test -n "$MOZ_TREMOR"; then
5588     AC_DEFINE(MOZ_TREMOR)
5591 if test -n "$MOZ_OPUS"; then
5592     AC_DEFINE(MOZ_OPUS)
5595 dnl ========================================================
5596 dnl = Check alsa availability on Linux if using sydneyaudio
5597 dnl ========================================================
5599 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5600 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5601     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5602          [echo "$MOZ_ALSA_PKG_ERRORS"
5603           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.)])])
5606 dnl ========================================================
5607 dnl = Enable GStreamer
5608 dnl ========================================================
5609 MOZ_ARG_ENABLE_BOOL(gstreamer,
5610 [  --enable-gstreamer           Enable GStreamer support],
5611 MOZ_GSTREAMER=1,
5612 MOZ_GSTREAMER=)
5614 if test "$MOZ_GSTREAMER"; then
5615     # API version, eg 0.10, 1.0 etc
5616     GST_API_VERSION=0.10
5617     # core/base release number
5618     # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5619     # introduced
5620     GST_VERSION=0.10.33
5621     PKG_CHECK_MODULES(GSTREAMER,
5622                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5623                       gstreamer-app-$GST_API_VERSION
5624                       gstreamer-plugins-base-$GST_API_VERSION)
5625     if test -n "$GSTREAMER_LIBS"; then
5626        _SAVE_LDFLAGS=$LDFLAGS
5627        LDFLAGS="$LDFLAGS -lgstvideo-$GST_API_VERSION"
5628        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5629        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5630           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5631        else
5632           AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5633        fi
5634        LDFLAGS=$_SAVE_LDFLAGS
5635     else
5636        AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5637     fi
5639 AC_SUBST(GSTREAMER_CFLAGS)
5640 AC_SUBST(GSTREAMER_LIBS)
5641 AC_SUBST(MOZ_GSTREAMER)
5643 if test -n "$MOZ_GSTREAMER"; then
5644    AC_DEFINE(MOZ_GSTREAMER)
5645    MOZ_MEDIA=1
5649 dnl ========================================================
5650 dnl Permissions System
5651 dnl ========================================================
5652 MOZ_ARG_DISABLE_BOOL(permissions,
5653 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5654     MOZ_PERMISSIONS=,
5655     MOZ_PERMISSIONS=1
5658 dnl ========================================================
5659 dnl NegotiateAuth
5660 dnl ========================================================
5661 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5662 [  --disable-negotiateauth Disable GSS-API negotiation ],
5663     MOZ_AUTH_EXTENSION=,
5664     MOZ_AUTH_EXTENSION=1 )
5666 dnl ========================================================
5667 dnl XTF
5668 dnl ========================================================
5669 MOZ_ARG_DISABLE_BOOL(xtf,
5670 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5671     MOZ_XTF=,
5672     MOZ_XTF=1 )
5673 if test "$MOZ_XTF"; then
5674   AC_DEFINE(MOZ_XTF)
5677 dnl ========================================================
5678 dnl Pref extensions (autoconfig)
5679 dnl ========================================================
5680 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5681 [  --disable-pref-extensions
5682                           Disable pref extensions such as autoconfig],
5683   MOZ_PREF_EXTENSIONS=,
5684   MOZ_PREF_EXTENSIONS=1 )
5686 dnl ========================================================
5687 dnl Searching of system directories for extensions.
5688 dnl Note: this switch is meant to be used for test builds
5689 dnl whose behavior should not depend on what happens to be
5690 dnl installed on the local machine.
5691 dnl ========================================================
5692 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5693 [  --disable-system-extension-dirs
5694                           Disable searching system- and account-global
5695                           directories for extensions of any kind; use
5696                           only profile-specific extension directories],
5697   ENABLE_SYSTEM_EXTENSION_DIRS=,
5698   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5699 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5700   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5703 dnl ========================================================
5704 dnl = Universalchardet
5705 dnl ========================================================
5706 MOZ_ARG_DISABLE_BOOL(universalchardet,
5707 [  --disable-universalchardet
5708                           Disable universal encoding detection],
5709   MOZ_UNIVERSALCHARDET=,
5710   MOZ_UNIVERSALCHARDET=1 )
5712 if test -n "${JAVA_BIN_PATH}"; then
5713   dnl Look for javac and jar in the specified path.
5714   JAVA_PATH="$JAVA_BIN_PATH"
5715 else
5716   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5717   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5720 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5721 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5722 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5724 if test -n "${JAVA_BIN_PATH}" -o \
5725   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5726   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5727     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}])
5728   fi
5731 dnl ========================================================
5732 dnl = ANGLE OpenGL->D3D translator for WebGL
5733 dnl = * only applies to win32
5734 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5735 dnl ========================================================
5736 MOZ_ANGLE_RENDERER=
5737 MOZ_DIRECTX_SDK_PATH=
5738 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5739 MOZ_D3DX9_VERSION=
5740 MOZ_D3DX9_CAB=
5741 MOZ_D3DCOMPILER_CAB=
5742 MOZ_D3DX9_DLL=
5743 MOZ_D3DCOMPILER_DLL=
5744 case "$target_os" in
5745 *mingw*)
5746     MOZ_ANGLE_RENDERER=1
5747     ;;
5748 esac
5750 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5751 case "${target_cpu}" in
5752 i*86)
5753   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5754   ;;
5755 x86_64)
5756   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5757   ;;
5758 esac
5760 MOZ_ARG_DISABLE_BOOL(webgl,
5761 [  --disable-webgl     Disable building of the WebGL implementation],
5762     MOZ_WEBGL_DISABLED=1,
5763     MOZ_WEBGL_DISABLED=)
5765 if test -n "$MOZ_WEBGL_DISABLED"; then
5766   MOZ_WEBGL=
5767   MOZ_ANGLE_RENDERER=
5770 if test -n "$MOZ_ANGLE_RENDERER"; then
5771   # Get the SDK path from the registry.
5772   # First try to get the June 2010 SDK
5773   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5774   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5775     # Otherwise just take whatever comes first
5776     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5777   fi
5779   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5780     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.])
5781   else
5782     MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
5783   fi
5785   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5786      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5787          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5788     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5789   else
5790     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.])
5791   fi
5793   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5794   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'`
5796   if test -z "$MOZ_D3DX9_VERSION" ; then
5797         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.])
5798   fi
5800   MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5801   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5803   MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5804   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5807 dnl ========================================================
5808 dnl = Breakpad crash reporting (on by default on supported platforms)
5809 dnl ========================================================
5811 case $target in
5812 i?86-*-mingw*|x86_64-*-mingw*)
5813   MOZ_CRASHREPORTER=1
5814   ;;
5815 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
5816   MOZ_CRASHREPORTER=1
5817   ;;
5818 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5819   if test "$MOZ_ENABLE_GTK2"; then
5820     MOZ_CRASHREPORTER=1
5821   fi
5822   ;;
5823 *-android*|*-linuxandroid*)
5824   MOZ_CRASHREPORTER=1
5825   ;;
5826 *solaris*)
5827   MOZ_CRASHREPORTER=1
5828   ;;
5829 esac
5831 MOZ_ARG_DISABLE_BOOL(crashreporter,
5832 [  --disable-crashreporter Disable breakpad crash reporting],
5833     MOZ_CRASHREPORTER=,
5834     MOZ_CRASHREPORTER=1)
5836 if test -n "$MOZ_CRASHREPORTER"; then
5837    AC_DEFINE(MOZ_CRASHREPORTER)
5839   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
5840     test -z "$SKIP_LIBRARY_CHECKS"; then
5841     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5842     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5843     AC_SUBST(MOZ_GTHREAD_LIBS)
5845     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.])])
5846   fi
5848   if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
5849     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
5850   fi
5852   if test "$OS_ARCH" == "WINNT" -a -z "$HAVE_64BIT_OS"; then
5853     MOZ_CRASHREPORTER_INJECTOR=1
5854     AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5855   fi
5858 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5859 [  --with-crashreporter-enable-percent=NN
5860                           Enable sending crash reports by default on NN% of users. (default=100)],
5861 [ val=`echo $withval | sed 's/[^0-9]//g'`
5862     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5864 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5865    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5867 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5869 dnl ========================================================
5870 dnl = libjpeg-turbo configuration
5871 dnl ========================================================
5872 MOZ_LIBJPEG_TURBO=
5873 if test -z "$MOZ_NATIVE_JPEG"; then
5874     MOZ_LIBJPEG_TURBO=1
5877 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5878 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
5879     MOZ_LIBJPEG_TURBO=,
5880     MOZ_LIBJPEG_TURBO=1)
5882 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5883     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5886 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5887 dnl files.
5889 if test -n "$MOZ_LIBJPEG_TURBO"; then
5891   dnl Do we support libjpeg-turbo on this platform?
5892   case "$OS_ARCH:$OS_TEST" in
5893   Linux:x86|Linux:i?86)
5894     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5895     LIBJPEG_TURBO_X86_ASM=1
5896   ;;
5897   Linux:x86_64)
5898     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5899     LIBJPEG_TURBO_X64_ASM=1
5900   ;;
5901   SunOS:i?86)
5902     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5903     LIBJPEG_TURBO_X86_ASM=1
5904   ;;
5905   SunOS:x86_64)
5906     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5907     LIBJPEG_TURBO_X64_ASM=1
5908   ;;
5909   Darwin:i?86)
5910     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5911     LIBJPEG_TURBO_X86_ASM=1
5912   ;;
5913   Darwin:x86_64)
5914     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5915     LIBJPEG_TURBO_X64_ASM=1
5916   ;;
5917   WINNT:x86|WINNT:i?86)
5918     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5919     LIBJPEG_TURBO_X86_ASM=1
5920   ;;
5921   WINNT:x86_64)
5922     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5923     LIBJPEG_TURBO_X64_ASM=1
5924   ;;
5925   *:arm*)
5926     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5927     LIBJPEG_TURBO_ARM_ASM=1
5928   ;;
5929   esac
5933 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5934 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
5935 dnl it doesn't exist or we have too old of a version.
5936 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
5937     AC_MSG_CHECKING([for Yasm assembler])
5938     AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
5940     if test -z "$LIBJPEG_TURBO_AS" ; then
5941         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.])
5942     fi
5944     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
5945     dnl on Linux and 1.1 or newer everywhere else.
5946     if test "$OS_ARCH" = "Linux" ; then
5947         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
5948             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.])
5949         fi
5950     else
5951         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5952             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.])
5953         fi
5954     fi
5957 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
5958 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
5959 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
5960     echo "Using $AS as the assembler for ARM code."
5961     LIBJPEG_TURBO_AS=$AS
5964 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
5965     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
5966 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
5967     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
5968 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
5969     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
5970 elif test -n "$MOZ_LIBJPEG_TURBO"; then
5971     dnl Warn if we're not building the optimized routines, even though the user
5972     dnl didn't specify --disable-libjpeg-turbo.
5973     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
5976 dnl ========================================================
5977 dnl = Enable compilation of specific extension modules
5978 dnl ========================================================
5980 MOZ_ARG_ENABLE_STRING(extensions,
5981 [  --enable-extensions     Enable extensions],
5982 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5983     if test "$option" = "yes" -o "$option" = "all"; then
5984         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5985     elif test "$option" = "no" -o "$option" = "none"; then
5986         MOZ_EXTENSIONS=""
5987     elif test "$option" = "default"; then
5988         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5989     elif test `echo "$option" | grep -c \^-` != 0; then
5990         option=`echo $option | sed 's/^-//'`
5991         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5992     else
5993         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5994     fi
5995 done],
5996     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5998 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5999     # Suppress warning on non-X11 platforms
6000     if test -n "$MOZ_X11"; then
6001         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6002     fi
6003     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6006 dnl Do not build gnomevfs with libxul based apps
6007 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6008     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6011 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6012     # Suppress warning on non-X11 platforms
6013     if test -n "$MOZ_X11"; then
6014         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6015     fi
6016     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6019 dnl Do not build gio with libxul based apps
6020 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6021     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6024 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6025     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6026     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6029 dnl xforms requires xtf
6030 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6031     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6032     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6035 dnl Remove dupes
6036 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6038 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6039 dnl when trying to build a nonexistent extension.
6040 for extension in $MOZ_EXTENSIONS; do
6041     if test ! -d "${srcdir}/extensions/${extension}"; then
6042         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6043     fi
6044 done
6046 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6047   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6050 dnl ========================================================
6051 dnl CSS3 Flexbox Support
6052 dnl ========================================================
6053 if test -n "$MOZ_FLEXBOX"; then
6054   AC_DEFINE(MOZ_FLEXBOX)
6057 dnl ========================================================
6058 dnl SVG Display Lists
6059 dnl ========================================================
6060 if test -n "$MOZ_SVG_DLISTS"; then
6061   AC_DEFINE(MOZ_SVG_DLISTS)
6064 dnl ========================================================
6065 dnl Build Freetype in the tree
6066 dnl ========================================================
6067 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6068 [  --enable-tree-freetype  Enable Tree FreeType],
6069     MOZ_TREE_FREETYPE=1,
6070     MOZ_TREE_FREETYPE= )
6071 if test -n "$MOZ_TREE_FREETYPE"; then
6072    if test -n "$_WIN32_MSVC"; then
6073       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6074    fi
6075    AC_DEFINE(MOZ_TREE_FREETYPE)
6076    AC_SUBST(MOZ_TREE_FREETYPE)
6077    MOZ_ENABLE_CAIRO_FT=1
6078    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6079    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6080    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6081    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6082    CAIRO_FT_OSLIBS=''
6083    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6084    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6085    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6086    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6087    AC_SUBST(CAIRO_FT_CFLAGS)
6090 dnl ========================================================
6091 dnl Installer
6092 dnl ========================================================
6093 dnl Abort Windows build if the required major version and
6094 dnl minimum minor version of Unicode NSIS isn't in the path
6095 dnl (unless in case of cross compiling, for which Unicode
6096 dnl is not yet sufficient).
6097 if test "$OS_ARCH" = "WINNT"; then
6098     REQ_NSIS_MAJOR_VER=2
6099     MIN_NSIS_MINOR_VER=33
6100     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6101     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6102       AC_MSG_RESULT([yes])
6103       changequote(,)
6104       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6105       changequote([,])
6106       if test ! "$MAKENSISU_VER" = ""; then
6107           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6108           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6109       fi
6110       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6111       if test "$MAKENSISU_VER" = "" || \
6112          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6113               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6114           AC_MSG_RESULT([no])
6115           if test -z "$CROSS_COMPILE"; then
6116             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.])
6117           else
6118             MAKENSISU=
6119           fi
6120       fi
6121     elif test -z "$CROSS_COMPILE"; then
6122       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.])
6123     else
6124       MAKENSISU=
6125     fi
6128 dnl ========================================================
6129 dnl Web App Runtime
6130 dnl ========================================================
6131 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6132 [  --disable-webapp-runtime  Disable Web App Runtime],
6133     MOZ_WEBAPP_RUNTIME=,
6134     MOZ_WEBAPP_RUNTIME=1)
6135 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6136     MOZ_WEBAPP_RUNTIME=
6138 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6139     MOZ_WEBAPP_RUNTIME=
6141 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6142 if test "$MOZ_WEBAPP_RUNTIME"; then
6143     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6146 AC_MSG_CHECKING([for tar archiver])
6147 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6148 if test -z "$TAR"; then
6149     AC_MSG_ERROR([no tar archiver found in \$PATH])
6151 AC_MSG_RESULT([$TAR])
6152 AC_SUBST(TAR)
6154 AC_MSG_CHECKING([for wget])
6155 AC_CHECK_PROGS(WGET, wget, "")
6156 AC_MSG_RESULT([$WGET])
6157 AC_SUBST(WGET)
6159 dnl ========================================================
6160 dnl Signing
6161 dnl ========================================================
6163 if test -n "$MOZ_SIGN_CMD"; then
6164     AC_DEFINE(MOZ_SIGNING)
6167 dnl ========================================================
6168 dnl Maintenance Service
6169 dnl ========================================================
6171 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6172 [  --enable-maintenance-service       Enable building of maintenanceservice],
6173     MOZ_MAINTENANCE_SERVICE=1,
6174     MOZ_MAINTENANCE_SERVICE= )
6176 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6177   if test "$OS_ARCH" = "WINNT"; then
6178     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6179   else
6180     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6181   fi
6184 dnl ========================================================
6185 dnl Verify MAR signatures
6186 dnl ========================================================
6188 MOZ_ARG_ENABLE_BOOL(verify-mar,
6189 [  --enable-verify-mar     Enable verifying MAR signatures],
6190     MOZ_VERIFY_MAR_SIGNATURE=1,
6191     MOZ_VERIFY_MAR_SIGNATURE= )
6193 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6194   if test "$OS_ARCH" = "WINNT"; then
6195     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6196   else
6197     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6198   fi
6201 dnl ========================================================
6202 dnl Enable building the signmar program.
6203 dnl This option is much different than the --enable-verify-mar option.
6204 dnl --enable-verify-mar is for enabling the verification check on MAR
6205 dnl files in the updater.  The --enable-signmar option is for building
6206 dnl the signmar program.
6207 dnl ========================================================
6209 MOZ_ARG_ENABLE_BOOL(signmar,
6210 [  --enable-signmar     Enable building the signmar program],
6211     MOZ_ENABLE_SIGNMAR=1,
6212     MOZ_ENABLE_SIGNMAR= )
6214 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6215   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6218 dnl ========================================================
6219 dnl Updater
6220 dnl ========================================================
6222 MOZ_ARG_DISABLE_BOOL(updater,
6223 [  --disable-updater       Disable building of updater],
6224     MOZ_UPDATER=,
6225     MOZ_UPDATER=1 )
6227 if test -n "$MOZ_UPDATER"; then
6228     AC_DEFINE(MOZ_UPDATER)
6231 # app update channel is 'default' when not supplied.
6232 MOZ_ARG_ENABLE_STRING([update-channel],
6233 [  --enable-update-channel=CHANNEL
6234                           Select application update channel (default=default)],
6235     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6237 if test -z "$MOZ_UPDATE_CHANNEL"; then
6238     MOZ_UPDATE_CHANNEL=default
6240 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6241 AC_SUBST(MOZ_UPDATE_CHANNEL)
6243 # tools/update-packaging is not checked out by default.
6244 MOZ_ARG_ENABLE_BOOL(update-packaging,
6245 [  --enable-update-packaging
6246                           Enable tools/update-packaging],
6247     MOZ_UPDATE_PACKAGING=1,
6248     MOZ_UPDATE_PACKAGING= )
6249 AC_SUBST(MOZ_UPDATE_PACKAGING)
6251 dnl ========================================================
6252 dnl build the tests by default
6253 dnl ========================================================
6254 MOZ_ARG_DISABLE_BOOL(tests,
6255 [  --disable-tests         Do not build test libraries & programs],
6256     ENABLE_TESTS=,
6257     ENABLE_TESTS=1 )
6259 dnl ========================================================
6260 dnl parental controls (for Windows Vista)
6261 dnl ========================================================
6262 MOZ_ARG_DISABLE_BOOL(parental-controls,
6263 [  --disable-parental-controls
6264                           Do not build parental controls],
6265    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6266    MOZ_DISABLE_PARENTAL_CONTROLS=)
6267 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6268     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6271 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6273 dnl ========================================================
6274 dnl = Disable DOMCrypto
6275 dnl ========================================================
6276 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6277     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6280 dnl ========================================================
6281 dnl =
6282 dnl = Module specific options
6283 dnl =
6284 dnl ========================================================
6285 MOZ_ARG_HEADER(Individual module options)
6287 dnl ========================================================
6288 dnl = Disable feed handling components
6289 dnl ========================================================
6290 MOZ_ARG_DISABLE_BOOL(feeds,
6291 [  --disable-feeds         Disable feed handling and processing components],
6292     MOZ_FEEDS=,
6293     MOZ_FEEDS=1 )
6294 if test -n "$MOZ_FEEDS"; then
6295     AC_DEFINE(MOZ_FEEDS)
6296 else
6297     if test "$MOZ_BUILD_APP" = "browser"; then
6298         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6299     fi
6302 dnl ========================================================
6303 dnl Check for sqlite
6304 dnl ========================================================
6306 MOZ_NATIVE_SQLITE=
6307 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6308 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6309 MOZ_NATIVE_SQLITE=1,
6310 MOZ_NATIVE_SQLITE= )
6312 if test -z "$MOZ_NATIVE_SQLITE"
6313 then
6314     SQLITE_CFLAGS=
6315     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6316 else
6317     dnl ============================
6318     dnl === SQLite Version check ===
6319     dnl ============================
6320     dnl Check to see if the system SQLite package is new enough.
6321     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6323     dnl ==================================
6324     dnl === SQLITE_SECURE_DELETE check ===
6325     dnl ==================================
6326     dnl Check to see if the system SQLite package is compiled with
6327     dnl SQLITE_SECURE_DELETE enabled.
6328     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6329     _SAVE_CFLAGS="$CFLAGS"
6330     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6331     _SAVE_LIBS="$LIBS"
6332     LIBS="$LIBS $SQLITE_LIBS"
6333     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6334         AC_TRY_RUN([
6335             #include "sqlite3.h"
6337             int main(int argc, char **argv){
6338               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6339             }],
6340             ac_cv_sqlite_secure_delete=yes,
6341             ac_cv_sqlite_secure_delete=no,
6342             ac_cv_sqlite_secure_delete=no
6343         )
6344     ])
6345     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6346     CFLAGS="$_SAVE_CFLAGS"
6347     LIBS="$_SAVE_LIBS"
6348     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6349         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6350     fi
6352     dnl ===============================
6353     dnl === SQLITE_THREADSAFE check ===
6354     dnl ===============================
6355     dnl Check to see if the system SQLite package is compiled with
6356     dnl SQLITE_THREADSAFE enabled.
6357     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6358     _SAVE_CFLAGS="$CFLAGS"
6359     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6360     _SAVE_LIBS="$LIBS"
6361     LIBS="$LIBS $SQLITE_LIBS"
6362     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6363         AC_TRY_RUN([
6364             #include "sqlite3.h"
6366             int main(int argc, char **argv){
6367               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6368             }],
6369             ac_cv_sqlite_threadsafe=yes,
6370             ac_cv_sqlite_threadsafe=no,
6371             ac_cv_sqlite_threadsafe=no
6372         )
6373     ])
6374     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6375     CFLAGS="$_SAVE_CFLAGS"
6376     LIBS="$_SAVE_LIBS"
6377     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6378         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6379     fi
6381     dnl ================================
6382     dnl === SQLITE_ENABLE_FTS3 check ===
6383     dnl ================================
6384     dnl check to see if the system SQLite package is compiled with
6385     dnl SQLITE_ENABLE_FTS3 enabled.
6386     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6387     _SAVE_CFLAGS="$CFLAGS"
6388     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6389     _SAVE_LIBS="$LIBS"
6390     LIBS="$LIBS $SQLITE_LIBS"
6391     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6392         AC_TRY_RUN([
6393             #include "sqlite3.h"
6395             int main(int argc, char **argv){
6396               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6397             }],
6398             ac_cv_sqlite_enable_fts3=yes,
6399             ac_cv_sqlite_enable_fts3=no,
6400             ac_cv_sqlite_enable_fts3=no
6401         )
6402     ])
6403     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6404     CFLAGS="$_SAVE_CFLAGS"
6405     LIBS="$_SAVE_LIBS"
6406     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6407         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6408     fi
6410     dnl =========================================
6411     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6412     dnl =========================================
6413     dnl check to see if the system SQLite package is compiled with
6414     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6415     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6416     _SAVE_CFLAGS="$CFLAGS"
6417     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6418     _SAVE_LIBS="$LIBS"
6419     LIBS="$LIBS $SQLITE_LIBS"
6420     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6421         AC_TRY_RUN([
6422             #include "sqlite3.h"
6424             int main(int argc, char **argv){
6425               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6426             }],
6427             ac_cv_sqlite_enable_unlock_notify=yes,
6428             ac_cv_sqlite_enable_unlock_notify=no,
6429             ac_cv_sqlite_enable_unlock_notify=no
6430         )
6431     ])
6432     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6433     CFLAGS="$_SAVE_CFLAGS"
6434     LIBS="$_SAVE_LIBS"
6435     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6436         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6437     fi
6440 if test -n "$MOZ_NATIVE_SQLITE"; then
6441     AC_DEFINE(MOZ_NATIVE_SQLITE)
6443 AC_SUBST(MOZ_NATIVE_SQLITE)
6445 dnl ========================================================
6446 dnl = Enable help viewer (off by default)
6447 dnl ========================================================
6448 if test -n "$MOZ_HELP_VIEWER"; then
6449      dnl Do this if defined in confvars.sh
6450      AC_DEFINE(MOZ_HELP_VIEWER)
6453 dnl ========================================================
6454 dnl = Enable safe browsing (anti-phishing)
6455 dnl ========================================================
6456 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6457 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6458     MOZ_SAFE_BROWSING=1,
6459     MOZ_SAFE_BROWSING= )
6460 if test -n "$MOZ_SAFE_BROWSING"; then
6461     AC_DEFINE(MOZ_SAFE_BROWSING)
6463 AC_SUBST(MOZ_SAFE_BROWSING)
6465 dnl ========================================================
6466 dnl = Enable url-classifier
6467 dnl ========================================================
6468 dnl Implicitly enabled by default if building with safe-browsing
6469 if test -n "$MOZ_SAFE_BROWSING"; then
6470     MOZ_URL_CLASSIFIER=1
6472 MOZ_ARG_ENABLE_BOOL(url-classifier,
6473 [  --enable-url-classifier Enable url classifier module],
6474     MOZ_URL_CLASSIFIER=1,
6475     MOZ_URL_CLASSIFIER= )
6476 if test -n "$MOZ_URL_CLASSIFIER"; then
6477     AC_DEFINE(MOZ_URL_CLASSIFIER)
6479 AC_SUBST(MOZ_URL_CLASSIFIER)
6481 dnl ========================================================
6482 dnl = Disable zipwriter
6483 dnl ========================================================
6484 MOZ_ARG_DISABLE_BOOL(zipwriter,
6485 [  --disable-zipwriter     Disable zipwriter component],
6486     MOZ_ZIPWRITER=,
6487     MOZ_ZIPWRITER=1 )
6488 AC_SUBST(MOZ_ZIPWRITER)
6490 dnl ========================================================
6491 dnl = libconic
6492 dnl ========================================================
6493 dnl superseded by QtNetwork starting from 4.7
6494 MOZ_ENABLE_LIBCONIC=1
6496 if test -n "$MOZ_ENABLE_QT"; then
6497   if test "$MOZ_ENABLE_QTNETWORK"; then
6498     MOZ_ENABLE_LIBCONIC=
6499   fi
6502 MOZ_ARG_DISABLE_BOOL(libconic,
6503 [  --disable-libconic      Disable libconic],
6504     MOZ_ENABLE_LIBCONIC=,
6505     MOZ_ENABLE_LIBCONIC=1 )
6507 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6508     PKG_CHECK_MODULES(LIBCONIC, conic,
6509                       MOZ_ENABLE_LIBCONIC=1,
6510                       MOZ_ENABLE_LIBCONIC=)
6512 if test "$MOZ_ENABLE_LIBCONIC"; then
6513     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6516 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6517 AC_SUBST(LIBCONIC_CFLAGS)
6518 AC_SUBST(LIBCONIC_LIBS)
6520 dnl ========================================================
6521 dnl = Maemo checks
6522 dnl ========================================================
6524 MAEMO_SDK_TARGET_VER=-1
6526 MOZ_ARG_WITH_STRING(maemo-version,
6527 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6528                           Maemo SDK Version],
6529   MAEMO_SDK_TARGET_VER=$withval)
6531 case "$MAEMO_SDK_TARGET_VER" in
6533     MOZ_PLATFORM_MAEMO=5
6534     ;;
6537     MOZ_PLATFORM_MAEMO=6
6538     ;;
6541     dnl We aren't compiling for Maemo, move on.
6542     ;;
6544     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6545     ;;
6546 esac
6548 if test $MOZ_PLATFORM_MAEMO; then
6549    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6551    if test -z "$MOZ_ENABLE_DBUS"; then
6552        AC_MSG_ERROR([DBus is required when building for Maemo])
6553    fi
6555    MOZ_GFX_OPTIMIZE_MOBILE=1
6556    MOZ_GL_DEFAULT_PROVIDER=EGL
6557    MOZ_MAEMO_LIBLOCATION=
6559    if test $MOZ_PLATFORM_MAEMO = 5; then
6560       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6561       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6562           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6563       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6564                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6566       AC_SUBST(XCOMPOSITE_LIBS)
6568       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6569       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6570       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6571       if test -z "$_LIB_FOUND"; then
6572          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6573       fi
6576       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6577       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6578       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6579       if test -z "$_LIB_FOUND"; then
6580          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6581       fi
6583       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6584       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6585       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6586       if test -z "$_LIB_FOUND"; then
6587          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6588       fi
6590    fi
6591    if test $MOZ_PLATFORM_MAEMO = 6; then
6593       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6594                         _LIB_FOUND=1,
6595                         _LIB_FOUND=)
6596       if test "$_LIB_FOUND"; then
6597          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6598          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6599          MOZ_ENABLE_CONTENTMANAGER=1
6600          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6601       else
6602          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6603       fi
6604       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6606       dnl ========================================================
6607       dnl = Enable meego libcontentaction
6608       dnl ========================================================
6609       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6610       [  --enable-meegocontentaction           Enable meegocontentaction support],
6611          MOZ_MEEGOCONTENTACTION=1,
6612          MOZ_MEEGOCONTENTACTION=)
6614       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6616          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6617          if test "$_LIB_FOUND"; then
6618             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6619             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6620             MOZ_ENABLE_CONTENTACTION=1
6621             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6622             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6623          fi
6624       fi
6626       MOZ_ARG_ENABLE_BOOL(meegotouch,
6627       [  --enable-meegotouch  Enable meegotouch support],
6628          MOZ_MEEGOTOUCHENABLED=1,
6629          MOZ_MEEGOTOUCHENABLED=)
6631       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6632           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6633           if test "$_LIB_FOUND"; then
6634               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6635               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6636               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6637           else
6638               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6639           fi
6640       fi
6641    fi
6643    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6644    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6645    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6646    if test "$_LIB_FOUND"; then
6647       MOZ_MAEMO_LIBLOCATION=1
6648       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6649    else
6650       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6651    fi
6652    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6654    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6655    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6656    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6657    if test "$_LIB_FOUND"; then
6658       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6659       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6660    else
6661       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6662    fi
6663    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6665    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6666    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6669 dnl ========================================================
6670 dnl = XRender Composite
6671 dnl ========================================================
6672 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6673 [  --enable-egl-xrender-composite
6674                           Enable EGL xrender composite optimizations],
6675     MOZ_EGL_XRENDER_COMPOSITE=1)
6677 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6678     AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6681 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6683 dnl ========================================================
6684 dnl GL provider
6685 dnl ========================================================
6686 MOZ_GL_PROVIDER=
6687 MOZ_ARG_WITH_STRING(gl-provider,
6688 [  --with-gl-provider=ID
6689                           Set GL provider backend type],
6690 [ val=`echo $withval`
6691     MOZ_GL_PROVIDER="$val"])
6693 if test -n "$MOZ_GL_PROVIDER"; then
6694 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6695 AC_SUBST(MOZ_GL_PROVIDER)
6696 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6698 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6700 dnl ========================================================
6701 dnl = faststripe theme
6702 dnl ========================================================
6703 MOZ_ARG_ENABLE_BOOL(faststripe,
6704 [  --enable-faststripe     Use faststripe theme],
6705     MOZ_THEME_FASTSTRIPE=1,
6706     MOZ_THEME_FASTSTRIPE= )
6707 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6709 dnl ========================================================
6710 dnl =
6711 dnl = Feature options that require extra sources to be pulled
6712 dnl =
6713 dnl ========================================================
6714 dnl MOZ_ARG_HEADER(Features that require extra sources)
6716 dnl ========================================================
6717 dnl =
6718 dnl = Debugging Options
6719 dnl =
6720 dnl ========================================================
6721 MOZ_ARG_HEADER(Debugging and Optimizations)
6723 dnl ========================================================
6724 dnl = Disable building with debug info.
6725 dnl = Debugging is OFF by default
6726 dnl ========================================================
6727 if test -z "$MOZ_DEBUG_FLAGS"; then
6728   MOZ_DEBUG_FLAGS="-g"
6731 MOZ_ARG_ENABLE_STRING(debug,
6732 [  --enable-debug[=DBG]    Enable building with developer debug info
6733                            (using compiler flags DBG)],
6734 [ if test "$enableval" != "no"; then
6735     MOZ_DEBUG=1
6736     if test -n "$enableval" -a "$enableval" != "yes"; then
6737         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6738         _MOZ_DEBUG_FLAGS_SET=1
6739     fi
6740   else
6741     MOZ_DEBUG=
6742   fi ],
6743   MOZ_DEBUG=)
6745 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6746 MOZ_ARG_WITH_STRING(debug-label,
6747 [  --with-debug-label=LABELS
6748                           Define DEBUG_<value> for each comma-separated
6749                           value given.],
6750 [ for option in `echo $withval | sed 's/,/ /g'`; do
6751     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6752 done])
6754 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6756 if test -n "$MOZ_DEBUG"; then
6757     AC_MSG_CHECKING([for valid debug flags])
6758     _SAVE_CFLAGS=$CFLAGS
6759     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6760     AC_TRY_COMPILE([#include <stdio.h>],
6761         [printf("Hello World\n");],
6762         _results=yes,
6763         _results=no)
6764     AC_MSG_RESULT([$_results])
6765     if test "$_results" = "no"; then
6766         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6767     fi
6768     CFLAGS=$_SAVE_CFLAGS
6771 dnl ========================================================
6772 dnl enable mobile optimizations
6773 dnl ========================================================
6774 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6775 [  --enable-mobile-optimize
6776                           Enable mobile optimizations],
6777     MOZ_GFX_OPTIMIZE_MOBILE=1)
6779 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6781 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6782     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6785 dnl ========================================================
6786 dnl = Enable code optimization. ON by default.
6787 dnl ========================================================
6788 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6789         MOZ_OPTIMIZE_FLAGS="-O"
6792 MOZ_ARG_ENABLE_STRING(optimize,
6793 [  --disable-optimize      Disable compiler optimization
6794   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6795 [ if test "$enableval" != "no"; then
6796     MOZ_OPTIMIZE=1
6797     if test -n "$enableval" -a "$enableval" != "yes"; then
6798         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6799         MOZ_OPTIMIZE=2
6800     fi
6801 else
6802     MOZ_OPTIMIZE=
6803 fi ], MOZ_OPTIMIZE=1)
6805 MOZ_SET_FRAMEPTR_FLAGS
6807 if test "$COMPILE_ENVIRONMENT"; then
6808 if test -n "$MOZ_OPTIMIZE"; then
6809     AC_MSG_CHECKING([for valid optimization flags])
6810     _SAVE_CFLAGS=$CFLAGS
6811     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6812     AC_TRY_COMPILE([#include <stdio.h>],
6813         [printf("Hello World\n");],
6814         _results=yes,
6815         _results=no)
6816     AC_MSG_RESULT([$_results])
6817     if test "$_results" = "no"; then
6818         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6819     fi
6820     CFLAGS=$_SAVE_CFLAGS
6822 fi # COMPILE_ENVIRONMENT
6824 AC_SUBST(MOZ_OPTIMIZE)
6825 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6826 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6827 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6828 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6829 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6830 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6832 dnl ========================================================
6833 dnl = Enable generation of debug symbols
6834 dnl ========================================================
6835 MOZ_ARG_ENABLE_STRING(debug-symbols,
6836 [  --enable-debug-symbols[=DBG]
6837                           Enable debugging symbols (using compiler flags DBG)],
6838 [ if test "$enableval" != "no"; then
6839       MOZ_DEBUG_SYMBOLS=1
6840       if test -n "$enableval" -a "$enableval" != "yes"; then
6841           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6842               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6843           else
6844               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6845           fi
6846       fi
6847   else
6848       MOZ_DEBUG_SYMBOLS=
6849   fi ],
6850   MOZ_DEBUG_SYMBOLS=1)
6852 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6853     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6854     export MOZ_DEBUG_SYMBOLS
6857 dnl ========================================================
6858 dnl = Enable any treating of compile warnings as errors
6859 dnl ========================================================
6860 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6861 [  --enable-warnings-as-errors
6862                           Enable treating of warnings as errors],
6863     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6864     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6865 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6866    WARNINGS_AS_ERRORS=''
6869 dnl ========================================================
6870 dnl = Disable runtime logging checks
6871 dnl ========================================================
6872 MOZ_ARG_DISABLE_BOOL(logging,
6873 [  --disable-logging       Disable logging facilities],
6874     NS_DISABLE_LOGGING=1,
6875     NS_DISABLE_LOGGING= )
6876 if test "$NS_DISABLE_LOGGING"; then
6877     AC_DEFINE(NS_DISABLE_LOGGING)
6878 else
6879     AC_DEFINE(MOZ_LOGGING)
6882 dnl ========================================================
6883 dnl = This will enable logging of addref, release, ctor, dtor.
6884 dnl ========================================================
6885 _ENABLE_LOGREFCNT=42
6886 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6887 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6888     _ENABLE_LOGREFCNT=1,
6889     _ENABLE_LOGREFCNT= )
6890 if test "$_ENABLE_LOGREFCNT" = "1"; then
6891     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6892 elif test -z "$_ENABLE_LOGREFCNT"; then
6893     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6896 dnl ========================================================
6897 dnl moz_dump_painting
6898 dnl ========================================================
6899 MOZ_ARG_ENABLE_BOOL(dump-painting,
6900 [  --enable-dump-painting          Enable paint debugging.],
6901     MOZ_DUMP_PAINTING=1,
6902     MOZ_DUMP_PAINTING= )
6903 if test -n "$MOZ_DUMP_PAINTING"; then
6904     AC_DEFINE(MOZ_DUMP_PAINTING)
6905     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6907 if test -n "$MOZ_DEBUG"; then
6908     AC_DEFINE(MOZ_DUMP_PAINTING)
6911 dnl ========================================================
6912 dnl = Enable trace malloc
6913 dnl ========================================================
6914 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6915 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6916 [  --enable-trace-malloc   Enable malloc tracing; also disables jemalloc],
6917     NS_TRACE_MALLOC=1,
6918     NS_TRACE_MALLOC= )
6919 if test "$NS_TRACE_MALLOC"; then
6920   # Please, Mr. Linker Man, don't take away our symbol names
6921   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6922   USE_ELF_DYNSTR_GC=
6923   AC_DEFINE(NS_TRACE_MALLOC)
6925 AC_SUBST(NS_TRACE_MALLOC)
6927 dnl ========================================================
6928 dnl = Enable jemalloc
6929 dnl ========================================================
6930 MOZ_ARG_ENABLE_BOOL(jemalloc,
6931 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6932     MOZ_MEMORY=1,
6933     MOZ_MEMORY=)
6935 if test "$NS_TRACE_MALLOC"; then
6936     MOZ_MEMORY=
6938 if test "$MOZ_DMD"; then
6939     MOZ_MEMORY=
6942 if test "${OS_TARGET}" = "Android"; then
6943   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6944   :
6945 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6946   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6947   if test -z "$GNU_CC"; then
6948     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6949   else
6950     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6951   fi
6952 else
6953   dnl On other Unix systems, we only want to link executables against mozglue
6954   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6955   dnl On other Unix systems, where mozglue is a static library, jemalloc is
6956   dnl separated for the SDK, so we need to add it here.
6957   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6958     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6959   fi
6960   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6961   if test -n "$GNU_CC"; then
6962     dnl And we need mozglue symbols to be exported.
6963     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6964   fi
6965   if test "$MOZ_LINKER" = 1; then
6966     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
6967   fi
6970 if test -z "$MOZ_MEMORY"; then
6971   case "${target}" in
6972     *-mingw*)
6973       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6974         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.])
6975       fi
6976       ;;
6977   esac
6978 else
6979   dnl Don't try to run compiler tests on Windows
6980   if test "$OS_ARCH" = "WINNT"; then
6981     if test -z "$HAVE_64BIT_OS"; then
6982       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6983     else
6984       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6985     fi
6986   else
6987     AC_CHECK_SIZEOF([int *], [4])
6988     case "${ac_cv_sizeof_int_p}" in
6989     4)
6990       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6991       ;;
6992     8)
6993       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6994       ;;
6995     *)
6996       AC_MSG_ERROR([Unexpected pointer size])
6997       ;;
6998     esac
6999   fi
7001   AC_DEFINE(MOZ_MEMORY)
7002   if test -n "$MOZ_JEMALLOC"; then
7003     AC_DEFINE(MOZ_JEMALLOC)
7004   fi
7005   if test "x$MOZ_DEBUG" = "x1"; then
7006     AC_DEFINE(MOZ_MEMORY_DEBUG)
7007   fi
7008   dnl The generic feature tests that determine how to compute ncpus are long and
7009   dnl complicated.  Therefore, simply define special cpp variables for the
7010   dnl platforms we have special knowledge of.
7011   case "${target}" in
7012   *-darwin*)
7013     AC_DEFINE(MOZ_MEMORY_DARWIN)
7014     ;;
7015   *-*freebsd*)
7016     AC_DEFINE(MOZ_MEMORY_BSD)
7017     ;;
7018   *-android*|*-linuxandroid*)
7019     AC_DEFINE(MOZ_MEMORY_LINUX)
7020     AC_DEFINE(MOZ_MEMORY_ANDROID)
7021     _WRAP_MALLOC=1
7022     MOZ_GLUE_LDFLAGS=
7023     ;;
7024   *-*linux*)
7025     AC_DEFINE(MOZ_MEMORY_LINUX)
7026     ;;
7027   *-netbsd*)
7028     AC_DEFINE(MOZ_MEMORY_BSD)
7029     ;;
7030   *-solaris*)
7031     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7032     ;;
7033   *-mingw*)
7034     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7035     if test -z "$MOZ_DEBUG"; then
7036       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7037     else
7038       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7039     fi
7040     dnl Look for a broken crtdll.obj
7041     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7042     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7043     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7044       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7045       dnl Also pass this to NSPR/NSS
7046       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7047     else
7048       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7049     fi
7050     rm crtdll.obj
7052     export DLLFLAGS
7053     ;;
7054   *)
7055     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7056     ;;
7057   esac
7058 fi # MOZ_MEMORY
7059 AC_SUBST(MOZ_MEMORY)
7060 AC_SUBST(MOZ_JEMALLOC)
7061 AC_SUBST(MOZ_GLUE_LDFLAGS)
7062 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7063 AC_SUBST(WIN32_CRT_LIBS)
7064 dnl Need to set this for make because NSS doesn't have configure
7065 AC_SUBST(DLLFLAGS)
7067 dnl We need to wrap dlopen and related functions on Android because we use
7068 dnl our own linker.
7069 if test "$OS_TARGET" = Android; then
7070     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7071     if test -n "$MOZ_OLD_LINKER"; then
7072         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7073     fi
7074     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7075     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7078 dnl ========================================================
7079 dnl = Use malloc wrapper lib
7080 dnl ========================================================
7081 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7082 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7083     _WRAP_MALLOC=1,
7084     _WRAP_MALLOC= )
7086 if test -n "$_WRAP_MALLOC"; then
7087     if test -n "$GNU_CC"; then
7088         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7089         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7090         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7091         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7092         dnl Wrap operator new and operator delete on Android.
7093         if test "$OS_TARGET" = "Android"; then
7094             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7095         fi
7096     else
7097         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7098     fi
7101 dnl ========================================================
7102 dnl = Location of malloc wrapper lib
7103 dnl ========================================================
7104 MOZ_ARG_WITH_STRING(wrap-malloc,
7105 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7106     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7108 dnl ========================================================
7109 dnl = Use JS Call tracing
7110 dnl ========================================================
7111 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7112 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7113     MOZ_TRACE_JSCALLS=1,
7114     MOZ_TRACE_JSCALLS= )
7115 if test -n "$MOZ_TRACE_JSCALLS"; then
7116     AC_DEFINE(MOZ_TRACE_JSCALLS)
7119 dnl ========================================================
7120 dnl = Use incremental GC
7121 dnl ========================================================
7122 JSGC_INCREMENTAL=1
7123 MOZ_ARG_DISABLE_BOOL(gcincremental,
7124 [  --disable-gcincremental Disable incremental GC],
7125     JSGC_INCREMENTAL= )
7126 if test -n "$JSGC_INCREMENTAL"; then
7127     AC_DEFINE(JSGC_INCREMENTAL)
7130 dnl ========================================================
7131 dnl ETW - Event Tracing for Windows
7132 dnl ========================================================
7133 MOZ_ARG_ENABLE_BOOL(ETW,
7134 [  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting],
7135     MOZ_ETW=1,
7136     MOZ_ETW= )
7137 if test -n "$MOZ_ETW"; then
7138     AC_DEFINE(MOZ_ETW)
7141 if test -n "$MOZ_ETW"; then
7142     if test -z "$MOZ_WINSDK_TARGETVER"; then
7143         AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7144     fi
7147 dnl ========================================================
7148 dnl Zealous JavaScript GC
7149 dnl ========================================================
7150 MOZ_ARG_ENABLE_BOOL(gczeal,
7151 [  --enable-gczeal         Enable zealous JavaScript GCing],
7152     JS_GC_ZEAL=1,
7153     JS_GC_ZEAL= )
7154 if test -n "$JS_GC_ZEAL"; then
7155     AC_DEFINE(JS_GC_ZEAL)
7158 dnl ========================================================
7159 dnl JS opt-mode assertions and minidump instrumentation
7160 dnl ========================================================
7161 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7162 [  --enable-js-diagnostics
7163                           Enable JS diagnostic assertions and breakpad data],
7164     JS_CRASH_DIAGNOSTICS=1,
7165     JS_CRASH_DIAGNOSTICS= )
7166 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7167     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7170 dnl ======================================================
7171 dnl = Enable compiling with ccache
7172 dnl ======================================================
7173 MOZ_ARG_WITH_STRING(ccache,
7174 [  --with-ccache[=path/to/ccache]
7175                           Enable compiling with ccache],
7176     CCACHE=$withval, CCACHE="no")
7178 if test "$CCACHE" != "no"; then
7179     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7180         CCACHE=
7181     else
7182         if test ! -e "$CCACHE"; then
7183             AC_MSG_ERROR([$CCACHE not found])
7184         fi
7185     fi
7186     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7187     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7188         AC_MSG_ERROR([ccache not found])
7189     elif test -x "$CCACHE"; then
7190         CC="$CCACHE $CC"
7191         CXX="$CCACHE $CXX"
7192     else
7193         AC_MSG_ERROR([$CCACHE is not executable])
7194     fi
7197 dnl ========================================================
7198 dnl = Enable static checking using gcc-dehydra
7199 dnl ========================================================
7201 MOZ_ARG_WITH_STRING(static-checking,
7202 [  --with-static-checking=path/to/gcc_dehydra.so
7203                           Enable static checking of code using GCC-dehydra],
7204     DEHYDRA_PATH=$withval,
7205     DEHYDRA_PATH= )
7207 if test -n "$DEHYDRA_PATH"; then
7208     if test ! -f "$DEHYDRA_PATH"; then
7209         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7210     fi
7211     AC_DEFINE(NS_STATIC_CHECKING)
7213 AC_SUBST(DEHYDRA_PATH)
7215 dnl ========================================================
7216 dnl = Enable stripping of libs & executables
7217 dnl ========================================================
7218 MOZ_ARG_ENABLE_BOOL(strip,
7219 [  --enable-strip          Enable stripping of libs & executables ],
7220     ENABLE_STRIP=1,
7221     ENABLE_STRIP= )
7223 dnl ========================================================
7224 dnl = Enable stripping of libs & executables when packaging
7225 dnl ========================================================
7226 MOZ_ARG_ENABLE_BOOL(install-strip,
7227 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7228     PKG_SKIP_STRIP= ,
7229     PKG_SKIP_STRIP=1)
7231 dnl ========================================================
7232 dnl = --enable-elf-dynstr-gc
7233 dnl ========================================================
7234 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7235 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7236     USE_ELF_DYNSTR_GC=1,
7237     USE_ELF_DYNSTR_GC= )
7239 dnl ========================================================
7240 dnl = --disable-elf-hack
7241 dnl ========================================================
7243 USE_ELF_HACK=1
7244 MOZ_ARG_DISABLE_BOOL(elf-hack,
7245 [  --disable-elf-hack      Disable elf hacks],
7246     USE_ELF_HACK=,
7247     USE_ELF_HACK=1)
7249 # Disable elf hack for profiling because the built in profiler
7250 # doesn't read the segments properly with elf hack. This is
7251 # temporary and should be fixed soon in the profiler.
7252 if test "$MOZ_PROFILING" = 1; then
7253   USE_ELF_HACK=
7256 # Only enable elfhack where supported
7257 if test "$USE_ELF_HACK" = 1; then
7258     case "${HOST_OS_ARCH},${OS_ARCH}" in
7259     Linux,Linux)
7260         case "${CPU_ARCH}" in
7261         arm | x86 | x86_64)
7262             USE_ELF_HACK=1
7263             ;;
7264         *)
7265             USE_ELF_HACK=
7266             ;;
7267         esac
7268         ;;
7269     *)
7270         USE_ELF_HACK=
7271         ;;
7272     esac
7275 if test "$USE_ELF_HACK" = 1; then
7276     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7277     dnl memory addresses it maps to. The result is that by the time elfhack
7278     dnl kicks in, it is not possible to apply relocations because of that,
7279     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7280     dnl segment. It makes elfhack mostly useless, so considering the problems
7281     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7282     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7283     dnl the linker creates PT_GNU_RELRO segments.
7284     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7285         LINK_WITH_PT_GNU_RELRO,
7286         [echo "int main() {return 0;}" > conftest.${ac_ext}
7287          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7288             test -s conftest${ac_exeext}; then
7289             if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7290                 LINK_WITH_PT_GNU_RELRO=yes
7291             else
7292                 LINK_WITH_PT_GNU_RELRO=no
7293             fi
7294          else
7295              dnl We really don't expect to get here, but just in case
7296              AC_ERROR([couldn't compile a simple C file])
7297          fi
7298          rm -rf conftest*])
7299     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7300         AC_MSG_WARN([Disabling elfhack])
7301         USE_ELF_HACK=
7302     fi
7305 dnl ========================================================
7306 dnl = libstdc++ compatibility hacks
7307 dnl ========================================================
7309 STDCXX_COMPAT=
7310 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7311 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7312     STDCXX_COMPAT=1)
7314 AC_SUBST(STDCXX_COMPAT)
7316 if test -n "$STDCXX_COMPAT"; then
7317    eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7318    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7319    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7322 dnl ========================================================
7323 dnl =
7324 dnl = Profiling and Instrumenting
7325 dnl =
7326 dnl ========================================================
7327 MOZ_ARG_HEADER(Profiling and Instrumenting)
7329 dnl ========================================================
7330 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7331 dnl = timing for identifying code bottlenecks
7332 dnl = NS_FUNCTION_TIMER is off by default.
7333 dnl ========================================================
7334 MOZ_ARG_ENABLE_BOOL(functiontimer,
7335 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7336     NS_FUNCTION_TIMER=1,
7337     NS_FUNCTION_TIMER= )
7338 if test -n "$NS_FUNCTION_TIMER"; then
7339     AC_DEFINE(NS_FUNCTION_TIMER)
7342 dnl ========================================================
7343 dnl = Enable runtime visual profiling logger
7344 dnl ========================================================
7345 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7346 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7347     MOZ_VISUAL_EVENT_TRACER=1,
7348     MOZ_VISUAL_EVENT_TRACER=)
7349 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7350     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7353 dnl ========================================================
7354 dnl Turn on reflow counting
7355 dnl ========================================================
7356 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7357 [  --enable-reflow-perf    Enable reflow performance tracing],
7358     MOZ_REFLOW_PERF=1,
7359     MOZ_REFLOW_PERF= )
7360 if test -n "$MOZ_REFLOW_PERF"; then
7361     AC_DEFINE(MOZ_REFLOW_PERF)
7364 dnl ========================================================
7365 dnl Enable code size metrics.
7366 dnl ========================================================
7367 MOZ_ARG_ENABLE_BOOL(codesighs,
7368 [  --enable-codesighs      Enable code size analysis tools],
7369     _ENABLE_CODESIGHS=1,
7370     _ENABLE_CODESIGHS= )
7371 if test -n "$_ENABLE_CODESIGHS"; then
7372     if test -d $srcdir/tools/codesighs; then
7373         MOZ_MAPINFO=1
7374     else
7375         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7376     fi
7379 dnl ========================================================
7380 dnl = Enable Radio Interface for B2G (Gonk usually)
7381 dnl ========================================================
7382 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7383 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7384     MOZ_B2G_RIL=1,
7385     MOZ_B2G_RIL= )
7386 if test -n "$MOZ_B2G_RIL"; then
7387    AC_DEFINE(MOZ_B2G_RIL)
7389 AC_SUBST(MOZ_B2G_RIL)
7391 dnl ========================================================
7392 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7393 dnl ========================================================
7394 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7395 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7396     MOZ_B2G_BT=1,
7397     MOZ_B2G_BT= )
7398 if test -n "$MOZ_B2G_BT"; then
7399    AC_DEFINE(MOZ_B2G_BT)
7401 AC_SUBST(MOZ_B2G_BT)
7403 dnl ========================================================
7404 dnl = Enable Support for System Messages API
7405 dnl ========================================================
7407 AC_SUBST(MOZ_SYS_MSG)
7409 dnl ========================================================
7410 dnl = Support for demangling undefined symbols
7411 dnl ========================================================
7412 if test -z "$SKIP_LIBRARY_CHECKS"; then
7413     AC_LANG_SAVE
7414     AC_LANG_CPLUSPLUS
7415     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7416     AC_LANG_RESTORE
7419 # Demangle only for debug or trace-malloc builds
7420 MOZ_DEMANGLE_SYMBOLS=
7421 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7422     MOZ_DEMANGLE_SYMBOLS=1
7423     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7425 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7427 dnl ========================================================
7428 dnl = Support for gcc stack unwinding (from gcc 3.3)
7429 dnl ========================================================
7430 if test -z "$SKIP_LIBRARY_CHECKS"; then
7431     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7434 dnl ========================================================
7435 dnl JIT observers
7436 dnl ========================================================
7438 MOZ_ARG_WITH_STRING(jitreport-granularity,
7439 [  --jitreport-granularity=N
7440                            Default granularity at which to report JIT code
7441                            to external tools
7442                              0 - no info
7443                              1 - code ranges for whole functions only
7444                              2 - per-line information
7445                              3 - per-op information],
7446   JITREPORT_GRANULARITY=$withval,
7447   JITREPORT_GRANULARITY=3)
7449 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7451 dnl ========================================================
7452 dnl =
7453 dnl = Misc. Options
7454 dnl =
7455 dnl ========================================================
7456 MOZ_ARG_HEADER(Misc. Options)
7458 dnl ========================================================
7459 dnl update xterm title
7460 dnl ========================================================
7461 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7462 [  --enable-xterm-updates  Update XTERM titles with current command.],
7463     MOZ_UPDATE_XTERM=1,
7464     MOZ_UPDATE_XTERM= )
7466 dnl =========================================================
7467 dnl = Chrome format
7468 dnl =========================================================
7469 MOZ_ARG_ENABLE_STRING([chrome-format],
7470 [  --enable-chrome-format=jar|flat|both|symlink|omni
7471                           Select FORMAT of chrome files (default=jar)],
7472     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7474 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7475     MOZ_CHROME_FILE_FORMAT=jar
7478 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7479     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7480     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7481     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7482     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7483     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7486 dnl =========================================================
7487 dnl Omnijar packaging (bug 552121)
7488 dnl =========================================================
7489 dnl Omnijar packaging is compatible with flat packaging.
7490 dnl In unpackaged builds, omnijar looks for files as if
7491 dnl things were flat packaged. After packaging, all files
7492 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7493 dnl is set to flat since putting files into jars is only
7494 dnl done during packaging with omnijar.
7495 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7496     MOZ_OMNIJAR=1
7497     AC_DEFINE(MOZ_OMNIJAR)
7498     if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7499         MOZ_CHROME_FILE_FORMAT=flat
7500     else
7501         MOZ_CHROME_FILE_FORMAT=symlink
7502     fi
7503 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7504     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7507 OMNIJAR_NAME=omni.ja
7508 AC_SUBST(OMNIJAR_NAME)
7509 AC_SUBST(MOZ_OMNIJAR)
7511 dnl ========================================================
7512 dnl = Define default location for MOZILLA_FIVE_HOME
7513 dnl ========================================================
7514 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7515 [  --with-default-mozilla-five-home
7516                           Set the default value for MOZILLA_FIVE_HOME],
7517 [ val=`echo $withval`
7518   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7520 dnl ========================================================
7521 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7522 dnl ========================================================
7523 MOZ_ARG_WITH_STRING(user-appdir,
7524 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7525 [ val=`echo $withval`
7526 if echo "$val" | grep "\/" >/dev/null; then
7527     AC_MSG_ERROR("Homedir must be single relative path.")
7528 else
7529     MOZ_USER_DIR="$val"
7530 fi])
7532 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7534 dnl ========================================================
7535 dnl = Doxygen configuration
7536 dnl ========================================================
7537 dnl Use commas to specify multiple dirs to this arg
7538 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7539 MOZ_ARG_WITH_STRING(doc-input-dirs,
7540 [  --with-doc-input-dirs=DIRS
7541                           Header/idl dirs to create docs from],
7542 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7543 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7545 dnl Use commas to specify multiple dirs to this arg
7546 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7547 MOZ_ARG_WITH_STRING(doc-include-dirs,
7548 [  --with-doc-include-dirs=DIRS
7549                           Include dirs to preprocess doc headers],
7550 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7551 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7553 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7554 MOZ_ARG_WITH_STRING(doc-output-dir,
7555 [  --with-doc-output-dir=DIR
7556                           Dir to generate docs into],
7557 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7558 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7560 if test -z "$SKIP_COMPILER_CHECKS"; then
7561 dnl ========================================================
7562 dnl =
7563 dnl = Compiler Options
7564 dnl =
7565 dnl ========================================================
7566 MOZ_ARG_HEADER(Compiler Options)
7568 dnl ========================================================
7569 dnl Check for gcc -pipe support
7570 dnl ========================================================
7571 AC_MSG_CHECKING([for -pipe support])
7572 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7573     dnl Any gcc that supports firefox supports -pipe.
7574     CFLAGS="$CFLAGS -pipe"
7575     CXXFLAGS="$CXXFLAGS -pipe"
7576     AC_MSG_RESULT([yes])
7577 else
7578     AC_MSG_RESULT([no])
7581 dnl ========================================================
7582 dnl Profile guided optimization (gcc checks)
7583 dnl ========================================================
7584 dnl Test for profiling options
7585 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7587 _SAVE_CFLAGS="$CFLAGS"
7588 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7590 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7591 AC_TRY_COMPILE([], [return 0;],
7592                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7593                  result="yes" ], result="no")
7594 AC_MSG_RESULT([$result])
7596 if test $result = "yes"; then
7597   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7598   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7599   PROFILE_USE_LDFLAGS="-fprofile-use"
7602 CFLAGS="$_SAVE_CFLAGS"
7604 if test -n "$INTEL_CC"; then
7605   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7606   PROFILE_GEN_LDFLAGS=
7607   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7608   PROFILE_USE_LDFLAGS=
7611 dnl Sun Studio on Solaris
7612 if test "$SOLARIS_SUNPRO_CC"; then
7613   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7614   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7615   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7616   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7619 AC_SUBST(PROFILE_GEN_CFLAGS)
7620 AC_SUBST(PROFILE_GEN_LDFLAGS)
7621 AC_SUBST(PROFILE_USE_CFLAGS)
7622 AC_SUBST(PROFILE_USE_LDFLAGS)
7624 AC_LANG_CPLUSPLUS
7626 dnl ========================================================
7627 dnl Test for -pedantic bustage
7628 dnl ========================================================
7629 MOZ_ARG_DISABLE_BOOL(pedantic,
7630 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7631 _PEDANTIC= )
7632 if test "$_PEDANTIC"; then
7633     _SAVE_CXXFLAGS=$CXXFLAGS
7634     CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7635     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7636     AC_TRY_COMPILE([$configure_static_assert_macros],
7637                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7638                    result="no", result="yes" )
7639     AC_MSG_RESULT([$result])
7640     CXXFLAGS="$_SAVE_CXXFLAGS"
7642     case "$result" in
7643     no)
7644         _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7645         _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7646         ;;
7647     yes)
7648         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7649         ;;
7650     esac
7653 dnl ========================================================
7654 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7655 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7656 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7657 dnl ========================================================
7658 _SAVE_CXXFLAGS=$CXXFLAGS
7659 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7660 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7661     ac_nscap_nonconst_opeq_bug,
7662     [AC_TRY_COMPILE([
7663                       template <class T>
7664                       class Pointer
7665                         {
7666                         public:
7667                           T* myPtr;
7668                         };
7670                       template <class T, class U>
7671                       int operator==(const Pointer<T>& rhs, U* lhs)
7672                         {
7673                           return rhs.myPtr == lhs;
7674                         }
7676                       template <class T, class U>
7677                       int operator==(const Pointer<T>& rhs, const U* lhs)
7678                         {
7679                           return rhs.myPtr == lhs;
7680                         }
7681                     ],
7682                     [
7683                       Pointer<int> foo;
7684                       const int* bar;
7685                       return foo == bar;
7686                     ],
7687                     ac_nscap_nonconst_opeq_bug="no",
7688                     ac_nscap_nonconst_opeq_bug="yes")])
7689 CXXFLAGS="$_SAVE_CXXFLAGS"
7691 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7692     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7694 fi # ! SKIP_COMPILER_CHECKS
7696 AC_DEFINE(CPP_THROW_NEW, [throw()])
7697 AC_LANG_C
7699 if test "$COMPILE_ENVIRONMENT"; then
7700 MOZ_EXPAND_LIBS
7701 fi # COMPILE_ENVIRONMENT
7703 dnl ========================================================
7704 dnl =
7705 dnl = Build depencency options
7706 dnl =
7707 dnl ========================================================
7708 MOZ_ARG_HEADER(Build dependencies)
7710 dnl ========================================================
7711 dnl = Do not auto generate dependency info
7712 dnl ========================================================
7713 MOZ_AUTO_DEPS=1
7714 MOZ_ARG_DISABLE_BOOL(auto-deps,
7715 [  --disable-auto-deps     Do not automatically generate dependency info],
7716     MOZ_AUTO_DEPS=,
7717     MOZ_AUTO_DEPS=1)
7719 if test -n "$MOZ_AUTO_DEPS"; then
7720 dnl ========================================================
7721 dnl = Use mkdepend instead of $CC -MD for dependency generation
7722 dnl ========================================================
7723 _cpp_md_flag=
7724 MOZ_ARG_DISABLE_BOOL(md,
7725 [  --disable-md            Do not use compiler-based dependencies ],
7726   [_cpp_md_flag=],
7727   [_cpp_md_flag=1],
7728   [dnl Default is to turn on -MD if using GNU-compatible compilers
7729    if test "$GNU_CC" -a "$GNU_CXX"; then
7730      _cpp_md_flag=1
7731    fi
7732   dnl Default is to use -xM if using Sun Studio on Solaris
7733    if test "$SOLARIS_SUNPRO_CC"; then
7734      _cpp_md_flag=1
7735    fi])
7736 if test "$_cpp_md_flag"; then
7737   COMPILER_DEPEND=1
7738   _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
7739   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7740   if test "$SOLARIS_SUNPRO_CC"; then
7741     _DEPEND_CFLAGS=
7742   fi
7743 else
7744   COMPILER_DEPEND=
7745   dnl Don't override this for MSVC
7746   if test -z "$_WIN32_MSVC"; then
7747     _USE_CPP_INCLUDE_FLAG=
7748     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7749     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7750   else
7751     echo '#include <stdio.h>' > dummy-hello.c
7752     changequote(,)
7753     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7754     changequote([,])
7755     if test -z "$CL_INCLUDES_PREFIX"; then
7756         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7757     fi
7758     AC_SUBST(CL_INCLUDES_PREFIX)
7759     rm -f dummy-hello.c
7760     dnl cl.py provides dependency generation for MSVC
7761     CC_WRAPPER='$(PYTHON) -O $(topsrcdir)/build/cl.py'
7762     CXX_WRAPPER='$(PYTHON) -O $(topsrcdir)/build/cl.py'
7763     COMPILER_DEPEND=1
7764   fi
7766 fi # MOZ_AUTO_DEPS
7767 MDDEPDIR='.deps'
7768 AC_SUBST(MOZ_AUTO_DEPS)
7769 AC_SUBST(COMPILER_DEPEND)
7770 AC_SUBST(MDDEPDIR)
7771 AC_SUBST(CC_WRAPPER)
7772 AC_SUBST(CXX_WRAPPER)
7775 dnl ========================================================
7776 dnl =
7777 dnl = Static Build Options
7778 dnl =
7779 dnl ========================================================
7780 MOZ_ARG_HEADER(Static build options)
7782 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7783 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7784   ENABLE_SHARED_JS=1
7787 MOZ_ARG_ENABLE_BOOL(shared-js,
7788 [  --enable-shared-js
7789                           Create a shared JavaScript library.],
7790     ENABLE_SHARED_JS=1,
7791     ENABLE_SHARED_JS=)
7793 if test -n "$ENABLE_SHARED_JS"; then
7794   JS_SHARED_LIBRARY=1
7795   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7796 else
7797   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7798   AC_DEFINE(MOZ_STATIC_JS)
7800 AC_SUBST(JS_SHARED_LIBRARY)
7802 AC_SUBST(LIBXUL_LIBS)
7803 XPCOM_LIBS="$LIBXUL_LIBS"
7805 dnl ========================================================
7806 dnl =
7807 dnl = Standalone module options
7808 dnl =
7809 dnl ========================================================
7810 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7812 dnl Check for GLib.
7813 dnl ========================================================
7815 if test -z "$SKIP_PATH_CHECKS"; then
7816 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7817     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7818         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7819     fi
7823 if test -z "${GLIB_GMODULE_LIBS}" \
7824    -a -n "${GLIB_CONFIG}"\
7825     -a "${GLIB_CONFIG}" != no\
7826 ; then
7827     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7830 AC_SUBST(GLIB_CFLAGS)
7831 AC_SUBST(GLIB_LIBS)
7832 AC_SUBST(GLIB_GMODULE_LIBS)
7834 dnl ========================================================
7835 dnl Graphics checks.
7836 dnl ========================================================
7838 if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7839 MOZ_ENABLE_SKIA=1
7840 else
7841 MOZ_ENABLE_SKIA=
7844 MOZ_ARG_ENABLE_BOOL(skia,
7845 [  --enable-skia   Enable use of Skia],
7846 MOZ_ENABLE_SKIA=1,
7847 MOZ_ENABLE_SKIA=)
7849 if test "$USE_FC_FREETYPE"; then
7850     if test "$COMPILE_ENVIRONMENT"; then
7851         dnl ========================================================
7852         dnl = Check for freetype2 and its functionality
7853         dnl ========================================================
7854         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7856         if test "$_HAVE_FREETYPE2"; then
7857             _SAVE_LIBS="$LIBS"
7858             _SAVE_CFLAGS="$CFLAGS"
7859             LIBS="$LIBS $FT2_LIBS"
7860             CFLAGS="$CFLAGS $FT2_CFLAGS"
7862             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7863                 ac_cv_member_FT_Bitmap_Size_y_ppem,
7864                 [AC_TRY_COMPILE([#include <ft2build.h>
7865                                  #include FT_FREETYPE_H],
7866                                 [FT_Bitmap_Size s;
7867                                  if (sizeof s.y_ppem) return 0;
7868                                  return 1],
7869                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7870                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7871             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7872                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7873             else
7874                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7875             fi
7876             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7877                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7878                                [FT_Bitmap_Size structure includes y_ppem field])
7880             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7882             LIBS="$_SAVE_LIBS"
7883             CFLAGS="$_SAVE_CFLAGS"
7884         fi
7886         _SAVE_CPPFLAGS="$CPPFLAGS"
7887         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7888         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7889             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7890         CPPFLAGS="$_SAVE_CPPFLAGS"
7891     else
7892         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7893     fi
7896 dnl ========================================================
7897 dnl Check for pixman and cairo
7898 dnl ========================================================
7900 MOZ_TREE_CAIRO=1
7901 MOZ_ARG_ENABLE_BOOL(system-cairo,
7902 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
7903 MOZ_TREE_CAIRO=,
7904 MOZ_TREE_CAIRO=1 )
7906 MOZ_TREE_PIXMAN=1
7907 MOZ_ARG_ENABLE_BOOL(system-pixman,
7908 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7909 MOZ_TREE_PIXMAN=,
7910 MOZ_TREE_PIXMAN=force,
7911 MOZ_TREE_PIXMAN=1 )
7913 # System cairo depends on system pixman
7914 if test "$MOZ_TREE_PIXMAN" = "force"; then
7915     if test -z "$MOZ_TREE_CAIRO"; then
7916         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7917     else
7918         MOZ_TREE_PIXMAN=1
7919     fi
7920 elif test -z "$MOZ_TREE_CAIRO"; then
7921     MOZ_TREE_PIXMAN=
7924 if test "$MOZ_TREE_PIXMAN"; then
7925     AC_DEFINE(MOZ_TREE_PIXMAN)
7926     MOZ_PIXMAN_CFLAGS=""
7927     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7928 else
7929     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7930     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7931     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7933 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7934 AC_SUBST(MOZ_PIXMAN_LIBS)
7936 # Check for headers defining standard int types.
7937 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7939 if test "$MOZ_TREE_CAIRO"; then
7940     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7941     AC_DEFINE(MOZ_TREE_CAIRO)
7943     # For now we assume that we will have a uint64_t available through
7944     # one of the above headers or mozstdint.h.
7945     AC_DEFINE(HAVE_UINT64_T)
7947     # Define macros for cairo-features.h
7948     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7949     if test "$MOZ_X11"; then
7950         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7951         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7952         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7953         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7954         MOZ_ENABLE_CAIRO_FT=1
7955         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7956     fi
7957     case "$MOZ_WIDGET_TOOLKIT" in
7958       qt)
7959         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7960         ;;
7961       cocoa | uikit)
7962         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7963         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7964         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7965         ;;
7966       windows)
7967         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7968         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7969         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7970             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7971             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7972             MOZ_ENABLE_D2D_SURFACE=1
7973             MOZ_ENABLE_DWRITE_FONT=1
7974         else
7975             WIN32_DWRITE_FONT_FEATURE=
7976             WIN32_D2D_SURFACE_FEATURE=
7977         fi
7979         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7981         dnl D3D10 Layers depend on D2D Surfaces.
7982         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7983           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7984         fi
7985         ;;
7986       os2)
7987         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7988         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7989         MOZ_ENABLE_CAIRO_FT=1
7990         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7991         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7992         CAIRO_FT_LIBS=""
7993         ;;
7994     esac
7995     if test "$USE_FC_FREETYPE"; then
7996         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7997     fi
7998     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7999     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8000     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8001     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8002     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8003     AC_SUBST(CAIRO_FT_CFLAGS)
8005     AC_SUBST(PS_SURFACE_FEATURE)
8006     AC_SUBST(PDF_SURFACE_FEATURE)
8007     AC_SUBST(SVG_SURFACE_FEATURE)
8008     AC_SUBST(XLIB_SURFACE_FEATURE)
8009     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8010     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8011     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8012     AC_SUBST(WIN32_SURFACE_FEATURE)
8013     AC_SUBST(OS2_SURFACE_FEATURE)
8014     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8015     AC_SUBST(FT_FONT_FEATURE)
8016     AC_SUBST(FC_FONT_FEATURE)
8017     AC_SUBST(WIN32_FONT_FEATURE)
8018     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8019     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8020     AC_SUBST(QUARTZ_FONT_FEATURE)
8021     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8022     AC_SUBST(QT_SURFACE_FEATURE)
8023     AC_SUBST(TEE_SURFACE_FEATURE)
8025     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8026     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8028     if test "$MOZ_X11"; then
8029         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8030     fi
8032     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8033     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8035 else
8036     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8037     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8038     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8039     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8040     if test "$MOZ_X11"; then
8041         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8042         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8043         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8044         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8045     fi
8048 AC_SUBST(MOZ_TREE_CAIRO)
8049 AC_SUBST(MOZ_CAIRO_CFLAGS)
8050 AC_SUBST(MOZ_CAIRO_LIBS)
8051 AC_SUBST(MOZ_CAIRO_OSLIBS)
8052 AC_SUBST(MOZ_TREE_PIXMAN)
8054 dnl ========================================================
8055 dnl qcms
8056 dnl ========================================================
8058 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8059 AC_SUBST(QCMS_LIBS)
8061 dnl ========================================================
8062 dnl HarfBuzz
8063 dnl ========================================================
8064 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8065 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8067 dnl ========================================================
8068 dnl SIL Graphite
8069 dnl ========================================================
8070 if test "$MOZ_GRAPHITE"; then
8071   MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8072   AC_DEFINE(MOZ_GRAPHITE)
8073 else
8074   MOZ_GRAPHITE_LIBS=
8076 AC_SUBST(MOZ_GRAPHITE)
8077 AC_SUBST(MOZ_GRAPHITE_LIBS)
8079 dnl ========================================================
8080 dnl OTS
8081 dnl ========================================================
8082 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8083 AC_SUBST(MOZ_OTS_LIBS)
8085 dnl ========================================================
8086 dnl Skia 
8087 dnl ========================================================
8088 if test "$MOZ_ENABLE_SKIA"; then
8089   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8090   AC_DEFINE(MOZ_ENABLE_SKIA)
8091 else
8092   MOZ_SKIA_LIBS=
8094 AC_SUBST(MOZ_ENABLE_SKIA)
8095 AC_SUBST(MOZ_SKIA_LIBS)
8097 dnl ========================================================
8098 dnl disable xul
8099 dnl ========================================================
8100 MOZ_ARG_DISABLE_BOOL(xul,
8101 [  --disable-xul           Disable XUL],
8102     MOZ_XUL= )
8103 if test "$MOZ_XUL"; then
8104   AC_DEFINE(MOZ_XUL)
8105 else
8106   dnl remove extensions that require XUL
8107   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8110 AC_SUBST(MOZ_XUL)
8112 dnl ========================================================
8113 dnl disable profile locking
8114 dnl   do no use this in applications that can have more than
8115 dnl   one process accessing the profile directory.
8116 dnl ========================================================
8117 MOZ_ARG_DISABLE_BOOL(profilelocking,
8118 [  --disable-profilelocking
8119                           Disable profile locking],
8120     MOZ_PROFILELOCKING=,
8121     MOZ_PROFILELOCKING=1 )
8122 if test "$MOZ_PROFILELOCKING"; then
8123   AC_DEFINE(MOZ_PROFILELOCKING)
8126 dnl ========================================================
8127 dnl necko configuration options
8128 dnl ========================================================
8131 dnl option to disable various necko protocols
8133 MOZ_ARG_ENABLE_STRING(necko-protocols,
8134 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8135                           Enable/disable specific protocol handlers],
8136 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8137     if test "$option" = "yes" -o "$option" = "all"; then
8138         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8139     elif test "$option" = "no" -o "$option" = "none"; then
8140         NECKO_PROTOCOLS=""
8141     elif test "$option" = "default"; then
8142         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8143     elif test `echo "$option" | grep -c \^-` != 0; then
8144         option=`echo $option | sed 's/^-//'`
8145         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8146     else
8147         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8148     fi
8149 done],
8150     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8151 dnl Remove dupes
8152 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8153 AC_SUBST(NECKO_PROTOCOLS)
8154 for p in $NECKO_PROTOCOLS; do
8155     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8156 done
8159 dnl option to disable necko's wifi scanner
8161 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8162 [  --disable-necko-wifi    Disable necko wifi scanner],
8163     NECKO_WIFI=,
8164     NECKO_WIFI=1)
8166 if test "$OS_ARCH" = "OS2"; then
8167   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8168   NECKO_WIFI=
8170 if test "$NECKO_WIFI" -a \
8171         "$OS_ARCH" != "Linux" -a \
8172         "$OS_ARCH" != "Darwin" -a \
8173         "$OS_ARCH" != "SunOS" -a \
8174         "$OS_ARCH" != "WINNT"; then
8175   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8178 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8179 then
8180   MOZ_CHECK_HEADER([iwlib.h])
8181   if test "$ac_cv_header_iwlib_h" != "yes"; then
8182     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])
8183   fi
8186 if test "$NECKO_WIFI"; then
8187   AC_DEFINE(NECKO_WIFI)
8189 AC_SUBST(NECKO_WIFI)
8192 dnl option to disable cookies
8194 MOZ_ARG_DISABLE_BOOL(cookies,
8195 [  --disable-cookies       Disable cookie support],
8196     NECKO_COOKIES=,
8197     NECKO_COOKIES=1)
8198 AC_SUBST(NECKO_COOKIES)
8199 if test "$NECKO_COOKIES"; then
8200     AC_DEFINE(NECKO_COOKIES)
8204 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8206 MOZ_ARG_DISABLE_BOOL(ctypes,
8207 [  --disable-ctypes        Disable js-ctypes],
8208     BUILD_CTYPES=,
8209     BUILD_CTYPES=1)
8210 AC_SUBST(BUILD_CTYPES)
8211 if test "$BUILD_CTYPES"; then
8212     AC_DEFINE(BUILD_CTYPES)
8215 dnl NECKO_ configuration options are not global
8216 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8218 dnl Build Places if required
8219 if test "$MOZ_PLACES"; then
8220   AC_DEFINE(MOZ_PLACES)
8223 dnl Build Apps in the Cloud (AITC) if required
8224 AC_SUBST(MOZ_SERVICES_AITC)
8225 if test -n "$MOZ_SERVICES_AITC"; then
8226   AC_DEFINE(MOZ_SERVICES_AITC)
8229 dnl Build Notifications if required
8230 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8231 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8232   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8235 dnl Build Sync Services if required
8236 AC_SUBST(MOZ_SERVICES_SYNC)
8237 if test -n "$MOZ_SERVICES_SYNC"; then
8238   AC_DEFINE(MOZ_SERVICES_SYNC)
8241 dnl ========================================================
8242 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8243     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8246 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8247   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8250 if test "$MOZ_APP_COMPONENT_MODULES"; then
8251   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8254 dnl ========================================================
8255 dnl =
8256 dnl = Maintainer debug option (no --enable equivalent)
8257 dnl =
8258 dnl ========================================================
8260 AC_SUBST(AR)
8261 AC_SUBST(AR_FLAGS)
8262 AC_SUBST(AR_LIST)
8263 AC_SUBST(AR_EXTRACT)
8264 AC_SUBST(AR_DELETE)
8265 AC_SUBST(AS)
8266 AC_SUBST(ASFLAGS)
8267 AC_SUBST(AS_DASH_C_FLAG)
8268 AC_SUBST(LD)
8269 AC_SUBST(RC)
8270 AC_SUBST(RCFLAGS)
8271 AC_SUBST(MC)
8272 AC_SUBST(WINDRES)
8273 AC_SUBST(IMPLIB)
8274 AC_SUBST(FILTER)
8275 AC_SUBST(BIN_FLAGS)
8276 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8277 AC_SUBST(MOZ_UPDATE_XTERM)
8278 AC_SUBST(MOZ_PLATFORM_MAEMO)
8279 AC_SUBST(MOZ_AUTH_EXTENSION)
8280 AC_SUBST(MOZ_PERMISSIONS)
8281 AC_SUBST(MOZ_XTF)
8282 AC_SUBST(MOZ_PREF_EXTENSIONS)
8283 AC_SUBST(MOZ_JS_LIBS)
8284 AC_SUBST(MOZ_PSM)
8285 AC_SUBST(MOZ_DEBUG)
8286 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8287 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8288 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8289 AC_SUBST(MOZ_DEBUG_FLAGS)
8290 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8291 AC_SUBST(WARNINGS_AS_ERRORS)
8292 AC_SUBST(MOZ_EXTENSIONS)
8293 AC_SUBST(MOZ_JSDEBUGGER)
8294 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8295 AC_SUBST(MOZ_JPROF)
8296 AC_SUBST(MOZ_SHARK)
8297 AC_SUBST(MOZ_CALLGRIND)
8298 AC_SUBST(MOZ_VTUNE)
8299 AC_SUBST(MOZ_ETW)
8300 AC_SUBST(MOZ_PROFILING)
8301 AC_SUBST(LIBICONV)
8302 AC_SUBST(MOZ_PLACES)
8303 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8304 AC_SUBST(MOZ_FEEDS)
8305 AC_SUBST(NS_PRINTING)
8306 AC_SUBST(MOZ_WEBGL)
8307 AC_SUBST(MOZ_HELP_VIEWER)
8308 AC_SUBST(TOOLCHAIN_PREFIX)
8310 AC_SUBST(JAVA)
8311 AC_SUBST(JAVAC)
8312 AC_SUBST(JAR)
8314 AC_SUBST(MOZ_PROFILELOCKING)
8316 AC_SUBST(ENABLE_TESTS)
8317 AC_SUBST(ENABLE_MARIONETTE)
8318 AC_SUBST(IBMBIDI)
8319 AC_SUBST(MOZ_UNIVERSALCHARDET)
8320 AC_SUBST(ACCESSIBILITY)
8321 AC_SUBST(MOZ_SPELLCHECK)
8322 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8323 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8324 AC_SUBST(MOZ_CRASHREPORTER)
8325 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8326 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8327 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8328 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8329 AC_SUBST(MOZ_UPDATER)
8330 AC_SUBST(MOZ_ANGLE_RENDERER)
8331 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8332 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8333 AC_SUBST(MOZ_D3DX9_VERSION)
8334 AC_SUBST(MOZ_D3DX9_CAB)
8335 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8336 AC_SUBST(MOZ_D3DX9_DLL)
8337 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8338 AC_SUBST(MOZ_METRO)
8340 AC_SUBST(MOZ_ANDROID_HISTORY)
8341 AC_SUBST(MOZ_WEBSMS_BACKEND)
8342 AC_SUBST(ENABLE_STRIP)
8343 AC_SUBST(PKG_SKIP_STRIP)
8344 AC_SUBST(STRIP_FLAGS)
8345 AC_SUBST(USE_ELF_DYNSTR_GC)
8346 AC_SUBST(USE_ELF_HACK)
8347 AC_SUBST(INCREMENTAL_LINKER)
8348 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8349 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8351 AC_SUBST(MOZ_FIX_LINK_PATHS)
8352 AC_SUBST(XPCOM_LIBS)
8353 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8354 AC_SUBST(XPCOM_GLUE_LDOPTS)
8355 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8356 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8357 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8359 AC_SUBST(USE_DEPENDENT_LIBS)
8361 AC_SUBST(MOZ_BUILD_ROOT)
8362 AC_SUBST(MOZ_OS2_TOOLS)
8364 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8365 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8366 AC_SUBST(MOZ_LINKER_EXTRACT)
8367 AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
8369 dnl ========================================================
8370 dnl = Mac bundle name prefix
8371 dnl ========================================================
8372 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8373 [  --with-macbundlename-prefix=prefix
8374                           Prefix for MOZ_MACBUNDLE_NAME],
8375 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8377 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8378 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8379   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8382 if test "$MOZ_DEBUG"; then
8383   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8384 else
8385   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8387 AC_SUBST(MOZ_MACBUNDLE_NAME)
8389 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8390 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8391 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8392 if test "$MOZ_DEBUG"; then
8393   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8396 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8397 AC_SUBST(MOZ_MACBUNDLE_ID)
8399 # The following variables are available to branding and application
8400 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8401 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8402 # impacts profile location and user-visible fields.
8403 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8404 # versions of a given application (e.g. Aurora and Firefox both use
8405 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8406 # for application.ini's "Name" field, which controls profile location in
8407 # the absence of a "Profile" field (see below), and various system
8408 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8409 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8410 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8411 # builds (e.g. Aurora for Firefox).
8412 # - MOZ_APP_VERSION: Defines the application version number.
8413 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8414 # defaults to a lowercase form of MOZ_APP_BASENAME.
8415 # - MOZ_APP_PROFILE: When set, used for application.ini's
8416 # "Profile" field, which controls profile location.
8417 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8418 # crash reporter server url.
8419 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8420 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8422 if test -z "$MOZ_APP_NAME"; then
8423    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8426 # For extensions and langpacks, we require a max version that is compatible
8427 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8428 # 10.0a1 and 10.0a2 aren't affected
8429 # 10.0 becomes 10.0.*
8430 # 10.0.1 becomes 10.0.*
8431 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8432 if test -z "$IS_ALPHA"; then
8433   changequote(,)
8434   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8435   changequote([,])
8436 else
8437   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8440 AC_SUBST(MOZ_APP_NAME)
8441 AC_SUBST(MOZ_APP_DISPLAYNAME)
8442 AC_SUBST(MOZ_APP_BASENAME)
8443 AC_SUBST(MOZ_APP_VENDOR)
8444 AC_SUBST(MOZ_APP_PROFILE)
8445 AC_SUBST(MOZ_APP_ID)
8446 AC_SUBST(MAR_CHANNEL_ID)
8447 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8448 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8449 AC_SUBST(MOZ_EXTENSION_MANAGER)
8450 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8451 AC_SUBST(MOZ_APP_UA_NAME)
8452 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8453 AC_SUBST(MOZ_APP_VERSION)
8454 AC_SUBST(MOZ_APP_MAXVERSION)
8455 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8456 AC_SUBST(FIREFOX_VERSION)
8458 # We can't use the static application.ini data when building against
8459 # a libxul SDK.
8460 if test -n "$LIBXUL_SDK"; then
8461     MOZ_APP_STATIC_INI=
8463 AC_SUBST(MOZ_APP_STATIC_INI)
8465 AC_SUBST(MOZ_PKG_SPECIAL)
8467 AC_SUBST(MOZILLA_OFFICIAL)
8469 if test "$MOZ_TELEMETRY_REPORTING"; then
8470     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8473 dnl win32 options
8474 AC_SUBST(MOZ_MAPINFO)
8475 AC_SUBST(MOZ_BROWSE_INFO)
8476 AC_SUBST(MOZ_TOOLS_DIR)
8477 AC_SUBST(WIN32_REDIST_DIR)
8478 AC_SUBST(MAKENSISU)
8480 dnl Echo the CFLAGS to remove extra whitespace.
8481 CFLAGS=`echo \
8482         $_WARNINGS_CFLAGS \
8483         $CFLAGS`
8485 CXXFLAGS=`echo \
8486         $_WARNINGS_CXXFLAGS \
8487         $CXXFLAGS`
8489 COMPILE_CFLAGS=`echo \
8490     $_DEFINES_CFLAGS \
8491         $_DEPEND_CFLAGS \
8492     $COMPILE_CFLAGS`
8494 COMPILE_CXXFLAGS=`echo \
8495     $_DEFINES_CXXFLAGS \
8496         $_DEPEND_CFLAGS \
8497     $COMPILE_CXXFLAGS`
8499 AC_SUBST(MOZ_NATIVE_MAKEDEPEND)
8500 AC_SUBST(SYSTEM_LIBXUL)
8501 AC_SUBST(MOZ_NATIVE_JPEG)
8502 AC_SUBST(MOZ_NATIVE_PNG)
8503 AC_SUBST(MOZ_NATIVE_BZ2)
8505 AC_SUBST(MOZ_FLEXBOX)
8506 AC_SUBST(MOZ_JPEG_CFLAGS)
8507 AC_SUBST(MOZ_JPEG_LIBS)
8508 AC_SUBST(MOZ_BZ2_CFLAGS)
8509 AC_SUBST(MOZ_BZ2_LIBS)
8510 AC_SUBST(MOZ_PNG_CFLAGS)
8511 AC_SUBST(MOZ_PNG_LIBS)
8513 AC_SUBST(NSPR_CFLAGS)
8514 AC_SUBST(NSPR_LIBS)
8515 AC_SUBST(MOZ_NATIVE_NSPR)
8517 AC_SUBST(NSS_CFLAGS)
8518 AC_SUBST(NSS_LIBS)
8519 AC_SUBST(NSS_DEP_LIBS)
8520 AC_SUBST(MOZ_NATIVE_NSS)
8521 AC_SUBST(NSS_DISABLE_DBM)
8523 OS_CFLAGS="$CFLAGS"
8524 OS_CXXFLAGS="$CXXFLAGS"
8525 OS_CPPFLAGS="$CPPFLAGS"
8526 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8527 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8528 OS_LDFLAGS="$LDFLAGS"
8529 OS_LIBS="$LIBS"
8530 AC_SUBST(OS_CFLAGS)
8531 AC_SUBST(OS_CXXFLAGS)
8532 AC_SUBST(OS_CPPFLAGS)
8533 AC_SUBST(OS_COMPILE_CFLAGS)
8534 AC_SUBST(OS_COMPILE_CXXFLAGS)
8535 AC_SUBST(OS_LDFLAGS)
8536 AC_SUBST(OS_LIBS)
8537 AC_SUBST(CROSS_COMPILE)
8538 AC_SUBST(WCHAR_CFLAGS)
8540 AC_SUBST(HOST_CC)
8541 AC_SUBST(HOST_CXX)
8542 AC_SUBST(HOST_CFLAGS)
8543 AC_SUBST(HOST_CXXFLAGS)
8544 AC_SUBST(HOST_LDFLAGS)
8545 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8546 AC_SUBST(HOST_AR)
8547 AC_SUBST(HOST_AR_FLAGS)
8548 AC_SUBST(HOST_LD)
8549 AC_SUBST(HOST_RANLIB)
8550 AC_SUBST(HOST_NSPR_MDCPUCFG)
8551 AC_SUBST(HOST_BIN_SUFFIX)
8552 AC_SUBST(HOST_OS_ARCH)
8554 AC_SUBST(TARGET_CPU)
8555 AC_SUBST(TARGET_VENDOR)
8556 AC_SUBST(TARGET_OS)
8557 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8558 AC_SUBST(TARGET_MD_ARCH)
8559 AC_SUBST(TARGET_XPCOM_ABI)
8560 AC_SUBST(OS_TARGET)
8561 AC_SUBST(OS_ARCH)
8562 AC_SUBST(OS_RELEASE)
8563 AC_SUBST(OS_TEST)
8564 AC_SUBST(CPU_ARCH)
8565 AC_SUBST(INTEL_ARCHITECTURE)
8567 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8569 AC_SUBST(WRAP_LDFLAGS)
8570 AC_SUBST(MKSHLIB)
8571 AC_SUBST(MKCSHLIB)
8572 AC_SUBST(MKSHLIB_FORCE_ALL)
8573 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8574 AC_SUBST(DSO_CFLAGS)
8575 AC_SUBST(DSO_PIC_CFLAGS)
8576 AC_SUBST(DSO_LDOPTS)
8577 AC_SUBST(LIB_PREFIX)
8578 AC_SUBST(DLL_PREFIX)
8579 AC_SUBST(DLL_SUFFIX)
8580 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8581 AC_SUBST(LIB_SUFFIX)
8582 AC_SUBST(OBJ_SUFFIX)
8583 AC_SUBST(BIN_SUFFIX)
8584 AC_SUBST(ASM_SUFFIX)
8585 AC_SUBST(IMPORT_LIB_SUFFIX)
8586 AC_SUBST(USE_N32)
8587 AC_SUBST(CC_VERSION)
8588 AC_SUBST(CXX_VERSION)
8589 AC_SUBST(MSMANIFEST_TOOL)
8590 AC_SUBST(NS_ENABLE_TSF)
8591 AC_SUBST(MOZ_NSS_PATCH)
8592 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8593 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8595 AC_SUBST(MOZ_MEDIA)
8596 AC_SUBST(MOZ_SYDNEYAUDIO)
8597 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8598 AC_SUBST(MOZ_CUBEB)
8599 AC_SUBST(MOZ_WAVE)
8600 AC_SUBST(MOZ_VORBIS)
8601 AC_SUBST(MOZ_TREMOR)
8602 AC_SUBST(MOZ_OPUS)
8603 AC_SUBST(MOZ_WEBM)
8604 AC_SUBST(MOZ_MEDIA_PLUGINS)
8605 AC_SUBST(MOZ_OMX_PLUGIN)
8606 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8607 AC_SUBST(MOZ_VP8_ENCODER)
8608 AC_SUBST(MOZ_VP8)
8609 AC_SUBST(MOZ_OGG)
8610 AC_SUBST(MOZ_ALSA_LIBS)
8611 AC_SUBST(MOZ_ALSA_CFLAGS)
8612 AC_SUBST(VPX_AS)
8613 AC_SUBST(VPX_ASFLAGS)
8614 AC_SUBST(VPX_DASH_C_FLAG)
8615 AC_SUBST(VPX_AS_CONVERSION)
8616 AC_SUBST(VPX_ASM_SUFFIX)
8617 AC_SUBST(VPX_X86_ASM)
8618 AC_SUBST(VPX_ARM_ASM)
8619 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8620 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8621 AC_SUBST(LIBJPEG_TURBO_AS)
8622 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8623 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8624 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8625 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8627 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8629 AC_MSG_CHECKING([for posix_fallocate])
8630 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8631   #include <fcntl.h>],
8632                  [posix_fallocate(0, 0, 0);],
8633                  [ac_cv___posix_fallocate=true],
8634                  [ac_cv___posix_fallocate=false])
8636 if test "$ac_cv___posix_fallocate" = true ; then
8637   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8638   AC_MSG_RESULT(yes)
8639 else
8640   AC_MSG_RESULT(no)
8643 dnl Check for missing components
8644 if test "$COMPILE_ENVIRONMENT"; then
8645 if test "$MOZ_X11"; then
8646     if test "$WITHOUT_X11"; then
8647         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8648     fi
8649     dnl ====================================================
8650     dnl = Check if X headers exist
8651     dnl ====================================================
8652     _SAVE_CFLAGS=$CFLAGS
8653     CFLAGS="$CFLAGS $XCFLAGS"
8654     AC_TRY_COMPILE([
8655         #include <stdio.h>
8656         #include <stdlib.h>
8657         #include <X11/Xlib.h>
8658         #include <X11/Intrinsic.h>
8659         #include <X11/extensions/XShm.h>
8660     ],
8661     [
8662         Display *dpy = 0;
8663         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8664             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8665             exit(1);
8666         }
8667     ], [],
8668     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8669     CFLAGS="$_SAVE_CFLAGS"
8671     if test -n "$MISSING_X"; then
8672         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8673     fi
8675 fi # MOZ_X11
8677 dnl Check for headers, etc. needed by WebGL.
8678 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8679     MOZ_CHECK_HEADER(GL/glx.h)
8680     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8681         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))])
8682     fi
8683 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8684 fi # COMPILE_ENVIRONMENT
8686 dnl Set various defines and substitutions
8687 dnl ========================================================
8689 if test "$OS_ARCH" = "Darwin"; then
8690   AC_DEFINE(XP_UNIX)
8691   AC_DEFINE(UNIX_ASYNC_DNS)
8692 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8693   AC_DEFINE(XP_UNIX)
8694   AC_DEFINE(UNIX_ASYNC_DNS)
8697 if test "$MOZ_DEBUG"; then
8698     AC_DEFINE(MOZ_REFLOW_PERF)
8699     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8702 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8703     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8704     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8705     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8706     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8707     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8708     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8709     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8710     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8713 case "$host_os" in
8714 mingw*)
8715     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8716     ;;
8717 esac
8719 AC_SUBST(WIN_TOP_SRC)
8721 AC_SUBST(MOZILLA_VERSION)
8723 AC_SUBST(ac_configure_args)
8725 dnl Spit out some output
8726 dnl ========================================================
8728 dnl The following defines are used by xpcom
8729 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8730 CPP_THROW_NEW
8731 HAVE_CPP_2BYTE_WCHAR_T
8732 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8733 HAVE_CPP_CHAR16_T
8734 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8735 HAVE_CPP_PARTIAL_SPECIALIZATION
8736 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8737 HAVE_STATVFS
8738 NEED_CPP_UNUSED_IMPLEMENTATIONS
8739 NEW_H
8740 HAVE_GETPAGESIZE
8741 HAVE_ICONV
8742 HAVE_ICONV_WITH_CONST_INPUT
8743 HAVE_MBRTOWC
8744 HAVE_SYS_MOUNT_H
8745 HAVE_SYS_VFS_H
8746 HAVE_WCRTOMB
8749 AC_CONFIG_HEADER(
8750 netwerk/necko-config.h
8751 xpcom/xpcom-config.h
8752 xpcom/xpcom-private.h
8755 # Hack around an Apple bug that effects the egrep that comes with OS X 10.7.
8756 # "arch -arch i386 egrep" always uses the 32-bit Intel part of the egrep fat
8757 # binary, even on 64-bit systems. We (apparently) only need this hack when
8758 # egrep's "pattern" is particularly long (as in the following code).
8759 # See bug 655339.
8760 case "$host" in
8761 *-apple-darwin11*)
8762     FIXED_EGREP="arch -arch i386 egrep"
8763     ;;
8765     FIXED_EGREP="egrep"
8766     ;;
8767 esac
8769 # Save the defines header file before autoconf removes it.
8770 # (Do not add AC_DEFINE calls after this line.)
8771   _CONFIG_TMP=confdefs-tmp.h
8772   _CONFIG_DEFS_H=mozilla-config.h
8774   cat > $_CONFIG_TMP <<\EOF
8775 /* List of defines generated by configure. Included with preprocessor flag,
8776  * -include, to avoid long list of -D defines on the compile command-line.
8777  * Do not edit.
8778  */
8780 #ifndef _MOZILLA_CONFIG_H_
8781 #define _MOZILLA_CONFIG_H_
8784 _EGREP_PATTERN='^#define ('
8785 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8786     for f in $_NON_GLOBAL_ACDEFINES; do
8787         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8788     done
8790 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8792   sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8794   if test "$?" != 0; then
8795     AC_MSG_ERROR([Error outputting config definitions])
8796   fi
8798   cat >> $_CONFIG_TMP <<\EOF
8800 /* The c99 defining the limit macros (UINT32_MAX for example), says:
8801  * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
8802  * is defined before <stdint.h> is included. */
8803 #define __STDC_LIMIT_MACROS
8805 /* Force-include hunspell_alloc_hooks.h for hunspell, so that we don't need to
8806  * modify it directly.
8808  * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/Makefile.in,
8809  * unless --enable-system-hunspell is defined.
8810  */
8811 #if defined(HUNSPELL_STATIC)
8812 #include "hunspell_alloc_hooks.h"
8813 #endif
8815 #endif /* _MOZILLA_CONFIG_H_ */
8819   # Only write mozilla-config.h when something changes (or it doesn't exist)
8820   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8821     rm $_CONFIG_TMP
8822   else
8823     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8824     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8826     echo ==== $_CONFIG_DEFS_H =================================
8827     cat $_CONFIG_DEFS_H
8828   fi
8830 dnl Probably shouldn't call this manually but we always want the output of DEFS
8831 rm -f confdefs.h.save
8832 mv confdefs.h confdefs.h.save
8833 $FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8834 if test "$?" != 0; then
8835   AC_MSG_ERROR([Error outputting confdefs.h])
8837 AC_OUTPUT_MAKE_DEFS()
8838 ACDEFINES=$DEFS
8839 AC_SUBST(ACDEFINES)
8840 rm -f confdefs.h
8841 mv confdefs.h.save confdefs.h
8843 dnl Create a virtualenv where we can install local Python packages
8844 AC_MSG_RESULT([Creating Python virtualenv])
8845 rm -rf _virtualenv
8846 mkdir -p _virtualenv
8847 MACOSX_DEPLOYMENT_TARGET= PYTHONDONTWRITEBYTECODE= $PYTHON $_topsrcdir/other-licenses/virtualenv/virtualenv.py --system-site-packages ./_virtualenv
8848 case "$host_os" in
8849 mingw*)
8850     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/Scripts/python.exe
8851     ;;
8853     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
8854     ;;
8855 esac
8857 AC_SUBST(PYTHON)
8859 dnl Load the list of Makefiles to generate.
8860 dnl   To add new Makefiles, edit allmakefiles.sh.
8861 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8862 . ${srcdir}/allmakefiles.sh
8864 dnl Run a perl script to quickly create the makefiles.
8865 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8866 dnl   for the files it cannot handle correctly. This way, config.status
8867 dnl   will handle these files.
8868 dnl If it fails, nothing is set and config.status will run as usual.
8870 dnl This does not change the $MAKEFILES variable.
8872 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8873 res="$?"
8874 if test "$res" != 0; then
8875     exit $res
8877 . ./conftest.sh
8878 rm conftest.sh
8880 echo $MAKEFILES > unallmakefiles
8882 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8884 AC_OUTPUT($MAKEFILES)
8886 # Generate Makefiles for WebRTC directly from .gyp files
8887 if test "${OS_TARGET}" = "WINNT"; then
8888    if test "$HAVE_64BIT_OS"; then
8889       OS_BITS=64
8890    else
8891       OS_BITS=32
8892    fi
8893    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8896 if test -n "$MOZ_WEBRTC"; then
8897    AC_MSG_RESULT("generating WebRTC Makefiles...")
8899    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}"
8901    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8902      $GYP_WEBRTC_OPTIONS \
8903      --generator-output=${_objdir}/media/webrtc/trunk \
8904      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8905    if test "$?" != 0; then
8906       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8907    fi
8909    # XXX disable until we land the tranche with signaling
8910    if test -n "$MOZ_WEBRTC_SIGNALING"; then
8911      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8912      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8913        $GYP_WEBRTC_OPTIONS \
8914        --generator-output=${_objdir}/media/webrtc/signaling \
8915        ${srcdir}/media/webrtc/signaling/signaling.gyp
8916      if test "$?" != 0; then
8917         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8918      fi
8919    fi
8921    AC_MSG_RESULT("generating gtest Makefiles...")
8922    # Ok to pass some extra -D's that are ignored here
8923    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8924      $GYP_WEBRTC_OPTIONS \
8925      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8926      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8927    if test "$?" != 0; then
8928       AC_MSG_ERROR([failed to generate gtest Makefiles])
8929    fi
8932 # Populate the virtualenv
8933 AC_MSG_RESULT([Populating Python virtualenv])
8934 $MAKE -C build/virtualenv MACOSX_DEPLOYMENT_TARGET=  || exit 1
8936 # Generate a JSON config file for unittest harnesses etc to read
8937 # build configuration details from in a standardized way.
8938 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
8939 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8940   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8941 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8942   rm ./mozinfo.json.tmp
8943 else
8944   mv -f ./mozinfo.json.tmp ./mozinfo.json
8947 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8948 if test "$CAIRO_FEATURES_H"; then
8949   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8950     echo "$CAIRO_FEATURES_H is unchanged"
8951     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8952   else
8953     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8954   fi
8957 # Run jemalloc configure script
8959 if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
8960   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8961   if test "$OS_ARCH" = "Linux"; then
8962     MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
8963     MANGLED=
8964     JEMALLOC_WRAPPER=
8965     if test -n "$_WRAP_MALLOC"; then
8966       JEMALLOC_WRAPPER=__wrap_
8967     fi
8968     for mangle in ${MANGLE}; do
8969       if test -n "$MANGLED"; then
8970         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8971       else
8972         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8973       fi
8974     done
8975     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8976   fi
8977   unset CONFIG_FILES
8978   if test -z "$MOZ_TLS"; then
8979     ac_configure_args="$ac_configure_args --disable-tls"
8980   fi
8981   EXTRA_CFLAGS="$CFLAGS"
8982   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8983     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8984   done
8985   if test "$CROSS_COMPILE"; then
8986     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8987   fi
8988   _save_cache_file="$cache_file"
8989   cache_file=$_objdir/memory/jemalloc/src/config.cache
8990   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
8991   cache_file="$_save_cache_file"
8992   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8995 dnl Build libunwind for Android profiling builds
8996 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
8997   old_ac_configure_arg="$ac_configure_args"
8998   ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
8999   if test "$MOZ_DEBUG"; then
9000     ac_configure_args="$ac_configure_args --enable-debug"
9001   fi
9002   if test "$DSO_PIC_CFLAGS"; then
9003     ac_configure_args="$ac_configure_args --with-pic"
9004   fi
9005   ac_configure_args="$ac_configure_args \
9006       CC=\"$CC\" \
9007       CXX=\"$CXX\" \
9008       CPP=\"$CPP\" \
9009       CFLAGS=\"$CFLAGS\" \
9010       CXXFLAGS=\"$CXXFLAGS\" \
9011       CPPFLAGS=\"$CPPFLAGS\" \
9012       LD=\"$LD\" \
9013       LDFLAGS=\"$LDFLAGS\" \
9014       AR=\"$AR\" \
9015       RANLIB=\"$RANLIB\" \
9016       STRIP=\"$STRIP\" \
9017       LIBS=\"$LIBS\""
9019   # Use a separate cache file for libunwind, since it does not use caching.
9020   mkdir -p $_objdir/tools/profiler/libunwind/src
9021   old_cache_file=$cache_file
9022   cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
9023   old_config_files=$CONFIG_FILES
9024   unset CONFIG_FILES
9025   AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
9026   cache_file=$old_cache_file
9027   ac_configure_args="$old_ac_configure_args"
9028   CONFIG_FILES=$old_config_files
9031 # Run freetype configure script
9033 if test "$MOZ_TREE_FREETYPE"; then
9034    export CFLAGS="$CFLAGS -std=c99"
9035    export CPPFLAGS="$CPPFLAGS"
9036    export CXXFLAGS="$CXXFLAGS"
9037    export LDFLAGS="$LDFLAGS"
9038    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9039    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9040    AC_OUTPUT_SUBDIRS(modules/freetype2)
9043 if test -z "$direct_nspr_config"; then
9044     dnl ========================================================
9045     dnl = Setup a nice relatively clean build environment for
9046     dnl = sub-configures.
9047     dnl ========================================================
9048     CC="$_SUBDIR_CC"
9049     CXX="$_SUBDIR_CXX"
9050     CFLAGS="$_SUBDIR_CFLAGS"
9051     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9052     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9053     LDFLAGS="$_SUBDIR_LDFLAGS"
9054     HOST_CC="$_SUBDIR_HOST_CC"
9055     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9056     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9057     RC=
9060 unset MAKEFILES
9061 unset CONFIG_FILES
9063 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9064 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9066 export WRAP_LDFLAGS
9068 if test -n "$_WRAP_MALLOC"; then
9069     # Avoid doubling wrap malloc arguments
9070     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9073 if test -z "$MOZ_NATIVE_NSPR"; then
9074     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9075     if test -z "$MOZ_DEBUG"; then
9076         ac_configure_args="$ac_configure_args --disable-debug"
9077     else
9078         ac_configure_args="$ac_configure_args --enable-debug"
9079     fi
9080     if test "$MOZ_OPTIMIZE" = "1"; then
9081         ac_configure_args="$ac_configure_args --enable-optimize"
9082     elif test -z "$MOZ_OPTIMIZE"; then
9083         ac_configure_args="$ac_configure_args --disable-optimize"
9084     fi
9085     if test -n "$HAVE_64BIT_OS"; then
9086         ac_configure_args="$ac_configure_args --enable-64bit"
9087     fi
9088     if test -n "$USE_ARM_KUSER"; then
9089         ac_configure_args="$ac_configure_args --with-arm-kuser"
9090     fi
9091     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9092     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9093       # dladdr is supported by the new linker, even when the system linker doesn't
9094       # support it. Trick nspr into using dladdr when it's not supported.
9095       _SAVE_CPPFLAGS="$CPPFLAGS"
9096       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9097     fi
9098     _SAVE_LDFLAGS="$LDFLAGS"
9099     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9100     AC_OUTPUT_SUBDIRS(nsprpub)
9101     LDFLAGS="$_SAVE_LDFLAGS"
9102     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9103       unset CPPFLAGS
9104       CPPFLAGS="$_SAVE_CFLAGS"
9105     fi
9106     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9109 if test -z "$MOZ_NATIVE_NSPR"; then
9110     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9111     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9112     if test "$OS_ARCH" != "WINNT"; then
9113        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9114        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9115        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9116        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9117     fi
9118     rm -f config/autoconf.mk.bak
9121 dnl ========================================================
9122 dnl = Setup a nice relatively clean build environment for
9123 dnl = sub-configures.
9124 dnl ========================================================
9125 CC="$_SUBDIR_CC"
9126 CXX="$_SUBDIR_CXX"
9127 CFLAGS="$_SUBDIR_CFLAGS"
9128 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9129 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9130 LDFLAGS="$_SUBDIR_LDFLAGS"
9131 HOST_CC="$_SUBDIR_HOST_CC"
9132 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9133 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9136 # Run the SpiderMonkey 'configure' script.
9137 dist=$MOZ_BUILD_ROOT/dist
9138 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9139 ac_configure_args="$ac_configure_args --enable-threadsafe"
9140 if test "$BUILD_CTYPES"; then
9141     # Build js-ctypes on the platforms we can.
9142     ac_configure_args="$ac_configure_args --enable-ctypes"
9144 if test -z "$JS_SHARED_LIBRARY" ; then
9145     ac_configure_args="$ac_configure_args --disable-shared-js"
9147 if test -z "$MOZ_NATIVE_NSPR"; then
9148     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9149     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9151 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9152 ac_configure_args="$ac_configure_args --prefix=$dist"
9153 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9154 if test "$MOZ_MEMORY"; then
9155    ac_configure_args="$ac_configure_args --enable-jemalloc"
9157 if test -n "$MOZ_GLUE_LDFLAGS"; then
9158    export MOZ_GLUE_LDFLAGS
9160 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9161    export MOZ_GLUE_PROGRAM_LDFLAGS
9163 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9164    MOZ_ZLIB_LIBS=
9166 export MOZ_NATIVE_ZLIB
9167 export MOZ_ZLIB_CFLAGS
9168 export MOZ_ZLIB_LIBS
9169 export MOZ_APP_NAME
9170 export STLPORT_CPPFLAGS
9171 export STLPORT_LDFLAGS
9172 export STLPORT_LIBS
9173 AC_OUTPUT_SUBDIRS(js/src)
9174 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9176 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9178 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9179 dnl Needs to be at the end to respect possible changes from NSPR configure
9180 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9181   echo "config/autoconf.mk is unchanged"
9182   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9183 else
9184   rm -f config/autoconf.mk.orig 2> /dev/null