Merge m-c to inbound.
[gecko.git] / configure.in
blob18730281e0a39870d8940af9669d396cee8b010d
2 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
4 dnl This Source Code Form is subject to the terms of the Mozilla Public
5 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
6 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 dnl Process this file with autoconf to produce a configure script.
9 dnl ========================================================
11 AC_PREREQ(2.13)
12 AC_INIT(config/config.mk)
13 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 AC_CANONICAL_SYSTEM
15 TARGET_CPU="${target_cpu}"
16 TARGET_VENDOR="${target_vendor}"
17 TARGET_OS="${target_os}"
19 dnl ========================================================
20 dnl =
21 dnl = Don't change the following two lines.  Doing so breaks:
22 dnl =
23 dnl = CFLAGS="-foo" ./configure
24 dnl =
25 dnl ========================================================
26 CFLAGS="${CFLAGS=}"
27 CPPFLAGS="${CPPFLAGS=}"
28 CXXFLAGS="${CXXFLAGS=}"
29 LDFLAGS="${LDFLAGS=}"
30 HOST_CFLAGS="${HOST_CFLAGS=}"
31 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
32 HOST_LDFLAGS="${HOST_LDFLAGS=}"
34 dnl ========================================================
35 dnl = Preserve certain environment flags passed to configure
36 dnl = We want sub projects to receive the same flags
37 dnl = untainted by this configure script
38 dnl ========================================================
39 _SUBDIR_CC="$CC"
40 _SUBDIR_CXX="$CXX"
41 _SUBDIR_CFLAGS="$CFLAGS"
42 _SUBDIR_CPPFLAGS="$CPPFLAGS"
43 _SUBDIR_CXXFLAGS="$CXXFLAGS"
44 _SUBDIR_LDFLAGS="$LDFLAGS"
45 _SUBDIR_HOST_CC="$HOST_CC"
46 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
47 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
48 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
49 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
51 dnl Set the version number of the libs included with mozilla
52 dnl ========================================================
53 MOZJPEG=62
54 MOZPNG=10606
55 NSPR_VERSION=4
56 NSS_VERSION=3
58 dnl Set the minimum version of toolkit libs used by mozilla
59 dnl ========================================================
60 GLIB_VERSION=1.2.0
61 PERL_VERSION=5.006
62 CAIRO_VERSION=1.10
63 PANGO_VERSION=1.14.0
64 GTK2_VERSION=2.10.0
65 GTK3_VERSION=3.0.0
66 WINDRES_VERSION=2.14.90
67 W32API_VERSION=3.14
68 GNOMEVFS_VERSION=2.0
69 GNOMEUI_VERSION=2.2.0
70 GCONF_VERSION=1.2.1
71 GIO_VERSION=2.20
72 STARTUP_NOTIFICATION_VERSION=0.8
73 DBUS_VERSION=0.60
74 SQLITE_VERSION=3.8.0.2
76 MSMANIFEST_TOOL=
78 dnl Set various checks
79 dnl ========================================================
80 MISSING_X=
81 AC_PROG_AWK
83 dnl Initialize the Pthread test variables early so they can be
84 dnl  overridden by each platform.
85 dnl ========================================================
86 MOZ_USE_PTHREADS=
87 _PTHREAD_LDFLAGS=""
89 dnl Do not allow a separate objdir build if a srcdir build exists.
90 dnl ==============================================================
91 _topsrcdir=`cd \`dirname $0\`; pwd`
92 _objdir=`pwd`
94 if test "$_topsrcdir" != "$_objdir"
95 then
96   # Check for a couple representative files in the source tree
97   _conflict_files=
98   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
99     if test -f $file; then
100       _conflict_files="$_conflict_files $file"
101     fi
102   done
103   if test "$_conflict_files"; then
104     echo "***"
105     echo "*   Your source tree contains these files:"
106     for file in $_conflict_files; do
107       echo "*         $file"
108     done
109     cat 1>&2 <<-EOF
110         *   This indicates that you previously built in the source tree.
111         *   A source tree build can confuse the separate objdir build.
112         *
113         *   To clean up the source tree:
114         *     1. cd $_topsrcdir
115         *     2. gmake distclean
116         ***
117         EOF
118     exit 1
119     break
120   fi
122 MOZ_BUILD_ROOT=`pwd`
124 MOZ_PYTHON
126 MOZ_DEFAULT_COMPILER
128 COMPILE_ENVIRONMENT=1
129 MOZ_ARG_DISABLE_BOOL(compile-environment,
130 [  --disable-compile-environment
131                           Disable compiler/library checks.],
132     COMPILE_ENVIRONMENT= )
133 AC_SUBST(COMPILE_ENVIRONMENT)
135 MOZ_ARG_WITH_STRING(l10n-base,
136 [  --with-l10n-base=DIR    path to l10n repositories],
137     L10NBASEDIR=$withval)
138 if test -n "$L10NBASEDIR"; then
139     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
140         AC_MSG_ERROR([--with-l10n-base must specify a path])
141     elif test -d "$L10NBASEDIR"; then
142         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
143     else
144         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
145     fi
147 AC_SUBST(L10NBASEDIR)
149 dnl Check for Perl first -- needed for win32 SDK checks
150 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
151 if test -z "$PERL" -o "$PERL" = ":"; then
152     AC_MSG_ERROR([perl not found in \$PATH])
155 AC_SUBST(GAIADIR)
156 if test -n "$GAIADIR" ; then
157     AC_DEFINE(PACKAGE_GAIA)
160 MOZ_ARG_WITH_STRING(gonk,
161 [  --with-gonk=DIR
162                location of gonk dir],
163     gonkdir=$withval)
165 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
166 [  --with-gonk-toolchain-prefix=DIR
167                           prefix to gonk toolchain commands],
168     gonk_toolchain_prefix=$withval)
170 if test -n "$gonkdir" ; then
171     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
172     android_source="$gonkdir"
173     ANDROID_SOURCE="$android_source"
174     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
175     dnl Default to ICS
176     ANDROID_VERSION=15
177     if test -n "${PLATFORM_SDK_VERSION}"; then
178         ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
179     fi
181     dnl set up compilers
182     TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
183     AS="$gonk_toolchain_prefix"as
184     CC="$gonk_toolchain_prefix"gcc
185     CXX="$gonk_toolchain_prefix"g++
186     CPP="$gonk_toolchain_prefix"cpp
187     LD="$gonk_toolchain_prefix"ld
188     AR="$gonk_toolchain_prefix"ar
189     RANLIB="$gonk_toolchain_prefix"ranlib
190     STRIP="$gonk_toolchain_prefix"strip
191     OBJCOPY="$gonk_toolchain_prefix"objcopy
193     if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
194         AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
195     fi
196     STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
197     STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a"
199     case "$target_cpu" in
200     arm)
201         ARCH_DIR=arch-arm
202         ;;
203     i?86)
204         ARCH_DIR=arch-x86
205         ;;
206     esac
208     case "$ANDROID_VERSION" in
209     15)
210         GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
211         MOZ_B2G_BT=1
212         MOZ_B2G_CAMERA=1
213         MOZ_OMX_DECODER=1
214         AC_SUBST(MOZ_OMX_DECODER)
215         ;;
216     18)
217         GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
218         if test -d "$gonkdir/external/bluetooth/bluez"; then
219             GONK_INCLUDES+=" -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
220             MOZ_B2G_BT=1
221         fi
222         MOZ_B2G_CAMERA=1
223         MOZ_OMX_DECODER=1
224         AC_SUBST(MOZ_OMX_DECODER)
225         ;;
226     *)
227         AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
228         ;;
229     esac
230     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/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS"
231     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
232     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
233     dnl Add -llog by default, since we use it all over the place.
234     LIBS="$LIBS -llog"
236     LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ $LDFLAGS"
238     dnl prevent cross compile section from using these flags as host flags
239     if test -z "$HOST_CPPFLAGS" ; then
240         HOST_CPPFLAGS=" "
241     fi
242     if test -z "$HOST_CFLAGS" ; then
243         HOST_CFLAGS=" "
244     fi
245     if test -z "$HOST_CXXFLAGS" ; then
246         HOST_CXXFLAGS=" "
247     fi
248     if test -z "$HOST_LDFLAGS" ; then
249         HOST_LDFLAGS=" "
250     fi
252     AC_DEFINE(ANDROID)
253     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
254     AC_SUBST(ANDROID_VERSION)
255     AC_DEFINE(HAVE_SYS_UIO_H)
256     AC_DEFINE(HAVE_PTHREADS)
257     CROSS_COMPILE=1
258     MOZ_CHROME_FILE_FORMAT=omni
259     direct_nspr_config=1
260 else
261     MOZ_ANDROID_NDK
263     case "$target" in
264     *-android*|*-linuxandroid*)
265         if test -z "$ANDROID_PACKAGE_NAME" ; then
266             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
267         fi
268         MOZ_CHROME_FILE_FORMAT=omni
269         ZLIB_DIR=yes
270         ;;
271     *-linux*)
272         AC_PATH_PROG(OBJCOPY,objcopy)
273         ;;
274     esac
277 AC_SUBST(ANDROID_SOURCE)
278 AC_SUBST(ANDROID_PACKAGE_NAME)
279 AC_SUBST(OBJCOPY)
281 dnl ========================================================
282 dnl Checks for compilers.
283 dnl ========================================================
284 dnl Set CROSS_COMPILE in the environment when running configure
285 dnl to use the cross-compile setup for now
286 dnl ========================================================
288 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
289 AR_FLAGS='cr $@'
291 if test "$COMPILE_ENVIRONMENT"; then
293 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
294     MOZ_CROSS_COMPILER
295 else
296     AC_PROG_CC
297     case "$target" in
298     *-mingw*)
299       # Work around the conftest.exe access problem on Windows
300       sleep 2
301     esac
302     AC_PROG_CXX
303     AC_PROG_RANLIB
304     MOZ_PATH_PROGS(AS, $AS as, $CC)
305     AC_CHECK_PROGS(AR, ar, :)
306     AC_CHECK_PROGS(LD, ld, :)
307     AC_CHECK_PROGS(STRIP, strip, :)
308     AC_CHECK_PROGS(WINDRES, windres, :)
309     if test -z "$HOST_CC"; then
310         HOST_CC="$CC"
311     fi
312     if test -z "$HOST_CFLAGS"; then
313         HOST_CFLAGS="$CFLAGS"
314     fi
315     if test -z "$HOST_CXX"; then
316         HOST_CXX="$CXX"
317     fi
318     if test -z "$HOST_CXXFLAGS"; then
319         HOST_CXXFLAGS="$CXXFLAGS"
320     fi
321     if test -z "$HOST_LDFLAGS"; then
322         HOST_LDFLAGS="$LDFLAGS"
323     fi
324     if test -z "$HOST_RANLIB"; then
325         HOST_RANLIB="$RANLIB"
326     fi
327     if test -z "$HOST_AR"; then
328         HOST_AR="$AR"
329     fi
330     if test -z "$HOST_AR_FLAGS"; then
331         HOST_AR_FLAGS="$AR_FLAGS"
332     fi
335 if test -n "$MOZ_WINCONSOLE"; then
336     AC_DEFINE(MOZ_WINCONSOLE)
339 MOZ_TOOL_VARIABLES
341 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
342     if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
343        test "$GCC_MAJOR_VERSION" -lt 4; then
344         AC_MSG_ERROR([Only GCC 4.4 or newer supported])
345     fi
348 dnl ========================================================
349 dnl Special win32 checks
350 dnl ========================================================
352 MOZ_ARG_ENABLE_BOOL(metro,
353 [  --enable-metro           Enable Windows Metro build targets],
354     MOZ_METRO=1,
355     MOZ_METRO=)
356 if test -n "$MOZ_METRO"; then
357     AC_DEFINE(MOZ_METRO)
358     # Target the Windows 8 Kit
359     WINSDK_TARGETVER=602
360     WINVER=502
361     # toolkit/library/makefile.in needs these, see nsDllMain.
362     CRTDLLVERSION=110
363     CRTEXPDLLVERSION=1-1-0
364 else
365     # Target the Windows 7 SDK by default
366     WINSDK_TARGETVER=601
367     WINVER=502
370 AC_SUBST(CRTDLLVERSION)
371 AC_SUBST(CRTEXPDLLVERSION)
373 MOZ_ARG_WITH_STRING(windows-version,
374 [  --with-windows-version=WINSDK_TARGETVER
375                           Windows SDK version to target. Lowest version
376                           currently allowed is 601 (Win7), highest is 602 (Win8)],
377   WINSDK_TARGETVER=$withval)
379 # Currently only two sdk versions allowed, 601 and 602
380 case "$WINSDK_TARGETVER" in
381 601|602)
382     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
383     ;;
386     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
387     ;;
388 esac
390 case "$target" in
391 *-mingw*)
392     if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
393         # Check to see if we are really running in a msvc environemnt
394         _WIN32_MSVC=1
395         AC_CHECK_PROGS(MIDL, midl)
397         # Make sure compilers are valid
398         CFLAGS="$CFLAGS -TC -nologo"
399         CXXFLAGS="$CXXFLAGS -TP -nologo"
400         AC_LANG_SAVE
401         AC_LANG_C
402         AC_TRY_COMPILE([#include <stdio.h>],
403             [ printf("Hello World\n"); ],,
404             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
406         AC_LANG_CPLUSPLUS
407         AC_TRY_COMPILE([#include <new.h>],
408             [ unsigned *test = new unsigned(42); ],,
409             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
410         AC_LANG_RESTORE
412         changequote(,)
413         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
414         changequote([,])
416         # Determine compiler version
417         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
418         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
419         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
420         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
421         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
422         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
424         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
425         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
427         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
428             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
429         fi
431         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
432         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
434         if test "$_CC_MAJOR_VERSION" = "16"; then
435             _CC_SUITE=10
436             _MSVS_VERSION=2010
437         elif test "$_CC_MAJOR_VERSION" = "17"; then
438             _CC_SUITE=11
439             _MSVS_VERSION=2012
440         elif test "$_CC_MAJOR_VERSION" = "18"; then
441             _CC_SUITE=12
442             _MSVS_VERSION=2013
443         else
444             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
445         fi
447         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
449         if test -n "$WIN32_REDIST_DIR"; then
450           if test ! -d "$WIN32_REDIST_DIR"; then
451             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
452           fi
453           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
454         fi
456         dnl Confirm we have the pri tools on win8 builds
457         if test -n "$MOZ_METRO"; then
458           AC_MSG_CHECKING([for makepri])
459           AC_CHECK_PROGS(MAKEPRI, makepri, "")
460           if test -z "MAKEPRI" ; then
461               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
462           fi
463           AC_SUBST(MAKEPRI)
464         fi
466         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
467         dnl not something else like "magnetic tape manipulation utility".
468         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
469         if test -z "$MSMT_TOOL"; then
470           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
471         fi
473         changequote(,)
474         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
475         changequote([,])
476         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
477         if test -z "$MSMANIFEST_TOOL_VERSION"; then
478           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
479         fi
481         MSMANIFEST_TOOL=1
482         unset MSMT_TOOL
484         # Check linker version
485         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
486         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
487         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
488             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
489         fi
491         INCREMENTAL_LINKER=1
493         # Set midl environment
494         case "$target" in
495         i*86-*)
496             MIDL_FLAGS="${MIDL_FLAGS} -env win32"
497             ;;
498         x86_64-*)
499             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
500             ;;
501         esac
503         unset _MSVC_VER_FILTER
505         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
506             [
507                 AC_LANG_SAVE
508                 AC_LANG_CPLUSPLUS
509                 _SAVE_CXXFLAGS="$CXXFLAGS"
510                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
511                 AC_TRY_COMPILE([#include <exception>],
512                             [std::_Throw(std::exception()); return 0;],
513                             ac_cv_have_std__Throw="yes",
514                             ac_cv_have_std__Throw="no")
515                 CXXFLAGS="$_SAVE_CXXFLAGS"
516                 AC_LANG_RESTORE
517             ])
519         if test "$ac_cv_have_std__Throw" = "yes"; then
520             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
521                            ac_cv_have_dllimport_exception_bug,
522                 [
523                     AC_LANG_SAVE
524                     AC_LANG_CPLUSPLUS
525                     _SAVE_CXXFLAGS="$CXXFLAGS"
526                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
527                     AC_TRY_LINK([#include <vector>],
528                                 [std::vector<int> v; return v.at(1);],
529                                 ac_cv_have_dllimport_exception_bug="no",
530                                 ac_cv_have_dllimport_exception_bug="yes")
531                     CXXFLAGS="$_SAVE_CXXFLAGS"
532                     AC_LANG_RESTORE
533                 ])
534             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
535                 WRAP_STL_INCLUDES=1
536                 MOZ_MSVC_STL_WRAP__Throw=1
537                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
538             fi
539         else
540             AC_CACHE_CHECK(for overridable _RAISE,
541                            ac_cv_have__RAISE,
542                 [
543                     AC_LANG_SAVE
544                     AC_LANG_CPLUSPLUS
545                     _SAVE_CXXFLAGS="$CXXFLAGS"
546                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
547                     AC_TRY_COMPILE([#include <xstddef>
548                                     #undef _RAISE
549                                     #define _RAISE(x) externallyDefinedFunction((x).what())
550                                     #include <vector>
551                                    ],
552                                    [std::vector<int> v; return v.at(1);],
553                                    ac_cv_have__RAISE="no",
554                                    ac_cv_have__RAISE="yes")
555                     CXXFLAGS="$_SAVE_CXXFLAGS"
556                     AC_LANG_RESTORE
557                 ])
558             if test "$ac_cv_have__RAISE" = "yes"; then
559                 WRAP_STL_INCLUDES=1
560                 MOZ_MSVC_STL_WRAP__RAISE=1
561                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
562             else
563                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
564             fi
565         fi
567         if test "$WRAP_STL_INCLUDES" = "1"; then
568             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
569         fi
570     elif test -z "$CLANG_CC"; then
571         # Check w32api version
572         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
573         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
574         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
575         AC_TRY_COMPILE([#include <w32api.h>],
576             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
577                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
578                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
579                 #error "test failed."
580             #endif
581             , [ res=yes ], [ res=no ])
582         AC_MSG_RESULT([$res])
583         if test "$res" != "yes"; then
584             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
585         fi
586         # Check windres version
587         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
588         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
589         AC_MSG_RESULT([$_WINDRES_VERSION])
590         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
591         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
592         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
593         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
594         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
595         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
596         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
597                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
598                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
599                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
600                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
601                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
602         then
603             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
604         fi
606         AC_CHECK_PROGS(MIDL, $target-widl widl)
607         if test -n "$MIDL"; then
608             case "$target" in
609             i*86-*)
610                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
611                 ;;
612             x86_64-*)
613                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
614                 ;;
615             esac
616         fi
618         MOZ_WINSDK_MAXVER=0x06020000
619     fi # !GNU_CC
621     # If MSVC or clang
622     if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
623         MOZ_FIND_WINSDK_VERSION
624     fi
626     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
627     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
628     # Require OS features provided by IE 6.0 SP2 (XP SP2)
629     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
631     # If the maximum version supported by this SDK is lower than the target
632     # version, error out
633     AC_MSG_CHECKING([for Windows SDK being recent enough])
634     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
635         AC_MSG_RESULT("yes")
636     else
637         AC_MSG_RESULT("no")
638         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.])
639     fi
640     
641     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
642     # Definitions matching sdkddkver.h
643     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
644     AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
645     AC_SUBST(MOZ_WINSDK_MAXVER)
646     ;;
647 esac
649 AC_PROG_CPP
650 AC_PROG_CXXCPP
652 if test -n "$_WIN32_MSVC"; then
653     SKIP_PATH_CHECKS=1
654     SKIP_COMPILER_CHECKS=1
655     SKIP_LIBRARY_CHECKS=1
657     # Since we're skipping compiler and library checks, hard-code
658     # some facts here.
659     AC_DEFINE(HAVE_IO_H)
660     AC_DEFINE(HAVE_SETBUF)
661     AC_DEFINE(HAVE_ISATTY)
664 fi # COMPILE_ENVIRONMENT
666 AC_SUBST(MIDL_FLAGS)
667 AC_SUBST(_MSC_VER)
669 AC_SUBST(GNU_AS)
670 AC_SUBST(GNU_LD)
671 AC_SUBST(GNU_CC)
672 AC_SUBST(GNU_CXX)
673 AC_SUBST(INTEL_CC)
674 AC_SUBST(INTEL_CXX)
676 AC_SUBST(STL_FLAGS)
677 AC_SUBST(WRAP_STL_INCLUDES)
678 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
679 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
681 dnl ========================================================
682 dnl Checks for programs.
683 dnl ========================================================
684 AC_PROG_INSTALL
685 AC_PROG_LN_S
687 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
688 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
689 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
690 _perl_res=$?
691 AC_MSG_RESULT([$_perl_version])
693 if test "$_perl_res" != 0; then
694     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
698 AC_MSG_CHECKING([for full perl installation])
699 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
700 _perl_res=$?
701 if test "$_perl_res" != 0; then
702     AC_MSG_RESULT([no])
703     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
704 else
705     AC_MSG_RESULT([yes])
708 if test -z "$COMPILE_ENVIRONMENT"; then
709     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
711 AC_SUBST(NSINSTALL_BIN)
713 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
714 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
715 MOZ_PATH_PROGS(UNZIP, unzip)
716 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
717     AC_MSG_ERROR([unzip not found in \$PATH])
719 MOZ_PATH_PROGS(ZIP, zip)
720 if test -z "$ZIP" -o "$ZIP" = ":"; then
721     AC_MSG_ERROR([zip not found in \$PATH])
723 MOZ_PATH_PROG(XARGS, xargs)
724 if test -z "$XARGS" -o "$XARGS" = ":"; then
725     AC_MSG_ERROR([xargs not found in \$PATH .])
728 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
729 AC_SUBST(RPMBUILD)
731 if test "$COMPILE_ENVIRONMENT"; then
733 dnl ========================================================
734 dnl = Mac OS X toolchain support
735 dnl ========================================================
737 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
738 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
739 dnl when we can run target binaries.
740 AC_SUBST(UNIVERSAL_BINARY)
741 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
743 MOZ_ARG_WITH_STRING(unify-dist,
744 [  --with-unify-dist=dir   Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
745     UNIFY_DIST=$withval)
746 if test -n "$UNIVERSAL_BINARY"; then
747     if test -z "$UNIFY_DIST"; then
748         AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
749     fi
750     case "$UNIFY_DIST" in
751     /*)
752         ;;
753     *)
754         UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
755         ;;
756     esac
758 AC_SUBST(UNIFY_DIST)
760 dnl ========================================================
761 dnl Check for MacOS deployment target version
762 dnl ========================================================
764 MOZ_ARG_ENABLE_STRING(macos-target,
765                       [  --enable-macos-target=VER (default=10.6)
766                           Set the minimum MacOS version needed at runtime],
767                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
769 case "$target" in
770 *-darwin*)
771     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
772         dnl Use the specified value
773         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
774     else
775         dnl No value specified on the command line or in the environment,
776         dnl use architecture minimum.
777         export MACOSX_DEPLOYMENT_TARGET=10.6
778     fi
779     ;;
780 esac
782 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
784 dnl ========================================================
785 dnl = Mac OS X SDK support
786 dnl ========================================================
787 MACOS_SDK_DIR=
788 NEXT_ROOT=
789 MOZ_ARG_WITH_STRING(macos-sdk,
790 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
791     MACOS_SDK_DIR=$withval)
793 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
794 dnl NEXT_ROOT will be set and exported only if it's needed.
795 AC_SUBST(MACOS_SDK_DIR)
796 AC_SUBST(NEXT_ROOT)
798 if test "$MACOS_SDK_DIR"; then
799   dnl Sync this section with the ones in NSPR and NSS.
800   dnl Changes to the cross environment here need to be accounted for in
801   dnl the libIDL checks (below) and xpidl build.
803   if test ! -d "$MACOS_SDK_DIR"; then
804     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
805 specify a valid SDK.  SDKs are installed when the optional cross-development
806 tools are selected during the Xcode/Developer Tools installation.])
807   fi
809   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
810   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
812   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
813   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
814   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
816   AC_LANG_SAVE
817   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
818   AC_LANG_CPLUSPLUS
819   AC_TRY_COMPILE([#include <new>],[],
820    result=yes,
821    result=no)
822   AC_LANG_RESTORE
823   AC_MSG_RESULT($result)
825   if test "$result" = "no" ; then
826     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
827   fi
830 fi # COMPILE_ENVIRONMENT
832 AC_MSG_CHECKING([compiler version])
833 # Just print it so it shows up in the logs.
834 cc_version=$($CC --version)
835 AC_MSG_RESULT([$cc_version])
837 if test -n "$MAKE"; then
838   if test `echo $MAKE | grep -c make.py` != 1; then
839      NOT_PYMAKE=$MAKE
840   fi
843 case "$host_os" in
844 mingw*)
845     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
846     ;;
848     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
849     ;;
850 esac
851 if test "$GMAKE" = ":"; then
852    AC_MSG_ERROR([GNU make not found])
854 AC_SUBST(GMAKE)
856 if test -z "$MAKE"; then
857   MAKE=$GMAKE
860 if test "$COMPILE_ENVIRONMENT"; then
862 AC_PATH_XTRA
864 XCFLAGS="$X_CFLAGS"
866 fi # COMPILE_ENVIRONMENT
868 dnl ========================================================
869 dnl set the defaults first
870 dnl ========================================================
871 AS_BIN=$AS
872 AR_LIST='$(AR) t'
873 AR_EXTRACT='$(AR) x'
874 AR_DELETE='$(AR) d'
875 AS='$(CC)'
876 AS_DASH_C_FLAG='-c'
877 DLL_PREFIX=lib
878 LIB_PREFIX=lib
879 DLL_SUFFIX=.so
880 OBJ_SUFFIX=o
881 LIB_SUFFIX=a
882 ASM_SUFFIX=s
883 IMPORT_LIB_SUFFIX=
884 TARGET_MD_ARCH=unix
885 DIRENT_INO=d_ino
886 MOZ_USER_DIR=".mozilla"
888 MOZ_JPEG_CFLAGS=
889 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
890 MOZ_BZ2_CFLAGS=
891 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
892 MOZ_PNG_CFLAGS=
893 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
895 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
896 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
897 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
898 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)'
899 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
900 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
901 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
903 # These are specially defined on Windows only
904 case "$target" in
905 *-mingw*)
906   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
907   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
908   ;;
910   XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
911   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
912   ;;
913 esac
915 MOZ_FS_LAYOUT=unix
917 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
919 USE_DEPENDENT_LIBS=1
921 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
923 if test -n "$CROSS_COMPILE"; then
924     OS_TARGET="${target_os}"
925     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
926     OS_RELEASE=
927     case "${target_os}" in
928         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
929         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
930         gnu*)         OS_ARCH=GNU ;;
931         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
932         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
933         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
934     esac
935     case "${target}" in
936         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
937     esac
938 else
939     OS_TARGET=`uname -s`
940     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
941     OS_RELEASE=`uname -r`
944 # Before this used `uname -m` when not cross compiling
945 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
946 OS_TEST="${target_cpu}"
948 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
950 #######################################################################
951 # Master "Core Components" macros for getting the OS target           #
952 #######################################################################
955 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
956 # cross-compilation.
960 # Define and override various archtecture-specific variables, including
961 # HOST_OS_ARCH
962 # OS_ARCH
963 # OS_TEST
964 # OS_TARGET
965 # OS_RELEASE
966 # OS_MINOR_RELEASE
969 case "$HOST_OS_ARCH" in
970 mingw*)
971     HOST_OS_ARCH=WINNT
972     ;;
973 darwin*)
974     HOST_OS_ARCH=Darwin
975     ;;
976 linux*)
977     HOST_OS_ARCH=Linux
978     ;;
979 solaris*)
980     HOST_OS_ARCH=SunOS
981     SOLARIS_SUNPRO_CC=
982     SOLARIS_SUNPRO_CXX=
983     if test -z "$GNU_CC"; then
984         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
985             SOLARIS_SUNPRO_CC=1
986        fi
987     fi
989     if test -z "$GNU_CXX"; then
990        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
991            SOLARIS_SUNPRO_CXX=1
992        fi
993     fi
994     AC_SUBST(SOLARIS_SUNPRO_CC)
995     AC_SUBST(SOLARIS_SUNPRO_CXX)
996     ;;
997 OS_2)
998     HOST_OS_ARCH=OS2
999     ;;
1000 esac
1002 case "$OS_ARCH" in
1003 WINNT)
1004     if test -z "$CROSS_COMPILE" ; then
1005         OS_TEST=`uname -p`
1006     fi
1007     ;;
1008 Windows_NT)
1010 # If uname -s returns "Windows_NT", we assume that we are using
1011 # the uname.exe in MKS toolkit.
1013 # The -r option of MKS uname only returns the major version number.
1014 # So we need to use its -v option to get the minor version number.
1015 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1017     OS_ARCH=WINNT
1018     OS_TARGET=WINNT
1019     OS_MINOR_RELEASE=`uname -v`
1020     if test "$OS_MINOR_RELEASE" = "00"; then
1021         OS_MINOR_RELEASE=0
1022     fi
1023     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1024     ;;
1025 MINGW*_NT*)
1027 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1028 # the uname.exe in the MSYS tools.
1030     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1031     OS_ARCH=WINNT
1032     OS_TARGET=WINNT
1033     ;;
1034 AIX)
1035     OS_RELEASE=`uname -v`.`uname -r`
1036     OS_TEST=${target_cpu}
1037     ;;
1038 OS_2)
1039     OS_ARCH=OS2
1040     OS_TARGET=OS2
1041     OS_RELEASE=`uname -v`
1042     ;;
1043 Darwin)
1044     case "${target_cpu}" in
1045     powerpc*)
1046         OS_TEST=ppc
1047         ;;
1048     i*86*)
1049         OS_TEST=i386
1050         ;;
1051     x86_64)
1052         OS_TEST=x86_64
1053         ;;
1054     *)
1055         if test -z "$CROSS_COMPILE" ; then
1056             OS_TEST=`uname -p`
1057         fi
1058         ;;
1059     esac
1060     ;;
1061 esac
1063 # Only set CPU_ARCH if we recognize the value of OS_TEST
1065 case "$OS_TEST" in
1066 *86 | i86pc)
1067     CPU_ARCH=x86
1068     ;;
1070 powerpc64 | ppc64)
1071     CPU_ARCH=ppc64
1072     ;;
1074 powerpc | ppc | rs6000)
1075     CPU_ARCH=ppc
1076     ;;
1078 Alpha | alpha | ALPHA)
1079     CPU_ARCH=Alpha
1080     ;;
1082 s390)
1083     CPU_ARCH=s390
1084     ;;
1086 s390x)
1087     CPU_ARCH=s390x
1088     ;;
1090 hppa* | parisc)
1091     CPU_ARCH=hppa
1092     ;;
1094 sun4u | sparc*)
1095     CPU_ARCH=sparc
1096     ;;
1098 x86_64 | ia64)
1099     CPU_ARCH="$OS_TEST"
1100     ;;
1102 arm*)
1103     CPU_ARCH=arm
1104     ;;
1106 mips|mipsel)
1107     CPU_ARCH="mips"
1108     ;;
1109 esac
1111 if test -z "$OS_TARGET"; then
1112     OS_TARGET=$OS_ARCH
1114 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1116 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1117 dnl ===============================================================
1118 INTEL_ARCHITECTURE=
1119 case "$OS_TEST" in
1120     x86_64|i?86)
1121       INTEL_ARCHITECTURE=1
1122 esac
1124 dnl Configure platform-specific CPU architecture compiler options.
1125 dnl ==============================================================
1126 MOZ_ARCH_OPTS
1128 dnl =================================================================
1129 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1130 dnl which is bad when cross compiling.
1131 dnl =================================================================
1132 if test "$COMPILE_ENVIRONMENT"; then
1133 configure_static_assert_macros='
1134 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1135 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1136 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1139 dnl test that the macros actually work:
1140 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1141 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1142  [AC_LANG_SAVE
1143   AC_LANG_C
1144   ac_cv_static_assertion_macros_work="yes"
1145   AC_TRY_COMPILE([$configure_static_assert_macros],
1146                  [CONFIGURE_STATIC_ASSERT(1)],
1147                  ,
1148                  ac_cv_static_assertion_macros_work="no")
1149   AC_TRY_COMPILE([$configure_static_assert_macros],
1150                  [CONFIGURE_STATIC_ASSERT(0)],
1151                  ac_cv_static_assertion_macros_work="no",
1152                  )
1153   AC_LANG_CPLUSPLUS
1154   AC_TRY_COMPILE([$configure_static_assert_macros],
1155                  [CONFIGURE_STATIC_ASSERT(1)],
1156                  ,
1157                  ac_cv_static_assertion_macros_work="no")
1158   AC_TRY_COMPILE([$configure_static_assert_macros],
1159                  [CONFIGURE_STATIC_ASSERT(0)],
1160                  ac_cv_static_assertion_macros_work="no",
1161                  )
1162   AC_LANG_RESTORE
1163  ])
1164 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1165 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1166     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1168 fi # COMPILE_ENVIRONMENT
1170 dnl ========================================================
1171 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1172 dnl computed above.
1173 dnl ========================================================
1175 MOZ_ANDROID_STLPORT
1177 dnl ========================================================
1178 dnl Suppress Clang Argument Warnings
1179 dnl ========================================================
1180 if test -n "$CLANG_CC"; then
1181     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1182     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1184 if test -n "$CLANG_CXX"; then
1185     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1188 dnl ========================================================
1189 dnl = Use Address Sanitizer
1190 dnl ========================================================
1191 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1192 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1193     MOZ_ASAN=1,
1194     MOZ_ASAN= )
1195 if test -n "$MOZ_ASAN"; then
1196     MOZ_LLVM_HACKS=1
1197     AC_DEFINE(MOZ_ASAN)
1198     MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1200 AC_SUBST(MOZ_ASAN)
1201 AC_SUBST(LLVM_SYMBOLIZER)
1203 dnl ========================================================
1204 dnl = Enable hacks required for LLVM instrumentations
1205 dnl ========================================================
1206 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1207 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1208     MOZ_LLVM_HACKS=1,
1209     MOZ_LLVM_HACKS= )
1210 if test -n "$MOZ_LLVM_HACKS"; then
1211     MOZ_NO_WLZDEFS=1
1212     MOZ_CFLAGS_NSS=1
1214 AC_SUBST(MOZ_NO_WLZDEFS)
1215 AC_SUBST(MOZ_CFLAGS_NSS)
1217 dnl ========================================================
1218 dnl GNU specific defaults
1219 dnl ========================================================
1220 if test "$GNU_CC"; then
1221     # Per bug 719659 comment 2, some of the headers on ancient build machines
1222     # may require gnu89 inline semantics.  But otherwise, we use C99.
1223     # But on OS X we just use C99 plus GNU extensions, in order to fix
1224     # bug 917526.
1225     CFLAGS="$CFLAGS -std=gnu99"
1226     if test "${OS_ARCH}" != Darwin; then
1227         CFLAGS="$CFLAGS -fgnu89-inline"
1228     fi
1229     # FIXME: Let us build with strict aliasing. bug 414641.
1230     CFLAGS="$CFLAGS -fno-strict-aliasing"
1231     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1232     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1233     DSO_LDOPTS='-shared'
1234     if test "$GCC_USE_GNU_LD"; then
1235         # Some tools like ASan use a runtime library that is only
1236         # linked against executables, so we must allow undefined
1237         # symbols for shared objects in some cases.
1238         if test -z "$MOZ_NO_WLZDEFS"; then
1239             # Don't allow undefined symbols in libraries
1240             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1241         fi
1242     fi
1243     WARNINGS_AS_ERRORS='-Werror'
1244     DSO_CFLAGS=''
1245     DSO_PIC_CFLAGS='-fPIC'
1246     ASFLAGS="$ASFLAGS -fPIC"
1247     AC_MSG_CHECKING([for --noexecstack option to as])
1248     _SAVE_CFLAGS=$CFLAGS
1249     CFLAGS="$CFLAGS -Wa,--noexecstack"
1250     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1251                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1252                      AC_MSG_RESULT([no]))
1253     CFLAGS=$_SAVE_CFLAGS
1254     AC_MSG_CHECKING([for -z noexecstack option to ld])
1255     _SAVE_LDFLAGS=$LDFLAGS
1256     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1257     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1258                   AC_MSG_RESULT([no])
1259                   LDFLAGS=$_SAVE_LDFLAGS)
1261     AC_MSG_CHECKING([for -z text option to ld])
1262     _SAVE_LDFLAGS=$LDFLAGS
1263     LDFLAGS="$LDFLAGS -Wl,-z,text"
1264     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1265                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1266                   AC_MSG_RESULT([no])
1267                   LDFLAGS=$_SAVE_LDFLAGS)
1269     AC_MSG_CHECKING([for --build-id option to ld])
1270     _SAVE_LDFLAGS=$LDFLAGS
1271     LDFLAGS="$LDFLAGS -Wl,--build-id"
1272     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1273                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1274                   AC_MSG_RESULT([no])
1275                   LDFLAGS=$_SAVE_LDFLAGS)
1278     # Check for -mssse3 on $CC
1279     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1280     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1281     _SAVE_CFLAGS=$CFLAGS
1282     CFLAGS="$CFLAGS -mssse3"
1283     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1284                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1285                      AC_MSG_RESULT([no]))
1286     CFLAGS=$_SAVE_CFLAGS
1288     # Check for -msse4.1 on $CC
1289     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1290     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1291     _SAVE_CFLAGS=$CFLAGS
1292     CFLAGS="$CFLAGS -msse4.1"
1293     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1294                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1295                      AC_MSG_RESULT([no]))
1296     CFLAGS=$_SAVE_CFLAGS
1298     # Turn on GNU-specific warnings:
1299     # -Wall - turn on a lot of warnings
1300     # -Wpointer-arith - good to have
1301     # -Wdeclaration-after-statement - MSVC doesn't like these
1302     # -Werror=return-type - catches missing returns, zero false positives
1303     # -Wtype-limits - catches overflow bugs, few false positives
1304     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1305     # -Wsign-compare - catches comparison of signed and unsigned types
1306     #
1307     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1308     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1309     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1310     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1311     MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1313     # Turn off the following warnings that -Wall turns on:
1314     # -Wno-unused - lots of violations in third-party code
1315     #
1316     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1318     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1319        # Don't use -Wcast-align with ICC or clang
1320        case "$CPU_ARCH" in
1321            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1322            hppa | ia64 | sparc | arm)
1323            ;;
1324            *)
1325         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1326            ;;
1327        esac
1328     fi
1330     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1331     _USE_CPP_INCLUDE_FLAG=1
1332     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1334 elif test "$SOLARIS_SUNPRO_CC"; then
1335     DSO_CFLAGS=''
1336     if test "$CPU_ARCH" = "sparc"; then
1337         # for Sun Studio on Solaris/SPARC
1338         DSO_PIC_CFLAGS='-xcode=pic32'
1339     else
1340         DSO_PIC_CFLAGS='-KPIC'
1341     fi
1342     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1343 else
1344     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1345     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1347     DSO_LDOPTS='-shared'
1348     if test "$GNU_LD"; then
1349         # Don't allow undefined symbols in libraries
1350         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1351     fi
1353     DSO_CFLAGS=''
1354     DSO_PIC_CFLAGS='-KPIC'
1355     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1358 if test "$GNU_CXX"; then
1359     # FIXME: Let us build with strict aliasing. bug 414641.
1360     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1362     # Turn on GNU-specific warnings:
1363     # -Wall - turn on a lot of warnings
1364     # -Wpointer-arith - good to have
1365     # -Woverloaded-virtual - ???
1366     # -Werror=return-type - catches missing returns, zero false positives
1367     # -Wtype-limits - catches overflow bugs, few false positives
1368     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1369     # -Wsign-compare - catches comparison of signed and unsigned types
1370     #
1371     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1372     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1373     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1374     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1375     MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1377     # Turn off the following warnings that -Wall turns on:
1378     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1379     #
1380     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1382     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1383        # Don't use -Wcast-align with ICC or clang
1384        case "$CPU_ARCH" in
1385            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1386            hppa | ia64 | sparc | arm)
1387            ;;
1388            *)
1389         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1390            ;;
1391        esac
1392     fi
1394     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1395     _USE_CPP_INCLUDE_FLAG=1
1397     # Recent clang and gcc support C++11 deleted functions without warnings if
1398     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1399     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1400     # unused.  But clang's warning can be disabled, so when compiling with clang
1401     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1402     # deleted function syntax.
1403     if test "$CLANG_CXX"; then
1404         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1405         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1406     fi
1408 else
1409     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1412 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1413 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1414 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1415 dnl normal behavior.
1416 dnl ========================================================
1417 MKSHLIB_FORCE_ALL=
1418 MKSHLIB_UNFORCE_ALL=
1420 if test "$COMPILE_ENVIRONMENT"; then
1421 if test "$GNU_CC"; then
1422   AC_MSG_CHECKING(whether ld has archive extraction flags)
1423   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1424    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1425     ac_cv_mkshlib_force_and_unforce="no"
1426     exec 3<&0 <<LOOP_INPUT
1427         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1428         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1429         force="-Wl,-all";              unforce="-Wl,-none"
1430 LOOP_INPUT
1431     while read line
1432     do
1433       eval $line
1434       LDFLAGS=$force
1435       LIBS=$unforce
1436       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1437     done
1438     exec 0<&3 3<&-
1439     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1440    ])
1441   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1442     AC_MSG_RESULT(no)
1443   else
1444     AC_MSG_RESULT(yes)
1445     eval $ac_cv_mkshlib_force_and_unforce
1446     MKSHLIB_FORCE_ALL=$force
1447     MKSHLIB_UNFORCE_ALL=$unforce
1448   fi
1449 fi # GNU_CC
1450 fi # COMPILE_ENVIRONMENT
1452 dnl ========================================================
1453 dnl Checking for 64-bit OS
1454 dnl ========================================================
1455 if test "$COMPILE_ENVIRONMENT"; then
1456 AC_LANG_SAVE
1457 AC_LANG_C
1458 AC_MSG_CHECKING(for 64-bit OS)
1459 AC_TRY_COMPILE([$configure_static_assert_macros],
1460                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1461                result="yes", result="no")
1462 AC_MSG_RESULT("$result")
1463 if test "$result" = "yes"; then
1464     AC_DEFINE(HAVE_64BIT_OS)
1465     HAVE_64BIT_OS=1
1467 AC_SUBST(HAVE_64BIT_OS)
1468 AC_LANG_RESTORE
1469 fi # COMPILE_ENVIRONMENT
1471 dnl ========================================================
1472 dnl Enable high-memory support on OS/2 by default.
1473 dnl ========================================================
1474 MOZ_OS2_HIGH_MEMORY=1
1475 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1476 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1477     MOZ_OS2_HIGH_MEMORY=,
1478     MOZ_OS2_HIGH_MEMORY=1 )
1479 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1481 dnl ========================================================
1482 dnl = Use profiling compile flags
1483 dnl ========================================================
1484 MOZ_ARG_ENABLE_BOOL(profiling,
1485 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1486     MOZ_PROFILING=1,
1487     MOZ_PROFILING= )
1489 # For profiling builds keep the symbol information
1490 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1491     case "$OS_TARGET" in
1492     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1493         STRIP_FLAGS="--strip-debug"
1494         ;;
1495     esac
1498 dnl ========================================================
1499 dnl = Use incremental GC
1500 dnl ========================================================
1501 JSGC_INCREMENTAL=1
1502 MOZ_ARG_DISABLE_BOOL(gcincremental,
1503 [  --disable-gcincremental Disable incremental GC],
1504     JSGC_INCREMENTAL= )
1505 if test -n "$JSGC_INCREMENTAL"; then
1506     AC_DEFINE(JSGC_INCREMENTAL)
1509 dnl ========================================================
1510 dnl = Use generational GC
1511 dnl ========================================================
1512 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1513 [  --enable-gcgenerational Enable generational GC],
1514     JSGC_GENERATIONAL=1,
1515     JSGC_GENERATIONAL= )
1516 if test -n "$JSGC_GENERATIONAL"; then
1517     AC_DEFINE(JSGC_GENERATIONAL)
1520 dnl ========================================================
1521 dnl = Perform moving GC stack rooting analysis
1522 dnl ========================================================
1523 MOZ_ARG_ENABLE_BOOL(root-analysis,
1524 [  --enable-root-analysis  Enable moving GC stack root analysis],
1525     JSGC_ROOT_ANALYSIS=1,
1526     JSGC_ROOT_ANALYSIS= )
1527 if test -n "$JSGC_ROOT_ANALYSIS"; then
1528     AC_DEFINE(JSGC_ROOT_ANALYSIS)
1531 dnl ========================================================
1532 dnl = Use exact stack rooting for GC
1533 dnl ========================================================
1534 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1535 [  --enable-exact-rooting  Enable use of exact stack roots for GC],
1536     JSGC_USE_EXACT_ROOTING=1,
1537     JSGC_USE_EXACT_ROOTING= )
1538 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1539     AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1542 dnl ========================================================
1543 dnl = Use Valgrind
1544 dnl ========================================================
1545 MOZ_ARG_ENABLE_BOOL(valgrind,
1546 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1547     MOZ_VALGRIND=1,
1548     MOZ_VALGRIND= )
1549 if test -n "$MOZ_VALGRIND"; then
1550     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1551         AC_MSG_ERROR(
1552             [--enable-valgrind specified but Valgrind is not installed]))
1553     AC_DEFINE(MOZ_VALGRIND)
1555 AC_SUBST(MOZ_VALGRIND)
1557 dnl ========================================================
1558 dnl jprof
1559 dnl ========================================================
1560 MOZ_ARG_ENABLE_BOOL(jprof,
1561 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1562     MOZ_JPROF=1,
1563     MOZ_JPROF= )
1564 if test -n "$MOZ_JPROF"; then
1565     MOZ_PROFILING=1
1566     AC_DEFINE(MOZ_JPROF)
1569 dnl ========================================================
1570 dnl SPS Profiler
1571 dnl ========================================================
1572 MOZ_ENABLE_PROFILER_SPS=1
1574 case "${OS_TARGET}" in
1575 Android)
1576     case "${CPU_ARCH}" in
1577     x86 | arm) ;;
1578     *)
1579         MOZ_ENABLE_PROFILER_SPS=
1580     esac
1581     ;;
1582 Linux)
1583     case "${CPU_ARCH}" in
1584     x86 | x86_64) ;;
1585     *)
1586         MOZ_ENABLE_PROFILER_SPS=
1587     esac
1588     ;;
1589 WINNT|Darwin) ;;
1591     MOZ_ENABLE_PROFILER_SPS=
1592     ;;
1593 esac
1595 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1596     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1599 dnl ========================================================
1600 dnl shark
1601 dnl ========================================================
1602 MOZ_ARG_ENABLE_BOOL(shark,
1603 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1604     MOZ_SHARK=1,
1605     MOZ_SHARK= )
1606 if test -n "$MOZ_SHARK"; then
1607     MOZ_PROFILING=1
1608     AC_DEFINE(MOZ_SHARK)
1611 dnl ========================================================
1612 dnl instruments
1613 dnl ========================================================
1614 MOZ_ARG_ENABLE_BOOL(instruments,
1615 [  --enable-instruments    Enable instruments remote profiling. Implies --enable-profiling.],
1616     MOZ_INSTRUMENTS=1,
1617     MOZ_INSTRUMENTS= )
1618 if test -n "$MOZ_INSTRUMENTS"; then
1619     MOZ_PROFILING=1
1620     AC_DEFINE(MOZ_INSTRUMENTS)
1623 dnl ========================================================
1624 dnl callgrind
1625 dnl ========================================================
1626 MOZ_ARG_ENABLE_BOOL(callgrind,
1627 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1628     MOZ_CALLGRIND=1,
1629     MOZ_CALLGRIND= )
1630 if test -n "$MOZ_CALLGRIND"; then
1631     MOZ_PROFILING=1
1632     AC_DEFINE(MOZ_CALLGRIND)
1635 dnl ========================================================
1636 dnl vtune
1637 dnl ========================================================
1638 MOZ_ARG_ENABLE_BOOL(vtune,
1639 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1640     MOZ_VTUNE=1,
1641     MOZ_VTUNE= )
1642 if test -n "$MOZ_VTUNE"; then
1643     MOZ_PROFILING=1
1644     AC_DEFINE(MOZ_VTUNE)
1647 dnl ========================================================
1648 dnl Profiling
1649 dnl ========================================================
1650 if test -n "$MOZ_PROFILING"; then
1651     AC_DEFINE(MOZ_PROFILING)
1654 dnl ========================================================
1655 dnl System overrides of the defaults for host
1656 dnl ========================================================
1657 case "$host" in
1658 *mingw*)
1659     if test -n "$_WIN32_MSVC"; then
1660         HOST_AR=lib
1661         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1662         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1663         HOST_RANLIB='echo ranlib'
1664     else
1665         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1666     fi
1667     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1668     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1669     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1670     HOST_BIN_SUFFIX=.exe
1671     case "$host" in
1672     *mingw*)
1673         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1674         ;;
1675     esac
1677     case "${host_cpu}" in
1678     i*86)
1679         if test -n "$_WIN32_MSVC"; then
1680             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1681         fi
1682         ;;
1683     x86_64)
1684         if test -n "$_WIN32_MSVC"; then
1685             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1686         fi
1687         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1688         ;;
1689     esac
1690     ;;
1692 *-darwin*)
1693     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1694     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1695     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1696     ;;
1698 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1699     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1700     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1701     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1702     ;;
1704 *os2*)
1705     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1706     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1707     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1708     HOST_BIN_SUFFIX=.exe
1709     MOZ_FIX_LINK_PATHS=
1710     ;;
1713     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1714     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1715     ;;
1716 esac
1718 dnl Check for using a custom <inttypes.h> implementation
1719 dnl ========================================================
1720 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1721 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1722   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1723   AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1724 else
1725   AC_MSG_RESULT(none specified)
1728 dnl Get mozilla version from central milestone file
1729 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1730 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1732 dnl Get version of various core apps from the version files.
1733 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1735 if test -z "$FIREFOX_VERSION"; then
1736     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1739 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1740 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1741 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1743 MOZ_DOING_LTO(lto_is_enabled)
1745 dnl ========================================================
1746 dnl System overrides of the defaults for target
1747 dnl ========================================================
1749 case "$target" in
1750 *-aix*)
1751     AC_DEFINE(AIX)
1752     if test ! "$GNU_CC"; then
1753         if test ! "$HAVE_64BIT_OS"; then
1754             # Compiling with Visual Age C++ object model compat is the
1755             # default. To compile with object model ibm, add
1756             # AIX_OBJMODEL=ibm to .mozconfig.
1757             if test "$AIX_OBJMODEL" = "ibm"; then
1758                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1759             else
1760                 AIX_OBJMODEL=compat
1761             fi
1762         else
1763             AIX_OBJMODEL=compat
1764         fi
1765         AC_SUBST(AIX_OBJMODEL)
1766         DSO_LDOPTS='-qmkshrobj=1'
1767         DSO_CFLAGS='-qflag=w:w'
1768         DSO_PIC_CFLAGS=
1769         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1770         MOZ_FIX_LINK_PATHS=
1771         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1772         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1773         if test "$COMPILE_ENVIRONMENT"; then
1774             AC_LANG_SAVE
1775             AC_LANG_CPLUSPLUS
1776             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1777             AC_TRY_COMPILE([],
1778                 [#if (__IBMCPP__ < 900)
1779                  #error "Bad compiler"
1780                  #endif],
1781                 _BAD_COMPILER=,_BAD_COMPILER=1)
1782             if test -n "$_BAD_COMPILER"; then
1783                 AC_MSG_RESULT([no])
1784                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1785             else
1786                 AC_MSG_RESULT([yes])
1787             fi
1788             AC_LANG_RESTORE
1789             TARGET_COMPILER_ABI="ibmc"
1790             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1791             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1792         fi
1793     fi
1794     case "${target_os}" in
1795     aix4.1*)
1796         DLL_SUFFIX='_shr.a'
1797         ;;
1798     esac
1799     if test "$COMPILE_ENVIRONMENT"; then
1800         MOZ_CHECK_HEADERS(sys/inttypes.h)
1801     fi
1802     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1803     ;;
1805 *-darwin*)
1806     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1807     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1808     MOZ_OPTIMIZE_FLAGS="-O3"
1809     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1810     if test "$HAVE_64BIT_OS"; then
1811         MOZ_MEMORY=1
1812     fi
1813     DLL_SUFFIX=".dylib"
1814     DSO_LDOPTS=''
1815     STRIP_FLAGS="$STRIP_FLAGS -x -S"
1816     # Check whether we're targeting OS X or iOS
1817     AC_CACHE_CHECK(for iOS target,
1818                    ac_cv_ios_target,
1819                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1820 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1821 #error not iOS
1822 #endif],
1823                                    [],
1824                                    ac_cv_ios_target="yes",
1825                                    ac_cv_ios_target="no")])
1826     if test "$ac_cv_ios_target" = "yes"; then
1827         AC_DEFINE(XP_IOS)
1828         AC_DEFINE(XP_DARWIN)
1829         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1830     else
1831         AC_DEFINE(XP_MACOSX)
1832         AC_DEFINE(XP_DARWIN)
1833         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1834         # The ExceptionHandling framework is needed for Objective-C exception
1835         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1836         # builds.
1837         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1838     fi
1839     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1842     if test "x$lto_is_enabled" = "xyes"; then
1843         echo "Skipping -dead_strip because lto is enabled."
1844     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1845     dnl ===================================================================
1846     elif test "x$enable_dtrace" = "xyes"; then
1847         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1848     else
1849         dnl check for the presence of the -dead_strip linker flag
1850         AC_MSG_CHECKING([for -dead_strip option to ld])
1851         _SAVE_LDFLAGS=$LDFLAGS
1852         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1853         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1854         if test -n "$_HAVE_DEAD_STRIP" ; then
1855             AC_MSG_RESULT([yes])
1856             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1857         else
1858             AC_MSG_RESULT([no])
1859         fi
1861         LDFLAGS=$_SAVE_LDFLAGS
1862     fi
1864     dnl With newer linkers we need to pass -allow_heap_execute because of
1865     dnl Microsoft Silverlight (5.1.10411.0 at least).
1866     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1867     _SAVE_LDFLAGS=$LDFLAGS
1868     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1869     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1870                 _HAVE_ALLOW_HEAP_EXECUTE=)
1871     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1872         AC_MSG_RESULT([yes])
1873         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1874     else
1875         AC_MSG_RESULT([no])
1876     fi
1877     LDFLAGS=$_SAVE_LDFLAGS
1879     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1880     ;;
1882 ia64*-hpux*)
1883     DLL_SUFFIX=".so"
1884     if test ! "$GNU_CC"; then
1885        DSO_LDOPTS='-b'
1886        DSO_CFLAGS=""
1887        DSO_PIC_CFLAGS=
1888        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1889        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1890        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1891     else
1892        DSO_LDOPTS='-b -E'
1893        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1894        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1895     fi
1896     MOZ_FIX_LINK_PATHS=
1897     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1898     AC_DEFINE(_LARGEFILE64_SOURCE)
1899     ;;
1901 *-hpux*)
1902     DLL_SUFFIX=".sl"
1903     if test ! "$GNU_CC"; then
1904         DSO_LDOPTS='-b -Wl,+s'
1905         DSO_CFLAGS=""
1906         DSO_PIC_CFLAGS="+Z"
1907         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1908         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1909         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1910     else
1911         DSO_LDOPTS='-b -E +s'
1912         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1913         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1914     fi
1915     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1916     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1917     ;;
1919 *-android*|*-linuxandroid*)
1920     AC_DEFINE(NO_PW_GECOS)
1921     no_x=yes
1922     if test -n "$gonkdir"; then
1923         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
1924         MOZ_B2G_RIL=1
1925         MOZ_B2G_FM=1
1926         MOZ_SYNTH_PICO=1
1927     else
1928         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
1929         MOZ_LINKER=1
1930     fi
1931     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1933     MOZ_GFX_OPTIMIZE_MOBILE=1
1934     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
1935     ;;
1937 *-*linux*)
1938     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1939     # Similarly for GNU_CXX and INTEL_CXX.
1940     if test "$INTEL_CC" -o "$INTEL_CXX"; then
1941         # -Os has been broken on Intel's C/C++ compilers for quite a
1942         # while; Intel recommends against using it.
1943         MOZ_OPTIMIZE_FLAGS="-O2"
1944     elif test "$GNU_CC" -o "$GNU_CXX"; then
1945         case $GCC_VERSION in
1946         4.5.*)
1947             # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
1948             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1949         esac
1950         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
1951         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
1952     fi
1954     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1956     MOZ_MEMORY=1
1958     case "${target_cpu}" in
1959     alpha*)
1960         CFLAGS="$CFLAGS -mieee"
1961         CXXFLAGS="$CXXFLAGS -mieee"
1962     ;;
1963     i*86)
1964         USE_ELF_DYNSTR_GC=1
1965     ;;
1966     esac
1968     if test -z "$MC"; then
1969         MC=mc.exe
1970     fi
1971     ;;
1972 *-mingw*)
1973     DSO_CFLAGS=
1974     DSO_PIC_CFLAGS=
1975     DLL_SUFFIX=.dll
1976     RC=rc.exe
1977     MC=mc.exe
1978     # certain versions of cygwin's makedepend barf on the
1979     # #include <string> vs -I./dist/include/string issue so don't use it
1980     XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
1981     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
1982         CC="$CC -mwindows"
1983         CXX="$CXX -mwindows"
1984         CPP="$CPP -mwindows"
1985         CFLAGS="$CFLAGS -mms-bitfields"
1986         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1987         DSO_LDOPTS='-shared'
1988         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1989         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1990         RC='$(WINDRES)'
1991         # Use static libgcc and libstdc++
1992         LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
1993         NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
1994         # Use temp file for windres (bug 213281)
1995         RCFLAGS='-O coff --use-temp-file'
1996         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1997         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
1998         MOZ_FIX_LINK_PATHS=
1999         DLL_PREFIX=
2000         IMPORT_LIB_SUFFIX=dll.a
2002         # We use mix of both POSIX and Win32 printf format across the tree, so format
2003         # warnings are useless on mingw.
2004         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2005         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2006     else
2007         TARGET_COMPILER_ABI=msvc
2008         HOST_CC='$(CC)'
2009         HOST_CXX='$(CXX)'
2010         HOST_LD='$(LD)'
2011         if test "$AS_BIN"; then
2012             AS="$(basename "$AS_BIN")"
2013         fi
2014         AR='lib'
2015         AR_FLAGS='-NOLOGO -OUT:"$@"'
2016         AR_EXTRACT=
2017         RANLIB='echo not_ranlib'
2018         STRIP='echo not_strip'
2019         PKG_SKIP_STRIP=1
2020         XARGS=xargs
2021         ZIP=zip
2022         UNZIP=unzip
2023         DOXYGEN=:
2024         ASM_SUFFIX=asm
2025         OBJ_SUFFIX=obj
2026         LIB_SUFFIX=lib
2027         DLL_PREFIX=
2028         LIB_PREFIX=
2029         IMPORT_LIB_SUFFIX=lib
2030         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2031         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2032         MKSHLIB_FORCE_ALL=
2033         MKSHLIB_UNFORCE_ALL=
2034         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2035         _USE_CPP_INCLUDE_FLAG=1
2036         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2037         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2038         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2039         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2040         if test "$_CC_SUITE" -ge "12"; then
2041             dnl VS2013+ requires -FS when parallel building by make -jN.
2042             dnl If nothing, compiler sometimes causes C1041 error.
2043             CFLAGS="$CFLAGS -FS"
2044             CXXFLAGS="$CXXFLAGS -FS"
2045         fi
2046         # khuey says we can safely ignore MSVC warning C4251
2047         # MSVC warning C4244 (implicit type conversion may lose data) warns
2048         # and requires workarounds for perfectly valid code.  Also, GCC/clang
2049         # don't warn about it by default. So for consistency/sanity, we turn
2050         # it off on MSVC, too.
2051         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2052         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2053         # MSVC warning C4482 warns when an enum value is refered specifing the
2054         # name of the enum itself.  This behavior is allowed in C++11, and the
2055         # warning has been removed in VS2012.
2056         # MSVC warning C4800 warns when a value is implicitly cast to bool,
2057         # because this also forces narrowing to a single byte, which can be a
2058         # perf hit.  But this matters so little in practice (and often we want
2059         # that behavior) that it's better to turn it off.
2060         # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2061         # on non-Western system locales even if it is in a comment.
2062         CFLAGS="$CFLAGS -wd4244 -wd4819"
2063         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2064         # make 'foo == bar;' error out
2065         CFLAGS="$CFLAGS -we4553"
2066         CXXFLAGS="$CXXFLAGS -we4553"
2067         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2068         MOZ_DEBUG_FLAGS='-Zi'
2069         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2070         WARNINGS_AS_ERRORS='-WX'
2071         MOZ_OPTIMIZE_FLAGS='-O1'
2072         MOZ_FIX_LINK_PATHS=
2073         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2074         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2075         if test -z "$DEVELOPER_OPTIONS"; then
2076             LDFLAGS="$LDFLAGS -RELEASE"
2077         fi
2078         dnl For profile-guided optimization
2079         PROFILE_GEN_CFLAGS="-GL"
2080         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2081         dnl XXX: PGO builds can fail with warnings treated as errors,
2082         dnl specifically "no profile data available" appears to be
2083         dnl treated as an error sometimes. This might be a consequence
2084         dnl of using WARNINGS_AS_ERRORS in some modules, combined
2085         dnl with the linker doing most of the work in the whole-program
2086         dnl optimization/PGO case. I think it's probably a compiler bug,
2087         dnl but we work around it here.
2088         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2089         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2090         dnl Probably also a compiler bug, but what can you do?
2091         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2092         LDFLAGS="$LDFLAGS -DYNAMICBASE"
2093         dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2094         dnl both SSSE3 and SSE4.1.
2095         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2096         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2097     fi
2098     AC_DEFINE(HAVE_SNPRINTF)
2099     AC_DEFINE(_WINDOWS)
2100     AC_DEFINE(WIN32)
2101     AC_DEFINE(XP_WIN)
2102     AC_DEFINE(XP_WIN32)
2103     AC_DEFINE(HW_THREADS)
2104     AC_DEFINE(STDC_HEADERS)
2105     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2106     TARGET_MD_ARCH=win32
2107     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2108     BIN_SUFFIX='.exe'
2109     MOZ_USER_DIR="Mozilla"
2111     dnl Hardcode to win95 for now - cls
2112     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2114     dnl set NO_X11 defines here as the general check is skipped on win32
2115     no_x=yes
2116     AC_DEFINE(NO_X11)
2118     case "$host" in
2119     *-mingw*)
2120         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2121         if test -n "$L10NBASEDIR"; then
2122             L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2123         fi
2124         ;;
2125     esac
2127     case "$host" in
2128     *-mingw*)
2129         if test -z "$MOZ_TOOLS"; then
2130             AC_MSG_ERROR([MOZ_TOOLS is not set])
2131         fi
2132         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2133         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2134             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2135         fi
2136         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2137         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2138             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2139         fi
2140         ;;
2141     esac
2143     case "$host_os" in
2144     cygwin*|msvc*|mks*)
2145         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.])
2146         ;;
2147     esac
2149     case "$target" in
2150     i*86-*)
2151         if test "$HAVE_64BIT_OS"; then
2152             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2153         fi
2155         if test -n "$GNU_CC"; then
2156             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2157             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2158             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2159         else
2160             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2161             LDFLAGS="$LDFLAGS -SAFESEH"
2162         fi
2164         AC_DEFINE(_X86_)
2165         ;;
2166     x86_64-*)
2167         if test -n "$_WIN32_MSVC"; then
2168             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2169         fi
2170         AC_DEFINE(_AMD64_)
2171         ;;
2172     *)
2173         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2174         ;;
2175     esac
2176     ;;
2178 *-netbsd*)
2179     DSO_CFLAGS=''
2180     CFLAGS="$CFLAGS -Dunix"
2181     CXXFLAGS="$CXXFLAGS -Dunix"
2182     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2183         DLL_SUFFIX=".so"
2184         DSO_PIC_CFLAGS='-fPIC -DPIC'
2185         DSO_LDOPTS='-shared'
2186         BIN_FLAGS='-Wl,--export-dynamic'
2187     else
2188         DSO_PIC_CFLAGS='-fPIC -DPIC'
2189         DLL_SUFFIX=".so.1.0"
2190         DSO_LDOPTS='-shared'
2191     fi
2192     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2193     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2194     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2195     if test "$LIBRUNPATH"; then
2196         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2197     fi
2198     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
2199     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
2200     ;;
2202 *-openbsd*)
2203     if test "$SO_VERSION"; then
2204         DLL_SUFFIX=".so.$SO_VERSION"
2205     else
2206         DLL_SUFFIX=".so.1.0"
2207     fi
2208     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2209     DSO_CFLAGS=''
2210     DSO_PIC_CFLAGS='-fPIC'
2211     DSO_LDOPTS='-shared -fPIC'
2212     if test "$LIBRUNPATH"; then
2213         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2214     fi
2215     ;;
2217 *-os2*)
2218     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2219     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2220     AC_DEFINE(OS2)
2221     AC_DEFINE(XP_OS2)
2222     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2223     AC_DEFINE(TCPV40HDRS)
2224     DLL_PREFIX=
2225     LIB_PREFIX=
2226     LIB_SUFFIX=lib
2227     BIN_SUFFIX=".exe"
2228     DLL_SUFFIX=".dll"
2229     IMPORT_LIB_SUFFIX=lib
2230     DSO_PIC_CFLAGS=
2231     AR=emxomfar
2232     AR_FLAGS='r $@'
2233     CFLAGS="$CFLAGS -Zomf"
2234     CXXFLAGS="$CXXFLAGS -Zomf"
2235     DSO_LDOPTS='-Zdll'
2236     BIN_FLAGS='-Zlinker /ST:0x100000'
2237     IMPLIB='emximp -o'
2238     FILTER='true'
2239     LDFLAGS='-Zmap'
2240     WARNINGS_AS_ERRORS='-Werror'
2241     MOZ_DEBUG_FLAGS="-g -fno-inline"
2242     MOZ_OPTIMIZE_FLAGS="-O2"
2243     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2244     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2245     TARGET_MD_ARCH=os2
2246     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2247     RC=rc.exe
2248     MC=mc.exe
2249     RCFLAGS='-n'
2250     MOZ_USER_DIR="Mozilla"
2251     ZIP="$ZIP -X"
2252     STRIP=lxlite
2253     STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2255     if test "$MOZTOOLS"; then
2256         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2257     else
2258         AC_MSG_ERROR([MOZTOOLS is not set])
2259     fi
2260     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2261         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2262         LDFLAGS="$LDFLAGS -Zhigh-mem"
2263         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2264         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2265     fi
2267     # GCC for OS/2 currently predefines these, but we don't want them
2268     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2269     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2271     AC_CACHE_CHECK(for __declspec(dllexport),
2272         ac_os2_declspec,
2273         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2274                         [return 0;],
2275                         ac_os2_declspec="yes",
2276                         ac_os2_declspec="no")])
2277     if test "$ac_os2_declspec" != "yes"; then
2278         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2279     fi
2280     ;;
2282 *-solaris*)
2283     AC_DEFINE(SOLARIS)
2284     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2285     MOZ_FIX_LINK_PATHS=
2286     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2287     # libraries one level up (e.g. libnspr4.so)
2288     if test "$SOLARIS_SUNPRO_CC"; then
2289        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2290        LIBS="-lCrun -lCstd -lc $LIBS"
2291        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2292        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2293        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2294        LDFLAGS="-xildoff $LDFLAGS"
2295        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2296            _SAVE_LDFLAGS=$LDFLAGS
2297            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2298            AC_TRY_LINK([#include <stdio.h>],
2299                        [printf("Hello World\n");],
2300                        ,
2301                        [LDFLAGS=$_SAVE_LDFLAGS])
2302        fi
2303        MOZ_OPTIMIZE_FLAGS="-xO4"
2304        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2305        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2306        MKSHLIB_FORCE_ALL='-z allextract'
2307        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2308        DSO_LDOPTS='-G'
2309        AR_LIST="$AR t"
2310        AR_EXTRACT="$AR x"
2311        AR_DELETE="$AR d"
2312        AR='$(CXX) -xar'
2313        AR_FLAGS='-o $@'
2314        AS='/usr/ccs/bin/as'
2315        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2316        AS_DASH_C_FLAG=''
2317        TARGET_COMPILER_ABI="sunc"
2318        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2319        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2320        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2321        AC_LANG_SAVE
2322        AC_LANG_CPLUSPLUS
2323        AC_TRY_COMPILE([],
2324            [#if (__SUNPRO_CC < 0x590)
2325            #error "Denied"
2326            #endif],
2327            _BAD_COMPILER=,_BAD_COMPILER=1)
2328        if test -n "$_BAD_COMPILER"; then
2329            _res="no"
2330            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2331        else
2332            _res="yes"
2333        fi
2334        AC_TRY_COMPILE([],
2335            [#if (__SUNPRO_CC >= 0x5100)
2336            #error "Sun C++ 5.10 or above"
2337            #endif],
2338            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2339        if test "$_ABOVE_SS12U1"; then
2340            # disable xannotate
2341            CXXFLAGS="$CXXFLAGS -xannotate=no"
2342        fi
2343        AC_MSG_RESULT([$_res])
2344        AC_LANG_RESTORE
2345     else
2346        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2347        LIBS="-lc $LIBS"
2348        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2349        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2350        ASFLAGS="$ASFLAGS -fPIC"
2351        DSO_LDOPTS='-shared'
2352        WARNINGS_AS_ERRORS='-Werror'
2353        _WARNINGS_CFLAGS=''
2354        _WARNINGS_CXXFLAGS=''
2355        if test "$OS_RELEASE" = "5.3"; then
2356            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2357        fi
2358     fi
2359     if test "$OS_RELEASE" = "5.5.1"; then
2360         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2361     fi
2362     ;;
2364 *-sunos*)
2365     DSO_LDOPTS='-Bdynamic'
2366     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2367     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2368     AC_DEFINE(SUNOS4)
2369     AC_DEFINE(SPRINTF_RETURNS_STRING)
2370     case "$(target_os)" in
2371     sunos4.1*)
2372         DLL_SUFFIX='.so.1.0'
2373         ;;
2374     esac
2375     ;;
2377 *-os2*)
2378     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2379     ;;
2381 esac
2383 case "$target" in
2384 *-*linux*)
2385     # Includes linux-android
2386     AC_DEFINE(XP_LINUX)
2387     ;;
2388 esac
2390 AC_SUBST(MOZ_LINKER)
2391 if test -n "$MOZ_LINKER"; then
2392   AC_DEFINE(MOZ_LINKER)
2395 dnl Only one oddball right now (QNX), but this gives us flexibility
2396 dnl if any other platforms need to override this in the future.
2397 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2399 dnl ========================================================
2400 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2401 dnl by now will not have any way to link most binaries (tests
2402 dnl as well as viewer, apprunner, etc.), because some symbols
2403 dnl will be left out of the "composite" .so's by ld as unneeded.
2404 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2405 dnl they can link in the static libs that provide the missing
2406 dnl symbols.
2407 dnl ========================================================
2408 NO_LD_ARCHIVE_FLAGS=
2409 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2410     NO_LD_ARCHIVE_FLAGS=1
2412 case "$target" in
2413 *-os2*)
2414     NO_LD_ARCHIVE_FLAGS=
2415     ;;
2416 *-aix4.3*|*-aix5*)
2417     NO_LD_ARCHIVE_FLAGS=
2418     ;;
2419 *-mingw*)
2420     if test -z "$GNU_CC"; then
2421         NO_LD_ARCHIVE_FLAGS=
2422     fi
2423     ;;
2424 esac
2425 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2427 dnl ========================================================
2428 dnl = Flags to strip unused symbols from .so components and
2429 dnl = to export jemalloc symbols when linking a program
2430 dnl ========================================================
2431 case "$target" in
2432     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2433         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2434         ;;
2435     *-solaris*)
2436         if test -z "$GNU_CC"; then
2437          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2438         else
2439          if test -z "$GCC_USE_GNU_LD"; then
2440           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2441          else
2442           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2443          fi
2444         fi
2445         ;;
2446     *-darwin*)
2447         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2448         ;;
2449     *-mingw*)
2450         if test -n "$GNU_CC"; then
2451            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2452         fi
2453         ;;
2454 esac
2456 if test -z "$COMPILE_ENVIRONMENT"; then
2457     SKIP_COMPILER_CHECKS=1
2458     SKIP_LIBRARY_CHECKS=1
2461 MOZ_COMPILER_OPTS
2462 if test -z "$SKIP_COMPILER_CHECKS"; then
2463 dnl Checks for typedefs, structures, and compiler characteristics.
2464 dnl ========================================================
2465 AC_HEADER_STDC
2466 AC_C_CONST
2467 AC_TYPE_MODE_T
2468 AC_TYPE_OFF_T
2469 AC_TYPE_PID_T
2470 AC_TYPE_SIZE_T
2471 AC_LANG_CPLUSPLUS
2472 AC_LANG_C
2473 AC_MSG_CHECKING(for ssize_t)
2474 AC_CACHE_VAL(ac_cv_type_ssize_t,
2475  [AC_TRY_COMPILE([#include <stdio.h>
2476                   #include <sys/types.h>],
2477                  [ssize_t foo = 0;],
2478                  [ac_cv_type_ssize_t=true],
2479                  [ac_cv_type_ssize_t=false])])
2480 if test "$ac_cv_type_ssize_t" = true ; then
2481   AC_DEFINE(HAVE_SSIZE_T)
2482   AC_MSG_RESULT(yes)
2483 else
2484   AC_MSG_RESULT(no)
2486 AC_STRUCT_ST_BLKSIZE
2487 AC_MSG_CHECKING(for siginfo_t)
2488 AC_CACHE_VAL(ac_cv_siginfo_t,
2489  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2490                   #include <signal.h>],
2491                  [siginfo_t* info;],
2492                  [ac_cv_siginfo_t=true],
2493                  [ac_cv_siginfo_t=false])])
2494 if test "$ac_cv_siginfo_t" = true ; then
2495   AC_DEFINE(HAVE_SIGINFO_T)
2496   AC_MSG_RESULT(yes)
2497 else
2498   AC_MSG_RESULT(no)
2501 dnl Check for int64, uint, and uint_t.
2502 dnl ========================================================
2503 AC_MSG_CHECKING(for int64)
2504 AC_CACHE_VAL(ac_cv_int64,
2505  [AC_TRY_COMPILE([#include <stdio.h>
2506                   #include <sys/types.h>],
2507                  [int64 foo = 0;],
2508                  [ac_cv_int64=true],
2509                  [ac_cv_int64=false])])
2510 if test "$ac_cv_int64" = true ; then
2511   AC_DEFINE(HAVE_INT64)
2512   AC_MSG_RESULT(yes)
2513 else
2514   AC_MSG_RESULT(no)
2516 AC_MSG_CHECKING(for uint)
2517 AC_CACHE_VAL(ac_cv_uint,
2518  [AC_TRY_COMPILE([#include <stdio.h>
2519                   #include <sys/types.h>],
2520                  [uint foo = 0;],
2521                  [ac_cv_uint=true],
2522                  [ac_cv_uint=false])])
2523 if test "$ac_cv_uint" = true ; then
2524   AC_DEFINE(HAVE_UINT)
2525   AC_MSG_RESULT(yes)
2526 else
2527   AC_MSG_RESULT(no)
2529 AC_MSG_CHECKING(for uint_t)
2530 AC_CACHE_VAL(ac_cv_uint_t,
2531  [AC_TRY_COMPILE([#include <stdio.h>
2532                   #include <sys/types.h>],
2533                  [uint_t foo = 0;],
2534                  [ac_cv_uint_t=true],
2535                  [ac_cv_uint_t=false])])
2536 if test "$ac_cv_uint_t" = true ; then
2537   AC_DEFINE(HAVE_UINT_T)
2538   AC_MSG_RESULT(yes)
2539 else
2540   AC_MSG_RESULT(no)
2543 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2544 dnl are defined when compiling C++ but not C.  Since the result of this
2545 dnl test is used only in C++, do it in C++.
2546 AC_LANG_CPLUSPLUS
2548 AC_MSG_CHECKING(for uname.domainname)
2549 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2550     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2551         [ struct utsname *res; char *domain;
2552             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2553         [ac_cv_have_uname_domainname_field=true],
2554         [ac_cv_have_uname_domainname_field=false])])
2556 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2557     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2558     AC_MSG_RESULT(yes)
2559 else
2560     AC_MSG_RESULT(no)
2563 AC_MSG_CHECKING(for uname.__domainname)
2564 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2565     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2566         [ struct utsname *res; char *domain;
2567             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2568         [ac_cv_have_uname_us_domainname_field=true],
2569         [ac_cv_have_uname_us_domainname_field=false])])
2571 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2572     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2573     AC_MSG_RESULT(yes)
2574 else
2575     AC_MSG_RESULT(no)
2578 MOZ_CXX11
2580 AC_LANG_C
2582 dnl Check for .hidden assembler directive and visibility attribute.
2583 dnl Borrowed from glibc configure.in
2584 dnl ===============================================================
2585 if test "$GNU_CC"; then
2586   AC_CACHE_CHECK(for visibility(hidden) attribute,
2587                  ac_cv_visibility_hidden,
2588                  [cat > conftest.c <<EOF
2589                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2591                   ac_cv_visibility_hidden=no
2592                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2593                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2594                       ac_cv_visibility_hidden=yes
2595                     fi
2596                   fi
2597                   rm -f conftest.[cs]
2598                  ])
2599   if test "$ac_cv_visibility_hidden" = "yes"; then
2600     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2602     AC_CACHE_CHECK(for visibility(default) attribute,
2603                    ac_cv_visibility_default,
2604                    [cat > conftest.c <<EOF
2605                     int foo __attribute__ ((visibility ("default"))) = 1;
2607                     ac_cv_visibility_default=no
2608                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2609                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2610                         ac_cv_visibility_default=yes
2611                       fi
2612                     fi
2613                     rm -f conftest.[cs]
2614                    ])
2615     if test "$ac_cv_visibility_default" = "yes"; then
2616       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2618       AC_CACHE_CHECK(for visibility pragma support,
2619                      ac_cv_visibility_pragma,
2620                      [cat > conftest.c <<EOF
2621 #pragma GCC visibility push(hidden)
2622                       int foo_hidden = 1;
2623 #pragma GCC visibility push(default)
2624                       int foo_default = 1;
2626                       ac_cv_visibility_pragma=no
2627                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2628                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2629                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2630                             ac_cv_visibility_pragma=yes
2631                           fi
2632                         fi
2633                       fi
2634                       rm -f conftest.[cs]
2635                     ])
2636       if test "$ac_cv_visibility_pragma" = "yes"; then
2637         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2638                        ac_cv_have_visibility_class_bug,
2639                        [cat > conftest.c <<EOF
2640 #pragma GCC visibility push(hidden)
2641 struct __attribute__ ((visibility ("default"))) TestStruct {
2642   static void Init();
2644 __attribute__ ((visibility ("default"))) void TestFunc() {
2645   TestStruct::Init();
2648                        ac_cv_have_visibility_class_bug=no
2649                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2650                          ac_cv_have_visibility_class_bug=yes
2651                        else
2652                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2653                            ac_cv_have_visibility_class_bug=yes
2654                          fi
2655                        fi
2656                        rm -rf conftest.{c,S}
2657                        ])
2659         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2660                        ac_cv_have_visibility_builtin_bug,
2661                        [cat > conftest.c <<EOF
2662 #pragma GCC visibility push(hidden)
2663 #pragma GCC visibility push(default)
2664 #include <string.h>
2665 #pragma GCC visibility pop
2667 __attribute__ ((visibility ("default"))) void Func() {
2668   char c[[100]];
2669   memset(c, 0, sizeof(c));
2672                        ac_cv_have_visibility_builtin_bug=no
2673                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2674                          ac_cv_have_visibility_builtin_bug=yes
2675                        else
2676                          if test `grep -c "@PLT" conftest.S` = 0; then
2677                            ac_cv_visibility_builtin_bug=yes
2678                          fi
2679                        fi
2680                        rm -f conftest.{c,S}
2681                        ])
2682         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2683                 "$ac_cv_have_visibility_class_bug" = "no"; then
2684           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2685           WRAP_SYSTEM_INCLUDES=1
2686           STL_FLAGS='-I$(DIST)/stl_wrappers'
2687           WRAP_STL_INCLUDES=1
2688         else
2689           VISIBILITY_FLAGS='-fvisibility=hidden'
2690         fi # have visibility pragma bug
2691       fi   # have visibility pragma
2692     fi     # have visibility(default) attribute
2693   fi       # have visibility(hidden) attribute
2694 fi         # GNU_CC
2696 # visibility hidden flag for Sun Studio on Solaris
2697 if test "$SOLARIS_SUNPRO_CC"; then
2698 VISIBILITY_FLAGS='-xldscope=hidden'
2699 fi         # Sun Studio on Solaris
2701 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2702 AC_SUBST(VISIBILITY_FLAGS)
2704 MOZ_GCC_PR49911
2705 MOZ_GCC_PR39608
2706 if test "$OS_TARGET" != WINNT; then
2707     # Only run this test with clang on non-Windows platforms, because clang
2708     # cannot do enough code gen for now to make this test work correctly.
2709     MOZ_LLVM_PR8927
2712 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2713 dnl ========================================================
2714 if test "$GNU_CC"; then
2715   CFLAGS_save="${CFLAGS}"
2716   CFLAGS="${CFLAGS} -Werror"
2717   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2718                  ac_cv_force_align_arg_pointer,
2719                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2720                                  [],
2721                                  ac_cv_force_align_arg_pointer="yes",
2722                                  ac_cv_force_align_arg_pointer="no")])
2723   CFLAGS="${CFLAGS_save}"
2724   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2725     HAVE_GCC_ALIGN_ARG_POINTER=1
2726   else
2727     HAVE_GCC_ALIGN_ARG_POINTER=
2728   fi
2730 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2732 dnl Checks for header files.
2733 dnl ========================================================
2734 AC_HEADER_DIRENT
2735 case "$target_os" in
2736 freebsd*|openbsd*)
2737 # for stuff like -lXshm
2738     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2739     ;;
2740 esac
2741 MOZ_CHECK_COMMON_HEADERS
2743 dnl These are all the places some variant of statfs can be hiding.
2744 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2746 dnl Quota support
2747 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2748 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2750 dnl SCTP support - needs various network include headers
2751 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2753 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2755 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2756 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2757                    ac_cv_sockaddr_in_sin_len,
2758                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2759                                     #include <sys/types.h>
2760                                     #endif
2761                                     #include <netinet/in.h>
2762                                     struct sockaddr_in x;
2763                                     void *foo = (void*) &x.sin_len;],
2764                                    [],
2765                                    [ac_cv_sockaddr_in_sin_len=true],
2766                                    [ac_cv_sockaddr_in_sin_len=false])])
2767 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2768   AC_DEFINE(HAVE_SIN_LEN)
2769 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2770   AC_DEFINE(HAVE_SCONN_LEN)
2773 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2774                ac_cv_sockaddr_in6_sin6_len,
2775                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2776                                 #include <sys/types.h>
2777                                 #endif
2778                                 #include <netinet/in.h>
2779                                 struct sockaddr_in6 x;
2780                                 void *foo = (void*) &x.sin6_len;],
2781                                [],
2782                                [ac_cv_sockaddr_in6_sin6_len=true],
2783                                [ac_cv_sockaddr_in6_sin6_len=false])])
2784 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2785   AC_DEFINE(HAVE_SIN6_LEN)
2788 AC_CACHE_CHECK(for sockaddr.sa_len,
2789                ac_cv_sockaddr_sa_len,
2790                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2791                                 #include <sys/types.h>
2792                                 #endif
2793                                 #include <sys/socket.h>
2794                                 struct sockaddr x;
2795                                 void *foo = (void*) &x.sa_len;],
2796                                [],
2797                                [ac_cv_sockaddr_sa_len=true],
2798                                [ac_cv_sockaddr_sa_len=false])])
2799 if test "$ac_cv_sockaddr_sa_len" = true ; then
2800   AC_DEFINE(HAVE_SA_LEN)
2803 AC_ARG_ENABLE(dtrace,
2804               [  --enable-dtrace         build with dtrace support if available (default=no)],
2805               [enable_dtrace="yes"],)
2806 if test "x$enable_dtrace" = "xyes"; then
2807   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2808   if test -n "$HAVE_DTRACE"; then
2809       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2810   else
2811       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2812   fi
2814 AC_SUBST(HAVE_DTRACE)
2816 case $target in
2817 *-aix4.3*|*-aix5*)
2818         ;;
2820         MOZ_CHECK_HEADERS(sys/cdefs.h)
2821         ;;
2822 esac
2824 MOZ_LINUX_PERF_EVENT
2826 dnl Checks for libraries.
2827 dnl ========================================================
2828 case $target in
2829 *-hpux11.*)
2830         ;;
2832         AC_CHECK_LIB(c_r, gethostbyname_r)
2833         ;;
2834 esac
2836 dnl We don't want to link with libdl even if it's present on OS X, since
2837 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2838 dnl in libc.
2839 dnl We don't want to link against libm or libpthread on Darwin since
2840 dnl they both are just symlinks to libSystem and explicitly linking
2841 dnl against libSystem causes issues when debugging (see bug 299601).
2842 case $target in
2843 *-darwin*)
2844     ;;
2845 *-os2*)
2846     ;;
2848     AC_SEARCH_LIBS(dlopen, dl,
2849         MOZ_CHECK_HEADER(dlfcn.h,
2850         AC_DEFINE(HAVE_DLOPEN)))
2851     ;;
2852 esac
2854 _SAVE_CFLAGS="$CFLAGS"
2855 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2856 AC_CHECK_FUNCS(dladdr memmem)
2857 CFLAGS="$_SAVE_CFLAGS"
2859 if test ! "$GNU_CXX"; then
2861     case $target in
2862     *-aix*)
2863         AC_CHECK_LIB(C_r, demangle)
2864         ;;
2865      *)
2866         AC_CHECK_LIB(C, demangle)
2867         ;;
2868      esac
2871 dnl OS/2 has socket in libc.
2872 case $target in
2873 *-os2*)
2874     ;;
2876     AC_CHECK_LIB(socket, socket)
2877 esac
2879 XLDFLAGS="$X_LIBS"
2880 XLIBS="$X_EXTRA_LIBS"
2882 dnl ========================================================
2883 dnl Checks for X libraries.
2884 dnl Ordering is important.
2885 dnl Xt is dependent upon SM as of X11R6
2886 dnl ========================================================
2887 if test "$no_x" = "yes"; then
2888     AC_DEFINE(NO_X11)
2889 else
2890     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2891         XLIBS="-lX11 $XLIBS"
2892         _SAVE_LDFLAGS="$LDFLAGS"
2893         LDFLAGS="$XLDFLAGS $LDFLAGS"
2894         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2895                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2896         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2897                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2899         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2900         unset ac_cv_lib_Xt_XtFree
2901             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2902             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2903         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2904                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2905         ])
2907     # AIX needs the motif library linked before libXt to prevent
2908     # crashes in plugins linked against Motif - Bug #98892
2909     case "${target_os}" in
2910     aix*)
2911         XT_LIBS="-lXm $XT_LIBS"
2912         ;;
2913     esac
2915     dnl ========================================================
2916     dnl = Check for XShm
2917     dnl ========================================================
2918     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2919         $XLIBS $XEXT_LIBS)
2921     dnl ========================================================
2922     dnl = Check for Xss
2923     dnl ========================================================
2924     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2925         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2926             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2927              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2929         LDFLAGS="$_SAVE_LDFLAGS"
2930 fi # $no_x
2932 AC_SUBST(XCFLAGS)
2933 AC_SUBST(XLDFLAGS)
2934 AC_SUBST(XLIBS)
2935 AC_SUBST(XEXT_LIBS)
2936 AC_SUBST(XT_LIBS)
2937 AC_SUBST(XSS_LIBS)
2939 dnl ========================================================
2940 dnl = pthread support
2941 dnl = Start by checking whether the system support pthreads
2942 dnl ========================================================
2943 case "$target_os" in
2944 darwin*)
2945     MOZ_USE_PTHREADS=1
2946     ;;
2948     MOZ_CHECK_PTHREADS(pthreads,
2949         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2950         MOZ_CHECK_PTHREADS(pthread,
2951             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2952             MOZ_CHECK_PTHREADS(c_r,
2953                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2954                 MOZ_CHECK_PTHREADS(c,
2955                     MOZ_USE_PTHREADS=1
2956                 )
2957             )
2958         )
2959     )
2960     ;;
2961 esac
2963 dnl ========================================================
2964 dnl Check the command line for --with-pthreads
2965 dnl ========================================================
2966 MOZ_ARG_WITH_BOOL(pthreads,
2967 [  --with-pthreads         Force use of system pthread library with NSPR ],
2968 [ if test "$MOZ_USE_PTHREADS"x = x; then
2969     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2970 fi],
2971     MOZ_USE_PTHREADS=
2972     _PTHREAD_LDFLAGS=
2975 dnl ========================================================
2976 dnl Do the platform specific pthread hackery
2977 dnl ========================================================
2978 if test "$MOZ_USE_PTHREADS"x != x
2979 then
2980         dnl
2981         dnl See if -pthread is supported.
2982         dnl
2983         rm -f conftest*
2984         ac_cv_have_dash_pthread=no
2985         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2986         echo 'int main() { return 0; }' | cat > conftest.c
2987         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2988         if test $? -eq 0; then
2989                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2990                         ac_cv_have_dash_pthread=yes
2991                 case "$target_os" in
2992                 freebsd*)
2993 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2994                 ;;
2995                 *)
2996                             CFLAGS="$CFLAGS -pthread"
2997                             CXXFLAGS="$CXXFLAGS -pthread"
2998                 ;;
2999                 esac
3000                 fi
3001         fi
3002         rm -f conftest*
3003     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3005         dnl
3006         dnl See if -pthreads is supported.
3007         dnl
3008     ac_cv_have_dash_pthreads=no
3009     if test "$ac_cv_have_dash_pthread" = "no"; then
3010             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3011         echo 'int main() { return 0; }' | cat > conftest.c
3012             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3013         if test $? -eq 0; then
3014                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3015                             ac_cv_have_dash_pthreads=yes
3016                             CFLAGS="$CFLAGS -pthreads"
3017                             CXXFLAGS="$CXXFLAGS -pthreads"
3018                     fi
3019             fi
3020             rm -f conftest*
3021         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3022     fi
3024         case "$target" in
3025             *-*-freebsd*)
3026                         AC_DEFINE(_REENTRANT)
3027                         AC_DEFINE(_THREAD_SAFE)
3028                         dnl -pthread links in -lpthread, so don't specify it explicitly.
3029                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3030                                 _PTHREAD_LDFLAGS="-pthread"
3031                         fi
3032                         ;;
3034             *-*-openbsd*|*-*-bsdi*)
3035                         AC_DEFINE(_REENTRANT)
3036                         AC_DEFINE(_THREAD_SAFE)
3037                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3038                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3039                 _PTHREAD_LDFLAGS="-pthread"
3040                         fi
3041                         ;;
3043             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3044                         AC_DEFINE(_REENTRANT)
3045                         ;;
3047             *-aix4.3*|*-aix5*)
3048                         AC_DEFINE(_REENTRANT)
3049                         ;;
3051             *-hpux11.*)
3052                         AC_DEFINE(_REENTRANT)
3053                         ;;
3055             *-*-solaris*)
3056                         AC_DEFINE(_REENTRANT)
3057                         if test "$SOLARIS_SUNPRO_CC"; then
3058                                 CFLAGS="$CFLAGS -mt"
3059                                 CXXFLAGS="$CXXFLAGS -mt"
3060                         fi
3061                         ;;
3062         esac
3063     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3064     AC_SUBST(MOZ_USE_PTHREADS)
3068 dnl Checks for library functions.
3069 dnl ========================================================
3070 AC_PROG_GCC_TRADITIONAL
3071 AC_FUNC_MEMCMP
3072 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove stat64 lstat64 truncate64 setbuf isatty)
3073 AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
3074 AC_CHECK_FUNCS(flockfile getpagesize)
3075 AC_CHECK_FUNCS(localtime_r strtok_r)
3077 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3078 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3079                ac_cv_clock_monotonic,
3080                [for libs in "" -lrt; do
3081                     _SAVE_LIBS="$LIBS"
3082                     LIBS="$LIBS $libs"
3083                     AC_TRY_LINK([#include <time.h>],
3084                                  [ struct timespec ts;
3085                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3086                                  ac_cv_clock_monotonic=$libs
3087                                  LIBS="$_SAVE_LIBS"
3088                                  break,
3089                                  ac_cv_clock_monotonic=no)
3090                     LIBS="$_SAVE_LIBS"
3091                 done])
3092 if test "$ac_cv_clock_monotonic" != "no"; then
3093     HAVE_CLOCK_MONOTONIC=1
3094     REALTIME_LIBS=$ac_cv_clock_monotonic
3095     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3096     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3097     AC_SUBST(REALTIME_LIBS)
3100 dnl check for wcrtomb/mbrtowc
3101 dnl =======================================================================
3102 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3103 AC_LANG_SAVE
3104 AC_LANG_CPLUSPLUS
3105 AC_CACHE_CHECK(for wcrtomb,
3106     ac_cv_have_wcrtomb,
3107     [AC_TRY_LINK([#include <wchar.h>],
3108                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3109                  ac_cv_have_wcrtomb="yes",
3110                  ac_cv_have_wcrtomb="no")])
3111 if test "$ac_cv_have_wcrtomb" = "yes"; then
3112     AC_DEFINE(HAVE_WCRTOMB)
3114 AC_CACHE_CHECK(for mbrtowc,
3115     ac_cv_have_mbrtowc,
3116     [AC_TRY_LINK([#include <wchar.h>],
3117                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3118                  ac_cv_have_mbrtowc="yes",
3119                  ac_cv_have_mbrtowc="no")])
3120 if test "$ac_cv_have_mbrtowc" = "yes"; then
3121     AC_DEFINE(HAVE_MBRTOWC)
3123 AC_LANG_RESTORE
3126 AC_CACHE_CHECK(
3127     [for res_ninit()],
3128     ac_cv_func_res_ninit,
3129     [AC_TRY_LINK([
3130         #ifdef linux
3131         #define _BSD_SOURCE 1
3132         #endif
3133         #include <resolv.h>
3134         ],
3135         [int foo = res_ninit(&_res);],
3136         [ac_cv_func_res_ninit=yes],
3137         [ac_cv_func_res_ninit=no])
3138     ])
3140 if test "$ac_cv_func_res_ninit" = "yes"; then
3141     AC_DEFINE(HAVE_RES_NINIT)
3142 dnl must add the link line we do something as foolish as this... dougt
3143 dnl else
3144 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3145 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3148 AC_LANG_CPLUSPLUS
3149 AC_CACHE_CHECK(
3150     [for gnu_get_libc_version()],
3151     ac_cv_func_gnu_get_libc_version,
3152     [AC_TRY_LINK([
3153         #ifdef HAVE_GNU_LIBC_VERSION_H
3154         #include <gnu/libc-version.h>
3155         #endif
3156         ],
3157         [const char *glibc_version = gnu_get_libc_version();],
3158         [ac_cv_func_gnu_get_libc_version=yes],
3159         [ac_cv_func_gnu_get_libc_version=no]
3160         )]
3161     )
3163 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3164     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3167 case $target_os in
3168     darwin*|mingw*|os2*)
3169         ;;
3170     *)
3172 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3173     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3174         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3175 _SAVE_LIBS=$LIBS
3176 LIBS="$LIBS $_ICONV_LIBS"
3177 AC_CACHE_CHECK(
3178     [for iconv()],
3179     ac_cv_func_iconv,
3180     [AC_TRY_LINK([
3181         #include <stdlib.h>
3182         #include <iconv.h>
3183         ],
3184         [
3185             iconv_t h = iconv_open("", "");
3186             iconv(h, NULL, NULL, NULL, NULL);
3187             iconv_close(h);
3188         ],
3189         [ac_cv_func_iconv=yes],
3190         [ac_cv_func_iconv=no]
3191         )]
3192     )
3193 if test "$ac_cv_func_iconv" = "yes"; then
3194     AC_DEFINE(HAVE_ICONV)
3195     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3196     LIBICONV="$_ICONV_LIBS"
3197     AC_CACHE_CHECK(
3198         [for iconv() with const input],
3199         ac_cv_func_const_iconv,
3200         [AC_TRY_COMPILE([
3201             #include <stdlib.h>
3202             #include <iconv.h>
3203             ],
3204             [
3205                 const char *input = "testing";
3206                 iconv_t h = iconv_open("", "");
3207                 iconv(h, &input, NULL, NULL, NULL);
3208                 iconv_close(h);
3209             ],
3210             [ac_cv_func_const_iconv=yes],
3211             [ac_cv_func_const_iconv=no]
3212             )]
3213         )
3214     if test "$ac_cv_func_const_iconv" = "yes"; then
3215         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3216     fi
3218 LIBS=$_SAVE_LIBS
3220     ;;
3221 esac
3223 AM_LANGINFO_CODESET
3225 AC_LANG_C
3227 dnl **********************
3228 dnl *** va_copy checks ***
3229 dnl **********************
3230 dnl we currently check for all three va_copy possibilities, so we get
3231 dnl all results in config.log for bug reports.
3232 AC_MSG_CHECKING(for an implementation of va_copy())
3233 AC_CACHE_VAL(ac_cv_va_copy,[
3234     AC_TRY_RUN([
3235         #include <stdarg.h>
3236         void f (int i, ...) {
3237             va_list args1, args2;
3238             va_start (args1, i);
3239             va_copy (args2, args1);
3240             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3241                 exit (1);
3242             va_end (args1); va_end (args2);
3243         }
3244         int main() { f (0, 42); return 0; }],
3245         ac_cv_va_copy=yes,
3246         ac_cv_va_copy=no,
3247         ac_cv_va_copy=no
3248     )
3250 AC_MSG_RESULT($ac_cv_va_copy)
3251 AC_MSG_CHECKING(for an implementation of __va_copy())
3252 AC_CACHE_VAL(ac_cv___va_copy,[
3253     AC_TRY_RUN([
3254         #include <stdarg.h>
3255         void f (int i, ...) {
3256             va_list args1, args2;
3257             va_start (args1, i);
3258             __va_copy (args2, args1);
3259             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3260                 exit (1);
3261             va_end (args1); va_end (args2);
3262         }
3263         int main() { f (0, 42); return 0; }],
3264         ac_cv___va_copy=yes,
3265         ac_cv___va_copy=no,
3266         ac_cv___va_copy=no
3267     )
3269 AC_MSG_RESULT($ac_cv___va_copy)
3270 AC_MSG_CHECKING(whether va_lists can be copied by value)
3271 AC_CACHE_VAL(ac_cv_va_val_copy,[
3272     AC_TRY_RUN([
3273         #include <stdarg.h>
3274         void f (int i, ...) {
3275             va_list args1, args2;
3276             va_start (args1, i);
3277             args2 = args1;
3278             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3279                 exit (1);
3280             va_end (args1); va_end (args2);
3281         }
3282         int main() { f (0, 42); return 0; }],
3283         ac_cv_va_val_copy=yes,
3284         ac_cv_va_val_copy=no,
3285         ac_cv_va_val_copy=yes
3286     )
3288 if test "x$ac_cv_va_copy" = "xyes"; then
3289     AC_DEFINE(VA_COPY, va_copy)
3290     AC_DEFINE(HAVE_VA_COPY)
3291 elif test "x$ac_cv___va_copy" = "xyes"; then
3292     AC_DEFINE(VA_COPY, __va_copy)
3293     AC_DEFINE(HAVE_VA_COPY)
3296 if test "x$ac_cv_va_val_copy" = "xno"; then
3297    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3299 AC_MSG_RESULT($ac_cv_va_val_copy)
3301 dnl ===================================================================
3302 dnl ========================================================
3303 dnl Put your C++ language/feature checks below
3304 dnl ========================================================
3305 AC_LANG_CPLUSPLUS
3307 ARM_ABI_PREFIX=
3308 if test "$GNU_CC"; then
3309   if test "$CPU_ARCH" = "arm" ; then
3310     AC_CACHE_CHECK(for ARM EABI,
3311         ac_cv_gcc_arm_eabi,
3312         [AC_TRY_COMPILE([],
3313                         [
3314 #if defined(__ARM_EABI__)
3315   return 0;
3316 #else
3317 #error Not ARM EABI.
3318 #endif
3319                         ],
3320                         ac_cv_gcc_arm_eabi="yes",
3321                         ac_cv_gcc_arm_eabi="no")])
3322     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3323         HAVE_ARM_EABI=1
3324         ARM_ABI_PREFIX=eabi-
3325     else
3326         ARM_ABI_PREFIX=oabi-
3327     fi
3328   fi
3330   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3333 dnl Check to see if we can resolve ambiguity with |using|.
3334 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3335                ac_cv_cpp_ambiguity_resolving_using,
3336                [AC_TRY_COMPILE(class X {
3337                                  public: int go(const X&) {return 3;}
3338                                          int jo(const X&) {return 3;}
3339                                };
3340                                class Y : public X {
3341                                  public:  int go(int) {return 2;}
3342                                           int jo(int) {return 2;}
3343                                           using X::jo;
3344                                  private: using X::go;
3345                                };,
3346                                X x; Y y; y.jo(x);,
3347                                ac_cv_cpp_ambiguity_resolving_using=yes,
3348                                ac_cv_cpp_ambiguity_resolving_using=no)])
3349 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3350    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3353 dnl See if a dynamic_cast to void* gives the most derived object.
3354 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3355                ac_cv_cpp_dynamic_cast_void_ptr,
3356                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3357                             class Y { int j; public: virtual ~Y() { } };
3358                             class Z : public X, public Y { int k; };
3360                             int main() {
3361                                  Z mdo;
3362                                  X *subx = (X*)&mdo;
3363                                  Y *suby = (Y*)&mdo;
3364                                  return !((((void*)&mdo != (void*)subx) &&
3365                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3366                                           (((void*)&mdo != (void*)suby) &&
3367                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3368                             }],
3369                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3370                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3371                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3372 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3373    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3377 dnl note that this one is reversed - if the test fails, then
3378 dnl we require implementations of unused virtual methods. Which
3379 dnl really blows because it means we'll have useless vtable
3380 dnl bloat.
3381 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3382                ac_cv_cpp_unused_required,
3383                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3384                                X x;,
3385                                ac_cv_cpp_unused_required=no,
3386                                ac_cv_cpp_unused_required=yes)])
3387 if test "$ac_cv_cpp_unused_required" = yes ; then
3388    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3392 dnl Some compilers have trouble comparing a constant reference to a templatized
3393 dnl class to zero, and require an explicit operator==() to be defined that takes
3394 dnl an int. This test separates the strong from the weak.
3396 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3397                ac_cv_trouble_comparing_to_zero,
3398                [AC_TRY_COMPILE([#include <algorithm>
3399                                 template <class T> class Foo {};
3400                                 class T2;
3401                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3402                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3403                                [Foo<int> f; return (0 != f);],
3404                                ac_cv_trouble_comparing_to_zero=no,
3405                                ac_cv_trouble_comparing_to_zero=yes)])
3406 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3407   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3410 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3411 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3412 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3413 # linking XUL.
3414 _SAVE_LDFLAGS=$LDFLAGS
3415 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3416 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3417                ac_cv_thread_keyword,
3418                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3419                             [return tlsIsMainThread;],
3420                             ac_cv_thread_keyword=yes,
3421                             ac_cv_thread_keyword=no)])
3422 LDFLAGS=$_SAVE_LDFLAGS
3423 # The custom dynamic linker doesn't support TLS variables
3424 MOZ_TLS=
3425 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3426   # mips builds fail with TLS variables because of a binutils bug.
3427   # See bug 528687
3428   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3429   case "${target}" in
3430     mips*-*)
3431       :
3432       ;;
3433     *-android*|*-linuxandroid*)
3434       :
3435       ;;
3436     *-openbsd*)
3437       :
3438       ;;
3439     *)
3440       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3441       MOZ_TLS=1
3442       ;;
3443   esac
3446 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3447 if test -n "$MOZ_LINKER"; then
3448   if test "$CPU_ARCH" = arm; then
3449     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3450     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3451       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3452       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3453     fi
3454   fi
3457 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3458 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3459 dnl We however want to avoid these text relocations, and this can be done
3460 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3461 dnl doesn't contain anything at all, beside placeholders for some sections,
3462 dnl and crtbegin only contains a finalizer function that calls
3463 dnl __cxa_finalize. The custom linker actually takes care of calling
3464 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3465 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3466 dnl link crtbegin and crtend at all.
3467 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3468   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3469     ac_cv_crt_has_text_relocations,
3470     [echo 'int foo() { return 0; }' > conftest.cpp
3471      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3472         test -s conftest${DLL_SUFFIX}; then
3473        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3474          ac_cv_crt_has_text_relocations=yes
3475        else
3476          ac_cv_crt_has_text_relocations=no
3477        fi
3478      else
3479        AC_ERROR([couldn't compile a simple C file])
3480      fi
3481      rm -rf conftest*])
3482   if test "$ac_cv_crt_has_text_relocations" = yes; then
3483     dnl While we want libraries to skip the CRT files, we don't want
3484     dnl executables to be treated the same way. We thus set the flag
3485     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3486     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3487     dnl Using LDFLAGS in nspr is safe, since we only really build
3488     dnl libraries there.
3489     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3490     NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3491   fi
3494 dnl Check for the existence of various allocation headers/functions
3496 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3497 MALLOC_H=
3499 for file in $MALLOC_HEADERS; do
3500   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3501   if test "$MALLOC_H" != ""; then
3502     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3503     break
3504   fi
3505 done
3507 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3508 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3510 AC_CHECK_FUNCS(malloc_usable_size)
3512 dnl See if compiler supports some gcc-style attributes
3514 AC_CACHE_CHECK(for __attribute__((always_inline)),
3515                ac_cv_attribute_always_inline,
3516                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3517                                [],
3518                                ac_cv_attribute_always_inline=yes,
3519                                ac_cv_attribute_always_inline=no)])
3521 AC_CACHE_CHECK(for __attribute__((malloc)),
3522                ac_cv_attribute_malloc,
3523                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3524                                [],
3525                                ac_cv_attribute_malloc=yes,
3526                                ac_cv_attribute_malloc=no)])
3528 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3529                ac_cv_attribute_warn_unused,
3530                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3531                                [],
3532                                ac_cv_attribute_warn_unused=yes,
3533                                ac_cv_attribute_warn_unused=no)])
3535 dnl End of C++ language/feature checks
3536 AC_LANG_C
3538 dnl ========================================================
3539 dnl =  Internationalization checks
3540 dnl ========================================================
3542 dnl Internationalization and Locale support is different
3543 dnl on various UNIX platforms.  Checks for specific i18n
3544 dnl features go here.
3546 dnl check for LC_MESSAGES
3547 AC_CACHE_CHECK(for LC_MESSAGES,
3548                 ac_cv_i18n_lc_messages,
3549                 [AC_TRY_COMPILE([#include <locale.h>],
3550                                 [int category = LC_MESSAGES;],
3551                                 ac_cv_i18n_lc_messages=yes,
3552                                 ac_cv_i18n_lc_messages=no)])
3553 if test "$ac_cv_i18n_lc_messages" = yes; then
3554    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3557 AC_HAVE_FUNCS(localeconv)
3558 fi # ! SKIP_COMPILER_CHECKS
3560 TARGET_XPCOM_ABI=
3561 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3562     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3565 dnl Mozilla specific options
3566 dnl ========================================================
3567 dnl The macros used for command line options
3568 dnl are defined in build/autoconf/altoptions.m4.
3570 dnl If the compiler supports these attributes, define them as
3571 dnl convenience macros.
3572 if test "$ac_cv_attribute_malloc" = yes ; then
3573   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3574 else
3575   AC_DEFINE(NS_ATTR_MALLOC,)
3578 if test "$ac_cv_attribute_warn_unused" = yes ; then
3579   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3580 else
3581   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3584 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3585 dnl features that Windows actually does support.
3587 if test -n "$SKIP_COMPILER_CHECKS"; then
3588    dnl Windows has malloc.h
3589    AC_DEFINE(MALLOC_H, [<malloc.h>])
3590    AC_DEFINE(HAVE_FORCEINLINE)
3591    AC_DEFINE(HAVE_LOCALECONV)
3592 fi # SKIP_COMPILER_CHECKS
3594 dnl ========================================================
3595 dnl =
3596 dnl = Check for external package dependencies
3597 dnl =
3598 dnl ========================================================
3599 MOZ_ARG_HEADER(External Packages)
3601 MOZ_ARG_WITH_STRING(libxul-sdk,
3602 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3603   LIBXUL_SDK_DIR=$withval)
3605 if test "$LIBXUL_SDK_DIR" = "yes"; then
3606     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3607 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3608     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3610     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3611         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3612     fi
3615 AC_SUBST(LIBXUL_SDK)
3617 if test -n "$LIBXUL_SDK"; then
3618     LIBXUL_DIST="$LIBXUL_SDK"
3619 else
3620     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3622 AC_SUBST(LIBXUL_DIST)
3624 SYSTEM_LIBXUL=
3626 MOZ_ARG_WITH_BOOL(system-libxul,
3627 [  --with-system-libxul    Use system installed libxul SDK],
3628     SYSTEM_LIBXUL=1)
3630 dnl ========================================================
3631 dnl = If NSPR was not detected in the system,
3632 dnl = use the one in the source tree (mozilla/nsprpub)
3633 dnl ========================================================
3634 MOZ_ARG_WITH_BOOL(system-nspr,
3635 [  --with-system-nspr      Use system installed NSPR],
3636     _USE_SYSTEM_NSPR=1 )
3638 if test -n "$_USE_SYSTEM_NSPR"; then
3639     AM_PATH_NSPR(4.9.6, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3642 if test -n "$MOZ_NATIVE_NSPR"; then
3643     _SAVE_CFLAGS=$CFLAGS
3644     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3645     AC_TRY_COMPILE([#include "prtypes.h"],
3646                 [#ifndef PR_STATIC_ASSERT
3647                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3648                  #endif],
3649                 [MOZ_NATIVE_NSPR=1],
3650                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3651     AC_TRY_COMPILE([#include "prtypes.h"],
3652                 [#ifndef PR_UINT64
3653                  #error PR_UINT64 not defined or requires including prtypes.h
3654                  #endif],
3655                 [MOZ_NATIVE_NSPR=1],
3656                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3657     CFLAGS=$_SAVE_CFLAGS
3658 else
3659     if test -z "$LIBXUL_SDK"; then
3660         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3661         if test -n "$GNU_CC"; then
3662             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3663         else
3664             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3665         fi
3666     else
3667         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3668         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3669     fi
3672 dnl set GRE_MILESTONE
3673 dnl ========================================================
3674 if test -n "$LIBXUL_SDK"; then
3675     GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3676 else
3677     GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3679 AC_SUBST(GRE_MILESTONE)
3681 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3682 # The logic works like this:
3683 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3684 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3685 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3686 case "$GRE_MILESTONE" in
3687   *a1*)
3688       NIGHTLY_BUILD=1
3689       AC_DEFINE(NIGHTLY_BUILD)
3690       ;;
3691   *a*)
3692       ;;
3693   *)
3694       RELEASE_BUILD=1
3695       AC_DEFINE(RELEASE_BUILD)
3696       ;;
3697 esac
3698 AC_SUBST(NIGHTLY_BUILD)
3699 AC_SUBST(RELEASE_BUILD)
3701 dnl system libevent Support
3702 dnl ========================================================
3703 MOZ_ARG_WITH_STRING(system-libevent,
3704 [  --with-system-libevent[=PFX]
3705                           Use system libevent [installed at prefix PFX]],
3706     LIBEVENT_DIR=$withval)
3708 _SAVE_CFLAGS=$CFLAGS
3709 _SAVE_LDFLAGS=$LDFLAGS
3710 _SAVE_LIBS=$LIBS
3711 if test "$LIBEVENT_DIR" = yes; then
3712     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3713         MOZ_NATIVE_LIBEVENT=1,
3714         LIBEVENT_DIR=/usr)
3716 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3717     MOZ_NATIVE_LIBEVENT=
3718 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3719     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3720     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3721     MOZ_CHECK_HEADER(event.h,
3722         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3723              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3724          fi],
3725         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3726     AC_CHECK_LIB(event, event_init,
3727                  [MOZ_NATIVE_LIBEVENT=1
3728                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3729                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3730                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3732 CFLAGS=$_SAVE_CFLAGS
3733 LDFLAGS=$_SAVE_LDFLAGS
3734 LIBS=$_SAVE_LIBS
3736 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3737 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3738 AC_SUBST(MOZ_LIBEVENT_LIBS)
3740 dnl ========================================================
3741 dnl = If NSS was not detected in the system,
3742 dnl = use the one in the source tree (mozilla/security/nss)
3743 dnl ========================================================
3745 MOZ_ARG_WITH_BOOL(system-nss,
3746 [  --with-system-nss       Use system installed NSS],
3747     _USE_SYSTEM_NSS=1 )
3749 if test -n "$_USE_SYSTEM_NSS"; then
3750     AM_PATH_NSS(3.15, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3753 if test -n "$MOZ_NATIVE_NSS"; then
3754    NSS_LIBS="$NSS_LIBS -lcrmf"
3755 else
3756    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3758    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3759        NSS_LIBS="\
3760         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3761         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3762         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3763         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3764         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3765    else
3766        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3767    fi
3770 dnl ======================
3771 dnl Detect yasm
3772 dnl ======================
3774 AC_MSG_CHECKING([for YASM assembler])
3775 AC_CHECK_PROGS(YASM, yasm, "")
3777 if test -n "$YASM"; then
3778   dnl Pull out yasm's version string
3779   YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3780   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3781   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3782   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3783   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3786 if test -z "$SKIP_LIBRARY_CHECKS"; then
3787 dnl system JPEG support
3788 dnl ========================================================
3789 MOZ_ARG_WITH_STRING(system-jpeg,
3790 [  --with-system-jpeg[=PFX]
3791                           Use system libjpeg [installed at prefix PFX]],
3792     JPEG_DIR=$withval)
3794 _SAVE_CFLAGS=$CFLAGS
3795 _SAVE_LDFLAGS=$LDFLAGS
3796 _SAVE_LIBS=$LIBS
3797 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3798     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3799     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3801 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3802     MOZ_NATIVE_JPEG=
3803 else
3804     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3807 if test "$MOZ_NATIVE_JPEG" = 1; then
3808     AC_TRY_COMPILE([ #include <stdio.h>
3809                      #include <sys/types.h>
3810                      #include <jpeglib.h> ],
3811                    [ #if JPEG_LIB_VERSION < $MOZJPEG
3812                      #error "Insufficient JPEG library version ($MOZJPEG required)."
3813                      #endif
3814                      #ifndef JCS_EXTENSIONS
3815                      #error "libjpeg-turbo JCS_EXTENSIONS required"
3816                      #endif
3817                      ],
3818                    MOZ_NATIVE_JPEG=1,
3819                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3821 CFLAGS=$_SAVE_CFLAGS
3822 LDFLAGS=$_SAVE_LDFLAGS
3823 LIBS=$_SAVE_LIBS
3825 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3826     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3827     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3829 fi # SKIP_LIBRARY_CHECKS
3831 dnl system ZLIB support
3832 dnl ========================================================
3833 MOZ_ZLIB_CHECK([1.2.3])
3835 if test "$MOZ_NATIVE_ZLIB" != 1; then
3836     MOZ_ZLIB_CFLAGS=
3837     MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
3840 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3841     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3844 if test -z "$SKIP_LIBRARY_CHECKS"; then
3845 dnl system BZIP2 Support
3846 dnl ========================================================
3847 MOZ_ARG_WITH_STRING(system-bz2,
3848 [  --with-system-bz2[=PFX]
3849                           Use system libbz2 [installed at prefix PFX]],
3850     BZ2_DIR=$withval)
3852 _SAVE_CFLAGS=$CFLAGS
3853 _SAVE_LDFLAGS=$LDFLAGS
3854 _SAVE_LIBS=$LIBS
3855 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3856     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3857     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3859 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3860     MOZ_NATIVE_BZ2=
3861 else
3862     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3863         [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3865 CFLAGS=$_SAVE_CFLAGS
3866 LDFLAGS=$_SAVE_LDFLAGS
3867 LIBS=$_SAVE_LIBS
3869 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3870     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3871     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3874 dnl system PNG Support
3875 dnl ========================================================
3876 MOZ_ARG_WITH_STRING(system-png,
3877 [  --with-system-png[=PFX]
3878                           Use system libpng [installed at prefix PFX]],
3879     PNG_DIR=$withval)
3881 _SAVE_CFLAGS=$CFLAGS
3882 _SAVE_LDFLAGS=$LDFLAGS
3883 _SAVE_LIBS=$LIBS
3884 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3885     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3886     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3888 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3889     MOZ_NATIVE_PNG=
3890 else
3891     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3892                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3893     AC_CHECK_LIB(png, png_get_acTL, ,
3894                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3896 if test "$MOZ_NATIVE_PNG" = 1; then
3897     AC_TRY_COMPILE([ #include <stdio.h>
3898                      #include <sys/types.h>
3899                      #include <png.h> ],
3900                    [ #if PNG_LIBPNG_VER < $MOZPNG
3901                      #error "Insufficient libpng version ($MOZPNG required)."
3902                      #endif
3903                      #ifndef PNG_UINT_31_MAX
3904                      #error "Insufficient libpng version."
3905                      #endif ],
3906                    MOZ_NATIVE_PNG=1,
3907                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3909 CFLAGS=$_SAVE_CFLAGS
3910 LDFLAGS=$_SAVE_LDFLAGS
3911 LIBS=$_SAVE_LIBS
3913 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3914     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3915     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3918 MOZ_PNG_ARM_NEON=
3919 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3920     MOZ_PNG_ARM_NEON=1
3922 AC_SUBST(MOZ_PNG_ARM_NEON)
3924 fi # SKIP_LIBRARY_CHECKS
3926 dnl system HunSpell Support
3927 dnl ========================================================
3928 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3929 [  --enable-system-hunspell
3930                           Use system hunspell (located with pkgconfig)],
3931     MOZ_NATIVE_HUNSPELL=1 )
3933 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3934     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3937 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3939 dnl ========================================================
3940 dnl system libffi Support
3941 dnl ========================================================
3942 MOZ_ARG_ENABLE_BOOL(system-ffi,
3943 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
3944     MOZ_NATIVE_FFI=1 )
3946 if test -n "$MOZ_NATIVE_FFI"; then
3947     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
3948     # for non-GCC compilers.
3949     if test -z "$GNU_CC"; then
3950         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
3951     else
3952         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
3953     fi
3954     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
3957 dnl ========================================================
3958 dnl System ICU Support
3959 dnl ========================================================
3960 MOZ_NATIVE_ICU=
3961 MOZ_ARG_WITH_BOOL(system-icu,
3962 [  --with-system-icu
3963                           Use system ICU (located with pkgconfig)],
3964     MOZ_NATIVE_ICU=1)
3966 if test -n "$MOZ_NATIVE_ICU"; then
3967     PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
3968     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
3971 AC_SUBST(MOZ_NATIVE_ICU)
3973 dnl ========================================================
3974 dnl Java SDK support
3975 dnl ========================================================
3977 JAVA_BIN_PATH=
3978 MOZ_ARG_WITH_STRING(java-bin-path,
3979 [  --with-java-bin-path=dir
3980                           Location of Java binaries (java, javac, jar)],
3981     JAVA_BIN_PATH=$withval)
3983 dnl ========================================================
3984 dnl =
3985 dnl = Application
3986 dnl =
3987 dnl ========================================================
3989 MOZ_ARG_HEADER(Application)
3991 ENABLE_TESTS=1
3992 ENABLE_SYSTEM_EXTENSION_DIRS=1
3993 MOZ_BRANDING_DIRECTORY=
3994 MOZ_OFFICIAL_BRANDING=
3995 MOZ_FEEDS=1
3996 MOZ_WEBAPP_RUNTIME=
3997 MOZ_JSDEBUGGER=1
3998 MOZ_AUTH_EXTENSION=1
3999 MOZ_OGG=1
4000 MOZ_RAW=
4001 MOZ_SPEEX_RESAMPLER=1
4002 MOZ_SOUNDTOUCH=1
4003 MOZ_CUBEB=
4004 MOZ_VORBIS=
4005 MOZ_TREMOR=
4006 MOZ_WAVE=1
4007 MOZ_SAMPLE_TYPE_FLOAT32=
4008 MOZ_SAMPLE_TYPE_S16=
4009 MOZ_OPUS=1
4010 MOZ_WEBM=1
4011 MOZ_DASH=
4012 MOZ_DIRECTSHOW=
4013 MOZ_WMF=
4014 MOZ_WEBRTC=1
4015 MOZ_PEERCONNECTION=
4016 MOZ_SRTP=
4017 MOZ_WEBRTC_SIGNALING=
4018 MOZ_WEBRTC_IN_LIBXUL=
4019 MOZ_WEBRTC_ASSERT_ALWAYS=1
4020 MOZ_SCTP=
4021 MOZ_MEDIA_PLUGINS=
4022 MOZ_MEDIA_NAVIGATOR=
4023 MOZ_OMX_PLUGIN=
4024 MOZ_VP8=
4025 MOZ_VP8_ERROR_CONCEALMENT=
4026 MOZ_VP8_ENCODER=
4027 MOZ_WEBSPEECH=1
4028 VPX_AS=
4029 VPX_ASFLAGS=
4030 VPX_AS_DASH_C_FLAG=
4031 VPX_AS_CONVERSION=
4032 VPX_ASM_SUFFIX=
4033 VPX_X86_ASM=
4034 VPX_ARM_ASM=
4035 LIBJPEG_TURBO_AS=
4036 LIBJPEG_TURBO_ASFLAGS=
4037 LIBJPEG_TURBO_X86_ASM=
4038 LIBJPEG_TURBO_X64_ASM=
4039 LIBJPEG_TURBO_ARM_ASM=
4040 MOZ_PANGO=1
4041 MOZ_PERMISSIONS=1
4042 MOZ_PLACES=1
4043 MOZ_SOCIAL=1
4044 MOZ_PREF_EXTENSIONS=1
4045 MOZ_PROFILELOCKING=1
4046 MOZ_REFLOW_PERF=
4047 MOZ_SAFE_BROWSING=
4048 MOZ_HELP_VIEWER=
4049 MOZ_SPELLCHECK=1
4050 MOZ_ANDROID_OMTC=
4051 MOZ_TOOLKIT_SEARCH=1
4052 MOZ_UI_LOCALE=en-US
4053 MOZ_UNIVERSALCHARDET=1
4054 MOZ_URL_CLASSIFIER=
4055 MOZ_XUL=1
4056 MOZ_ZIPWRITER=1
4057 NS_PRINTING=1
4058 MOZ_PDF_PRINTING=
4059 MOZ_DISABLE_CRYPTOLEGACY=
4060 NSS_DISABLE_DBM=
4061 NECKO_COOKIES=1
4062 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4063 USE_ARM_KUSER=
4064 BUILD_CTYPES=1
4065 MOZ_USE_NATIVE_POPUP_WINDOWS=
4066 MOZ_ANDROID_HISTORY=
4067 MOZ_WEBSMS_BACKEND=
4068 MOZ_ANDROID_BEAM=
4069 ACCESSIBILITY=1
4070 MOZ_TIME_MANAGER=
4071 MOZ_PAY=
4072 MOZ_AUDIO_CHANNEL_MANAGER=
4073 NSS_NO_LIBPKIX=
4074 MOZ_CONTENT_SANDBOX=
4075 MOZ_CONTENT_SANDBOX_REPORTER=
4077 case "$target_os" in
4078     mingw*)
4079         NS_ENABLE_TSF=1
4080         AC_DEFINE(NS_ENABLE_TSF)
4081         ;;
4082 esac
4084 case "${target}" in
4085     *-android*|*-linuxandroid*)
4086         if test "$CPU_ARCH" = "arm" ; then
4087           USE_ARM_KUSER=1
4088         fi
4090         NSS_DISABLE_DBM=1
4091         MOZ_THEME_FASTSTRIPE=1
4092         MOZ_TREE_FREETYPE=1
4093         MOZ_MEMORY=1
4094         MOZ_RAW=1
4095         ;;
4097 esac
4099 MOZ_ARG_WITH_STRING(external-source-dir,
4100 [  --with-external-source-dir=dir
4101                           External directory containing additional build files.],
4102 [ EXTERNAL_SOURCE_DIR=$withval])
4103 AC_SUBST(EXTERNAL_SOURCE_DIR)
4105 MOZ_ARG_ENABLE_STRING(application,
4106 [  --enable-application=APP
4107                           Options include:
4108                             browser (Firefox)
4109                             xulrunner
4110                             tools/update-packaging (AUS-related packaging tools)],
4111 [ MOZ_BUILD_APP=$enableval ] )
4113 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4114 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4115   XULRUNNER_STUB_NAME=$withval)
4117 if test -z "$XULRUNNER_STUB_NAME"; then
4118   case "$target_os" in
4119   darwin*)
4120     XULRUNNER_STUB_NAME=xulrunner
4121     ;;
4122   *)
4123     XULRUNNER_STUB_NAME=xulrunner-stub
4124   esac
4126 AC_SUBST(XULRUNNER_STUB_NAME)
4128 AC_MSG_CHECKING([for application to build])
4129 if test -z "$MOZ_BUILD_APP"; then
4130   AC_MSG_RESULT([browser])
4131   MOZ_BUILD_APP=browser
4132 else
4133   # "mobile" no longer exists.
4134   if test "$MOZ_BUILD_APP" = "mobile" ; then
4135     AC_MSG_RESULT([none])
4136     AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4137   fi
4138   # We have a valid application only if it has a build.mk file in its top
4139   # directory.
4140   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4141     AC_MSG_RESULT([none])
4142     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4143   else
4144     AC_MSG_RESULT([$MOZ_BUILD_APP])
4145   fi
4148 # The app update channel is 'default' when not supplied. The value is used in
4149 # the application's confvars.sh so it must be set before confvars.sh is called.
4150 MOZ_ARG_ENABLE_STRING([update-channel],
4151 [  --enable-update-channel=CHANNEL
4152                           Select application update channel (default=default)],
4153     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4155 if test -z "$MOZ_UPDATE_CHANNEL"; then
4156     MOZ_UPDATE_CHANNEL=default
4158 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4159 AC_SUBST(MOZ_UPDATE_CHANNEL)
4161 # Allow to specify a Google API key file that contains the secret key to be
4162 # used for various Google API requests.
4163 MOZ_ARG_WITH_STRING(google-api-keyfile,
4164 [  --with-google-api-keyfile=file   Use the secret key contained in the given keyfile for Google API requests],
4165   MOZ_GOOGLE_API_KEY=`cat $withval`)
4166 if test -z "$MOZ_GOOGLE_API_KEY"; then
4167     MOZ_GOOGLE_API_KEY=no-google-api-key
4169 AC_SUBST(MOZ_GOOGLE_API_KEY)
4171 # Allow the application to influence configure with a confvars.sh script.
4172 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4173 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4174   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4175   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4176 else
4177   AC_MSG_RESULT([no])
4180 # Allow influencing configure with a defines.sh script.
4181 . "${srcdir}/build/defines.sh"
4183 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4184 # set in defines.sh
4185 if test "$BUILDING_RELEASE"; then
4186   # Override value in defines.sh, if any
4187   EARLY_BETA_OR_EARLIER=
4188 elif test "$EARLY_BETA_OR_EARLIER"; then
4189   AC_DEFINE(EARLY_BETA_OR_EARLIER)
4191 AC_SUBST(EARLY_BETA_OR_EARLIER)
4193 # Allow the application to provide a subconfigure script
4194 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4195   do_output_subdirs() {
4196     if test -n "$_subconfigure_subdirs"; then
4197       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4198      fi
4199     _subconfigure_subdir="$1"
4200     _subconfigure_config_args="$ac_configure_args"
4201   }
4202   tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4203   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4204      "${srcdir}/build/autoconf/altoptions.m4" \
4205      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4206   . $tmpscript
4207   rm -f $tmpscript
4210 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4211 MOZ_ARG_WITH_STRING(app-name,
4212 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4213 WITH_APP_NAME=$withval,
4216 if test -n "$WITH_APP_NAME" ; then
4217     MOZ_APP_NAME="$WITH_APP_NAME"
4220 MOZ_ARG_WITH_STRING(app-basename,
4221 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4222 WITH_APP_BASENAME=$withval,
4225 if test -n "$WITH_APP_BASENAME" ; then
4226     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4229 # Now is a good time to test for logic errors, define mismatches, etc.
4230 case "$MOZ_BUILD_APP" in
4231 xulrunner)
4232   if test "$LIBXUL_SDK"; then
4233     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4234   fi
4235   ;;
4236 esac
4238 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4239 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4240 # MOZ_BUILD_APP.
4241 case "$MOZ_BUILD_APP" in
4242 browser)
4243   AC_DEFINE(MOZ_PHOENIX)
4244   ;;
4246 xulrunner)
4247   AC_DEFINE(MOZ_XULRUNNER)
4248   ;;
4249 b2g)
4250   AC_DEFINE(MOZ_B2G)
4251   ;;
4252 esac
4254 AC_SUBST(MOZ_BUILD_APP)
4255 AC_SUBST(MOZ_PHOENIX)
4256 AC_SUBST(MOZ_XULRUNNER)
4257 AC_SUBST(MOZ_B2G)
4259 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4261 dnl ========================================================
4262 dnl Check android sdk version depending on mobile target
4263 dnl ========================================================
4265 if test -z "$gonkdir" ; then
4266     # Minimum Android SDK API Level we require.
4267     case "$MOZ_BUILD_APP" in
4268     mobile/android)
4269         android_min_api_level=16
4270         case "$target" in
4271         *-android*|*-linuxandroid*)
4272             :
4273             ;;
4274         *)
4275             AC_MSG_ERROR([You must specify --target=arm-linux-androideabi (or some other valid android target) when building with --enable-application=mobile/android. See https://wiki.mozilla.org/Mobile/Fennec/Android#Setup_Fennec_mozconfig for more information about the necessary options])
4276             ;;
4277         esac
4278         ;;
4279     esac
4281     MOZ_ANDROID_SDK($android_min_api_level)
4284 dnl ========================================================
4285 dnl =
4286 dnl = Toolkit Options
4287 dnl =
4288 dnl ========================================================
4289 MOZ_ARG_HEADER(Toolkit Options)
4291     dnl ========================================================
4292     dnl = Select the default toolkit
4293     dnl ========================================================
4294         MOZ_ARG_ENABLE_STRING(default-toolkit,
4295         [  --enable-default-toolkit=TK
4296                           Select default toolkit
4297                           Platform specific defaults:
4298                             Mac OS X - cairo-cocoa
4299                             OS/2 - cairo-os2
4300                             Win32 - cairo-windows
4301                             * - cairo-gtk2
4302                             * - cairo-gtk3
4303                             * - cairo-qt],
4304     [ _DEFAULT_TOOLKIT=$enableval ],
4305     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4307     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4308         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4309         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4310         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4311         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4312         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4313         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4314         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4315         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4316         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4317     then
4318         dnl nglayout only supports building with one toolkit,
4319         dnl so ignore everything after the first comma (",").
4320         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4321     else
4322         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4323     fi
4325 MOZ_ARG_WITHOUT_BOOL(x,
4326 [  --without-x              Build without X11],
4327     WITHOUT_X11=1)
4329 dnl ========================================================
4330 dnl = Enable the toolkit as needed                         =
4331 dnl ========================================================
4333 MOZ_WIDGET_GTK=
4335 case "$MOZ_WIDGET_TOOLKIT" in
4337 cairo-windows)
4338     MOZ_WIDGET_TOOLKIT=windows
4339     MOZ_WEBGL=1
4340     MOZ_PDF_PRINTING=1
4341     MOZ_INSTRUMENT_EVENT_LOOP=1
4342     if test -n "$GNU_CC"; then
4343         MOZ_FOLD_LIBS=
4344     fi
4345     ;;
4347 cairo-gtk3)
4348     MOZ_WIDGET_TOOLKIT=gtk3
4349     MOZ_ENABLE_GTK=1
4350     MOZ_ENABLE_GTK3=1
4351     MOZ_ENABLE_XREMOTE=1
4352     MOZ_WEBGL=1
4353     MOZ_GL_DEFAULT_PROVIDER=GLX
4355     AC_DEFINE(MOZ_X11)
4356     MOZ_X11=1
4357     USE_FC_FREETYPE=1
4359     TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4360     TK_LIBS='$(MOZ_GTK3_LIBS)'
4361     MOZ_WIDGET_GTK=3
4362     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4363     MOZ_PDF_PRINTING=1
4364     MOZ_INSTRUMENT_EVENT_LOOP=1
4365     ;;
4367 cairo-gtk2|cairo-gtk2-x11)
4368     MOZ_WIDGET_TOOLKIT=gtk2
4369     MOZ_ENABLE_GTK=1
4370     MOZ_ENABLE_GTK2=1
4371     MOZ_ENABLE_XREMOTE=1
4372     MOZ_WEBGL=1
4373     MOZ_GL_DEFAULT_PROVIDER=GLX
4375     AC_DEFINE(MOZ_X11)
4376     MOZ_X11=1
4377     USE_FC_FREETYPE=1
4379     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4380     TK_LIBS='$(MOZ_GTK2_LIBS)'
4381     AC_DEFINE(MOZ_WIDGET_GTK2)
4382     MOZ_WIDGET_GTK=2
4383     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4384     MOZ_PDF_PRINTING=1
4385     MOZ_INSTRUMENT_EVENT_LOOP=1
4386     ;;
4388 cairo-qt)
4389     MOZ_WIDGET_TOOLKIT=qt
4390     MOZ_ENABLE_QT=1
4391     if test -z "$WITHOUT_X11"; then
4392       MOZ_ENABLE_XREMOTE=1
4393       MOZ_GL_DEFAULT_PROVIDER=GLX
4394       MOZ_X11=1
4395       AC_DEFINE(MOZ_X11)
4396       XT_LIBS=
4397     fi
4399     MOZ_WEBGL=1
4400     USE_ELF_DYNSTR_GC=
4401     USE_FC_FREETYPE=1
4402     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4403     TK_LIBS='$(MOZ_QT_LIBS)'
4404     AC_DEFINE(MOZ_WIDGET_QT)
4405     MOZ_PDF_PRINTING=1
4406     AC_DEFINE(QT_NO_KEYWORDS)
4407     ;;
4409 cairo-os2)
4410     MOZ_WIDGET_TOOLKIT=os2
4411     USE_FC_FREETYPE=1
4412     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4413     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4414     MOZ_PDF_PRINTING=1
4415     ;;
4417 cairo-cocoa)
4418     MOZ_WIDGET_TOOLKIT=cocoa
4419     AC_DEFINE(MOZ_WIDGET_COCOA)
4420     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4421     TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4422     TK_CFLAGS="-DNO_X11"
4423     CFLAGS="$CFLAGS $TK_CFLAGS"
4424     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4425     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4426     MOZ_USER_DIR="Mozilla"
4427     MOZ_FS_LAYOUT=bundle
4428     MOZ_WEBGL=1
4429     MOZ_INSTRUMENT_EVENT_LOOP=1
4430     ;;
4432 cairo-uikit)
4433     MOZ_WIDGET_TOOLKIT=uikit
4434     AC_DEFINE(MOZ_WIDGET_UIKIT)
4435     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4436     TK_CFLAGS="-DNO_X11"
4437     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4438     CFLAGS="$CFLAGS $TK_CFLAGS"
4439     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4440     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4441     MOZ_USER_DIR="Mozilla"
4442     MOZ_FS_LAYOUT=bundle
4443     ;;
4445 cairo-android)
4446     AC_DEFINE(MOZ_WIDGET_ANDROID)
4447     MOZ_WIDGET_TOOLKIT=android
4448     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4449     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4450     MOZ_WEBGL=1
4451     MOZ_PDF_PRINTING=1
4452     MOZ_INSTRUMENT_EVENT_LOOP=1
4453     ;;
4455 cairo-gonk)
4456     XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
4457     AC_DEFINE(MOZ_WIDGET_GONK)
4458     AC_DEFINE(MOZ_TOUCH)
4459     MOZ_WIDGET_TOOLKIT=gonk
4460     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4461     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4462     MOZ_WEBGL=1
4463     MOZ_PDF_PRINTING=1
4464     MOZ_TOUCH=1
4465     ;;
4467 esac
4469 AC_SUBST(MOZ_PDF_PRINTING)
4470 if test "$MOZ_PDF_PRINTING"; then
4471    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4472    AC_DEFINE(MOZ_PDF_PRINTING)
4475 if test "$MOZ_ENABLE_XREMOTE"; then
4476     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4479 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4480    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4483 if test "$COMPILE_ENVIRONMENT"; then
4484   if test "$MOZ_ENABLE_GTK3"; then
4485     PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4486   fi
4487   if test "$MOZ_ENABLE_GTK2"; then
4488     if test "$MOZ_X11"; then
4489       GDK_PACKAGES=gdk-x11-2.0
4490     fi
4492     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4493   fi
4495 fi # COMPILE_ENVIRONMENT
4497 AC_SUBST(MOZ_FS_LAYOUT)
4499 dnl ========================================================
4500 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4501 dnl their usage and use them in spidermonkey.
4502 dnl ========================================================
4503 MOZ_ARG_WITH_BOOL(arm-kuser,
4504 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4505     USE_ARM_KUSER=1,)
4506 if test -n "$USE_ARM_KUSER"; then
4507    AC_DEFINE(USE_ARM_KUSER)
4510 dnl ========================================================
4511 dnl = startup-notification support module
4512 dnl ========================================================
4514 if test "$MOZ_ENABLE_GTK"
4515 then
4516     MOZ_ENABLE_STARTUP_NOTIFICATION=
4518     MOZ_ARG_ENABLE_BOOL(startup-notification,
4519     [  --enable-startup-notification
4520                           Enable startup-notification support (default: disabled) ],
4521         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4522         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4523     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4524     then
4525         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4526                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4527         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4528             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4529             then
4530                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4531             fi
4532             MOZ_ENABLE_STARTUP_NOTIFICATION=
4533         ])
4534     fi
4536     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4537         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4538     fi
4540     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4542 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4543 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4544 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4546 dnl ========================================================
4547 dnl = QT support
4548 dnl ========================================================
4549 if test "$MOZ_ENABLE_QT"
4550 then
4551     MOZ_ARG_WITH_STRING(qtdir,
4552     [  --with-qtdir=\$dir       Specify Qt directory ],
4553     [ QTDIR=$withval])
4555     if test -z "$QTDIR"; then
4556         AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4557     else
4558         HOST_QMAKE="$QTDIR/bin/qmake"
4559     fi
4560     QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4562     if test -z "$QTDIR"; then
4563         case $QT_VERSION in
4564         5.*)
4565             AC_MSG_RESULT("Using qt5: $QT_VERSION")
4566             PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5OpenGL Qt5Widgets Qt5PrintSupport, ,
4567             [
4568               AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4569             ])
4570             QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4571             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4572             ;;
4573         4.*)
4574             AC_MSG_RESULT("Using qt4: $QT_VERSION")
4575             PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL, ,
4576             [
4577               AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt4 development package, (On Ubuntu, you might try installing the packages libqt4-dev libqt4-opengl-dev.)])
4578             ])
4579             ;;
4580         *)
4581             AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4582             ;;
4583         esac
4585         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4586         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4587     else
4588         MOZ_QT_CFLAGS="-DQT_SHARED"
4589         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4590         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4591         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4592         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4593         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4594         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4596         case $QT_VERSION in
4597         5.*)
4598             AC_MSG_RESULT("Using qt5: $QT_VERSION")
4599             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4600             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4601             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4602             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4603             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4604             ;;
4605         4.*)
4606             AC_MSG_RESULT("Using qt4: $QT_VERSION")
4607             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4608             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4609             ;;
4610         *)
4611             AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4612             ;;
4613         esac
4615         HOST_MOC="$QTDIR/bin/moc"
4616         HOST_RCC="$QTDIR/bin/rcc"
4617     fi
4618     if test -z "$HOST_MOC"; then
4619         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4620 incorrect])
4621     fi
4622     if test -z "$HOST_RCC"; then
4623         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4624 incorrect])
4625     fi
4627     MOC=$HOST_MOC
4628     RCC=$HOST_RCC
4630     MOZ_ENABLE_QMSYSTEM2=
4631     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4632                       MOZ_ENABLE_QMSYSTEM2=1,
4633                       MOZ_ENABLE_QMSYSTEM2=)
4635     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4636       MOZ_ENABLE_QMSYSTEM2=1
4637       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4638       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4639       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4640     fi
4642     MOZ_ENABLE_QTNETWORK=
4643     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4644                       MOZ_ENABLE_QTNETWORK=1,
4645                       MOZ_ENABLE_QTNETWORK=)
4647     if test "$MOZ_ENABLE_QTNETWORK"; then
4648       MOZ_ENABLE_QTNETWORK=1
4649       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4650     fi
4652     MOZ_ENABLE_QTMOBILITY=
4653     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4654                       MOZ_ENABLE_QTMOBILITY=1,
4655                       MOZ_ENABLE_QTMOBILITY=)
4656     if test "$MOZ_ENABLE_QTMOBILITY"; then
4657        MOZ_ENABLE_QTMOBILITY=1
4658        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4659        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4660        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4661        AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4662     else
4663        AC_CHECK_LIB(QtSensors, main, [
4664           MOZ_ENABLE_QTMOBILITY=1
4665           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4666           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4667           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4668           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4669           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4670        ])
4671     fi
4673     if test "$MOZ_ENABLE_CONTENTACTION"; then
4674       MOZ_ENABLE_CONTENTACTION=1
4675       AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4676     fi
4678     MOZ_ENABLE_CONTENTACTION=
4679     PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4680     if test "$MOZ_ENABLE_CONTENTACTION"; then
4681        MOZ_ENABLE_CONTENTACTION=1
4682        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4683        MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4684        AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4685        AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4686     fi
4689 AC_SUBST(GTK_CONFIG)
4690 AC_SUBST(TK_CFLAGS)
4691 AC_SUBST(TK_LIBS)
4693 AC_SUBST(MOZ_ENABLE_GTK2)
4694 AC_SUBST(MOZ_ENABLE_GTK3)
4695 AC_SUBST(MOZ_ENABLE_GTK)
4696 AC_SUBST(MOZ_ENABLE_QT)
4697 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4698 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4699 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4700 AC_SUBST(MOZ_ENABLE_XREMOTE)
4701 AC_SUBST(MOZ_GTK2_CFLAGS)
4702 AC_SUBST(MOZ_GTK2_LIBS)
4703 AC_SUBST(MOZ_GTK3_CFLAGS)
4704 AC_SUBST(MOZ_GTK3_LIBS)
4705 AC_SUBST(MOZ_WIDGET_GTK)
4706 AC_SUBST(MOZ_QT_CFLAGS)
4707 AC_SUBST(MOZ_QT_LIBS)
4709 AC_SUBST(MOC)
4710 AC_SUBST(RCC)
4712 AC_SUBST(MOZ_X11)
4714 dnl ========================================================
4715 dnl =
4716 dnl = Components & Features
4717 dnl =
4718 dnl ========================================================
4719 MOZ_ARG_HEADER(Components and Features)
4721 dnl ========================================================
4722 dnl = Localization
4723 dnl ========================================================
4724 MOZ_ARG_ENABLE_STRING(ui-locale,
4725 [  --enable-ui-locale=ab-CD
4726                           Select the user interface locale (default: en-US)],
4727     MOZ_UI_LOCALE=$enableval )
4728 AC_SUBST(MOZ_UI_LOCALE)
4730 dnl ========================================================
4731 dnl = Trademarked Branding
4732 dnl ========================================================
4733 MOZ_ARG_ENABLE_BOOL(official-branding,
4734 [  --enable-official-branding
4735                           Enable Official mozilla.org Branding
4736                           Do not distribute builds with
4737                           --enable-official-branding unless you have
4738                           permission to use trademarks per
4739                           http://www.mozilla.org/foundation/trademarks/ .],
4741   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4742     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4743   else
4744     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4745     MOZ_OFFICIAL_BRANDING=1
4746   fi
4747 ], MOZ_OFFICIAL_BRANDING=)
4749 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4750 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4751   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4754 MOZ_ARG_WITH_STRING(branding,
4755 [  --with-branding=dir     Use branding from the specified directory.],
4756     MOZ_BRANDING_DIRECTORY=$withval)
4758 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4759 if test -z "$REAL_BRANDING_DIRECTORY"; then
4760   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4763 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4764   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4767 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4769 dnl ========================================================
4770 dnl = Distribution ID
4771 dnl ========================================================
4772 MOZ_ARG_WITH_STRING(distribution-id,
4773 [  --with-distribution-id=ID
4774                           Set distribution-specific id (default=org.mozilla)],
4775 [ val=`echo $withval`
4776     MOZ_DISTRIBUTION_ID="$val"])
4778 if test -z "$MOZ_DISTRIBUTION_ID"; then
4779    MOZ_DISTRIBUTION_ID="org.mozilla"
4782 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4783 AC_SUBST(MOZ_DISTRIBUTION_ID)
4786 dnl ========================================================
4787 dnl complex text support off by default
4788 dnl ========================================================
4789 MOZ_ARG_DISABLE_BOOL(pango,
4790 [  --disable-pango         Disable usage of Pango ],
4791     MOZ_PANGO=,
4792     MOZ_PANGO=1)
4794 dnl ========================================================
4795 dnl = Pango
4796 dnl ========================================================
4797 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4798 then
4799     AC_SUBST(MOZ_PANGO)
4801     if test "$MOZ_PANGO"
4802     then
4803         PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4805         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4806         AC_SUBST(MOZ_PANGO_CFLAGS)
4807         AC_SUBST(MOZ_PANGO_LIBS)
4808         AC_DEFINE(MOZ_PANGO)
4809     else
4810         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
4811         AC_SUBST(FT2_CFLAGS)
4812         AC_SUBST(FT2_LIBS)
4813     fi
4816 dnl ========================================================
4817 dnl = GnomeVFS, GIO and GConf support module
4818 dnl ========================================================
4820 if test "$MOZ_X11"
4821 then
4822     dnl build the GIO extension by default only when the
4823     dnl GTK2 toolkit is in use.
4824     if test "$MOZ_ENABLE_GTK"
4825     then
4826         MOZ_ENABLE_GIO=1
4827         MOZ_ENABLE_GCONF=1
4828     fi
4830     dnl ========================================================
4831     dnl = GnomeVFS support module
4832     dnl ========================================================
4833     MOZ_ARG_ENABLE_BOOL(gnomevfs,
4834     [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
4835         MOZ_ENABLE_GNOMEVFS=force,
4836         MOZ_ENABLE_GNOMEVFS=)
4838     if test "$MOZ_ENABLE_GNOMEVFS"
4839     then
4840         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4841             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4842             MOZ_ENABLE_GNOMEVFS=1
4843             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4844         ],[
4845             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4846             then
4847                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4848             fi
4849             MOZ_ENABLE_GNOMEVFS=
4850         ])
4851     fi
4853     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4854     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4855     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4857     dnl ========================================================
4858     dnl = GIO support module
4859     dnl ========================================================
4860     MOZ_ARG_DISABLE_BOOL(gio,
4861     [  --disable-gio           Disable GIO support],
4862         MOZ_ENABLE_GIO=,
4863         MOZ_ENABLE_GIO=force)
4865     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4866     then
4867         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4868                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4869         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4870             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4871             MOZ_ENABLE_GIO=1
4872             AC_DEFINE(MOZ_ENABLE_GIO)
4873         ],[
4874             if test "$MOZ_ENABLE_GIO" = "force"
4875             then
4876                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4877             fi
4878             MOZ_ENABLE_GIO=
4879         ])
4880     fi
4882     AC_SUBST(MOZ_ENABLE_GIO)
4883     AC_SUBST(MOZ_GIO_CFLAGS)
4884     AC_SUBST(MOZ_GIO_LIBS)
4886     dnl ========================================================
4887     dnl = GConf support module
4888     dnl ========================================================
4889     MOZ_ARG_DISABLE_BOOL(gconf,
4890     [  --disable-gconf      Disable Gconf support ],
4891         MOZ_ENABLE_GCONF=,
4892         MOZ_ENABLE_GCONF=force)
4894     if test "$MOZ_ENABLE_GCONF"
4895     then
4896         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4897             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4898             MOZ_ENABLE_GCONF=1
4899         ],[
4900             if test "$MOZ_ENABLE_GCONF" = "force"
4901             then
4902                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4903             fi
4904             MOZ_ENABLE_GCONF=
4905         ])
4906     fi
4908     if test "$MOZ_ENABLE_GCONF"; then
4909         AC_DEFINE(MOZ_ENABLE_GCONF)
4910     fi
4912     AC_SUBST(MOZ_ENABLE_GCONF)
4913     AC_SUBST(MOZ_GCONF_CFLAGS)
4914     AC_SUBST(MOZ_GCONF_LIBS)
4917 dnl ========================================================
4918 dnl = libproxy support
4919 dnl ========================================================
4921 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4922 then
4923     MOZ_ENABLE_LIBPROXY=
4925     MOZ_ARG_ENABLE_BOOL(libproxy,
4926     [  --enable-libproxy         Enable libproxy support ],
4927     MOZ_ENABLE_LIBPROXY=1,
4928     MOZ_ENABLE_LIBPROXY=)
4930     if test "$MOZ_ENABLE_LIBPROXY"
4931     then
4932         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4933         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4934     fi
4936 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4937 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4938 AC_SUBST(MOZ_LIBPROXY_LIBS)
4940 dnl ========================================================
4941 dnl = GNOME component (mozgnome)
4942 dnl ========================================================
4944 if test "$MOZ_ENABLE_GTK2"
4945 then
4946     MOZ_ENABLE_GNOME_COMPONENT=1
4948 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4950 dnl ========================================================
4951 dnl = libgnomeui support module
4952 dnl ========================================================
4954 if test "$MOZ_ENABLE_GTK"
4955 then
4956     MOZ_ARG_ENABLE_BOOL(gnomeui,
4957     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
4958         MOZ_ENABLE_GNOMEUI=force,
4959         MOZ_ENABLE_GNOMEUI=)
4961     if test "$MOZ_ENABLE_GNOMEUI"
4962     then
4963         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4964         [
4965             MOZ_ENABLE_GNOMEUI=1
4966         ],[
4967             if test "$MOZ_ENABLE_GNOMEUI" = "force"
4968             then
4969                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4970             fi
4971             MOZ_ENABLE_GNOMEUI=
4972         ])
4973     fi
4975     if test "$MOZ_ENABLE_GNOMEUI"; then
4976         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4977     fi
4980 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4981 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
4983 dnl ========================================================
4984 dnl = dbus support
4985 dnl ========================================================
4987 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4988 then
4989     MOZ_ENABLE_DBUS=1
4991     MOZ_ARG_DISABLE_BOOL(dbus,
4992     [  --disable-dbus          Disable dbus support ],
4993         MOZ_ENABLE_DBUS=,
4994         MOZ_ENABLE_DBUS=1)
4996     if test "$MOZ_ENABLE_DBUS"
4997     then
4998         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4999         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5000         AC_DEFINE(MOZ_ENABLE_DBUS)
5001     fi
5003 AC_SUBST(MOZ_ENABLE_DBUS)
5004 AC_SUBST(MOZ_DBUS_CFLAGS)
5005 AC_SUBST(MOZ_DBUS_LIBS)
5006 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5007 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5009 dnl ========================================================
5010 dnl = Enable Android History instead of Places
5011 dnl ========================================================
5012 if test -n "$MOZ_ANDROID_HISTORY"; then
5013     if test -z "$MOZ_PLACES"; then
5014         AC_DEFINE(MOZ_ANDROID_HISTORY)
5015     else
5016         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
5017     fi
5020 dnl ========================================================
5021 dnl = Build with the Android compositor
5022 dnl ========================================================
5023 if test -n "$MOZ_ANDROID_OMTC"; then
5024      dnl Do this if defined in confvars.sh
5025      AC_DEFINE(MOZ_ANDROID_OMTC)
5028 dnl ========================================================
5029 dnl = Disable WebSMS backend
5030 dnl ========================================================
5031 MOZ_ARG_DISABLE_BOOL(websms-backend,
5032 [  --disable-websms-backend
5033                            Disable WebSMS backend],
5034     MOZ_WEBSMS_BACKEND=,
5035     MOZ_WEBSMS_BACKEND=1)
5037 if test -n "$MOZ_WEBSMS_BACKEND"; then
5038     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5041 dnl ========================================================
5042 dnl = Enable NFC permission on Android
5043 dnl ========================================================
5044 if test -n "$MOZ_ANDROID_BEAM"; then
5045     AC_DEFINE(MOZ_ANDROID_BEAM)
5048 dnl ========================================================
5049 dnl = JS Debugger XPCOM component (js/jsd)
5050 dnl ========================================================
5051 MOZ_ARG_DISABLE_BOOL(jsd,
5052 [  --disable-jsd           Disable JavaScript debug library],
5053     MOZ_JSDEBUGGER=,
5054     MOZ_JSDEBUGGER=1)
5057 dnl ========================================================
5058 dnl = Enable IPDL's "expensive" unit tests
5059 dnl ========================================================
5060 MOZ_IPDL_TESTS=
5062 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5063 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5064     MOZ_IPDL_TESTS=1,
5065     MOZ_IPDL_TESTS=)
5067 if test -n "$MOZ_IPDL_TESTS"; then
5068     AC_DEFINE(MOZ_IPDL_TESTS)
5071 AC_SUBST(MOZ_IPDL_TESTS)
5073 dnl ========================================================
5074 dnl = Disable building dbm
5075 dnl ========================================================
5076 MOZ_ARG_DISABLE_BOOL(dbm,
5077 [  --disable-dbm           Disable building dbm],
5078     NSS_DISABLE_DBM=1,
5079     NSS_DISABLE_DBM=)
5081 dnl bi-directional support always on
5082 IBMBIDI=1
5083 AC_DEFINE(IBMBIDI)
5085 dnl ========================================================
5086 dnl accessibility support on by default on all platforms
5087 dnl ========================================================
5088 MOZ_ARG_DISABLE_BOOL(accessibility,
5089 [  --disable-accessibility Disable accessibility support],
5090     ACCESSIBILITY=,
5091     ACCESSIBILITY=1 )
5092 if test "$ACCESSIBILITY"; then
5093     case "$target" in
5094     *-mingw*)
5095         if test -z "$MIDL"; then
5096             if test "$GCC" != "yes"; then
5097                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5098             else
5099                 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
5100             fi
5101         fi
5102     esac
5103     AC_DEFINE(ACCESSIBILITY)
5106 dnl ========================================================
5107 dnl Accessibility is required for the linuxgl widget
5108 dnl backend
5109 dnl ========================================================
5110 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5111     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5114 dnl ========================================================
5115 dnl Disable printing
5116 dnl ========================================================
5117 MOZ_ARG_DISABLE_BOOL(printing,
5118 [  --disable-printing      Disable printing support],
5119     NS_PRINTING=,
5120     NS_PRINTING=1)
5122 if test "$NS_PRINTING"; then
5123     AC_DEFINE(NS_PRINTING)
5124     AC_DEFINE(NS_PRINT_PREVIEW)
5127 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5128 dnl --enable-webrtc to override.  Can disable for everything in
5129 dnl the master list above.
5130 if test -n "$MOZ_WEBRTC"; then
5131     case "$target" in
5132     *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
5133         dnl Leave enabled
5134         ;;
5135     *)
5136         dnl default to disabled for all others
5137         MOZ_WEBRTC=
5138         ;;
5139     esac
5142 AC_TRY_COMPILE([#include <linux/ethtool.h>],
5143                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
5144                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
5146 # target_arch is from {ia32|x64|arm|ppc}
5147 case "$CPU_ARCH" in
5148 x86_64)
5149     WEBRTC_TARGET_ARCH=x64
5150     ;;
5152 arm*)
5153     WEBRTC_TARGET_ARCH=arm
5154     ;;
5156 x86)
5157     WEBRTC_TARGET_ARCH=ia32
5158     ;;
5160 ppc*)
5161     WEBRTC_TARGET_ARCH=ppc
5162     ;;
5163 ia64)
5164     WEBRTC_TARGET_ARCH=ia64
5165     ;;
5167 # unsupported arch for webrtc
5168     WEBRTC_TARGET_ARCH=unknown
5169     MOZ_WEBRTC=
5170     ;;
5172 esac
5174 dnl ========================================================
5175 dnl = Disable WebRTC code
5176 dnl ========================================================
5177 MOZ_ARG_DISABLE_BOOL(webrtc,
5178 [  --disable-webrtc        Disable support for WebRTC],
5179     MOZ_WEBRTC=,
5180     MOZ_WEBRTC=1)
5182 if test -n "$MOZ_WEBRTC"; then
5183     AC_DEFINE(MOZ_WEBRTC)
5184     dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5185     dnl opt/production builds (via MOZ_CRASH())
5186     AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5187     MOZ_RAW=1
5188     MOZ_VP8=1
5189     MOZ_VP8_ENCODER=1
5190     MOZ_VP8_ERROR_CONCEALMENT=1
5192 dnl enable once Signaling lands
5193     MOZ_WEBRTC_SIGNALING=1
5194     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5195     if test "${OS_TARGET}" = "WINNT"; then
5196         MOZ_WEBRTC_IN_LIBXUL=1
5197     fi
5198 dnl enable once PeerConnection lands
5199     MOZ_PEERCONNECTION=1
5200     AC_DEFINE(MOZ_PEERCONNECTION)
5201     MOZ_SCTP=1
5202     MOZ_SRTP=1
5203     AC_DEFINE(MOZ_SCTP)
5204     AC_DEFINE(MOZ_SRTP)
5207 AC_SUBST(MOZ_WEBRTC)
5208 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5209 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5210 AC_SUBST(MOZ_PEERCONNECTION)
5211 AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
5212 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5213 AC_SUBST(MOZ_SCTP)
5214 AC_SUBST(MOZ_SRTP)
5216 dnl Use integers over floats for audio on B2G and Android, because audio
5217 dnl backends for those platforms don't support floats.
5218 if test "$OS_TARGET" = "Android"; then
5219     MOZ_SAMPLE_TYPE_S16=1
5220     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5221     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5222 else
5223     MOZ_SAMPLE_TYPE_FLOAT32=1
5224     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5225     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5228 dnl ========================================================
5229 dnl = Disable Speech API code
5230 dnl ========================================================
5231 MOZ_ARG_DISABLE_BOOL(webspeech,
5232 [  --disable-webspeech        Disable support for HTML Speech API],
5233     MOZ_WEBSPEECH=,
5234     MOZ_WEBSPEECH=1)
5236 if test -n "$MOZ_WEBSPEECH"; then
5237     AC_DEFINE(MOZ_WEBSPEECH)
5240 AC_SUBST(MOZ_WEBSPEECH)
5242 dnl ========================================================
5243 dnl = Enable Raw Codecs
5244 dnl ========================================================
5245 MOZ_ARG_ENABLE_BOOL(raw,
5246 [  --enable-raw           Enable support for RAW media],
5247     MOZ_RAW=1,
5248     MOZ_RAW=)
5250 if test -n "$MOZ_RAW"; then
5251     AC_DEFINE(MOZ_RAW)
5254 AC_SUBST(MOZ_RAW)
5256 dnl ========================================================
5257 dnl = Disable Ogg Codecs
5258 dnl ========================================================
5259 MOZ_ARG_DISABLE_BOOL(ogg,
5260 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5261     MOZ_OGG=,
5262     MOZ_OGG=1)
5264 if test -n "$MOZ_OGG"; then
5265     AC_DEFINE(MOZ_OGG)
5266     MOZ_CUBEB=1
5268     dnl Checks for __attribute__(aligned()) directive
5269     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5270         [ac_cv_c_attribute_aligned],
5271         [ac_cv_c_attribute_aligned=0
5272          CFLAGS_save="${CFLAGS}"
5273          CFLAGS="${CFLAGS} -Werror"
5274          for ac_cv_c_attr_align_try in 64 32 16 8; do
5275            echo "trying $ac_cv_c_attr_align_try"
5276            AC_TRY_COMPILE([],
5277                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5278                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5279            if test "$ac_cv_c_attribute_aligned" != 0; then
5280              break;
5281            fi
5282          done
5283            CFLAGS="${CFLAGS_save}"])
5284     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5285       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5286                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5287     fi
5290 dnl ========================================================
5291 dnl = Disable Opus audio codec support
5292 dnl ========================================================
5293 MOZ_ARG_DISABLE_BOOL(opus,
5294 [  --disable-opus          Disable support for Opus audio],
5295     MOZ_OPUS=,
5296     MOZ_OPUS=1)
5298 dnl ========================================================
5299 dnl = Disable VP8 decoder support
5300 dnl ========================================================
5301 MOZ_ARG_DISABLE_BOOL(webm,
5302 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5303     MOZ_WEBM=,
5304     MOZ_WEBM=1)
5306 if test -n "$MOZ_WEBM"; then
5307     AC_DEFINE(MOZ_WEBM)
5308     MOZ_VP8=1
5311 dnl ========================================================
5312 dnl = DirectShow support
5313 dnl ========================================================
5314 if test "$OS_ARCH" = "WINNT"; then
5315     dnl Enable DirectShow support by default.
5316     MOZ_DIRECTSHOW=1
5319 MOZ_ARG_DISABLE_BOOL(directshow,
5320 [  --disable-directshow  Disable support for DirectShow],
5321     MOZ_DIRECTSHOW=,
5322     MOZ_DIRECTSHOW=1)
5324 if test -n "$MOZ_DIRECTSHOW"; then
5325     AC_DEFINE(MOZ_DIRECTSHOW)
5326     MOZ_CUBEB=1
5329 dnl ========================================================
5330 dnl = Windows Media Foundation support
5331 dnl ========================================================
5332 if test "$OS_ARCH" = "WINNT"; then
5333     dnl Enable Windows Media Foundation support by default.
5334     dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5335     dnl guaranteed to have a recent-enough SDK to build WMF.
5336     MOZ_WMF=1
5339 MOZ_ARG_DISABLE_BOOL(wmf,
5340 [  --disable-wmf  Disable support for Windows Media Foundation],
5341     MOZ_WMF=,
5342     MOZ_WMF=1)
5344 if test -n "$MOZ_WMF"; then
5345     AC_DEFINE(MOZ_WMF)
5346     MOZ_CUBEB=1
5349 dnl ========================================================
5350 dnl = Enable media plugin support
5351 dnl ========================================================
5352 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5353   dnl Enable support on android by default
5354   MOZ_MEDIA_PLUGINS=1
5357 MOZ_ARG_ENABLE_BOOL(media-plugins,
5358 [  --enable-media-plugins  Enable support for media plugins],
5359     MOZ_MEDIA_PLUGINS=1,
5360     MOZ_MEDIA_PLUGINS=)
5362 if test -n "$MOZ_MEDIA_PLUGINS"; then
5363   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5366 dnl ========================================================
5367 dnl = Disable platform MP3 decoder on OSX
5368 dnl ========================================================
5369 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5370   MOZ_APPLEMEDIA=1
5373 MOZ_ARG_DISABLE_BOOL(apple-media,
5374 [  --disable-apple-media  Disable support for Apple AudioToolbox/VideoToolbox],
5375     MOZ_APPLEMEDIA=,
5376     MOZ_APPLEMEDIA=1)
5378 if test -n "$MOZ_APPLEMEDIA"; then
5379   AC_DEFINE(MOZ_APPLEMEDIA)
5382 dnl ========================================================
5383 dnl = Enable getUserMedia support
5384 dnl ========================================================
5385 MOZ_ARG_ENABLE_BOOL(media-navigator,
5386 [  --enable-media-navigator  Enable support for getUserMedia],
5387     MOZ_MEDIA_NAVIGATOR=1,
5388     MOZ_MEDIA_NAVIGATOR=)
5390 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5391   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5394 dnl ========================================================
5395 dnl = Enable building OMX media plugin (B2G or Android)
5396 dnl ========================================================
5397 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5398   dnl Enable support on android by default
5399   MOZ_OMX_PLUGIN=1
5402 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5403 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5404     MOZ_OMX_PLUGIN=1,
5405     MOZ_OMX_PLUGIN=)
5407 if test -n "$MOZ_OMX_PLUGIN"; then
5408     if test "$OS_TARGET" = "Android"; then
5409         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5410         AC_DEFINE(MOZ_OMX_PLUGIN)
5411     else
5412        dnl fail if we're not building on Gonk or Android
5413        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5414     fi
5417 dnl system libvpx Support
5418 dnl ========================================================
5419 MOZ_ARG_WITH_BOOL(system-libvpx,
5420 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5421     MOZ_NATIVE_LIBVPX=1)
5423 MOZ_LIBVPX_CFLAGS=
5424 MOZ_LIBVPX_LIBS=
5426 if test -n "$MOZ_VP8"; then
5427     AC_DEFINE(MOZ_VP8)
5428     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5429         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5430     fi
5431     if test -n "$MOZ_VP8_ENCODER" ; then
5432         AC_DEFINE(MOZ_VP8_ENCODER)
5433     fi
5435     if test -n "$MOZ_NATIVE_LIBVPX"; then
5436         dnl ============================
5437         dnl === libvpx Version check ===
5438         dnl ============================
5439         dnl Check to see if we have a system libvpx package.
5440         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
5442         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5443          [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.])])
5445         _SAVE_LIBS=$LIBS
5446         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5447          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5448         LIBS=$_SAVE_LIBS
5449     fi
5452 AC_SUBST(MOZ_NATIVE_LIBVPX)
5453 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5454 AC_SUBST(MOZ_LIBVPX_LIBS)
5456 if test "$MOZ_WEBM"; then
5457     MOZ_CUBEB=1
5458     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5459         MOZ_VORBIS=1
5460     else
5461         MOZ_TREMOR=1
5462     fi
5465 if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
5467     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5468     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5469     dnl We currently require gcc on all arm platforms.
5470     VPX_AS=$YASM
5471     VPX_ASM_SUFFIX=asm
5472     VPX_NEED_OBJ_INT_EXTRACT=
5474     dnl See if we have assembly on this platform.
5475     case "$OS_ARCH:$CPU_ARCH" in
5476     Darwin:x86)
5477       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5478       VPX_X86_ASM=1
5479     ;;
5480     Darwin:x86_64)
5481       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5482       VPX_X86_ASM=1
5483     ;;
5484     WINNT:x86_64)
5485       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5486       VPX_X86_ASM=1
5487     ;;
5488     WINNT:x86)
5489       dnl Check for yasm 1.1 or greater.
5490       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5491         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.])
5492       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5493         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.])
5494       else
5495         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5496         VPX_X86_ASM=1
5497         dnl The encoder needs obj_int_extract to get asm offsets.
5498       fi
5499     ;;
5500     *:arm*)
5501       if test -n "$GNU_AS" ; then
5502         VPX_AS=$AS
5503         dnl These flags are a lie; they're just used to enable the requisite
5504         dnl opcodes; actual arch detection is done at runtime.
5505         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5506         VPX_DASH_C_FLAG="-c"
5507         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5508         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5509         VPX_ARM_ASM=1
5510       fi
5511     ;;
5512     *:x86)
5513       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5514         VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5515         VPX_X86_ASM=1
5516       fi
5517     ;;
5518     *:x86_64)
5519       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5520         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5521         VPX_X86_ASM=1
5522       fi
5523     ;;
5524     esac
5526     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5527       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.])
5528     fi
5530     if test -n "$MOZ_VP8_ENCODER" -a \
5531             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5532       dnl We prefer to get asm offsets using inline assembler, which the above
5533       dnl compilers can do. When we're not using one of those, we have to fall
5534       dnl back to obj_int_extract, which reads them from a compiled object
5535       dnl file. Unfortunately, that only works if we're compiling on a system
5536       dnl with the header files for the appropriate object file format.
5537       VPX_NEED_OBJ_INT_EXTRACT=1
5538     fi
5540     if test -n "$VPX_X86_ASM"; then
5541       AC_DEFINE(VPX_X86_ASM)
5542     elif test -n "$VPX_ARM_ASM"; then
5543       AC_DEFINE(VPX_ARM_ASM)
5544     else
5545       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5546     fi
5549 dnl ========================================================
5550 dnl = Disable Wave decoder support
5551 dnl ========================================================
5552 MOZ_ARG_DISABLE_BOOL(wave,
5553 [  --disable-wave          Disable Wave decoder support],
5554     MOZ_WAVE=,
5555     MOZ_WAVE=1)
5557 if test -n "$MOZ_WAVE"; then
5558     AC_DEFINE(MOZ_WAVE)
5559     MOZ_CUBEB=1
5562 dnl ========================================================
5563 dnl = Handle dependent CUBEB and MEDIA defines
5564 dnl ========================================================
5566 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5567     AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5570 if test -n "$MOZ_SOUNDTOUCH"; then
5571     AC_DEFINE(MOZ_SOUNDTOUCH)
5574 if test -n "$MOZ_CUBEB"; then
5575     AC_DEFINE(MOZ_CUBEB)
5578 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5579     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/])
5582 if test -n "$MOZ_VORBIS"; then
5583     AC_DEFINE(MOZ_VORBIS)
5586 if test -n "$MOZ_TREMOR"; then
5587     AC_DEFINE(MOZ_TREMOR)
5590 if test -n "$MOZ_OPUS"; then
5591     AC_DEFINE(MOZ_OPUS)
5594 dnl ========================================================
5595 dnl = Check alsa availability on Linux if using sydneyaudio
5596 dnl ========================================================
5598 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5599 if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
5600     MOZ_ALSA=1
5603 MOZ_ARG_ENABLE_BOOL(alsa,
5604 [  --enable-alsa          Enable Alsa support (default on Linux)],
5605 MOZ_ALSA=1,
5606 MOZ_ALSA=)
5608 if test -n "$MOZ_ALSA"; then
5609     AC_DEFINE(MOZ_CUBEB)
5610     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5611          [echo "$MOZ_ALSA_PKG_ERRORS"
5612           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.)])])
5615 AC_SUBST(MOZ_ALSA)
5616 AC_SUBST(MOZ_ALSA_CFLAGS)
5617 AC_SUBST(MOZ_ALSA_LIBS)
5619 dnl ========================================================
5620 dnl = Enable PulseAudio
5621 dnl ========================================================
5623 MOZ_ARG_ENABLE_BOOL(pulseaudio,
5624 [  --enable-pulseaudio          Enable PulseAudio support (experimental)],
5625 MOZ_PULSEAUDIO=1,
5626 MOZ_PULSEAUDIO=)
5628 if test -n "$MOZ_PULSEAUDIO"; then
5629     AC_DEFINE(MOZ_CUBEB)
5630     if test -z "$gonkdir"; then
5631         PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5632              [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5633               AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5634     else
5635         MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5636         MOZ_PULSEAUDIO_LIBS="-lpulse"
5637     fi
5640 AC_SUBST(MOZ_PULSEAUDIO)
5641 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5642 AC_SUBST(MOZ_PULSEAUDIO_LIBS)
5644 dnl ========================================================
5645 dnl = Enable GStreamer
5646 dnl ========================================================
5647 if test "$OS_TARGET" = "Linux"; then
5648   MOZ_GSTREAMER=1
5651 MOZ_ARG_ENABLE_BOOL(gstreamer,
5652 [  --enable-gstreamer           Enable GStreamer support],
5653 MOZ_GSTREAMER=1,
5654 MOZ_GSTREAMER=)
5656 if test "$MOZ_GSTREAMER"; then
5657     # API version, eg 0.10, 1.0 etc
5658     GST_API_VERSION=0.10
5659     # core/base release number
5660     GST_VERSION=0.10.25
5661     PKG_CHECK_MODULES(GSTREAMER,
5662                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5663                       gstreamer-app-$GST_API_VERSION
5664                       gstreamer-plugins-base-$GST_API_VERSION, ,
5665                       AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer]))
5666     if test -n "$GSTREAMER_LIBS"; then
5667        _SAVE_LDFLAGS=$LDFLAGS
5668        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5669        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5670        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5671           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5672        else
5673           AC_MSG_ERROR([gstreamer-plugins-base found, but no libgstvideo. Something has gone terribly wrong. Try reinstalling gstreamer-plugins-base; failing that, disable the gstreamer backend with --disable-gstreamer.])
5674        fi
5675        LDFLAGS=$_SAVE_LDFLAGS
5676     else
5677        AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer])
5678     fi
5680 AC_SUBST(GSTREAMER_CFLAGS)
5681 AC_SUBST(GSTREAMER_LIBS)
5682 AC_SUBST(MOZ_GSTREAMER)
5684 if test -n "$MOZ_GSTREAMER"; then
5685    AC_DEFINE(MOZ_GSTREAMER)
5689 dnl ========================================================
5690 dnl Permissions System
5691 dnl ========================================================
5692 MOZ_ARG_DISABLE_BOOL(permissions,
5693 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5694     MOZ_PERMISSIONS=,
5695     MOZ_PERMISSIONS=1
5698 dnl ========================================================
5699 dnl Child permissions, currently only used for b2g
5700 dnl ========================================================
5701 if test -n "$MOZ_B2G"; then
5702     if test -n "$MOZ_PERMISSIONS"; then
5703         MOZ_CHILD_PERMISSIONS=1
5704     else
5705         AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5706     fi
5708 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5710 dnl ========================================================
5711 dnl NegotiateAuth
5712 dnl ========================================================
5713 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5714 [  --disable-negotiateauth Disable GSS-API negotiation ],
5715     MOZ_AUTH_EXTENSION=,
5716     MOZ_AUTH_EXTENSION=1 )
5718 dnl ========================================================
5719 dnl Pref extensions (autoconfig)
5720 dnl ========================================================
5721 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5722 [  --disable-pref-extensions
5723                           Disable pref extensions such as autoconfig],
5724   MOZ_PREF_EXTENSIONS=,
5725   MOZ_PREF_EXTENSIONS=1 )
5727 dnl ========================================================
5728 dnl Searching of system directories for extensions.
5729 dnl Note: this switch is meant to be used for test builds
5730 dnl whose behavior should not depend on what happens to be
5731 dnl installed on the local machine.
5732 dnl ========================================================
5733 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5734 [  --disable-system-extension-dirs
5735                           Disable searching system- and account-global
5736                           directories for extensions of any kind; use
5737                           only profile-specific extension directories],
5738   ENABLE_SYSTEM_EXTENSION_DIRS=,
5739   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5740 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5741   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5744 dnl ========================================================
5745 dnl = Universalchardet
5746 dnl ========================================================
5747 MOZ_ARG_DISABLE_BOOL(universalchardet,
5748 [  --disable-universalchardet
5749                           Disable universal encoding detection],
5750   MOZ_UNIVERSALCHARDET=,
5751   MOZ_UNIVERSALCHARDET=1 )
5753 if test -n "${JAVA_BIN_PATH}"; then
5754   dnl Look for javac and jar in the specified path.
5755   JAVA_PATH="$JAVA_BIN_PATH"
5756 else
5757   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5758   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5761 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5762 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5763 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5764 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5765 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5766 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5768 if test -n "${JAVA_BIN_PATH}" -o \
5769   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5770   if test -z "$JAVA" -o "$JAVA" = ":"; then
5771     AC_MSG_ERROR([The program java was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5772   fi
5773   if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5774     AC_MSG_ERROR([The program javac was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5775   fi
5776   if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5777     AC_MSG_ERROR([The program javah was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5778   fi
5779   if test -z "$JAR" -o "$JAR" = ":"; then
5780     AC_MSG_ERROR([The program jar was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5781   fi
5782   if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5783     AC_MSG_ERROR([The program jarsigner was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5784   fi
5785   if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5786     AC_MSG_ERROR([The program keytool was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5787   fi
5790 dnl ========================================================
5791 dnl = ANGLE OpenGL->D3D translator for WebGL
5792 dnl = * only applies to win32
5793 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5794 dnl ========================================================
5795 MOZ_ANGLE_RENDERER=
5796 MOZ_DIRECTX_SDK_PATH=
5797 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5798 MOZ_D3DCOMPILER_CAB=
5799 MOZ_D3DCOMPILER_DLL=
5800 case "$target_os" in
5801 *mingw*)
5802     MOZ_ANGLE_RENDERER=1
5803     ;;
5804 esac
5806 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5807 case "${target_cpu}" in
5808 i*86)
5809   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5810   ;;
5811 x86_64)
5812   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5813   ;;
5814 esac
5816 MOZ_ARG_DISABLE_BOOL(webgl,
5817 [  --disable-webgl     Disable building of the WebGL implementation],
5818     MOZ_WEBGL_DISABLED=1,
5819     MOZ_WEBGL_DISABLED=)
5821 if test -n "$MOZ_WEBGL_DISABLED"; then
5822   MOZ_WEBGL=
5823   MOZ_ANGLE_RENDERER=
5826 if test -n "$MOZ_WEBGL"; then
5827   AC_DEFINE(MOZ_WEBGL)
5830 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5831   AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5834 # Locate a DirectX SDK here so we can use it for both ANGLE and
5835 # Joystick support.
5836 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
5837   # Get the SDK path from the registry.
5838   # First try to get the June 2010 SDK
5839   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5840   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5841     # Otherwise just take whatever comes first
5842     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5843   fi
5844   MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
5847 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5848   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5849     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.])
5850   fi
5852   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5853      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5854          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5855     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5856   else
5857     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.])
5858   fi
5860   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5861   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'`
5863   if test -z "$MOZ_D3DX9_VERSION" ; then
5864         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.])
5865   fi
5867   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5869   if test -z "$MOZ_D3DCOMPILER_CAB"; then
5870     AC_MSG_ERROR([Couldn't find the DirectX redistributable files. Either reinstall the DirectX SDK (making sure the "DirectX Redistributable Files" option is selected), or reconfigure with --disable-webgl.])
5871   fi
5873   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5876 dnl ========================================================
5877 dnl Gamepad support
5878 dnl ========================================================
5879 MOZ_GAMEPAD=
5880 MOZ_GAMEPAD_BACKEND=stub
5882 # Gamepad DOM is built on supported platforms by default.
5883 case "$OS_TARGET" in
5884      Darwin|WINNT|Linux)
5885        MOZ_GAMEPAD=1
5886        ;;
5887      *)
5888        ;;
5889 esac
5891 MOZ_ARG_DISABLE_BOOL(gamepad,
5892 [  --disable-gamepad   Disable gamepad support],
5893     MOZ_GAMEPAD=,
5894     MOZ_GAMEPAD=1)
5896 if test "$MOZ_GAMEPAD"; then
5897     case "$OS_TARGET" in
5898     Darwin)
5899         MOZ_GAMEPAD_BACKEND=cocoa
5900         ;;
5901     WINNT)
5902         if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5903             if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5904                MOZ_GAMEPAD=
5905             fi
5906         elif test "$GCC" != "yes"; then
5907             MOZ_GAMEPAD=
5908         fi
5909         if test -z "$MOZ_GAMEPAD"; then
5910            AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.])
5911         fi
5912         MOZ_GAMEPAD_BACKEND=windows
5913         ;;
5914     Linux)
5915         MOZ_CHECK_HEADER([linux/joystick.h])
5916         if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5917           AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
5918         fi
5919         MOZ_GAMEPAD_BACKEND=linux
5920         ;;
5921     *)
5922         ;;
5923    esac
5925   AC_DEFINE(MOZ_GAMEPAD)
5927 AC_SUBST(MOZ_GAMEPAD)
5928 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5930 dnl ========================================================
5931 dnl = Breakpad crash reporting (on by default on supported platforms)
5932 dnl ========================================================
5934 case $target in
5935 i?86-*-mingw*|x86_64-*-mingw*)
5936   MOZ_CRASHREPORTER=1
5937   ;;
5938 i?86-apple-darwin*|x86_64-apple-darwin*)
5939   MOZ_CRASHREPORTER=1
5940   ;;
5941 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5942   if test "$MOZ_ENABLE_GTK"; then
5943     MOZ_CRASHREPORTER=1
5944   fi
5945   ;;
5946 *-android*|*-linuxandroid*)
5947   MOZ_CRASHREPORTER=1
5948   ;;
5949 *solaris*)
5950   MOZ_CRASHREPORTER=1
5951   ;;
5952 esac
5954 MOZ_ARG_DISABLE_BOOL(crashreporter,
5955 [  --disable-crashreporter Disable breakpad crash reporting],
5956     [MOZ_CRASHREPORTER=],
5957     [MOZ_CRASHREPORTER=F # Force enable breakpad])
5959 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5960   if test "$MOZ_CRASHREPORTER" = F; then
5961     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
5962   fi
5963   MOZ_CRASHREPORTER=
5966 if test -n "$MOZ_CRASHREPORTER"; then
5967    AC_DEFINE(MOZ_CRASHREPORTER)
5969   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5970     test -z "$SKIP_LIBRARY_CHECKS"; then
5971     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5972     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5973     AC_SUBST(MOZ_GTHREAD_LIBS)
5974   fi
5976   if test "$OS_ARCH" = "WINNT"; then
5977     if test -z "$HAVE_64BIT_OS"; then
5978       MOZ_CRASHREPORTER_INJECTOR=1
5979       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5980     fi
5981   fi
5984 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5985 [  --with-crashreporter-enable-percent=NN
5986                           Enable sending crash reports by default on NN% of users. (default=100)],
5987 [ val=`echo $withval | sed 's/[^0-9]//g'`
5988     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5990 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5991    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5993 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5995 dnl ========================================================
5996 dnl = libjpeg-turbo configuration
5997 dnl ========================================================
5998 MOZ_LIBJPEG_TURBO=
5999 if test -z "$MOZ_NATIVE_JPEG"; then
6000     MOZ_LIBJPEG_TURBO=1
6003 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6004 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
6005     MOZ_LIBJPEG_TURBO=,
6006     MOZ_LIBJPEG_TURBO=1)
6008 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6009     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6012 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6013 dnl files.
6015 if test -n "$MOZ_LIBJPEG_TURBO"; then
6017   dnl Do we support libjpeg-turbo on this platform?
6018   case "$OS_ARCH:$OS_TEST" in
6019   Darwin:i?86)
6020     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6021     LIBJPEG_TURBO_X86_ASM=1
6022   ;;
6023   Darwin:x86_64)
6024     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6025     LIBJPEG_TURBO_X64_ASM=1
6026   ;;
6027   WINNT:x86|WINNT:i?86)
6028     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6029     LIBJPEG_TURBO_X86_ASM=1
6030   ;;
6031   WINNT:x86_64)
6032     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6033     LIBJPEG_TURBO_X64_ASM=1
6034   ;;
6035   *:arm*)
6036     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6037     LIBJPEG_TURBO_ARM_ASM=1
6038   ;;
6039   *:x86|*:i?86)
6040     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6041       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6042       LIBJPEG_TURBO_X86_ASM=1
6043     fi
6044   ;;
6045   *:x86_64)
6046     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6047       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6048       LIBJPEG_TURBO_X64_ASM=1
6049     fi
6050   ;;
6051   esac
6055 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6056 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6057 dnl it doesn't exist or we have too old of a version.
6058 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6059     LIBJPEG_TURBO_AS=$YASM
6061     if test -z "$LIBJPEG_TURBO_AS" ; then
6062         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.])
6063     fi
6065     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6066     dnl on Linux and 1.1 or newer everywhere else.
6067     if test "$OS_ARCH" = "Linux" ; then
6068         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
6069             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.])
6070         fi
6071     else
6072         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6073             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.])
6074         fi
6075     fi
6078 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6079 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6080 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6081     echo "Using $AS as the assembler for ARM code."
6082     LIBJPEG_TURBO_AS=$AS
6085 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6086     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6087 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6088     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6089 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6090     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6091 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6092     dnl Warn if we're not building the optimized routines, even though the user
6093     dnl didn't specify --disable-libjpeg-turbo.
6094     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6097 dnl ========================================================
6098 dnl = Enable compilation of specific extension modules
6099 dnl ========================================================
6101 MOZ_ARG_ENABLE_STRING(extensions,
6102 [  --enable-extensions     Enable extensions],
6103 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6104     if test "$option" = "yes" -o "$option" = "all"; then
6105         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6106     elif test "$option" = "no" -o "$option" = "none"; then
6107         MOZ_EXTENSIONS=""
6108     elif test "$option" = "default"; then
6109         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6110     elif test `echo "$option" | grep -c \^-` != 0; then
6111         option=`echo $option | sed 's/^-//'`
6112         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6113     else
6114         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6115     fi
6116 done],
6117     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6119 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6120     # Suppress warning on non-X11 platforms
6121     if test -n "$MOZ_X11"; then
6122         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6123     fi
6124     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6127 dnl Do not build gnomevfs with libxul based apps
6128 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6129     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6132 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6133     # Suppress warning on non-X11 platforms
6134     if test -n "$MOZ_X11"; then
6135         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6136     fi
6137     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6140 dnl Do not build gio with libxul based apps
6141 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6142     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6145 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6146     MOZ_GIO_COMPONENT=1
6147     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6149 AC_SUBST(MOZ_GIO_COMPONENT)
6151 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6152     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6153     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6156 dnl Remove dupes
6157 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6159 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6160 dnl when trying to build a nonexistent extension.
6161 for extension in $MOZ_EXTENSIONS; do
6162     if test ! -d "${srcdir}/extensions/${extension}"; then
6163         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6164     fi
6165 done
6167 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6168   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6171 dnl ========================================================
6172 dnl Build Freetype in the tree
6173 dnl ========================================================
6174 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6175 [  --enable-tree-freetype  Enable Tree FreeType],
6176     MOZ_TREE_FREETYPE=1,
6177     MOZ_TREE_FREETYPE= )
6178 if test -n "$MOZ_TREE_FREETYPE"; then
6179    if test -n "$_WIN32_MSVC"; then
6180       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6181    fi
6182    AC_DEFINE(MOZ_TREE_FREETYPE)
6183    AC_SUBST(MOZ_TREE_FREETYPE)
6184    MOZ_ENABLE_CAIRO_FT=1
6185    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6186    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6187    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6188    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6189    CAIRO_FT_OSLIBS=''
6190    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6191    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6192    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6193    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6194    AC_SUBST(CAIRO_FT_CFLAGS)
6197 dnl ========================================================
6198 dnl Installer
6199 dnl ========================================================
6200 dnl Abort Windows build if the required major version and
6201 dnl minimum minor version of Unicode NSIS isn't in the path
6202 dnl (unless in case of cross compiling, for which Unicode
6203 dnl is not yet sufficient).
6204 if test "$OS_ARCH" = "WINNT"; then
6205     REQ_NSIS_MAJOR_VER=2
6206     MIN_NSIS_MINOR_VER=46
6207     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6208     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6209       AC_MSG_RESULT([yes])
6210       changequote(,)
6211       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6212       changequote([,])
6213       if test ! "$MAKENSISU_VER" = ""; then
6214           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6215           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6216       fi
6217       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6218       if test "$MAKENSISU_VER" = "" || \
6219          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6220               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6221           AC_MSG_RESULT([no])
6222           if test -z "$CROSS_COMPILE"; then
6223             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.])
6224           else
6225             MAKENSISU=
6226           fi
6227       fi
6228     elif test -z "$CROSS_COMPILE"; then
6229       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.])
6230     else
6231       MAKENSISU=
6232     fi
6235 dnl ========================================================
6236 dnl Web App Runtime
6237 dnl ========================================================
6238 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6239 [  --disable-webapp-runtime  Disable Web App Runtime],
6240     MOZ_WEBAPP_RUNTIME=,
6241     MOZ_WEBAPP_RUNTIME=1)
6242 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6243     MOZ_WEBAPP_RUNTIME=
6245 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6246     MOZ_WEBAPP_RUNTIME=
6248 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6249 if test "$MOZ_WEBAPP_RUNTIME"; then
6250     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6253 AC_MSG_CHECKING([for tar archiver])
6254 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6255 if test -z "$TAR"; then
6256     AC_MSG_ERROR([no tar archiver found in \$PATH])
6258 AC_MSG_RESULT([$TAR])
6259 AC_SUBST(TAR)
6261 AC_MSG_CHECKING([for wget])
6262 AC_CHECK_PROGS(WGET, wget, "")
6263 AC_MSG_RESULT([$WGET])
6264 AC_SUBST(WGET)
6266 dnl ========================================================
6267 dnl Signing
6268 dnl ========================================================
6270 if test -n "$MOZ_SIGN_CMD"; then
6271     AC_DEFINE(MOZ_SIGNING)
6274 dnl ========================================================
6275 dnl Maintenance Service
6276 dnl ========================================================
6278 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6279 [  --enable-maintenance-service       Enable building of maintenanceservice],
6280     MOZ_MAINTENANCE_SERVICE=1,
6281     MOZ_MAINTENANCE_SERVICE= )
6283 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6284   if test "$OS_ARCH" = "WINNT"; then
6285     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6286   else
6287     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6288   fi
6291 dnl ========================================================
6292 dnl Verify MAR signatures
6293 dnl ========================================================
6295 MOZ_ARG_ENABLE_BOOL(verify-mar,
6296 [  --enable-verify-mar     Enable verifying MAR signatures],
6297     MOZ_VERIFY_MAR_SIGNATURE=1,
6298     MOZ_VERIFY_MAR_SIGNATURE= )
6300 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6301   if test "$OS_ARCH" = "WINNT"; then
6302     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6303   else
6304     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6305   fi
6308 dnl ========================================================
6309 dnl Enable building the signmar program.
6310 dnl This option is much different than the --enable-verify-mar option.
6311 dnl --enable-verify-mar is for enabling the verification check on MAR
6312 dnl files in the updater.  The --enable-signmar option is for building
6313 dnl the signmar program.
6314 dnl ========================================================
6316 MOZ_ARG_ENABLE_BOOL(signmar,
6317 [  --enable-signmar     Enable building the signmar program],
6318     MOZ_ENABLE_SIGNMAR=1,
6319     MOZ_ENABLE_SIGNMAR= )
6321 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6322   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6325 dnl ========================================================
6326 dnl Updater
6327 dnl ========================================================
6329 MOZ_ARG_DISABLE_BOOL(updater,
6330 [  --disable-updater       Disable building of updater],
6331     MOZ_UPDATER=,
6332     MOZ_UPDATER=1 )
6334 if test -n "$MOZ_UPDATER"; then
6335     AC_DEFINE(MOZ_UPDATER)
6338 # tools/update-packaging is not checked out by default.
6339 MOZ_ARG_ENABLE_BOOL(update-packaging,
6340 [  --enable-update-packaging
6341                           Enable tools/update-packaging],
6342     MOZ_UPDATE_PACKAGING=1,
6343     MOZ_UPDATE_PACKAGING= )
6344 AC_SUBST(MOZ_UPDATE_PACKAGING)
6346 dnl ========================================================
6347 dnl build the tests by default
6348 dnl ========================================================
6349 MOZ_ARG_DISABLE_BOOL(tests,
6350 [  --disable-tests         Do not build test libraries & programs],
6351     ENABLE_TESTS=,
6352     ENABLE_TESTS=1 )
6354 if test -n "$ENABLE_TESTS"; then
6355     MOZ_ENABLE_GTEST=1
6356     GTEST_HAS_RTTI=0
6357     AC_DEFINE(MOZ_ENABLE_GTEST)
6358     AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6359     AC_SUBST(MOZ_ENABLE_GTEST)
6360     AC_SUBST(GTEST_HAS_RTTI)
6361     if test -n "$_WIN32_MSVC"; then
6362           AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6363     fi
6364     if test "${OS_TARGET}" = "Android"; then
6365         AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6366         AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6367         AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6368         AC_SUBST(GTEST_OS_LINUX_ANDROID)
6369         AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6370         AC_SUBST(GTEST_HAS_CLONE)
6371     fi
6374 dnl ========================================================
6375 dnl parental controls (for Windows Vista)
6376 dnl ========================================================
6377 MOZ_ARG_DISABLE_BOOL(parental-controls,
6378 [  --disable-parental-controls
6379                           Do not build parental controls],
6380    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6381    MOZ_DISABLE_PARENTAL_CONTROLS=)
6382 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6383     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6386 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6388 dnl ========================================================
6389 dnl = Disable DOMCrypto
6390 dnl ========================================================
6391 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6392     AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6394 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6396 dnl ========================================================
6397 dnl = Disable libpkix
6398 dnl ========================================================
6399 if test -n "$NSS_NO_LIBPKIX"; then
6400     AC_DEFINE(NSS_NO_LIBPKIX)
6402 AC_SUBST(NSS_NO_LIBPKIX)
6404 dnl ========================================================
6405 dnl = Content process sandboxing
6406 dnl ========================================================
6407 if test -n "$gonkdir"; then
6408     MOZ_CONTENT_SANDBOX=1
6411 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6412 [  --enable-content-sandbox        Enable sandboxing support for content-processes],
6413     MOZ_CONTENT_SANDBOX=1,
6414     MOZ_CONTENT_SANDBOX=)
6416 if test -n "$MOZ_CONTENT_SANDBOX"; then
6417     AC_DEFINE(MOZ_CONTENT_SANDBOX)
6420 AC_SUBST(MOZ_CONTENT_SANDBOX)
6422 MOZ_ARG_ENABLE_BOOL(content-sandbox-reporter,
6423 [ --enable-content-sandbox-reporter        Enable syscall reporter to troubleshoot syscalls denied by the content-processes sandbox],
6424     MOZ_CONTENT_SANDBOX_REPORTER=1,
6425     MOZ_CONTENT_SANDBOX_REPORTER=)
6427 if test -n "$MOZ_CONTENT_SANDBOX_REPORTER"; then
6428     AC_DEFINE(MOZ_CONTENT_SANDBOX_REPORTER)
6431 AC_SUBST(MOZ_CONTENT_SANDBOX_REPORTER)
6433 dnl ========================================================
6434 dnl =
6435 dnl = Module specific options
6436 dnl =
6437 dnl ========================================================
6438 MOZ_ARG_HEADER(Individual module options)
6440 dnl ========================================================
6441 dnl = Disable feed handling components
6442 dnl ========================================================
6443 MOZ_ARG_DISABLE_BOOL(feeds,
6444 [  --disable-feeds         Disable feed handling and processing components],
6445     MOZ_FEEDS=,
6446     MOZ_FEEDS=1 )
6447 if test -n "$MOZ_FEEDS"; then
6448     AC_DEFINE(MOZ_FEEDS)
6449 else
6450     if test "$MOZ_BUILD_APP" = "browser"; then
6451         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6452     fi
6455 dnl ========================================================
6456 dnl Check for sqlite
6457 dnl ========================================================
6459 MOZ_NATIVE_SQLITE=
6460 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6461 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6462 MOZ_NATIVE_SQLITE=1,
6463 MOZ_NATIVE_SQLITE= )
6465 if test -z "$MOZ_NATIVE_SQLITE"
6466 then
6467     SQLITE_CFLAGS=
6468     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6469 else
6470     dnl ============================
6471     dnl === SQLite Version check ===
6472     dnl ============================
6473     dnl Check to see if the system SQLite package is new enough.
6474     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6476     dnl ==================================
6477     dnl === SQLITE_SECURE_DELETE check ===
6478     dnl ==================================
6479     dnl Check to see if the system SQLite package is compiled with
6480     dnl SQLITE_SECURE_DELETE enabled.
6481     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6482     _SAVE_CFLAGS="$CFLAGS"
6483     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6484     _SAVE_LIBS="$LIBS"
6485     LIBS="$LIBS $SQLITE_LIBS"
6486     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6487         AC_TRY_RUN([
6488             #include "sqlite3.h"
6490             int main(int argc, char **argv){
6491               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6492             }],
6493             ac_cv_sqlite_secure_delete=yes,
6494             ac_cv_sqlite_secure_delete=no,
6495             ac_cv_sqlite_secure_delete=no
6496         )
6497     ])
6498     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6499     CFLAGS="$_SAVE_CFLAGS"
6500     LIBS="$_SAVE_LIBS"
6501     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6502         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6503     fi
6505     dnl ===============================
6506     dnl === SQLITE_THREADSAFE check ===
6507     dnl ===============================
6508     dnl Check to see if the system SQLite package is compiled with
6509     dnl SQLITE_THREADSAFE enabled.
6510     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6511     _SAVE_CFLAGS="$CFLAGS"
6512     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6513     _SAVE_LIBS="$LIBS"
6514     LIBS="$LIBS $SQLITE_LIBS"
6515     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6516         AC_TRY_RUN([
6517             #include "sqlite3.h"
6519             int main(int argc, char **argv){
6520               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6521             }],
6522             ac_cv_sqlite_threadsafe=yes,
6523             ac_cv_sqlite_threadsafe=no,
6524             ac_cv_sqlite_threadsafe=no
6525         )
6526     ])
6527     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6528     CFLAGS="$_SAVE_CFLAGS"
6529     LIBS="$_SAVE_LIBS"
6530     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6531         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6532     fi
6534     dnl ================================
6535     dnl === SQLITE_ENABLE_FTS3 check ===
6536     dnl ================================
6537     dnl check to see if the system SQLite package is compiled with
6538     dnl SQLITE_ENABLE_FTS3 enabled.
6539     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6540     _SAVE_CFLAGS="$CFLAGS"
6541     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6542     _SAVE_LIBS="$LIBS"
6543     LIBS="$LIBS $SQLITE_LIBS"
6544     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6545         AC_TRY_RUN([
6546             #include "sqlite3.h"
6548             int main(int argc, char **argv){
6549               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6550             }],
6551             ac_cv_sqlite_enable_fts3=yes,
6552             ac_cv_sqlite_enable_fts3=no,
6553             ac_cv_sqlite_enable_fts3=no
6554         )
6555     ])
6556     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6557     CFLAGS="$_SAVE_CFLAGS"
6558     LIBS="$_SAVE_LIBS"
6559     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6560         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6561     fi
6563     dnl =========================================
6564     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6565     dnl =========================================
6566     dnl check to see if the system SQLite package is compiled with
6567     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6568     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6569     _SAVE_CFLAGS="$CFLAGS"
6570     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6571     _SAVE_LIBS="$LIBS"
6572     LIBS="$LIBS $SQLITE_LIBS"
6573     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6574         AC_TRY_RUN([
6575             #include "sqlite3.h"
6577             int main(int argc, char **argv){
6578               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6579             }],
6580             ac_cv_sqlite_enable_unlock_notify=yes,
6581             ac_cv_sqlite_enable_unlock_notify=no,
6582             ac_cv_sqlite_enable_unlock_notify=no
6583         )
6584     ])
6585     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6586     CFLAGS="$_SAVE_CFLAGS"
6587     LIBS="$_SAVE_LIBS"
6588     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6589         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6590     fi
6593 if test -n "$MOZ_NATIVE_SQLITE"; then
6594     AC_DEFINE(MOZ_NATIVE_SQLITE)
6596 AC_SUBST(MOZ_NATIVE_SQLITE)
6598 dnl ========================================================
6599 dnl = Enable help viewer (off by default)
6600 dnl ========================================================
6601 if test -n "$MOZ_HELP_VIEWER"; then
6602      dnl Do this if defined in confvars.sh
6603      AC_DEFINE(MOZ_HELP_VIEWER)
6606 dnl ========================================================
6607 dnl = Enable safe browsing (anti-phishing)
6608 dnl ========================================================
6609 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6610 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6611     MOZ_SAFE_BROWSING=1,
6612     MOZ_SAFE_BROWSING= )
6613 if test -n "$MOZ_SAFE_BROWSING"; then
6614     AC_DEFINE(MOZ_SAFE_BROWSING)
6616 AC_SUBST(MOZ_SAFE_BROWSING)
6618 dnl ========================================================
6619 dnl = Enable url-classifier
6620 dnl ========================================================
6621 dnl Implicitly enabled by default if building with safe-browsing
6622 if test -n "$MOZ_SAFE_BROWSING"; then
6623     MOZ_URL_CLASSIFIER=1
6625 MOZ_ARG_ENABLE_BOOL(url-classifier,
6626 [  --enable-url-classifier Enable url classifier module],
6627     MOZ_URL_CLASSIFIER=1,
6628     MOZ_URL_CLASSIFIER= )
6629 if test -n "$MOZ_URL_CLASSIFIER"; then
6630     AC_DEFINE(MOZ_URL_CLASSIFIER)
6632 AC_SUBST(MOZ_URL_CLASSIFIER)
6634 dnl ========================================================
6635 dnl = Disable zipwriter
6636 dnl ========================================================
6637 MOZ_ARG_DISABLE_BOOL(zipwriter,
6638 [  --disable-zipwriter     Disable zipwriter component],
6639     MOZ_ZIPWRITER=,
6640     MOZ_ZIPWRITER=1 )
6641 AC_SUBST(MOZ_ZIPWRITER)
6643 dnl ========================================================
6644 dnl GL provider
6645 dnl ========================================================
6646 MOZ_GL_PROVIDER=
6647 MOZ_ARG_WITH_STRING(gl-provider,
6648 [  --with-gl-provider=ID
6649                           Set GL provider backend type],
6650 [ val=`echo $withval`
6651     MOZ_GL_PROVIDER="$val"])
6653 if test -n "$MOZ_GL_PROVIDER"; then
6654 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6655 AC_SUBST(MOZ_GL_PROVIDER)
6656 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6658 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6659 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6661 dnl ========================================================
6662 dnl = faststripe theme
6663 dnl ========================================================
6664 MOZ_ARG_ENABLE_BOOL(faststripe,
6665 [  --enable-faststripe     Use faststripe theme],
6666     MOZ_THEME_FASTSTRIPE=1,
6667     MOZ_THEME_FASTSTRIPE= )
6668 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6670 dnl ========================================================
6671 dnl =
6672 dnl = Feature options that require extra sources to be pulled
6673 dnl =
6674 dnl ========================================================
6675 dnl MOZ_ARG_HEADER(Features that require extra sources)
6677 dnl ========================================================
6678 dnl =
6679 dnl = Runtime debugging and Optimization Options
6680 dnl =
6681 dnl ========================================================
6682 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6684 dnl ========================================================
6685 dnl enable mobile optimizations
6686 dnl ========================================================
6687 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6688 [  --enable-mobile-optimize
6689                           Enable mobile optimizations],
6690     MOZ_GFX_OPTIMIZE_MOBILE=1)
6692 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6694 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6695     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6698 dnl ========================================================
6699 dnl = Enable code optimization. ON by default.
6700 dnl ========================================================
6701 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6702         MOZ_OPTIMIZE_FLAGS="-O"
6705 MOZ_ARG_ENABLE_STRING(optimize,
6706 [  --disable-optimize      Disable compiler optimization
6707   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6708 [ if test "$enableval" != "no"; then
6709     MOZ_OPTIMIZE=1
6710     if test -n "$enableval" -a "$enableval" != "yes"; then
6711         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6712         MOZ_OPTIMIZE=2
6713     fi
6714 else
6715     MOZ_OPTIMIZE=
6716 fi ], MOZ_OPTIMIZE=1)
6718 MOZ_SET_FRAMEPTR_FLAGS
6720 if test "$COMPILE_ENVIRONMENT"; then
6721 if test -n "$MOZ_OPTIMIZE"; then
6722     AC_MSG_CHECKING([for valid optimization flags])
6723     _SAVE_CFLAGS=$CFLAGS
6724     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6725     AC_TRY_COMPILE([#include <stdio.h>],
6726         [printf("Hello World\n");],
6727         _results=yes,
6728         _results=no)
6729     AC_MSG_RESULT([$_results])
6730     if test "$_results" = "no"; then
6731         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6732     fi
6733     CFLAGS=$_SAVE_CFLAGS
6735 fi # COMPILE_ENVIRONMENT
6737 AC_SUBST(MOZ_OPTIMIZE)
6738 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6739 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6740 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6741 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6742 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6743 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6745 dnl ========================================================
6746 dnl = Enable any treating of compile warnings as errors
6747 dnl ========================================================
6748 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6749 [  --enable-warnings-as-errors
6750                           Enable treating of warnings as errors],
6751     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6752     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6753 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6754    WARNINGS_AS_ERRORS=''
6755 elif test "$GNU_CC"; then
6756     # Prevent the following GCC warnings from being treated as errors:
6757     # -Wuninitialized - too many false positives
6758     # -Wmaybe-uninitialized - too many false positives
6759     # -Wdeprecated-declarations - we don't want our builds held hostage when a
6760     #   platform-specific API becomes deprecated.
6761     MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6762     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6763     MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6764     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6765     MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6766     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6769 dnl ========================================================
6770 dnl = Disable runtime logging checks
6771 dnl ========================================================
6772 MOZ_ARG_DISABLE_BOOL(logging,
6773 [  --disable-logging       Disable logging facilities],
6774     NS_DISABLE_LOGGING=1,
6775     NS_DISABLE_LOGGING= )
6776 if test "$NS_DISABLE_LOGGING"; then
6777     AC_DEFINE(NS_DISABLE_LOGGING)
6778 else
6779     AC_DEFINE(MOZ_LOGGING)
6782 dnl ========================================================
6783 dnl = This will enable logging of addref, release, ctor, dtor.
6784 dnl ========================================================
6785 _ENABLE_LOGREFCNT=42
6786 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6787 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6788     _ENABLE_LOGREFCNT=1,
6789     _ENABLE_LOGREFCNT= )
6790 if test "$_ENABLE_LOGREFCNT" = "1"; then
6791     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6792 elif test -z "$_ENABLE_LOGREFCNT"; then
6793     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6796 dnl ========================================================
6797 dnl moz_dump_painting
6798 dnl ========================================================
6799 MOZ_ARG_ENABLE_BOOL(dump-painting,
6800 [  --enable-dump-painting          Enable paint debugging.],
6801     MOZ_DUMP_PAINTING=1,
6802     MOZ_DUMP_PAINTING= )
6803 if test -n "$MOZ_DUMP_PAINTING"; then
6804     AC_DEFINE(MOZ_DUMP_PAINTING)
6805     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6807 if test -n "$MOZ_DEBUG"; then
6808     AC_DEFINE(MOZ_DUMP_PAINTING)
6811 dnl ========================================================
6812 dnl = Enable trace malloc
6813 dnl ========================================================
6814 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6815 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6816 [  --enable-trace-malloc   Enable malloc tracing; also disables DMD and jemalloc],
6817     NS_TRACE_MALLOC=1,
6818     NS_TRACE_MALLOC= )
6819 if test "$NS_TRACE_MALLOC"; then
6820   # Please, Mr. Linker Man, don't take away our symbol names
6821   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6822   USE_ELF_DYNSTR_GC=
6823   AC_DEFINE(NS_TRACE_MALLOC)
6825 AC_SUBST(NS_TRACE_MALLOC)
6827 dnl ========================================================
6828 dnl = Enable DMD
6829 dnl ========================================================
6831 MOZ_ARG_ENABLE_BOOL(dmd,
6832 [  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc],
6833     MOZ_DMD=1,
6834     MOZ_DMD= )
6836 if test "$NS_TRACE_MALLOC"; then        # trace-malloc disables DMD
6837     MOZ_DMD=
6839 if test "$MOZ_DMD"; then
6840     USE_ELF_DYNSTR_GC=
6841     AC_DEFINE(MOZ_DMD)
6843     if test "${CPU_ARCH}" = "arm"; then
6844         CFLAGS="$CFLAGS -funwind-tables"
6845         CXXFLAGS="$CXXFLAGS -funwind-tables"
6846     fi
6848     MOZ_MEMORY=1                        # DMD enables jemalloc
6849     MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
6851 AC_SUBST(MOZ_DMD)
6853 dnl ========================================================
6854 dnl = Enable jemalloc
6855 dnl ========================================================
6856 MOZ_ARG_ENABLE_BOOL(jemalloc,
6857 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6858     MOZ_MEMORY=1,
6859     MOZ_MEMORY=)
6861 if test "$NS_TRACE_MALLOC"; then
6862     MOZ_MEMORY=
6865 if test "${OS_TARGET}" = "Android"; then
6866   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6867   :
6868 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6869   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6870   if test -z "$GNU_CC"; then
6871     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6872   else
6873     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6874   fi
6875 else
6876   dnl On other Unix systems, we only want to link executables against mozglue
6877   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6878   dnl On other Unix systems, where mozglue is a static library, jemalloc is
6879   dnl separated for the SDK, so we need to add it here.
6880   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6881     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6882   fi
6883   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6884   if test -n "$GNU_CC"; then
6885     dnl And we need mozglue symbols to be exported.
6886     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6887   fi
6888   if test "$MOZ_LINKER" = 1; then
6889     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6890   fi
6893 dnl ========================================================
6894 dnl = Enable dynamic replacement of malloc implementation
6895 dnl ========================================================
6896 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6897 [  --enable-replace-malloc   Enable ability to dynamically replace the malloc implementation],
6898     MOZ_REPLACE_MALLOC=1,
6899     MOZ_REPLACE_MALLOC= )
6901 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6902     dnl We don't want to enable jemalloc unconditionally because it may be a
6903     dnl deliberate choice not to enable it (bug 702250, for instance)
6904     AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6905 elif test -n "$MOZ_REPLACE_MALLOC"; then
6906     MOZ_NATIVE_JEMALLOC=
6908     dnl Replace-malloc Mac linkage quirks
6909     if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6910         AC_CACHE_CHECK([how to do weak dynamic linking],
6911             ac_cv_weak_dynamic_linking,
6912             [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6913              if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6914                 test -s conftest${DLL_SUFFIX}; then
6915                  dnl There are several ways the linker can put link edit rules in a binary:
6916                  dnl - classic info only (for OSX < 10.6)
6917                  dnl - dyld info only
6918                  dnl - both
6919                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6920                      _CLASSIC_INFO=
6921                  else
6922                      _CLASSIC_INFO=1
6923                  fi
6924                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
6925                      _DYLD_INFO=1
6926                  else
6927                      _DYLD_INFO=
6928                  fi
6929                  dnl With classic info, we need to build with -flat_namespace.
6930                  dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
6931                  dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
6932                  dnl forgets to set the weak flag in the dyld info.
6933                  dnl See http://glandium.org/blog/?p=2764 for more details.
6934                  dnl
6935                  dnl Values for ac_cv_weak_dynamic_linking, and subsequently
6936                  dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
6937                  dnl - "flat namespace" when -flat_namespace alone is needed
6938                  dnl - "dummy library" when a dummy library and -flat_namespace are needed
6939                  dnl - "compiler support" when nothing is needed
6940                  if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
6941                      if test -n "$_CLASSIC_INFO"; then
6942                          ac_cv_weak_dynamic_linking="flat namespace"
6943                      else
6944                          ac_cv_weak_dynamic_linking="compiler support"
6945                      fi
6946                  else
6947                      if test -n "$_DYLD_INFO"; then
6948                          ac_cv_weak_dynamic_linking="dummy library"
6949                      else
6950                          ac_cv_weak_dynamic_linking="flat namespace"
6951                      fi
6952                  fi
6953              else
6954                  AC_ERROR([couldn't compile a simple C file])
6955              fi
6956              rm -rf conftest*])
6957         MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
6958     fi
6960 AC_SUBST(MOZ_REPLACE_MALLOC)
6961 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
6963 dnl ========================================================
6964 dnl = Jemalloc build setup
6965 dnl ========================================================
6966 if test -z "$MOZ_MEMORY"; then
6967   if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
6968     MOZ_NATIVE_JEMALLOC=1
6969     AC_CHECK_FUNCS(mallctl nallocm,,
6970       [MOZ_NATIVE_JEMALLOC=
6971        break])
6972     if test -n "$MOZ_NATIVE_JEMALLOC"; then
6973       MOZ_MEMORY=1
6974       AC_DEFINE(MOZ_MEMORY)
6975       AC_DEFINE(MOZ_JEMALLOC3)
6976       AC_DEFINE(MOZ_NATIVE_JEMALLOC)
6977     fi
6978   fi
6979   case "${target}" in
6980     *-mingw*)
6981       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6982         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.])
6983       fi
6984       ;;
6985   esac
6986 else
6987   dnl Don't try to run compiler tests on Windows
6988   if test "$OS_ARCH" = "WINNT"; then
6989     if test -z "$HAVE_64BIT_OS"; then
6990       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6991     else
6992       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6993     fi
6994   else
6995     AC_CHECK_SIZEOF([int *], [4])
6996     case "${ac_cv_sizeof_int_p}" in
6997     4)
6998       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6999       ;;
7000     8)
7001       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7002       ;;
7003     *)
7004       AC_MSG_ERROR([Unexpected pointer size])
7005       ;;
7006     esac
7007   fi
7009   AC_DEFINE(MOZ_MEMORY)
7010   if test -n "$MOZ_JEMALLOC3"; then
7011     AC_DEFINE(MOZ_JEMALLOC3)
7012   fi
7013   if test "x$MOZ_DEBUG" = "x1"; then
7014     AC_DEFINE(MOZ_MEMORY_DEBUG)
7015   fi
7016   dnl The generic feature tests that determine how to compute ncpus are long and
7017   dnl complicated.  Therefore, simply define special cpp variables for the
7018   dnl platforms we have special knowledge of.
7019   case "${target}" in
7020   *-darwin*)
7021     AC_DEFINE(MOZ_MEMORY_DARWIN)
7022     ;;
7023   *-*freebsd*)
7024     AC_DEFINE(MOZ_MEMORY_BSD)
7025     ;;
7026   *-android*|*-linuxandroid*)
7027     AC_DEFINE(MOZ_MEMORY_LINUX)
7028     AC_DEFINE(MOZ_MEMORY_ANDROID)
7029     if test -z "$gonkdir"; then
7030       _WRAP_MALLOC=1
7031     else
7032       AC_DEFINE(MOZ_MEMORY_GONK)
7033     fi
7034     MOZ_GLUE_LDFLAGS=
7035     ;;
7036   *-*linux*)
7037     AC_DEFINE(MOZ_MEMORY_LINUX)
7038     ;;
7039   *-netbsd*)
7040     AC_DEFINE(MOZ_MEMORY_BSD)
7041     ;;
7042   *-solaris*)
7043     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7044     ;;
7045   *-mingw*)
7046     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7047     if test -z "$MOZ_DEBUG"; then
7048       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7049     else
7050       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7051     fi
7052     dnl Look for a broken crtdll.obj
7053     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7054     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7055     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7056       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7057       dnl Also pass this to NSPR/NSS
7058       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7059     else
7060       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7061     fi
7062     rm crtdll.obj
7064     export DLLFLAGS
7065     ;;
7066   *)
7067     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7068     ;;
7069   esac
7070 fi # MOZ_MEMORY
7071 AC_SUBST(MOZ_MEMORY)
7072 AC_SUBST(MOZ_JEMALLOC3)
7073 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7074 AC_SUBST(MOZ_GLUE_LDFLAGS)
7075 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7076 AC_SUBST(WIN32_CRT_LIBS)
7077 dnl Need to set this for make because NSS doesn't have configure
7078 AC_SUBST(DLLFLAGS)
7080 dnl We need to wrap dlopen and related functions on Android because we use
7081 dnl our own linker.
7082 if test "$OS_TARGET" = Android; then
7083     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7084     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7085     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7086     if test -z "$gonkdir"; then
7087         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7088         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=memccpy,--wrap=memchr,--wrap=memrchr,--wrap=memcmp,--wrap=memcpy,--wrap=memmove,--wrap=memset,--wrap=memmem,--wrap=memswap,--wrap=index,--wrap=strchr,--wrap=strrchr,--wrap=strlen,--wrap=strcmp,--wrap=strcpy,--wrap=strcat,--wrap=strcasecmp,--wrap=strncasecmp,--wrap=strstr,--wrap=strcasestr,--wrap=strtok,--wrap=strtok_r,--wrap=strerror,--wrap=strerror_r,--wrap=strnlen,--wrap=strncat,--wrap=strncmp,--wrap=strncpy,--wrap=strlcat,--wrap=strlcpy,--wrap=strcspn,--wrap=strpbrk,--wrap=strsep,--wrap=strspn,--wrap=strcoll,--wrap=strxfrm"
7089     fi
7092 dnl ========================================================
7093 dnl = Use malloc wrapper lib
7094 dnl ========================================================
7095 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7096 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7097     _WRAP_MALLOC=1,
7098     _WRAP_MALLOC= )
7100 if test -n "$_WRAP_MALLOC"; then
7101     if test -n "$GNU_CC"; then
7102         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7103         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7104         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7105         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7106         dnl Wrap operator new and operator delete on Android.
7107         if test "$OS_TARGET" = "Android"; then
7108             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7109             dnl Wrap the nothrow variants too.
7110             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7111         fi
7112     else
7113         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7114     fi
7117 dnl ========================================================
7118 dnl = Location of malloc wrapper lib
7119 dnl ========================================================
7120 MOZ_ARG_WITH_STRING(wrap-malloc,
7121 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7122     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7124 dnl ========================================================
7125 dnl = Use JS Call tracing
7126 dnl ========================================================
7127 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7128 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7129     MOZ_TRACE_JSCALLS=1,
7130     MOZ_TRACE_JSCALLS= )
7131 if test -n "$MOZ_TRACE_JSCALLS"; then
7132     AC_DEFINE(MOZ_TRACE_JSCALLS)
7135 dnl ========================================================
7136 dnl = Use incremental GC
7137 dnl ========================================================
7138 JSGC_INCREMENTAL=1
7139 MOZ_ARG_DISABLE_BOOL(gcincremental,
7140 [  --disable-gcincremental Disable incremental GC],
7141     JSGC_INCREMENTAL= )
7142 if test -n "$JSGC_INCREMENTAL"; then
7143     AC_DEFINE(JSGC_INCREMENTAL)
7146 dnl ========================================================
7147 dnl Zealous JavaScript GC
7148 dnl ========================================================
7149 MOZ_ARG_ENABLE_BOOL(gczeal,
7150 [  --enable-gczeal         Enable zealous JavaScript GCing],
7151     JS_GC_ZEAL=1,
7152     JS_GC_ZEAL= )
7153 if test -n "$JS_GC_ZEAL"; then
7154     AC_DEFINE(JS_GC_ZEAL)
7157 dnl ========================================================
7158 dnl JS opt-mode assertions and minidump instrumentation
7159 dnl ========================================================
7160 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7161 [  --enable-js-diagnostics
7162                           Enable JS diagnostic assertions and breakpad data],
7163     JS_CRASH_DIAGNOSTICS=1,
7164     JS_CRASH_DIAGNOSTICS= )
7165 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7166     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7169 MOZ_CHECK_CCACHE
7170 MOZ_CHECK_COMPILER_WRAPPER
7172 dnl ========================================================
7173 dnl = Enable static checking using gcc-dehydra
7174 dnl ========================================================
7176 MOZ_ARG_WITH_STRING(static-checking,
7177 [  --with-static-checking=path/to/gcc_dehydra.so
7178                           Enable static checking of code using GCC-dehydra],
7179     DEHYDRA_PATH=$withval,
7180     DEHYDRA_PATH= )
7182 if test -n "$DEHYDRA_PATH"; then
7183     if test ! -f "$DEHYDRA_PATH"; then
7184         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7185     fi
7186     AC_DEFINE(NS_STATIC_CHECKING)
7188 AC_SUBST(DEHYDRA_PATH)
7190 dnl ========================================================
7191 dnl = Enable using the clang plugin to build
7192 dnl ========================================================
7194 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7195 [  --enable-clang-plugin   Enable building with the mozilla clang plugin ],
7196    ENABLE_CLANG_PLUGIN=1,
7197    ENABLE_CLANG_PLUGIN= )
7198 if test -n "$ENABLE_CLANG_PLUGIN"; then
7199     if test -z "$CLANG_CC"; then
7200         AC_MSG_ERROR([Can't use clang plugin without clang.])
7201     fi
7202     AC_DEFINE(MOZ_CLANG_PLUGIN)
7205 AC_SUBST(ENABLE_CLANG_PLUGIN)
7207 dnl ========================================================
7208 dnl = Enable stripping of libs & executables
7209 dnl ========================================================
7210 MOZ_ARG_ENABLE_BOOL(strip,
7211 [  --enable-strip          Enable stripping of libs & executables ],
7212     ENABLE_STRIP=1,
7213     ENABLE_STRIP= )
7215 dnl ========================================================
7216 dnl = Enable stripping of libs & executables when packaging
7217 dnl ========================================================
7218 MOZ_ARG_ENABLE_BOOL(install-strip,
7219 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7220     PKG_SKIP_STRIP= ,
7221     PKG_SKIP_STRIP=1)
7223 dnl ========================================================
7224 dnl = --enable-elf-dynstr-gc
7225 dnl ========================================================
7226 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7227 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7228     USE_ELF_DYNSTR_GC=1,
7229     USE_ELF_DYNSTR_GC= )
7231 dnl ========================================================
7232 dnl = --disable-elf-hack
7233 dnl ========================================================
7235 USE_ELF_HACK=1
7236 MOZ_ARG_DISABLE_BOOL(elf-hack,
7237 [  --disable-elf-hack      Disable elf hacks],
7238     [USE_ELF_HACK=],
7239     [USE_ELF_HACK=F # Force enable elf-hack])
7241 # Disable elf hack for profiling because the built in profiler
7242 # doesn't read the segments properly with elf hack. This is
7243 # temporary and should be fixed soon in the profiler.
7244 if test "$MOZ_PROFILING" = 1; then
7245   if test "$USE_ELF_HACK" = F; then
7246     AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7247   fi
7248   USE_ELF_HACK=
7251 # Only enable elfhack where supported
7252 if test "$USE_ELF_HACK" = 1; then
7253     case "${HOST_OS_ARCH},${OS_ARCH}" in
7254     Linux,Linux)
7255         case "${CPU_ARCH}" in
7256         arm | x86 | x86_64)
7257             USE_ELF_HACK=1
7258             ;;
7259         *)
7260             USE_ELF_HACK=
7261             ;;
7262         esac
7263         ;;
7264     *)
7265         USE_ELF_HACK=
7266         ;;
7267     esac
7270 if test -n "$USE_ELF_HACK"; then
7271     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7272     dnl memory addresses it maps to. The result is that by the time elfhack
7273     dnl kicks in, it is not possible to apply relocations because of that,
7274     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7275     dnl segment. It makes elfhack mostly useless, so considering the problems
7276     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7277     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7278     dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7279     dnl elfhack enabled, disable PT_GNU_RELRO instead.
7280     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7281         LINK_WITH_PT_GNU_RELRO,
7282         [echo "int main() {return 0;}" > conftest.${ac_ext}
7283          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7284             test -s conftest${ac_exeext}; then
7285             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7286                 LINK_WITH_PT_GNU_RELRO=yes
7287             else
7288                 LINK_WITH_PT_GNU_RELRO=no
7289             fi
7290          else
7291              dnl We really don't expect to get here, but just in case
7292              AC_ERROR([couldn't compile a simple C file])
7293          fi
7294          rm -rf conftest*])
7295     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7296         if test "$USE_ELF_HACK" = F; then
7297             AC_MSG_CHECKING([for -z norelro option to ld])
7298             _SAVE_LDFLAGS=$LDFLAGS
7299             LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7300             AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7301                         [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7302                         AC_ERROR([--enable-elf-hack is not compatible with a linker creating a PT_GNU_RELRO segment and that doesn't support the "-z norelro" option.]))
7303             USE_ELF_HACK=1
7304         else
7305             AC_MSG_WARN([Disabling elfhack])
7306             USE_ELF_HACK=
7307         fi
7308     fi
7311 dnl ========================================================
7312 dnl = libstdc++ compatibility hacks
7313 dnl ========================================================
7315 STDCXX_COMPAT=
7316 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7317 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7318     STDCXX_COMPAT=1)
7320 if test -n "$STDCXX_COMPAT"; then
7321    eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7322    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7323    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7326 dnl ========================================================
7327 dnl =
7328 dnl = Profiling and Instrumenting
7329 dnl =
7330 dnl ========================================================
7331 MOZ_ARG_HEADER(Profiling and Instrumenting)
7333 dnl ========================================================
7334 dnl = Enable runtime visual profiling logger
7335 dnl ========================================================
7336 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7337 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7338     MOZ_VISUAL_EVENT_TRACER=1,
7339     MOZ_VISUAL_EVENT_TRACER=)
7340 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7341     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7344 dnl ========================================================
7345 dnl Turn on reflow counting
7346 dnl ========================================================
7347 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7348 [  --enable-reflow-perf    Enable reflow performance tracing],
7349     MOZ_REFLOW_PERF=1,
7350     MOZ_REFLOW_PERF= )
7351 if test -n "$MOZ_REFLOW_PERF"; then
7352     AC_DEFINE(MOZ_REFLOW_PERF)
7355 dnl ========================================================
7356 dnl = Enable Radio Interface for B2G (Gonk usually)
7357 dnl ========================================================
7358 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7359 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7360     MOZ_B2G_RIL=1,
7361     MOZ_B2G_RIL= )
7362 if test -n "$MOZ_B2G_RIL"; then
7363     AC_DEFINE(MOZ_B2G_RIL)
7365 AC_SUBST(MOZ_B2G_RIL)
7367 dnl ========================================================
7368 dnl = Enable Radio FM for B2G (Gonk usually)
7369 dnl ========================================================
7370 if test -n "$MOZ_B2G_FM"; then
7371     AC_DEFINE(MOZ_B2G_FM)
7373 AC_SUBST(MOZ_B2G_FM)
7375 dnl ========================================================
7376 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7377 dnl ========================================================
7378 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7379 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7380     MOZ_B2G_BT=1,
7381     MOZ_B2G_BT= )
7382 if test -n "$MOZ_B2G_BT"; then
7383     AC_DEFINE(MOZ_B2G_BT)
7385 AC_SUBST(MOZ_B2G_BT)
7387 dnl ========================================================
7388 dnl = Enable Pico Speech Synthesis (Gonk usually)
7389 dnl ========================================================
7390 MOZ_ARG_ENABLE_BOOL(synth-pico,
7391 [  --enable-synth-pico  Set compile flags necessary for compiling Pico Web Speech API ],
7392     MOZ_SYNTH_PICO=1,
7393     MOZ_SYNTH_PICO= )
7394 if test -n "$MOZ_SYNTH_PICO"; then
7395     AC_DEFINE(MOZ_SYNTH_PICO)
7397 AC_SUBST(MOZ_SYNTH_PICO)
7399 dnl ========================================================
7400 dnl = Enable Support for Time Manager API
7401 dnl ========================================================
7402 if test -n "$MOZ_TIME_MANAGER"; then
7403     AC_DEFINE(MOZ_TIME_MANAGER)
7405 AC_SUBST(MOZ_TIME_MANAGER)
7407 dnl ========================================================
7408 dnl = Enable Camera Interface for B2G (Gonk usually)
7409 dnl ========================================================
7410 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7411 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7412     MOZ_B2G_CAMERA=1,
7413     MOZ_B2G_CAMERA= )
7414 if test -n "$MOZ_B2G_CAMERA"; then
7415    AC_DEFINE(MOZ_B2G_CAMERA)
7417 AC_SUBST(MOZ_B2G_CAMERA)
7419 dnl ========================================================
7420 dnl = Enable Support B2G-specific changes to the NSS
7421 dnl = certificate trust database.
7422 dnl ========================================================
7423 if test -n "$MOZ_B2G_CERTDATA"; then
7424     AC_DEFINE(MOZ_B2G_CERTDATA)
7426 AC_SUBST(MOZ_B2G_CERTDATA)
7428 dnl ========================================================
7429 dnl = Enable Support for Payment API
7430 dnl ========================================================
7431 if test -n "$MOZ_PAY"; then
7432     AC_DEFINE(MOZ_PAY)
7434 AC_SUBST(MOZ_PAY)
7436 dnl ========================================================
7437 dnl = Enable Support for AudioChannelManager API
7438 dnl ========================================================
7439 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7440     AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7442 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7444 dnl ========================================================
7445 dnl = Support for demangling undefined symbols
7446 dnl ========================================================
7447 if test -z "$SKIP_LIBRARY_CHECKS"; then
7448     AC_LANG_SAVE
7449     AC_LANG_CPLUSPLUS
7450     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7451     AC_LANG_RESTORE
7454 # Demangle only for debug or trace-malloc or DMD builds
7455 MOZ_DEMANGLE_SYMBOLS=
7456 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7457     MOZ_DEMANGLE_SYMBOLS=1
7458     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7460 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7462 dnl ========================================================
7463 dnl = Support for gcc stack unwinding (from gcc 3.3)
7464 dnl ========================================================
7465 if test -z "$SKIP_LIBRARY_CHECKS"; then
7466     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7469 dnl ========================================================
7470 dnl JIT observers
7471 dnl ========================================================
7473 MOZ_ARG_WITH_STRING(jitreport-granularity,
7474 [  --jitreport-granularity=N
7475                            Default granularity at which to report JIT code
7476                            to external tools
7477                              0 - no info
7478                              1 - code ranges for whole functions only
7479                              2 - per-line information
7480                              3 - per-op information],
7481   JITREPORT_GRANULARITY=$withval,
7482   JITREPORT_GRANULARITY=3)
7484 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7486 dnl ========================================================
7487 dnl =
7488 dnl = Misc. Options
7489 dnl =
7490 dnl ========================================================
7491 MOZ_ARG_HEADER(Misc. Options)
7493 dnl ========================================================
7494 dnl update xterm title
7495 dnl ========================================================
7496 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7497 [  --enable-xterm-updates  Update XTERM titles with current command.],
7498     MOZ_UPDATE_XTERM=1,
7499     MOZ_UPDATE_XTERM= )
7501 dnl =========================================================
7502 dnl = Chrome format
7503 dnl =========================================================
7504 MOZ_ARG_ENABLE_STRING([chrome-format],
7505 [  --enable-chrome-format=jar|flat|omni
7506                           Select FORMAT of chrome files during packaging],
7507     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7509 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7510     MOZ_CHROME_FILE_FORMAT=jar
7513 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7514     AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7517 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7518     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7519     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7520     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7523 dnl =========================================================
7524 dnl Omnijar packaging (bug 552121)
7525 dnl =========================================================
7526 dnl Omnijar packaging is compatible with flat packaging.
7527 dnl In unpackaged builds, omnijar looks for files as if
7528 dnl things were flat packaged. After packaging, all files
7529 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7530 dnl is set to flat since putting files into jars is only
7531 dnl done during packaging with omnijar.
7532 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7533     MOZ_OMNIJAR=1
7534     AC_DEFINE(MOZ_OMNIJAR)
7536 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7537 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7538     MOZ_CHROME_FILE_FORMAT=flat
7539 else
7540     MOZ_CHROME_FILE_FORMAT=symlink
7543 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7544     dnl Fennec's static resources live in the assets/ folder of the
7545     dnl APK.  Adding a path to the name here works because we only
7546     dnl have one omnijar file in the final package (which is not the
7547     dnl case on desktop), and necessitates some contortions during
7548     dnl packaging so that the resources in the omnijar are considered
7549     dnl as rooted at / and not as rooted at assets/ (which again is
7550     dnl not the case on desktop: there are omnijars rooted at webrtc/,
7551     dnl etc). packager.mk handles changing the rooting of the single
7552     dnl omnijar.
7553     OMNIJAR_NAME=assets/omni.ja
7554 else
7555     OMNIJAR_NAME=omni.ja
7558 AC_SUBST(OMNIJAR_NAME)
7559 AC_SUBST(MOZ_OMNIJAR)
7560 AC_SUBST(MOZ_PACKAGER_FORMAT)
7562 dnl ========================================================
7563 dnl = Define default location for MOZILLA_FIVE_HOME
7564 dnl ========================================================
7565 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7566 [  --with-default-mozilla-five-home
7567                           Set the default value for MOZILLA_FIVE_HOME],
7568 [ val=`echo $withval`
7569   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7571 dnl ========================================================
7572 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7573 dnl ========================================================
7574 MOZ_ARG_WITH_STRING(user-appdir,
7575 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7576 [ val=`echo $withval`
7577 if echo "$val" | grep "\/" >/dev/null; then
7578     AC_MSG_ERROR("Homedir must be single relative path.")
7579 else
7580     MOZ_USER_DIR="$val"
7581 fi])
7583 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7585 dnl ========================================================
7586 dnl = Doxygen configuration
7587 dnl ========================================================
7588 dnl Use commas to specify multiple dirs to this arg
7589 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7590 MOZ_ARG_WITH_STRING(doc-input-dirs,
7591 [  --with-doc-input-dirs=DIRS
7592                           Header/idl dirs to create docs from],
7593 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7594 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7596 dnl Use commas to specify multiple dirs to this arg
7597 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7598 MOZ_ARG_WITH_STRING(doc-include-dirs,
7599 [  --with-doc-include-dirs=DIRS
7600                           Include dirs to preprocess doc headers],
7601 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7602 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7604 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7605 MOZ_ARG_WITH_STRING(doc-output-dir,
7606 [  --with-doc-output-dir=DIR
7607                           Dir to generate docs into],
7608 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7609 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7611 if test -z "$SKIP_COMPILER_CHECKS"; then
7612 dnl ========================================================
7613 dnl =
7614 dnl = Compiler Options
7615 dnl =
7616 dnl ========================================================
7617 MOZ_ARG_HEADER(Compiler Options)
7619 dnl ========================================================
7620 dnl Check for gcc -pipe support
7621 dnl ========================================================
7622 AC_MSG_CHECKING([for -pipe support])
7623 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7624     dnl Any gcc that supports firefox supports -pipe.
7625     CFLAGS="$CFLAGS -pipe"
7626     CXXFLAGS="$CXXFLAGS -pipe"
7627     AC_MSG_RESULT([yes])
7628 else
7629     AC_MSG_RESULT([no])
7632 dnl ========================================================
7633 dnl Profile guided optimization (gcc checks)
7634 dnl ========================================================
7635 dnl Test for profiling options
7636 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7638 _SAVE_CFLAGS="$CFLAGS"
7639 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7641 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7642 AC_TRY_COMPILE([], [return 0;],
7643                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7644                  result="yes" ], result="no")
7645 AC_MSG_RESULT([$result])
7647 if test $result = "yes"; then
7648   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7649   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7650   PROFILE_USE_LDFLAGS="-fprofile-use"
7653 CFLAGS="$_SAVE_CFLAGS"
7655 if test -n "$INTEL_CC"; then
7656   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7657   PROFILE_GEN_LDFLAGS=
7658   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7659   PROFILE_USE_LDFLAGS=
7662 dnl Sun Studio on Solaris
7663 if test "$SOLARIS_SUNPRO_CC"; then
7664   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7665   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7666   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7667   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7670 AC_SUBST(PROFILE_GEN_CFLAGS)
7671 AC_SUBST(PROFILE_GEN_LDFLAGS)
7672 AC_SUBST(PROFILE_USE_CFLAGS)
7673 AC_SUBST(PROFILE_USE_LDFLAGS)
7675 AC_LANG_CPLUSPLUS
7677 dnl ========================================================
7678 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7679 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7680 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7681 dnl ========================================================
7682 _SAVE_CXXFLAGS=$CXXFLAGS
7683 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7684 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7685     ac_nscap_nonconst_opeq_bug,
7686     [AC_TRY_COMPILE([
7687                       template <class T>
7688                       class Pointer
7689                         {
7690                         public:
7691                           T* myPtr;
7692                         };
7694                       template <class T, class U>
7695                       int operator==(const Pointer<T>& rhs, U* lhs)
7696                         {
7697                           return rhs.myPtr == lhs;
7698                         }
7700                       template <class T, class U>
7701                       int operator==(const Pointer<T>& rhs, const U* lhs)
7702                         {
7703                           return rhs.myPtr == lhs;
7704                         }
7705                     ],
7706                     [
7707                       Pointer<int> foo;
7708                       const int* bar;
7709                       return foo == bar;
7710                     ],
7711                     ac_nscap_nonconst_opeq_bug="no",
7712                     ac_nscap_nonconst_opeq_bug="yes")])
7713 CXXFLAGS="$_SAVE_CXXFLAGS"
7715 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7716     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7718 fi # ! SKIP_COMPILER_CHECKS
7720 AC_DEFINE(CPP_THROW_NEW, [throw()])
7721 AC_LANG_C
7723 if test "$COMPILE_ENVIRONMENT"; then
7724 MOZ_EXPAND_LIBS
7725 fi # COMPILE_ENVIRONMENT
7727 dnl ========================================================
7728 dnl =
7729 dnl = Build depencency options
7730 dnl =
7731 dnl ========================================================
7732 MOZ_ARG_HEADER(Build dependencies)
7734 if test "$GNU_CC" -a "$GNU_CXX"; then
7735   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7736 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7737 elif test "$SOLARIS_SUNPRO_CC"; then
7738   _DEPEND_CFLAGS=
7739 else
7740   dnl Don't override this for MSVC
7741   if test -z "$_WIN32_MSVC"; then
7742     _USE_CPP_INCLUDE_FLAG=
7743     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7744     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7745   else
7746     echo '#include <stdio.h>' > dummy-hello.c
7747     changequote(,)
7748     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7749     changequote([,])
7750     if test -z "$CL_INCLUDES_PREFIX"; then
7751         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7752     fi
7753     AC_SUBST(CL_INCLUDES_PREFIX)
7754     rm -f dummy-hello.c
7755   fi
7758 dnl ========================================================
7759 dnl =
7760 dnl = Static Build Options
7761 dnl =
7762 dnl ========================================================
7763 MOZ_ARG_HEADER(Static build options)
7765 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7766 if test "$OS_ARCH" = "WINNT"; then
7767   ENABLE_SHARED_JS=1
7770 MOZ_ARG_ENABLE_BOOL(shared-js,
7771 [  --enable-shared-js
7772                           Create a shared JavaScript library.],
7773     ENABLE_SHARED_JS=1,
7774     ENABLE_SHARED_JS=)
7776 if test -n "$ENABLE_SHARED_JS"; then
7777   JS_SHARED_LIBRARY=1
7778   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7779 else
7780   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7781   AC_DEFINE(MOZ_STATIC_JS)
7783 AC_SUBST(JS_SHARED_LIBRARY)
7785 AC_SUBST(LIBXUL_LIBS)
7786 XPCOM_LIBS="$LIBXUL_LIBS"
7788 dnl ========================================================
7789 dnl =
7790 dnl = Standalone module options
7791 dnl =
7792 dnl ========================================================
7793 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7795 dnl Check for GLib.
7796 dnl ========================================================
7798 if test -z "$SKIP_PATH_CHECKS"; then
7799 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7800     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7801         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7802     fi
7806 if test -z "${GLIB_GMODULE_LIBS}" \
7807    -a -n "${GLIB_CONFIG}"\
7808     -a "${GLIB_CONFIG}" != no\
7809 ; then
7810     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7813 AC_SUBST(GLIB_CFLAGS)
7814 AC_SUBST(GLIB_LIBS)
7815 AC_SUBST(GLIB_GMODULE_LIBS)
7817 dnl ========================================================
7818 dnl Graphics checks.
7819 dnl ========================================================
7821 if test "${OS_TARGET}" = "WINNT"; then
7822   if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7823     MOZ_ENABLE_DIRECT2D1_1=1
7824     AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7825   fi
7828 if test "${OS_TARGET}" = "WINNT" -o \
7829         "${OS_ARCH}" = "Darwin" -o \
7830         "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7831         "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7832         "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7833         "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7834     case "${target_cpu}" in
7835     i*86*|x86_64|arm)
7836         MOZ_ENABLE_SKIA=1
7837         ;;
7838     *)
7839         MOZ_ENABLE_SKIA=
7840         ;;
7841     esac
7842 else
7843 MOZ_ENABLE_SKIA=
7846 MOZ_ARG_ENABLE_BOOL(skia,
7847 [  --enable-skia   Enable use of Skia],
7848 MOZ_ENABLE_SKIA=1,
7849 MOZ_ENABLE_SKIA=)
7851 if test "$USE_FC_FREETYPE"; then
7852     if test "$COMPILE_ENVIRONMENT"; then
7853         dnl ========================================================
7854         dnl = Check for freetype2 and its functionality
7855         dnl ========================================================
7856         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7858         if test "$_HAVE_FREETYPE2"; then
7859             _SAVE_LIBS="$LIBS"
7860             _SAVE_CFLAGS="$CFLAGS"
7861             LIBS="$LIBS $FT2_LIBS"
7862             CFLAGS="$CFLAGS $FT2_CFLAGS"
7864             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7865                 ac_cv_member_FT_Bitmap_Size_y_ppem,
7866                 [AC_TRY_COMPILE([#include <ft2build.h>
7867                                  #include FT_FREETYPE_H],
7868                                 [FT_Bitmap_Size s;
7869                                  if (sizeof s.y_ppem) return 0;
7870                                  return 1],
7871                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7872                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7873             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7874                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7875             else
7876                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7877             fi
7878             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7879                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7880                                [FT_Bitmap_Size structure includes y_ppem field])
7882             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
7884             LIBS="$_SAVE_LIBS"
7885             CFLAGS="$_SAVE_CFLAGS"
7886         fi
7888         _SAVE_CPPFLAGS="$CPPFLAGS"
7889         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7890         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7891             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7892         CPPFLAGS="$_SAVE_CPPFLAGS"
7893     else
7894         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7895     fi
7897     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7898     [
7899         if test "$MOZ_PANGO"; then
7900             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7901             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7902         else
7903             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7904             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7905         fi
7906     ])
7909 dnl ========================================================
7910 dnl Check for pixman and cairo
7911 dnl ========================================================
7913 MOZ_TREE_CAIRO=1
7914 MOZ_ARG_ENABLE_BOOL(system-cairo,
7915 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
7916 MOZ_TREE_CAIRO=,
7917 MOZ_TREE_CAIRO=1 )
7919 MOZ_TREE_PIXMAN=1
7920 MOZ_ARG_ENABLE_BOOL(system-pixman,
7921 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7922 MOZ_TREE_PIXMAN=,
7923 MOZ_TREE_PIXMAN=force,
7924 MOZ_TREE_PIXMAN=1 )
7926 # System cairo depends on system pixman
7927 if test "$MOZ_TREE_PIXMAN" = "force"; then
7928     if test -z "$MOZ_TREE_CAIRO"; then
7929         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7930     else
7931         MOZ_TREE_PIXMAN=1
7932     fi
7933 elif test -z "$MOZ_TREE_CAIRO"; then
7934     MOZ_TREE_PIXMAN=
7937 if test "$MOZ_TREE_PIXMAN"; then
7938     AC_DEFINE(MOZ_TREE_PIXMAN)
7939     MOZ_PIXMAN_CFLAGS=""
7940     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7941 else
7942     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7943     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7944     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7946 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7947 AC_SUBST(MOZ_PIXMAN_LIBS)
7949 # Check for headers defining standard int types.
7950 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7952 if test "$MOZ_TREE_CAIRO"; then
7953     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7954     AC_DEFINE(MOZ_TREE_CAIRO)
7956     # For now we assume that we will have a uint64_t available through
7957     # one of the above headers or mozstdint.h.
7958     AC_DEFINE(HAVE_UINT64_T)
7960     # Define macros for cairo-features.h
7961     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7962     if test "$MOZ_X11"; then
7963         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7964         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7965         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7966         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7967         MOZ_ENABLE_CAIRO_FT=1
7968         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7969     fi
7970     case "$MOZ_WIDGET_TOOLKIT" in
7971       qt)
7972         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7973         ;;
7974       cocoa | uikit)
7975         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7976         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7977         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7978         ;;
7979       windows)
7980         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7981         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7982         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7983             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7984             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7985             MOZ_ENABLE_D2D_SURFACE=1
7986             MOZ_ENABLE_DWRITE_FONT=1
7987         else
7988             WIN32_DWRITE_FONT_FEATURE=
7989             WIN32_D2D_SURFACE_FEATURE=
7990         fi
7992         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7994         dnl D3D10 Layers depend on D2D Surfaces.
7995         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7996           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7997         fi
7998         ;;
7999       os2)
8000         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8001         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8002         MOZ_ENABLE_CAIRO_FT=1
8003         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8004         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8005         CAIRO_FT_LIBS=""
8006         ;;
8007     esac
8008     if test "$USE_FC_FREETYPE"; then
8009         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8010     fi
8011     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8012     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8013     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8014     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8015     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8016     AC_SUBST(CAIRO_FT_CFLAGS)
8018     AC_SUBST(PS_SURFACE_FEATURE)
8019     AC_SUBST(PDF_SURFACE_FEATURE)
8020     AC_SUBST(SVG_SURFACE_FEATURE)
8021     AC_SUBST(XLIB_SURFACE_FEATURE)
8022     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8023     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8024     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8025     AC_SUBST(WIN32_SURFACE_FEATURE)
8026     AC_SUBST(OS2_SURFACE_FEATURE)
8027     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8028     AC_SUBST(FT_FONT_FEATURE)
8029     AC_SUBST(FC_FONT_FEATURE)
8030     AC_SUBST(WIN32_FONT_FEATURE)
8031     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8032     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8033     AC_SUBST(QUARTZ_FONT_FEATURE)
8034     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8035     AC_SUBST(QT_SURFACE_FEATURE)
8036     AC_SUBST(TEE_SURFACE_FEATURE)
8038     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8039     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8041     if test "$MOZ_X11"; then
8042         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8043     fi
8045     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8046 else
8047     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8048     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8049     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8050     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8051     if test "$MOZ_X11"; then
8052         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8053         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8054         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8055         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8056     fi
8059 AC_SUBST(MOZ_TREE_CAIRO)
8060 AC_SUBST(MOZ_CAIRO_CFLAGS)
8061 AC_SUBST(MOZ_CAIRO_LIBS)
8062 AC_SUBST(MOZ_CAIRO_OSLIBS)
8063 AC_SUBST(MOZ_TREE_PIXMAN)
8065 dnl ========================================================
8066 dnl qcms
8067 dnl ========================================================
8069 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8070 AC_SUBST(QCMS_LIBS)
8072 dnl ========================================================
8073 dnl HarfBuzz
8074 dnl ========================================================
8075 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8076 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8078 dnl ========================================================
8079 dnl SIL Graphite
8080 dnl ========================================================
8081 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8082 AC_SUBST(MOZ_GRAPHITE_LIBS)
8084 dnl ========================================================
8085 dnl OTS
8086 dnl ========================================================
8087 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8088 AC_SUBST(MOZ_OTS_LIBS)
8090 dnl ========================================================
8091 dnl Skia 
8092 dnl ========================================================
8093 if test "$MOZ_ENABLE_SKIA"; then
8094   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8095   AC_DEFINE(MOZ_ENABLE_SKIA)
8096   AC_DEFINE(USE_SKIA)
8097   if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8098     AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8099   elif test "$OS_ARCH" = "WINNT"; then
8100     AC_DEFINE(SKIA_DLL)
8101     AC_DEFINE(GR_DLL)
8102   fi
8104   if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
8105     MOZ_ENABLE_SKIA_GPU=1
8106     AC_DEFINE(USE_SKIA_GPU)
8107     AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8108   fi
8109 else
8110   MOZ_SKIA_LIBS=
8112 AC_SUBST(MOZ_ENABLE_SKIA)
8113 AC_SUBST(MOZ_SKIA_LIBS)
8115 dnl ========================================================
8116 dnl disable xul
8117 dnl ========================================================
8118 MOZ_ARG_DISABLE_BOOL(xul,
8119 [  --disable-xul           Disable XUL],
8120     MOZ_XUL= )
8121 if test "$MOZ_XUL"; then
8122   AC_DEFINE(MOZ_XUL)
8123 else
8124   dnl remove extensions that require XUL
8125   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8128 AC_SUBST(MOZ_XUL)
8130 dnl ========================================================
8131 dnl disable profile locking
8132 dnl   do no use this in applications that can have more than
8133 dnl   one process accessing the profile directory.
8134 dnl ========================================================
8135 MOZ_ARG_DISABLE_BOOL(profilelocking,
8136 [  --disable-profilelocking
8137                           Disable profile locking],
8138     MOZ_PROFILELOCKING=,
8139     MOZ_PROFILELOCKING=1 )
8140 if test "$MOZ_PROFILELOCKING"; then
8141   AC_DEFINE(MOZ_PROFILELOCKING)
8144 dnl ========================================================
8145 dnl necko configuration options
8146 dnl ========================================================
8149 dnl option to disable various necko protocols
8151 MOZ_ARG_ENABLE_STRING(necko-protocols,
8152 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8153                           Enable/disable specific protocol handlers],
8154 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8155     if test "$option" = "yes" -o "$option" = "all"; then
8156         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8157     elif test "$option" = "no" -o "$option" = "none"; then
8158         NECKO_PROTOCOLS=""
8159     elif test "$option" = "default"; then
8160         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8161     elif test `echo "$option" | grep -c \^-` != 0; then
8162         option=`echo $option | sed 's/^-//'`
8163         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8164     else
8165         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8166     fi
8167 done],
8168     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8169 dnl Remove dupes
8170 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8171 AC_SUBST(NECKO_PROTOCOLS)
8172 for p in $NECKO_PROTOCOLS; do
8173     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8174     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8175 done
8178 dnl option to disable necko's wifi scanner
8181 case "$OS_TARGET" in
8182   Android)
8183     if test -n "$gonkdir"; then
8184       NECKO_WIFI=1
8185     fi
8186     ;;
8187   Darwin|SunOS|WINNT)
8188     NECKO_WIFI=1
8189     ;;
8190   Linux)
8191     NECKO_WIFI=1
8192     NECKO_WIFI_DBUS=1
8193     ;;
8194 esac
8196 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8197 [  --disable-necko-wifi    Disable necko wifi scanner],
8198     NECKO_WIFI=,
8199     NECKO_WIFI=1)
8201 if test "$NECKO_WIFI"; then
8202   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8203     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8204   fi
8205   AC_DEFINE(NECKO_WIFI)
8206   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8208 AC_SUBST(NECKO_WIFI)
8209 AC_SUBST(NECKO_WIFI_DBUS)
8212 dnl option to disable cookies
8214 MOZ_ARG_DISABLE_BOOL(cookies,
8215 [  --disable-cookies       Disable cookie support],
8216     NECKO_COOKIES=,
8217     NECKO_COOKIES=1)
8218 AC_SUBST(NECKO_COOKIES)
8219 if test "$NECKO_COOKIES"; then
8220     AC_DEFINE(NECKO_COOKIES)
8221     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8225 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8227 MOZ_ARG_DISABLE_BOOL(ctypes,
8228 [  --disable-ctypes        Disable js-ctypes],
8229     BUILD_CTYPES=,
8230     BUILD_CTYPES=1)
8231 AC_SUBST(BUILD_CTYPES)
8232 if test "$BUILD_CTYPES"; then
8233     AC_DEFINE(BUILD_CTYPES)
8236 dnl Build Places if required
8237 if test "$MOZ_PLACES"; then
8238   AC_DEFINE(MOZ_PLACES)
8241 dnl Build SocialAPI if required
8242 if test "$MOZ_SOCIAL"; then
8243   AC_DEFINE(MOZ_SOCIAL)
8246 dnl Build Common JS modules provided by services.
8247 AC_SUBST(MOZ_SERVICES_COMMON)
8248 if test -n "$MOZ_SERVICES_COMMON"; then
8249   AC_DEFINE(MOZ_SERVICES_COMMON)
8252 dnl Build Services crypto component (used by Sync)
8253 AC_SUBST(MOZ_SERVICES_CRYPTO)
8254 if test -n "$MOZ_SERVICES_CRYPTO"; then
8255   AC_DEFINE(MOZ_SERVICES_CRYPTO)
8258 dnl Build Firefox Health Reporter Service
8259 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8260 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8261   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8264 dnl Build Services metrics component
8265 AC_SUBST(MOZ_SERVICES_METRICS)
8266 if test -n "$MOZ_SERVICES_METRICS"; then
8267   AC_DEFINE(MOZ_SERVICES_METRICS)
8270 dnl Build Notifications if required
8271 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8272 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8273   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8276 dnl Build Sync Services if required
8277 AC_SUBST(MOZ_SERVICES_SYNC)
8278 if test -n "$MOZ_SERVICES_SYNC"; then
8279   AC_DEFINE(MOZ_SERVICES_SYNC)
8282 dnl Build Captive Portal Detector if required
8283 AC_SUBST(MOZ_CAPTIVEDETECT)
8284 if test -n "$MOZ_CAPTIVEDETECT"; then
8285   AC_DEFINE(MOZ_CAPTIVEDETECT)
8288 dnl ========================================================
8289 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8290     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8293 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8294   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8297 if test "$MOZ_APP_COMPONENT_MODULES"; then
8298   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8301 dnl ========================================================
8302 dnl =
8303 dnl = Maintainer debug option (no --enable equivalent)
8304 dnl =
8305 dnl ========================================================
8307 AC_SUBST(AR)
8308 AC_SUBST(AR_FLAGS)
8309 AC_SUBST(AR_LIST)
8310 AC_SUBST(AR_EXTRACT)
8311 AC_SUBST(AR_DELETE)
8312 AC_SUBST(AS)
8313 AC_SUBST(ASFLAGS)
8314 AC_SUBST(AS_DASH_C_FLAG)
8315 AC_SUBST(LD)
8316 AC_SUBST(RC)
8317 AC_SUBST(RCFLAGS)
8318 AC_SUBST(MC)
8319 AC_SUBST(WINDRES)
8320 AC_SUBST(IMPLIB)
8321 AC_SUBST(FILTER)
8322 AC_SUBST(BIN_FLAGS)
8323 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8324 AC_SUBST(MOZ_UPDATE_XTERM)
8325 AC_SUBST(MOZ_AUTH_EXTENSION)
8326 AC_SUBST(MOZ_PERMISSIONS)
8327 AC_SUBST(MOZ_PREF_EXTENSIONS)
8328 AC_SUBST(MOZ_JS_LIBS)
8329 AC_SUBST(MOZ_DEBUG)
8330 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8331 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8332 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8333 AC_SUBST(MOZ_DEBUG_FLAGS)
8334 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8335 AC_SUBST(WARNINGS_AS_ERRORS)
8336 AC_SUBST(MOZ_EXTENSIONS)
8337 AC_SUBST(MOZ_JSDEBUGGER)
8338 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8339 AC_SUBST(MOZ_JPROF)
8340 AC_SUBST(MOZ_SHARK)
8341 AC_SUBST(MOZ_INSTRUMENTS)
8342 AC_SUBST(MOZ_CALLGRIND)
8343 AC_SUBST(MOZ_VTUNE)
8344 AC_SUBST(MOZ_PROFILING)
8345 AC_SUBST(LIBICONV)
8346 AC_SUBST(MOZ_PLACES)
8347 AC_SUBST(MOZ_SOCIAL)
8348 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8349 AC_SUBST(MOZ_FEEDS)
8350 AC_SUBST(NS_PRINTING)
8351 AC_SUBST(MOZ_WEBGL)
8352 AC_SUBST(MOZ_HELP_VIEWER)
8353 AC_SUBST(TOOLCHAIN_PREFIX)
8355 AC_SUBST(JAVA)
8356 AC_SUBST(JAVAC)
8357 AC_SUBST(JAVAH)
8358 AC_SUBST(JAR)
8359 AC_SUBST(JARSIGNER)
8360 AC_SUBST(KEYTOOL)
8362 AC_SUBST(MOZ_PROFILELOCKING)
8364 AC_SUBST(ENABLE_TESTS)
8365 AC_SUBST(ENABLE_MARIONETTE)
8366 AC_SUBST(IBMBIDI)
8367 AC_SUBST(MOZ_UNIVERSALCHARDET)
8368 AC_SUBST(ACCESSIBILITY)
8369 AC_SUBST(MOZ_SPELLCHECK)
8370 AC_SUBST(MOZ_ANDROID_OMTC)
8371 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8372 AC_SUBST(MOZ_CRASHREPORTER)
8373 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8374 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8375 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8376 AC_SUBST(MOZ_STUB_INSTALLER)
8377 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8378 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8379 AC_SUBST(MOZ_UPDATER)
8380 AC_SUBST(MOZ_ANGLE_RENDERER)
8381 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8382 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8383 AC_SUBST(MOZ_D3DX9_VERSION)
8384 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8385 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8386 AC_SUBST(MOZ_METRO)
8388 AC_SUBST(MOZ_ANDROID_HISTORY)
8389 AC_SUBST(MOZ_WEBSMS_BACKEND)
8390 AC_SUBST(MOZ_ANDROID_BEAM)
8391 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8392 AC_SUBST(ENABLE_STRIP)
8393 AC_SUBST(PKG_SKIP_STRIP)
8394 AC_SUBST(STRIP_FLAGS)
8395 AC_SUBST(USE_ELF_DYNSTR_GC)
8396 AC_SUBST(USE_ELF_HACK)
8397 AC_SUBST(INCREMENTAL_LINKER)
8398 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8399 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8401 AC_SUBST(MOZ_FIX_LINK_PATHS)
8402 AC_SUBST(XPCOM_LIBS)
8403 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8404 AC_SUBST(XPCOM_GLUE_LDOPTS)
8405 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8406 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8407 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8409 AC_SUBST(USE_DEPENDENT_LIBS)
8411 AC_SUBST(MOZ_BUILD_ROOT)
8412 AC_SUBST(MOZ_OS2_TOOLS)
8414 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8415 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8416 AC_SUBST(MOZ_LINKER_EXTRACT)
8418 dnl ========================================================
8419 dnl = Mac bundle name prefix
8420 dnl ========================================================
8421 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8422 [  --with-macbundlename-prefix=prefix
8423                           Prefix for MOZ_MACBUNDLE_NAME],
8424 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8426 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8427 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8428   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8431 if test "$MOZ_DEBUG"; then
8432   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8433 else
8434   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8436 AC_SUBST(MOZ_MACBUNDLE_NAME)
8438 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8439 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8440 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8441 if test "$MOZ_DEBUG"; then
8442   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8445 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8446 AC_SUBST(MOZ_MACBUNDLE_ID)
8448 dnl ========================================================
8449 dnl = Child Process Name for IPC
8450 dnl ========================================================
8451 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8452   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8453 else
8454   # We want to let Android unpack the file at install time, but it only does
8455   # so if the file is named libsomething.so. The lib/ path is also required
8456   # because the unpacked file will be under the lib/ subdirectory and will
8457   # need to be executed from that path.
8458   MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8460 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8462 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8463 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8465 # The following variables are available to branding and application
8466 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8467 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8468 # impacts profile location and user-visible fields.
8469 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8470 # versions of a given application (e.g. Aurora and Firefox both use
8471 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8472 # for application.ini's "Name" field, which controls profile location in
8473 # the absence of a "Profile" field (see below), and various system
8474 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8475 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8476 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8477 # builds (e.g. Aurora for Firefox).
8478 # - MOZ_APP_VERSION: Defines the application version number.
8479 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8480 # defaults to a lowercase form of MOZ_APP_BASENAME.
8481 # - MOZ_APP_PROFILE: When set, used for application.ini's
8482 # "Profile" field, which controls profile location.
8483 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8484 # crash reporter server url.
8485 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8486 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8488 if test -z "$MOZ_APP_NAME"; then
8489    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8492 # For extensions and langpacks, we require a max version that is compatible
8493 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8494 # 10.0a1 and 10.0a2 aren't affected
8495 # 10.0 becomes 10.0.*
8496 # 10.0.1 becomes 10.0.*
8497 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8498 if test -z "$IS_ALPHA"; then
8499   changequote(,)
8500   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8501   changequote([,])
8502 else
8503   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8506 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8507 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8508 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8510 AC_SUBST(MOZ_APP_NAME)
8511 AC_SUBST(MOZ_APP_DISPLAYNAME)
8512 AC_SUBST(MOZ_APP_BASENAME)
8513 AC_SUBST(MOZ_APP_VENDOR)
8514 AC_SUBST(MOZ_APP_PROFILE)
8515 AC_SUBST(MOZ_APP_ID)
8516 AC_SUBST(MAR_CHANNEL_ID)
8517 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8518 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8519 AC_SUBST(MOZ_EXTENSION_MANAGER)
8520 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8521 AC_SUBST(MOZ_APP_UA_NAME)
8522 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8523 AC_SUBST(MOZ_APP_VERSION)
8524 AC_SUBST(MOZ_APP_MAXVERSION)
8525 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8526 AC_SUBST(FIREFOX_VERSION)
8527 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8528 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8529   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8532 AC_SUBST(MOZ_APP_STATIC_INI)
8534 AC_SUBST(MOZ_PKG_SPECIAL)
8536 AC_SUBST(MOZILLA_OFFICIAL)
8538 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8539 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8541 if test "$MOZ_TELEMETRY_REPORTING"; then
8542     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8544     # Enable Telemetry by default for nightly and aurora channels
8545     if test -z "$RELEASE_BUILD"; then
8546       AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8547     fi
8550 dnl If we have any service that uploads data (and requires data submission
8551 dnl policy alert), set MOZ_DATA_REPORTING.
8552 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8553 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8554   MOZ_DATA_REPORTING=1
8555   AC_DEFINE(MOZ_DATA_REPORTING)
8556   AC_SUBST(MOZ_DATA_REPORTING)
8559 dnl win32 options
8560 AC_SUBST(MOZ_BROWSE_INFO)
8561 AC_SUBST(MOZ_TOOLS_DIR)
8562 AC_SUBST(WIN32_REDIST_DIR)
8563 AC_SUBST(MAKENSISU)
8565 dnl Echo the CFLAGS to remove extra whitespace.
8566 CFLAGS=`echo \
8567         $_WARNINGS_CFLAGS \
8568         $CFLAGS`
8570 CXXFLAGS=`echo \
8571         $_WARNINGS_CXXFLAGS \
8572         $CXXFLAGS`
8574 COMPILE_CFLAGS=`echo \
8575     $_DEFINES_CFLAGS \
8576         $_DEPEND_CFLAGS \
8577     $COMPILE_CFLAGS`
8579 COMPILE_CXXFLAGS=`echo \
8580     $_DEFINES_CXXFLAGS \
8581         $_DEPEND_CFLAGS \
8582     $COMPILE_CXXFLAGS`
8584 AC_SUBST(SYSTEM_LIBXUL)
8585 AC_SUBST(MOZ_NATIVE_JPEG)
8586 AC_SUBST(MOZ_NATIVE_PNG)
8587 AC_SUBST(MOZ_NATIVE_BZ2)
8589 AC_SUBST(MOZ_JPEG_CFLAGS)
8590 AC_SUBST(MOZ_JPEG_LIBS)
8591 AC_SUBST(MOZ_BZ2_CFLAGS)
8592 AC_SUBST(MOZ_BZ2_LIBS)
8593 AC_SUBST(MOZ_PNG_CFLAGS)
8594 AC_SUBST(MOZ_PNG_LIBS)
8596 AC_SUBST(NSPR_CFLAGS)
8597 AC_SUBST(NSPR_LIBS)
8598 AC_SUBST(MOZ_NATIVE_NSPR)
8600 AC_SUBST(NSS_CFLAGS)
8601 AC_SUBST(NSS_LIBS)
8602 AC_SUBST(MOZ_NATIVE_NSS)
8603 AC_SUBST(NSS_DISABLE_DBM)
8605 OS_CFLAGS="$CFLAGS"
8606 OS_CXXFLAGS="$CXXFLAGS"
8607 OS_CPPFLAGS="$CPPFLAGS"
8608 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8609 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8610 OS_LDFLAGS="$LDFLAGS"
8611 OS_LIBS="$LIBS"
8612 AC_SUBST(OS_CFLAGS)
8613 AC_SUBST(OS_CXXFLAGS)
8614 AC_SUBST(OS_CPPFLAGS)
8615 AC_SUBST(OS_COMPILE_CFLAGS)
8616 AC_SUBST(OS_COMPILE_CXXFLAGS)
8617 AC_SUBST(OS_LDFLAGS)
8618 AC_SUBST(OS_LIBS)
8619 AC_SUBST(CROSS_COMPILE)
8620 AC_SUBST(WCHAR_CFLAGS)
8622 AC_SUBST(HOST_CC)
8623 AC_SUBST(HOST_CXX)
8624 AC_SUBST(HOST_CFLAGS)
8625 AC_SUBST(HOST_CXXFLAGS)
8626 AC_SUBST(HOST_LDFLAGS)
8627 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8628 AC_SUBST(HOST_AR)
8629 AC_SUBST(HOST_AR_FLAGS)
8630 AC_SUBST(HOST_LD)
8631 AC_SUBST(HOST_RANLIB)
8632 AC_SUBST(HOST_NSPR_MDCPUCFG)
8633 AC_SUBST(HOST_BIN_SUFFIX)
8634 AC_SUBST(HOST_OS_ARCH)
8636 AC_SUBST(TARGET_CPU)
8637 AC_SUBST(TARGET_VENDOR)
8638 AC_SUBST(TARGET_OS)
8639 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8640 AC_SUBST(TARGET_MD_ARCH)
8641 AC_SUBST(TARGET_XPCOM_ABI)
8642 AC_SUBST(OS_TARGET)
8643 AC_SUBST(OS_ARCH)
8644 AC_SUBST(OS_RELEASE)
8645 AC_SUBST(OS_TEST)
8646 AC_SUBST(CPU_ARCH)
8647 AC_SUBST(INTEL_ARCHITECTURE)
8648 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8649 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8651 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8653 AC_SUBST(WRAP_LDFLAGS)
8654 AC_SUBST(MKSHLIB)
8655 AC_SUBST(MKCSHLIB)
8656 AC_SUBST(MKSHLIB_FORCE_ALL)
8657 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8658 AC_SUBST(DSO_CFLAGS)
8659 AC_SUBST(DSO_PIC_CFLAGS)
8660 AC_SUBST(DSO_LDOPTS)
8661 AC_SUBST(LIB_PREFIX)
8662 AC_SUBST(DLL_PREFIX)
8663 AC_SUBST(DLL_SUFFIX)
8664 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8665 AC_SUBST(LIB_SUFFIX)
8666 AC_SUBST(OBJ_SUFFIX)
8667 AC_SUBST(BIN_SUFFIX)
8668 AC_SUBST(ASM_SUFFIX)
8669 AC_SUBST(IMPORT_LIB_SUFFIX)
8670 AC_SUBST(USE_N32)
8671 AC_SUBST(CC_VERSION)
8672 AC_SUBST(CXX_VERSION)
8673 AC_SUBST(MSMANIFEST_TOOL)
8674 AC_SUBST(NS_ENABLE_TSF)
8675 AC_SUBST(MOZ_NSS_PATCH)
8676 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8677 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8679 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8680 AC_SUBST(MOZ_SOUNDTOUCH)
8681 AC_SUBST(MOZ_CUBEB)
8682 AC_SUBST(MOZ_WAVE)
8683 AC_SUBST(MOZ_VORBIS)
8684 AC_SUBST(MOZ_TREMOR)
8685 AC_SUBST(MOZ_OPUS)
8686 AC_SUBST(MOZ_WEBM)
8687 AC_SUBST(MOZ_DASH)
8688 AC_SUBST(MOZ_WMF)
8689 AC_SUBST(MOZ_DIRECTSHOW)
8690 AC_SUBST(MOZ_MEDIA_PLUGINS)
8691 AC_SUBST(MOZ_APPLEMEDIA)
8692 AC_SUBST(MOZ_OMX_PLUGIN)
8693 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8694 AC_SUBST(MOZ_VP8_ENCODER)
8695 AC_SUBST(MOZ_VP8)
8696 AC_SUBST(MOZ_OGG)
8697 AC_SUBST(VPX_AS)
8698 AC_SUBST(VPX_ASFLAGS)
8699 AC_SUBST(VPX_DASH_C_FLAG)
8700 AC_SUBST(VPX_AS_CONVERSION)
8701 AC_SUBST(VPX_ASM_SUFFIX)
8702 AC_SUBST(VPX_X86_ASM)
8703 AC_SUBST(VPX_ARM_ASM)
8704 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8705 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8706 AC_SUBST(LIBJPEG_TURBO_AS)
8707 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8708 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8709 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8710 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8712 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8713 AC_SUBST(MOZ_FOLD_LIBS)
8715 AC_SUBST(MOZ_ENABLE_SZIP)
8716 AC_SUBST(MOZ_SZIP_FLAGS)
8718 AC_MSG_CHECKING([for posix_fallocate])
8719 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8720   #include <fcntl.h>],
8721                  [posix_fallocate(0, 0, 0);],
8722                  [ac_cv___posix_fallocate=true],
8723                  [ac_cv___posix_fallocate=false])
8725 if test "$ac_cv___posix_fallocate" = true ; then
8726   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8727   AC_MSG_RESULT(yes)
8728 else
8729   AC_MSG_RESULT(no)
8732 dnl Check for missing components
8733 if test "$COMPILE_ENVIRONMENT"; then
8734 if test "$MOZ_X11"; then
8735     if test "$WITHOUT_X11"; then
8736         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8737     fi
8738     dnl ====================================================
8739     dnl = Check if X headers exist
8740     dnl ====================================================
8741     _SAVE_CFLAGS=$CFLAGS
8742     CFLAGS="$CFLAGS $XCFLAGS"
8743     AC_TRY_COMPILE([
8744         #include <stdio.h>
8745         #include <stdlib.h>
8746         #include <X11/Xlib.h>
8747         #include <X11/Intrinsic.h>
8748         #include <X11/extensions/XShm.h>
8749     ],
8750     [
8751         Display *dpy = 0;
8752         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8753             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8754             exit(1);
8755         }
8756     ], [],
8757     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8758     CFLAGS="$_SAVE_CFLAGS"
8760     if test -n "$MISSING_X"; then
8761         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8762     fi
8764 fi # MOZ_X11
8766 dnl Check for headers, etc. needed by WebGL.
8767 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8768     MOZ_CHECK_HEADER(GL/glx.h)
8769     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8770         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))])
8771     fi
8772 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8773 fi # COMPILE_ENVIRONMENT
8775 dnl Set various defines and substitutions
8776 dnl ========================================================
8778 if test "$OS_ARCH" = "Darwin"; then
8779   AC_DEFINE(XP_UNIX)
8780 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8781   AC_DEFINE(XP_UNIX)
8784 if test "$MOZ_DEBUG"; then
8785     AC_DEFINE(MOZ_REFLOW_PERF)
8786     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8789 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8790     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8791     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8792     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8793     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8794     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8795     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8796     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8797     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8800 AC_SUBST(MOZILLA_VERSION)
8802 AC_SUBST(ac_configure_args)
8804 dnl Spit out some output
8805 dnl ========================================================
8807 dnl The following defines are used by xpcom
8808 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8809 CPP_THROW_NEW
8810 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8811 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8812 HAVE_CPP_PARTIAL_SPECIALIZATION
8813 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8814 NEED_CPP_UNUSED_IMPLEMENTATIONS
8815 HAVE_GETPAGESIZE
8816 HAVE_ICONV
8817 HAVE_ICONV_WITH_CONST_INPUT
8818 HAVE_MBRTOWC
8819 HAVE_WCRTOMB
8820 HAVE_STATVFS64
8821 HAVE_STATVFS
8822 HAVE_STATFS64
8823 HAVE_STATFS
8824 HAVE_SYS_STATVFS_H
8825 HAVE_SYS_STATFS_H
8826 HAVE_SYS_VFS_H
8827 HAVE_SYS_MOUNT_H
8830 # FUTURE? Consider moving all these to moz.build files.
8831 AC_CONFIG_HEADER(
8832 netwerk/necko-config.h
8833 xpcom/xpcom-config.h
8834 xpcom/xpcom-private.h
8837 AC_SUBST(STLPORT_LIBS)
8839 export WRITE_MOZINFO=1
8840 AC_OUTPUT([mozilla-config.h])
8841 unset WRITE_MOZINFO
8843 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8844 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8845 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8846 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8847 # (apparently) only need this hack when egrep's "pattern" is particularly long
8848 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
8849 # bug 655339.
8850 case "$host" in
8851 *-apple-darwin11*)
8852     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8853     ;;
8855     FIXED_EGREP="egrep"
8856     ;;
8857 esac
8859 # Generate Makefiles for WebRTC directly from .gyp files
8860 if test "${OS_TARGET}" = "WINNT"; then
8861    if test "$HAVE_64BIT_OS"; then
8862       OS_BITS=64
8863    else
8864       OS_BITS=32
8865    fi
8866    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
8868 elif test "${OS_TARGET}" = "Android"; then
8869    if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
8870       EXTRA_GYP_DEFINES="-G os=linux "
8871    else
8872       EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
8873    fi
8876 if test -n "$ARM_ARCH"; then
8877     if test "$ARM_ARCH" -lt 7; then
8878         EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
8879     else
8880         if test "${OS_TARGET}" = "Android"; then
8881             EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
8882         else
8883             dnl CPU detection for ARM works on Android only.  armv7 always uses CPU detection, so
8884             dnl we have to set armv7=0 for non-Android target
8885             EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
8886         fi
8887     fi
8890 # Keep libcubeb and audio_device backends in sync
8891 if test -n "$MOZ_ALSA"; then
8892    EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=1"
8893 else
8894    EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=0"
8896 if test -n "$MOZ_PULSEAUDIO"; then
8897    EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=1"
8898 else
8899    EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=0"
8902 # Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
8903 if test -n "$INTEL_ARCHITECTURE"; then
8904   if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSSE3" -o -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
8905     EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
8906   fi
8909 if test -n "$MOZ_WEBRTC"; then
8910    AC_MSG_RESULT("generating WebRTC Makefiles...")
8912    if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
8913       EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1"
8914    fi
8916 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
8917 dnl so that regeneration via dependencies works correctly
8918    WEBRTC_CONFIG="-D build_with_mozilla=1 -D build_with_chromium=0 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
8920    if test -n HAVE_CLOCK_MONOTONIC; then
8921       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
8922    else
8923       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
8924    fi
8926    if test -n "$MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI"; then
8927       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=1"
8928    else
8929       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=0"
8930    fi
8932    GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} -D target_arch=${WEBRTC_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
8934    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8935      $GYP_WEBRTC_OPTIONS \
8936      --generator-output=${_objdir}/media/webrtc/trunk \
8937      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
8938    if test "$?" != 0; then
8939       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
8940    fi
8942    # XXX disable until we land the tranche with signaling
8943    if test -n "$MOZ_WEBRTC_SIGNALING"; then
8944      AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
8945      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8946        $GYP_WEBRTC_OPTIONS \
8947        -D build_for_test=0 \
8948        --generator-output=${_objdir}/media/webrtc/signaling \
8949        ${srcdir}/media/webrtc/signaling/signaling.gyp
8950      if test "$?" != 0; then
8951         AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
8952      fi
8954      AC_MSG_RESULT("generating WebRTC/SignalingTest Makefiles...")
8955      $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8956        $GYP_WEBRTC_OPTIONS \
8957        -D build_for_test=1 \
8958        --generator-output=${_objdir}/media/webrtc/signalingtest \
8959        ${srcdir}/media/webrtc/signaling/signaling.gyp
8960      if test "$?" != 0; then
8961        AC_MSG_ERROR([failed to generate WebRTC/SignalingTest Makefiles])
8962      fi
8963    fi
8965    AC_MSG_RESULT("generating gtest Makefiles...")
8966    # Ok to pass some extra -D's that are ignored here
8967    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
8968      $GYP_WEBRTC_OPTIONS \
8969      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
8970      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
8971    if test "$?" != 0; then
8972       AC_MSG_ERROR([failed to generate gtest Makefiles])
8973    fi
8975    AC_MSG_RESULT("generating nrappkit Makefiles...")
8976    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8977      $GYP_WEBRTC_OPTIONS \
8978      --generator-output=${_objdir}/media/mtransport/third_party/nrappkit \
8979      ${srcdir}/media/mtransport/third_party/nrappkit/nrappkit.gyp
8980    if test "$?" != 0; then
8981       AC_MSG_ERROR([failed to generate nrappkit Makefiles])
8982    fi
8984    AC_MSG_RESULT("generating nICEr Makefiles...")
8985    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium --format=mozmake \
8986      $GYP_WEBRTC_OPTIONS \
8987      --generator-output=${_objdir}/media/mtransport/third_party/nICEr \
8988      ${srcdir}/media/mtransport/third_party/nICEr/nicer.gyp
8989    if test "$?" != 0; then
8990       AC_MSG_ERROR([failed to generate nICEr Makefiles])
8991    fi
8994 # Run jemalloc configure script
8996 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
8997   ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8998   if test -n "$MOZ_REPLACE_MALLOC"; then
8999     # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9000     ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9001     ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9002   fi
9003   if test -n "$MOZ_JEMALLOC3"; then
9004     case "${OS_ARCH}" in
9005       WINNT|Darwin)
9006         # We want jemalloc functions to be kept hidden on both Mac and Windows
9007         # See memory/build/mozmemory_wrap.h for details.
9008         ac_configure_args="$ac_configure_args --without-export"
9009         ;;
9010     esac
9011   elif test "${OS_ARCH}" = Darwin; then
9012     # When building as a replace-malloc lib, disabling the zone allocator
9013     # forces to use pthread_atfork.
9014     ac_configure_args="$ac_configure_args --disable-zone-allocator"
9015   fi
9016   _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9017   JEMALLOC_WRAPPER=
9018   if test -z "$MOZ_REPLACE_MALLOC"; then
9019     case "$OS_ARCH" in
9020       Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9021         MANGLE=$_MANGLE
9022         ;;
9023     esac
9024   elif test -z "$MOZ_JEMALLOC3"; then
9025     MANGLE=$_MANGLE
9026     JEMALLOC_WRAPPER=replace_
9027   fi
9028   if test -n "$MANGLE"; then
9029     MANGLED=
9030     if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
9031       JEMALLOC_WRAPPER=__wrap_
9032     fi
9033     for mangle in ${MANGLE}; do
9034       if test -n "$MANGLED"; then
9035         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9036       else
9037         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9038       fi
9039     done
9040     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9041   fi
9042   unset CONFIG_FILES
9043   if test -z "$MOZ_TLS"; then
9044     ac_configure_args="$ac_configure_args --disable-tls"
9045   fi
9046   EXTRA_CFLAGS="$CFLAGS"
9047   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9048     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9049   done
9050   if test "$CROSS_COMPILE"; then
9051     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9052   fi
9053   _save_cache_file="$cache_file"
9054   cache_file=$_objdir/memory/jemalloc/src/config.cache
9056   if ! test -e memory/jemalloc; then
9057     mkdir -p memory/jemalloc
9058   fi
9060   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9061   cache_file="$_save_cache_file"
9062   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9065 # Run freetype configure script
9067 if test "$MOZ_TREE_FREETYPE"; then
9068    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9069    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9070    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9071    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9072    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9073    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png"
9075    if ! test -e modules; then
9076      mkdir modules
9077    fi
9079    AC_OUTPUT_SUBDIRS(modules/freetype2)
9082 if test -z "$direct_nspr_config"; then
9083     dnl ========================================================
9084     dnl = Setup a nice relatively clean build environment for
9085     dnl = sub-configures.
9086     dnl ========================================================
9087     CC="$_SUBDIR_CC"
9088     CXX="$_SUBDIR_CXX"
9089     CFLAGS="$_SUBDIR_CFLAGS"
9090     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9091     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9092     LDFLAGS="$_SUBDIR_LDFLAGS"
9093     HOST_CC="$_SUBDIR_HOST_CC"
9094     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9095     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9096     RC=
9099 unset MAKEFILES
9100 unset CONFIG_FILES
9102 # Run all configure scripts specified by a subconfigure
9103 if test -n "$_subconfigure_subdir"; then
9104   _save_ac_configure_args="$ac_configure_args"
9105   ac_configure_args="$_subconfigure_config_args"
9106   AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9107   ac_configure_args="$_save_ac_configure_args"
9110 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9111 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9113 export WRAP_LDFLAGS
9115 if test -n "$_WRAP_MALLOC"; then
9116     # Avoid doubling wrap malloc arguments
9117     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9120 if test -z "$MOZ_NATIVE_NSPR"; then
9121     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9122     if test -z "$MOZ_DEBUG"; then
9123         ac_configure_args="$ac_configure_args --disable-debug"
9124     else
9125         ac_configure_args="$ac_configure_args --enable-debug"
9126     fi
9127     if test "$MOZ_OPTIMIZE" = "1"; then
9128         ac_configure_args="$ac_configure_args --enable-optimize"
9129     elif test -z "$MOZ_OPTIMIZE"; then
9130         ac_configure_args="$ac_configure_args --disable-optimize"
9131     fi
9132     if test -n "$HAVE_64BIT_OS"; then
9133         ac_configure_args="$ac_configure_args --enable-64bit"
9134     fi
9135     if test -n "$USE_ARM_KUSER"; then
9136         ac_configure_args="$ac_configure_args --with-arm-kuser"
9137     fi
9138     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9140     # Save these, so we can mess with them for the subconfigure ..
9141     _SAVE_CFLAGS="$CFLAGS"
9142     _SAVE_CPPFLAGS="$CPPFLAGS"
9143     _SAVE_LDFLAGS="$LDFLAGS"
9145     if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9146       # dladdr is supported by the new linker, even when the system linker doesn't
9147       # support it. Trick nspr into using dladdr when it's not supported.
9148       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9149     fi
9150     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9151     export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
9153     AC_OUTPUT_SUBDIRS(nsprpub)
9155     # .. and restore them
9156     unset CFLAGS
9157     unset CPPFLAGS
9158     unset LDFLAGS
9159     CFLAGS="$_SAVE_CFLAGS"
9160     CPPFLAGS="$_SAVE_CPPFLAGS"
9161     LDFLAGS="$_SAVE_LDFLAGS"
9163     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9166 dnl ========================================================
9167 dnl = Setup a nice relatively clean build environment for
9168 dnl = sub-configures.
9169 dnl ========================================================
9170 CC="$_SUBDIR_CC"
9171 CXX="$_SUBDIR_CXX"
9172 CFLAGS="$_SUBDIR_CFLAGS"
9173 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9174 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9175 LDFLAGS="$_SUBDIR_LDFLAGS"
9176 HOST_CC="$_SUBDIR_HOST_CC"
9177 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9178 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9181 if test -n "$ENABLE_CLANG_PLUGIN"; then
9182     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9183     AC_OUTPUT_SUBDIRS(build/clang-plugin)
9187 # Run the SpiderMonkey 'configure' script.
9188 dist=$MOZ_BUILD_ROOT/dist
9189 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9190 ac_configure_args="$ac_configure_args --enable-threadsafe"
9192 MOZ_ARG_WITH_STRING(intl-api,
9193 [  --with-intl-api, --with-intl-api=build, --without-intl-api
9194     Determine the status of the ECMAScript Internationalization API.  The first
9195     (or lack of any of these) builds and exposes the API.  The second builds it
9196     but doesn't use ICU or expose the API to script.  The third doesn't build
9197     ICU at all.],
9198     WITH_INTL="--with-intl-api=$withval"
9200 if test -z "$WITH_INTL"; then
9201 if test "$NIGHTLY_BUILD" = "1" -a "$MOZ_BUILD_APP" = "browser"; then
9202     # In desktop nightlies the Internationalization API is disabled, but all
9203     # code for it is still built.  Bug 853301 will remove this so that it's
9204     # built and the API is enabled.
9205     WITH_INTL="--with-intl-api=build"
9206 else
9207     # Internationalization isn't built or exposed by default in non-desktop and
9208     # non-nightly builds.  Bugs to enable:
9209     #
9210     #   Android:  bug 864843
9211     #   B2G:      bug 866301
9212     WITH_INTL="--without-intl-api"
9215 ac_configure_args="$ac_configure_args $WITH_INTL"
9217 if test "$BUILD_CTYPES"; then
9218     # Build js-ctypes on the platforms we can.
9219     ac_configure_args="$ac_configure_args --enable-ctypes"
9221 if test -z "$JS_SHARED_LIBRARY" ; then
9222     ac_configure_args="$ac_configure_args --disable-shared-js"
9224 if test -z "$MOZ_NATIVE_NSPR"; then
9225     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9226     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9228 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9229 ac_configure_args="$ac_configure_args --prefix=$dist"
9230 if test "$MOZ_MEMORY"; then
9231    ac_configure_args="$ac_configure_args --enable-jemalloc"
9233 if test -n "$MOZ_GLUE_LDFLAGS"; then
9234    export MOZ_GLUE_LDFLAGS
9236 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9237    export MOZ_GLUE_PROGRAM_LDFLAGS
9239 if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
9240    MOZ_ZLIB_LIBS=
9242 export MOZ_NATIVE_ZLIB
9243 export MOZ_ZLIB_CFLAGS
9244 export MOZ_ZLIB_LIBS
9245 export MOZ_APP_NAME
9246 export DONT_POPULATE_VIRTUALENV=1
9247 export PYTHON
9248 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9249 export STLPORT_CPPFLAGS
9250 export STLPORT_LDFLAGS
9251 export STLPORT_LIBS
9252 export JS_STANDALONE=no
9253 export MOZ_LINKER
9255 if ! test -e js; then
9256     mkdir js
9259 AC_OUTPUT_SUBDIRS(js/src)
9260 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9262 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR