Backout a74bd5095902, Bug 959405 - Please update the Buri Moz-central, 1.3, 1.2 with...
[gecko.git] / configure.in
blob0cd45d5c36230b6f5aba5a25e51a418117a2a704
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=10607
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.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 objdir == srcdir builds.
90 dnl ==============================================================
91 _topsrcdir=`cd \`dirname $0\`; pwd`
92 _objdir=`pwd`
96 dnl TODO Don't exempt L10N builds once bug 842760 is resolved.
97 if test "$_topsrcdir" = "$_objdir" -a "${with_l10n_base+set}" != set; then
98   echo "  ***"
99   echo "  * Building directly in the main source directory is not allowed."
100   echo "  *"
101   echo "  * To build, you must run configure from a separate directory"
102   echo "  * (referred to as an object directory)."
103   echo "  *"
104   echo "  * If you are building with a mozconfig, you will need to change your"
105   echo "  * mozconfig to point to a different object directory."
106   echo "  ***"
107   exit 1
110 # Check for a couple representative files in the source tree
111 _conflict_files=
112 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
113   if test -f $file; then
114     _conflict_files="$_conflict_files $file"
115   fi
116 done
117 if test "$_conflict_files"; then
118   echo "***"
119   echo "*   Your source tree contains these files:"
120   for file in $_conflict_files; do
121     echo "*         $file"
122   done
123   cat 1>&2 <<-EOF
124         *   This indicates that you previously built in the source tree.
125         *   A source tree build can confuse the separate objdir build.
126         *
127         *   To clean up the source tree:
128         *     1. cd $_topsrcdir
129         *     2. gmake distclean
130         ***
131         EOF
132   exit 1
133   break
135 MOZ_BUILD_ROOT=`pwd`
137 MOZ_PYTHON
139 MOZ_DEFAULT_COMPILER
141 COMPILE_ENVIRONMENT=1
142 MOZ_ARG_DISABLE_BOOL(compile-environment,
143 [  --disable-compile-environment
144                           Disable compiler/library checks.],
145     COMPILE_ENVIRONMENT= )
146 AC_SUBST(COMPILE_ENVIRONMENT)
148 MOZ_ARG_WITH_STRING(l10n-base,
149 [  --with-l10n-base=DIR    path to l10n repositories],
150     L10NBASEDIR=$withval)
151 if test -n "$L10NBASEDIR"; then
152     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
153         AC_MSG_ERROR([--with-l10n-base must specify a path])
154     elif test -d "$L10NBASEDIR"; then
155         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
156     else
157         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
158     fi
160 AC_SUBST(L10NBASEDIR)
162 dnl Check for Perl first -- needed for win32 SDK checks
163 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
164 if test -z "$PERL" -o "$PERL" = ":"; then
165     AC_MSG_ERROR([perl not found in \$PATH])
168 AC_SUBST(GAIADIR)
169 if test -n "$GAIADIR" ; then
170     AC_DEFINE(PACKAGE_GAIA)
173 MOZ_ARG_WITH_STRING(gonk,
174 [  --with-gonk=DIR
175                location of gonk dir],
176     gonkdir=$withval)
178 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
179 [  --with-gonk-toolchain-prefix=DIR
180                           prefix to gonk toolchain commands],
181     gonk_toolchain_prefix=$withval)
183 if test -n "$gonkdir" ; then
184     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
185     android_source="$gonkdir"
186     ANDROID_SOURCE="$android_source"
187     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
188     dnl Default to ICS
189     ANDROID_VERSION=15
190     if test -n "${PLATFORM_SDK_VERSION}"; then
191         ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
192     fi
194     dnl set up compilers
195     TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
196     AS="$gonk_toolchain_prefix"as
197     CC="$gonk_toolchain_prefix"gcc
198     CXX="$gonk_toolchain_prefix"g++
199     CPP="$gonk_toolchain_prefix"cpp
200     LD="$gonk_toolchain_prefix"ld
201     AR="$gonk_toolchain_prefix"ar
202     RANLIB="$gonk_toolchain_prefix"ranlib
203     STRIP="$gonk_toolchain_prefix"strip
204     OBJCOPY="$gonk_toolchain_prefix"objcopy
206     if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
207         AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
208     fi
209     STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
210     STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a"
212     case "$target_cpu" in
213     arm)
214         ARCH_DIR=arch-arm
215         ;;
216     i?86)
217         ARCH_DIR=arch-x86
218         ;;
219     esac
221     case "$ANDROID_VERSION" in
222     15)
223         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"
224         MOZ_B2G_BT=1
225         MOZ_B2G_BT_BLUEZ=1
226         MOZ_NFC=1
227         MOZ_B2G_CAMERA=1
228         MOZ_OMX_DECODER=1
229         AC_SUBST(MOZ_OMX_DECODER)
230         MOZ_RTSP=1
231         ;;
232     17|18)
233         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"
234         if test -d "$gonkdir/external/bluetooth/bluez"; then
235           GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
236             MOZ_B2G_BT=1
237             MOZ_B2G_BT_BLUEZ=1
238         elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
239             MOZ_B2G_BT=1
240             MOZ_B2G_BT_BLUEDROID=1
241         fi
243         MOZ_RTSP=1
244         MOZ_NFC=1
245         MOZ_B2G_CAMERA=1
246         MOZ_OMX_DECODER=1
247         AC_SUBST(MOZ_OMX_DECODER)
248         ;;
249     19)
250         GONK_INCLUDES="-I$gonkdir/frameworks/native/include"
251         MOZ_NFC=1
253         ;;
254     *)
255         AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
256         ;;
257     esac
258     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"
259     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
260     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
261     dnl Add -llog by default, since we use it all over the place.
262     LIBS="$LIBS -llog"
264     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"
266     dnl prevent cross compile section from using these flags as host flags
267     if test -z "$HOST_CPPFLAGS" ; then
268         HOST_CPPFLAGS=" "
269     fi
270     if test -z "$HOST_CFLAGS" ; then
271         HOST_CFLAGS=" "
272     fi
273     if test -z "$HOST_CXXFLAGS" ; then
274         HOST_CXXFLAGS=" "
275     fi
276     if test -z "$HOST_LDFLAGS" ; then
277         HOST_LDFLAGS=" "
278     fi
280     AC_DEFINE(ANDROID)
281     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
282     AC_SUBST(ANDROID_VERSION)
283     AC_DEFINE(HAVE_SYS_UIO_H)
284     AC_DEFINE(HAVE_PTHREADS)
285     CROSS_COMPILE=1
286     MOZ_CHROME_FILE_FORMAT=omni
287     direct_nspr_config=1
288 else
289     MOZ_ANDROID_NDK
291     case "$target" in
292     *-android*|*-linuxandroid*)
293         if test -z "$ANDROID_PACKAGE_NAME" ; then
294             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
295         fi
296         MOZ_CHROME_FILE_FORMAT=omni
297         ZLIB_DIR=yes
298         ;;
299     *-linux*)
300         AC_PATH_PROG(OBJCOPY,objcopy)
301         ;;
302     esac
305 AC_SUBST(ANDROID_SOURCE)
306 AC_SUBST(ANDROID_PACKAGE_NAME)
307 AC_SUBST(OBJCOPY)
309 dnl ========================================================
310 dnl Checks for compilers.
311 dnl ========================================================
312 dnl Set CROSS_COMPILE in the environment when running configure
313 dnl to use the cross-compile setup for now
314 dnl ========================================================
316 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
317 AR_FLAGS='crs $@'
319 if test "$COMPILE_ENVIRONMENT"; then
321 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
322     MOZ_CROSS_COMPILER
323 else
324     AC_PROG_CC
325     case "$target" in
326     *-mingw*)
327       # Work around the conftest.exe access problem on Windows
328       sleep 2
329     esac
330     AC_PROG_CXX
331     AC_PROG_RANLIB
332     MOZ_PATH_PROGS(AS, $AS as, $CC)
333     AC_CHECK_PROGS(AR, ar, :)
334     AC_CHECK_PROGS(LD, ld, :)
335     AC_CHECK_PROGS(STRIP, strip, :)
336     AC_CHECK_PROGS(WINDRES, windres, :)
337     if test -z "$HOST_CC"; then
338         HOST_CC="$CC"
339     fi
340     if test -z "$HOST_CFLAGS"; then
341         HOST_CFLAGS="$CFLAGS"
342     fi
343     if test -z "$HOST_CXX"; then
344         HOST_CXX="$CXX"
345     fi
346     if test -z "$HOST_CXXFLAGS"; then
347         HOST_CXXFLAGS="$CXXFLAGS"
348     fi
349     if test -z "$HOST_LDFLAGS"; then
350         HOST_LDFLAGS="$LDFLAGS"
351     fi
352     if test -z "$HOST_RANLIB"; then
353         HOST_RANLIB="$RANLIB"
354     fi
355     if test -z "$HOST_AR"; then
356         HOST_AR="$AR"
357     fi
358     if test -z "$HOST_AR_FLAGS"; then
359         HOST_AR_FLAGS="$AR_FLAGS"
360     fi
363 if test -n "$MOZ_WINCONSOLE"; then
364     AC_DEFINE(MOZ_WINCONSOLE)
367 MOZ_TOOL_VARIABLES
369 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
370     if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
371        test "$GCC_MAJOR_VERSION" -lt 4; then
372         AC_MSG_ERROR([Only GCC 4.4 or newer supported])
373     fi
376 dnl ========================================================
377 dnl Special win32 checks
378 dnl ========================================================
380 MOZ_ARG_ENABLE_BOOL(metro,
381 [  --enable-metro           Enable Windows Metro build targets],
382     MOZ_METRO=1,
383     MOZ_METRO=)
384 if test -n "$MOZ_METRO"; then
385     AC_DEFINE(MOZ_METRO)
386     # Target the Windows 8 Kit
387     WINSDK_TARGETVER=602
388     WINVER=502
389     # toolkit/library/makefile.in needs these, see nsDllMain.
390     CRTDLLVERSION=110
391     CRTEXPDLLVERSION=1-1-0
392 else
393     # Target the Windows 7 SDK by default
394     WINSDK_TARGETVER=601
395     WINVER=502
398 AC_SUBST(CRTDLLVERSION)
399 AC_SUBST(CRTEXPDLLVERSION)
401 MOZ_ARG_WITH_STRING(windows-version,
402 [  --with-windows-version=WINSDK_TARGETVER
403                           Windows SDK version to target. Lowest version
404                           currently allowed is 601 (Win7), highest is 602 (Win8)],
405   WINSDK_TARGETVER=$withval)
407 # Currently only two sdk versions allowed, 601 and 602
408 case "$WINSDK_TARGETVER" in
409 601|602)
410     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
411     ;;
414     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
415     ;;
416 esac
418 case "$target" in
419 *-mingw*)
420     if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
421         # Check to see if we are really running in a msvc environemnt
422         _WIN32_MSVC=1
423         AC_CHECK_PROGS(MIDL, midl)
425         # Make sure compilers are valid
426         CFLAGS="$CFLAGS -TC -nologo"
427         CXXFLAGS="$CXXFLAGS -TP -nologo"
428         AC_LANG_SAVE
429         AC_LANG_C
430         AC_TRY_COMPILE([#include <stdio.h>],
431             [ printf("Hello World\n"); ],,
432             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
434         AC_LANG_CPLUSPLUS
435         AC_TRY_COMPILE([#include <new.h>],
436             [ unsigned *test = new unsigned(42); ],,
437             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
438         AC_LANG_RESTORE
440         changequote(,)
441         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
442         changequote([,])
444         # Determine compiler version
445         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
446         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
447         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
448         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
449         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
450         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
452         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
453         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
455         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
456             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
457         fi
459         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
460         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
462         if test "$_CC_MAJOR_VERSION" = "16"; then
463             _CC_SUITE=10
464             MSVS_VERSION=2010
465         elif test "$_CC_MAJOR_VERSION" = "17"; then
466             _CC_SUITE=11
467             MSVS_VERSION=2012
468         elif test "$_CC_MAJOR_VERSION" = "18"; then
469             _CC_SUITE=12
470             MSVS_VERSION=2013
471         else
472             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
473         fi
474         AC_SUBST(MSVS_VERSION)
476         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
478         if test -n "$WIN32_REDIST_DIR"; then
479           if test ! -d "$WIN32_REDIST_DIR"; then
480             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
481           fi
482           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
483         fi
485         dnl Confirm we have the pri tools on win8 builds
486         if test -n "$MOZ_METRO"; then
487           AC_MSG_CHECKING([for makepri])
488           AC_CHECK_PROGS(MAKEPRI, makepri, "")
489           if test -z "MAKEPRI" ; then
490               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
491           fi
492           AC_SUBST(MAKEPRI)
493         fi
495         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
496         dnl not something else like "magnetic tape manipulation utility".
497         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
498         if test -z "$MSMT_TOOL"; then
499           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
500         fi
502         changequote(,)
503         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
504         changequote([,])
505         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
506         if test -z "$MSMANIFEST_TOOL_VERSION"; then
507           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
508         fi
510         MSMANIFEST_TOOL=1
511         unset MSMT_TOOL
513         # Check linker version
514         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
515         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
516         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
517             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
518         fi
520         INCREMENTAL_LINKER=1
522         # Set midl environment
523         case "$target" in
524         i*86-*)
525             MIDL_FLAGS="${MIDL_FLAGS} -env win32"
526             ;;
527         x86_64-*)
528             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
529             ;;
530         esac
532         unset _MSVC_VER_FILTER
534         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
535             [
536                 AC_LANG_SAVE
537                 AC_LANG_CPLUSPLUS
538                 _SAVE_CXXFLAGS="$CXXFLAGS"
539                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
540                 AC_TRY_COMPILE([#include <exception>],
541                             [std::_Throw(std::exception()); return 0;],
542                             ac_cv_have_std__Throw="yes",
543                             ac_cv_have_std__Throw="no")
544                 CXXFLAGS="$_SAVE_CXXFLAGS"
545                 AC_LANG_RESTORE
546             ])
548         if test "$ac_cv_have_std__Throw" = "yes"; then
549             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
550                            ac_cv_have_dllimport_exception_bug,
551                 [
552                     AC_LANG_SAVE
553                     AC_LANG_CPLUSPLUS
554                     _SAVE_CXXFLAGS="$CXXFLAGS"
555                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
556                     AC_TRY_LINK([#include <vector>],
557                                 [std::vector<int> v; return v.at(1);],
558                                 ac_cv_have_dllimport_exception_bug="no",
559                                 ac_cv_have_dllimport_exception_bug="yes")
560                     CXXFLAGS="$_SAVE_CXXFLAGS"
561                     AC_LANG_RESTORE
562                 ])
563             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
564                 WRAP_STL_INCLUDES=1
565                 MOZ_MSVC_STL_WRAP__Throw=1
566                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
567             fi
568         else
569             AC_CACHE_CHECK(for overridable _RAISE,
570                            ac_cv_have__RAISE,
571                 [
572                     AC_LANG_SAVE
573                     AC_LANG_CPLUSPLUS
574                     _SAVE_CXXFLAGS="$CXXFLAGS"
575                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
576                     AC_TRY_COMPILE([#include <xstddef>
577                                     #undef _RAISE
578                                     #define _RAISE(x) externallyDefinedFunction((x).what())
579                                     #include <vector>
580                                    ],
581                                    [std::vector<int> v; return v.at(1);],
582                                    ac_cv_have__RAISE="no",
583                                    ac_cv_have__RAISE="yes")
584                     CXXFLAGS="$_SAVE_CXXFLAGS"
585                     AC_LANG_RESTORE
586                 ])
587             if test "$ac_cv_have__RAISE" = "yes"; then
588                 WRAP_STL_INCLUDES=1
589                 MOZ_MSVC_STL_WRAP__RAISE=1
590                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
591             else
592                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
593             fi
594         fi
596         if test "$WRAP_STL_INCLUDES" = "1"; then
597             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
598         fi
599     elif test -z "$CLANG_CC"; then
600         # Check w32api version
601         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
602         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
603         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
604         AC_TRY_COMPILE([#include <w32api.h>],
605             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
606                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
607                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
608                 #error "test failed."
609             #endif
610             , [ res=yes ], [ res=no ])
611         AC_MSG_RESULT([$res])
612         if test "$res" != "yes"; then
613             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
614         fi
615         # Check windres version
616         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
617         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
618         AC_MSG_RESULT([$_WINDRES_VERSION])
619         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
620         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
621         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
622         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
623         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
624         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
625         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
626                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
627                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
628                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
629                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
630                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
631         then
632             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
633         fi
635         AC_CHECK_PROGS(MIDL, $target-widl widl)
636         if test -n "$MIDL"; then
637             case "$target" in
638             i*86-*)
639                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
640                 ;;
641             x86_64-*)
642                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
643                 ;;
644             esac
645         fi
647         MOZ_WINSDK_MAXVER=0x06020000
648     fi # !GNU_CC
650     # If MSVC or clang
651     if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
652         MOZ_FIND_WINSDK_VERSION
653     fi
655     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
656     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
657     # Require OS features provided by IE 6.0 SP2 (XP SP2)
658     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
660     # If the maximum version supported by this SDK is lower than the target
661     # version, error out
662     AC_MSG_CHECKING([for Windows SDK being recent enough])
663     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
664         AC_MSG_RESULT("yes")
665     else
666         AC_MSG_RESULT("no")
667         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.])
668     fi
669     
670     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
671     # Definitions matching sdkddkver.h
672     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
673     AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
674     AC_SUBST(MOZ_WINSDK_MAXVER)
675     ;;
676 esac
678 AC_PROG_CPP
679 AC_PROG_CXXCPP
681 if test -n "$_WIN32_MSVC"; then
682     SKIP_PATH_CHECKS=1
683     SKIP_COMPILER_CHECKS=1
684     SKIP_LIBRARY_CHECKS=1
686     # Since we're skipping compiler and library checks, hard-code
687     # some facts here.
688     AC_DEFINE(HAVE_IO_H)
689     AC_DEFINE(HAVE_SETBUF)
690     AC_DEFINE(HAVE_ISATTY)
693 fi # COMPILE_ENVIRONMENT
695 AC_SUBST(MIDL_FLAGS)
696 AC_SUBST(_MSC_VER)
698 AC_SUBST(GNU_AS)
699 AC_SUBST(GNU_LD)
700 AC_SUBST(GNU_CC)
701 AC_SUBST(GNU_CXX)
702 AC_SUBST(INTEL_CC)
703 AC_SUBST(INTEL_CXX)
705 AC_SUBST(STL_FLAGS)
706 AC_SUBST(WRAP_STL_INCLUDES)
707 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
708 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
710 dnl ========================================================
711 dnl Checks for programs.
712 dnl ========================================================
713 AC_PROG_INSTALL
714 AC_PROG_LN_S
716 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
717 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
718 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
719 _perl_res=$?
720 AC_MSG_RESULT([$_perl_version])
722 if test "$_perl_res" != 0; then
723     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
727 AC_MSG_CHECKING([for full perl installation])
728 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
729 _perl_res=$?
730 if test "$_perl_res" != 0; then
731     AC_MSG_RESULT([no])
732     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
733 else
734     AC_MSG_RESULT([yes])
737 if test -z "$COMPILE_ENVIRONMENT"; then
738     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
740 AC_SUBST(NSINSTALL_BIN)
742 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
743 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
744 MOZ_PATH_PROGS(UNZIP, unzip)
745 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
746     AC_MSG_ERROR([unzip not found in \$PATH])
748 MOZ_PATH_PROGS(ZIP, zip)
749 if test -z "$ZIP" -o "$ZIP" = ":"; then
750     AC_MSG_ERROR([zip not found in \$PATH])
752 MOZ_PATH_PROG(XARGS, xargs)
753 if test -z "$XARGS" -o "$XARGS" = ":"; then
754     AC_MSG_ERROR([xargs not found in \$PATH .])
757 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
758 AC_SUBST(RPMBUILD)
760 if test "$COMPILE_ENVIRONMENT"; then
762 dnl ========================================================
763 dnl = Mac OS X toolchain support
764 dnl ========================================================
766 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
767 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
768 dnl when we can run target binaries.
769 AC_SUBST(UNIVERSAL_BINARY)
770 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
772 MOZ_ARG_WITH_STRING(unify-dist,
773 [  --with-unify-dist=dir   Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
774     UNIFY_DIST=$withval)
775 if test -n "$UNIVERSAL_BINARY"; then
776     if test -z "$UNIFY_DIST"; then
777         AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
778     fi
779     case "$UNIFY_DIST" in
780     /*)
781         ;;
782     *)
783         UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
784         ;;
785     esac
787 AC_SUBST(UNIFY_DIST)
789 dnl ========================================================
790 dnl Check for MacOS deployment target version
791 dnl ========================================================
793 MOZ_ARG_ENABLE_STRING(macos-target,
794                       [  --enable-macos-target=VER (default=10.6)
795                           Set the minimum MacOS version needed at runtime],
796                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
798 case "$target" in
799 *-darwin*)
800     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
801         dnl Use the specified value
802         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
803     else
804         dnl No value specified on the command line or in the environment,
805         dnl use architecture minimum.
806         export MACOSX_DEPLOYMENT_TARGET=10.6
807     fi
808     ;;
809 esac
811 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
813 dnl ========================================================
814 dnl = Mac OS X SDK support
815 dnl ========================================================
816 MACOS_SDK_DIR=
817 MOZ_ARG_WITH_STRING(macos-sdk,
818 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
819     MACOS_SDK_DIR=$withval)
821 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
822 MOZ_ARG_WITH_STRING(macos-private-frameworks,
823 [  --with-macos-private-frameworks=dir    Location of private frameworks to use (Mac OS X only)],
824     MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
825     MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
826     MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
828 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
829   if test -z "$CROSS_COMPILE"; then
830     AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
831   fi
832   if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
833     AC_MSG_ERROR([PrivateFrameworks directory not found.])
834   fi
837 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
838 AC_SUBST(MACOS_SDK_DIR)
839 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
841 if test "$MACOS_SDK_DIR"; then
842   dnl Sync this section with the ones in NSPR and NSS.
843   dnl Changes to the cross environment here need to be accounted for in
844   dnl the libIDL checks (below) and xpidl build.
846   if test ! -d "$MACOS_SDK_DIR"; then
847     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
848 specify a valid SDK.  SDKs are installed when the optional cross-development
849 tools are selected during the Xcode/Developer Tools installation.])
850   fi
852   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
853   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
855   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
856   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
857   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
859   AC_LANG_SAVE
860   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
861   AC_LANG_CPLUSPLUS
862   AC_TRY_COMPILE([#include <new>],[],
863    result=yes,
864    result=no)
865   AC_LANG_RESTORE
866   AC_MSG_RESULT($result)
868   if test "$result" = "no" ; then
869     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
870   fi
873 fi # COMPILE_ENVIRONMENT
875 AC_MSG_CHECKING([compiler version])
876 # Just print it so it shows up in the logs.
877 cc_version=$($CC --version)
878 AC_MSG_RESULT([$cc_version])
880 if test -n "$MAKE"; then
881   if test `echo $MAKE | grep -c make.py` != 1; then
882      NOT_PYMAKE=$MAKE
883   fi
886 case "$host_os" in
887 mingw*)
888     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
889     ;;
891     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
892     ;;
893 esac
894 if test "$GMAKE" = ":"; then
895    AC_MSG_ERROR([GNU make not found])
897 AC_SUBST(GMAKE)
899 if test -z "$MAKE"; then
900   MAKE=$GMAKE
903 if test "$COMPILE_ENVIRONMENT"; then
905 AC_PATH_XTRA
907 XCFLAGS="$X_CFLAGS"
909 fi # COMPILE_ENVIRONMENT
911 dnl ========================================================
912 dnl set the defaults first
913 dnl ========================================================
914 AS_BIN=$AS
915 AR_LIST='$(AR) t'
916 AR_EXTRACT='$(AR) x'
917 AR_DELETE='$(AR) d'
918 AS='$(CC)'
919 AS_DASH_C_FLAG='-c'
920 DLL_PREFIX=lib
921 LIB_PREFIX=lib
922 DLL_SUFFIX=.so
923 OBJ_SUFFIX=o
924 LIB_SUFFIX=a
925 ASM_SUFFIX=s
926 IMPORT_LIB_SUFFIX=
927 TARGET_MD_ARCH=unix
928 DIRENT_INO=d_ino
929 MOZ_USER_DIR=".mozilla"
931 MOZ_JPEG_CFLAGS=
932 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
933 MOZ_BZ2_CFLAGS=
934 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
935 MOZ_PNG_CFLAGS=
936 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
938 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
939 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
940 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
941 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)'
942 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
943 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
944 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
946 # These are specially defined on Windows only
947 case "$target" in
948 *-mingw*)
949   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
950   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
951   ;;
953   XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
954   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
955   ;;
956 esac
958 MOZ_FS_LAYOUT=unix
960 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
962 USE_DEPENDENT_LIBS=1
964 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
966 if test -n "$CROSS_COMPILE"; then
967     OS_TARGET="${target_os}"
968     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
969     OS_RELEASE=
970     case "${target_os}" in
971         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
972         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
973         gnu*)         OS_ARCH=GNU ;;
974         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
975         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
976         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
977     esac
978     case "${target}" in
979         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
980     esac
981 else
982     OS_TARGET=`uname -s`
983     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
984     OS_RELEASE=`uname -r`
987 # Before this used `uname -m` when not cross compiling
988 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
989 OS_TEST="${target_cpu}"
991 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
993 #######################################################################
994 # Master "Core Components" macros for getting the OS target           #
995 #######################################################################
998 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
999 # cross-compilation.
1003 # Define and override various archtecture-specific variables, including
1004 # HOST_OS_ARCH
1005 # OS_ARCH
1006 # OS_TEST
1007 # OS_TARGET
1008 # OS_RELEASE
1009 # OS_MINOR_RELEASE
1012 case "$HOST_OS_ARCH" in
1013 mingw*)
1014     HOST_OS_ARCH=WINNT
1015     ;;
1016 darwin*)
1017     HOST_OS_ARCH=Darwin
1018     ;;
1019 linux*)
1020     HOST_OS_ARCH=Linux
1021     ;;
1022 solaris*)
1023     HOST_OS_ARCH=SunOS
1024     SOLARIS_SUNPRO_CC=
1025     SOLARIS_SUNPRO_CXX=
1026     if test -z "$GNU_CC"; then
1027         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1028             SOLARIS_SUNPRO_CC=1
1029        fi
1030     fi
1032     if test -z "$GNU_CXX"; then
1033        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1034            SOLARIS_SUNPRO_CXX=1
1035        fi
1036     fi
1037     AC_SUBST(SOLARIS_SUNPRO_CC)
1038     AC_SUBST(SOLARIS_SUNPRO_CXX)
1039     ;;
1040 OS_2)
1041     HOST_OS_ARCH=OS2
1042     ;;
1043 esac
1045 case "$OS_ARCH" in
1046 WINNT)
1047     if test -z "$CROSS_COMPILE" ; then
1048         OS_TEST=`uname -p`
1049     fi
1050     ;;
1051 Windows_NT)
1053 # If uname -s returns "Windows_NT", we assume that we are using
1054 # the uname.exe in MKS toolkit.
1056 # The -r option of MKS uname only returns the major version number.
1057 # So we need to use its -v option to get the minor version number.
1058 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1060     OS_ARCH=WINNT
1061     OS_TARGET=WINNT
1062     OS_MINOR_RELEASE=`uname -v`
1063     if test "$OS_MINOR_RELEASE" = "00"; then
1064         OS_MINOR_RELEASE=0
1065     fi
1066     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1067     ;;
1068 MINGW*_NT*)
1070 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1071 # the uname.exe in the MSYS tools.
1073     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1074     OS_ARCH=WINNT
1075     OS_TARGET=WINNT
1076     ;;
1077 AIX)
1078     OS_RELEASE=`uname -v`.`uname -r`
1079     OS_TEST=${target_cpu}
1080     ;;
1081 OS_2)
1082     OS_ARCH=OS2
1083     OS_TARGET=OS2
1084     OS_RELEASE=`uname -v`
1085     ;;
1086 Darwin)
1087     case "${target_cpu}" in
1088     powerpc*)
1089         OS_TEST=ppc
1090         ;;
1091     i*86*)
1092         OS_TEST=i386
1093         ;;
1094     x86_64)
1095         OS_TEST=x86_64
1096         ;;
1097     *)
1098         if test -z "$CROSS_COMPILE" ; then
1099             OS_TEST=`uname -p`
1100         fi
1101         ;;
1102     esac
1103     ;;
1104 esac
1106 # Only set CPU_ARCH if we recognize the value of OS_TEST
1108 case "$OS_TEST" in
1109 *86 | i86pc)
1110     CPU_ARCH=x86
1111     ;;
1113 powerpc64 | ppc64)
1114     CPU_ARCH=ppc64
1115     ;;
1117 powerpc | ppc | rs6000)
1118     CPU_ARCH=ppc
1119     ;;
1121 Alpha | alpha | ALPHA)
1122     CPU_ARCH=Alpha
1123     ;;
1125 s390)
1126     CPU_ARCH=s390
1127     ;;
1129 s390x)
1130     CPU_ARCH=s390x
1131     ;;
1133 hppa* | parisc)
1134     CPU_ARCH=hppa
1135     ;;
1137 sun4u | sparc*)
1138     CPU_ARCH=sparc
1139     ;;
1141 x86_64 | ia64)
1142     CPU_ARCH="$OS_TEST"
1143     ;;
1145 arm*)
1146     CPU_ARCH=arm
1147     ;;
1149 mips|mipsel)
1150     CPU_ARCH="mips"
1151     ;;
1152 esac
1154 if test -z "$OS_TARGET"; then
1155     OS_TARGET=$OS_ARCH
1157 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1159 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1160 dnl ===============================================================
1161 INTEL_ARCHITECTURE=
1162 case "$OS_TEST" in
1163     x86_64|i?86)
1164       INTEL_ARCHITECTURE=1
1165 esac
1167 dnl Configure platform-specific CPU architecture compiler options.
1168 dnl ==============================================================
1169 MOZ_ARCH_OPTS
1171 dnl =================================================================
1172 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1173 dnl which is bad when cross compiling.
1174 dnl =================================================================
1175 if test "$COMPILE_ENVIRONMENT"; then
1176 configure_static_assert_macros='
1177 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1178 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1179 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1182 dnl test that the macros actually work:
1183 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1184 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1185  [AC_LANG_SAVE
1186   AC_LANG_C
1187   ac_cv_static_assertion_macros_work="yes"
1188   AC_TRY_COMPILE([$configure_static_assert_macros],
1189                  [CONFIGURE_STATIC_ASSERT(1)],
1190                  ,
1191                  ac_cv_static_assertion_macros_work="no")
1192   AC_TRY_COMPILE([$configure_static_assert_macros],
1193                  [CONFIGURE_STATIC_ASSERT(0)],
1194                  ac_cv_static_assertion_macros_work="no",
1195                  )
1196   AC_LANG_CPLUSPLUS
1197   AC_TRY_COMPILE([$configure_static_assert_macros],
1198                  [CONFIGURE_STATIC_ASSERT(1)],
1199                  ,
1200                  ac_cv_static_assertion_macros_work="no")
1201   AC_TRY_COMPILE([$configure_static_assert_macros],
1202                  [CONFIGURE_STATIC_ASSERT(0)],
1203                  ac_cv_static_assertion_macros_work="no",
1204                  )
1205   AC_LANG_RESTORE
1206  ])
1207 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1208 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1209     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1211 fi # COMPILE_ENVIRONMENT
1213 dnl ========================================================
1214 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1215 dnl computed above.
1216 dnl ========================================================
1218 MOZ_ANDROID_STLPORT
1220 dnl ========================================================
1221 dnl Suppress Clang Argument Warnings
1222 dnl ========================================================
1223 if test -n "$CLANG_CC"; then
1224     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1225     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1227 if test -n "$CLANG_CXX"; then
1228     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1231 dnl ========================================================
1232 dnl = Use Address Sanitizer
1233 dnl ========================================================
1234 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1235 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1236     MOZ_ASAN=1,
1237     MOZ_ASAN= )
1238 if test -n "$MOZ_ASAN"; then
1239     MOZ_LLVM_HACKS=1
1240     AC_DEFINE(MOZ_ASAN)
1241     MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1243 AC_SUBST(MOZ_ASAN)
1244 AC_SUBST(LLVM_SYMBOLIZER)
1246 dnl ========================================================
1247 dnl = Enable hacks required for LLVM instrumentations
1248 dnl ========================================================
1249 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1250 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1251     MOZ_LLVM_HACKS=1,
1252     MOZ_LLVM_HACKS= )
1253 if test -n "$MOZ_LLVM_HACKS"; then
1254     MOZ_NO_WLZDEFS=1
1255     MOZ_CFLAGS_NSS=1
1257 AC_SUBST(MOZ_NO_WLZDEFS)
1258 AC_SUBST(MOZ_CFLAGS_NSS)
1260 dnl ========================================================
1261 dnl GNU specific defaults
1262 dnl ========================================================
1263 if test "$GNU_CC"; then
1264     # Per bug 719659 comment 2, some of the headers on ancient build machines
1265     # may require gnu89 inline semantics.  But otherwise, we use C99.
1266     # But on OS X we just use C99 plus GNU extensions, in order to fix
1267     # bug 917526.
1268     CFLAGS="$CFLAGS -std=gnu99"
1269     if test "${OS_ARCH}" != Darwin; then
1270         CFLAGS="$CFLAGS -fgnu89-inline"
1271     fi
1272     # FIXME: Let us build with strict aliasing. bug 414641.
1273     CFLAGS="$CFLAGS -fno-strict-aliasing"
1274     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1275     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1276     DSO_LDOPTS='-shared'
1277     if test "$GCC_USE_GNU_LD"; then
1278         # Some tools like ASan use a runtime library that is only
1279         # linked against executables, so we must allow undefined
1280         # symbols for shared objects in some cases.
1281         if test -z "$MOZ_NO_WLZDEFS"; then
1282             # Don't allow undefined symbols in libraries
1283             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1284         fi
1285     fi
1286     WARNINGS_AS_ERRORS='-Werror'
1287     DSO_CFLAGS=''
1288     DSO_PIC_CFLAGS='-fPIC'
1289     ASFLAGS="$ASFLAGS -fPIC"
1290     AC_MSG_CHECKING([for --noexecstack option to as])
1291     _SAVE_CFLAGS=$CFLAGS
1292     CFLAGS="$CFLAGS -Wa,--noexecstack"
1293     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1294                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1295                      AC_MSG_RESULT([no]))
1296     CFLAGS=$_SAVE_CFLAGS
1297     AC_MSG_CHECKING([for -z noexecstack option to ld])
1298     _SAVE_LDFLAGS=$LDFLAGS
1299     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1300     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1301                   AC_MSG_RESULT([no])
1302                   LDFLAGS=$_SAVE_LDFLAGS)
1304     AC_MSG_CHECKING([for -z text option to ld])
1305     _SAVE_LDFLAGS=$LDFLAGS
1306     LDFLAGS="$LDFLAGS -Wl,-z,text"
1307     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1308                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1309                   AC_MSG_RESULT([no])
1310                   LDFLAGS=$_SAVE_LDFLAGS)
1312     AC_MSG_CHECKING([for --build-id option to ld])
1313     _SAVE_LDFLAGS=$LDFLAGS
1314     LDFLAGS="$LDFLAGS -Wl,--build-id"
1315     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1316                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1317                   AC_MSG_RESULT([no])
1318                   LDFLAGS=$_SAVE_LDFLAGS)
1321     # Check for -mssse3 on $CC
1322     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1323     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1324     _SAVE_CFLAGS=$CFLAGS
1325     CFLAGS="$CFLAGS -mssse3"
1326     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1327                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1328                      AC_MSG_RESULT([no]))
1329     CFLAGS=$_SAVE_CFLAGS
1331     # Check for -msse4.1 on $CC
1332     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1333     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1334     _SAVE_CFLAGS=$CFLAGS
1335     CFLAGS="$CFLAGS -msse4.1"
1336     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1337                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1338                      AC_MSG_RESULT([no]))
1339     CFLAGS=$_SAVE_CFLAGS
1341     # Turn on GNU-specific warnings:
1342     # -Wall - turn on a lot of warnings
1343     # -Wpointer-arith - good to have
1344     # -Wdeclaration-after-statement - MSVC doesn't like these
1345     # -Werror=return-type - catches missing returns, zero false positives
1346     # -Wtype-limits - catches overflow bugs, few false positives
1347     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1348     # -Wsign-compare - catches comparison of signed and unsigned types
1349     #
1350     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1351     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1352     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1353     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1354     MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1356     # Turn off the following warnings that -Wall turns on:
1357     # -Wno-unused - lots of violations in third-party code
1358     #
1359     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1361     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1362        # Don't use -Wcast-align with ICC or clang
1363        case "$CPU_ARCH" in
1364            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1365            hppa | ia64 | sparc | arm)
1366            ;;
1367            *)
1368         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1369            ;;
1370        esac
1371     fi
1373     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1374     _USE_CPP_INCLUDE_FLAG=1
1375     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1377 elif test "$SOLARIS_SUNPRO_CC"; then
1378     DSO_CFLAGS=''
1379     if test "$CPU_ARCH" = "sparc"; then
1380         # for Sun Studio on Solaris/SPARC
1381         DSO_PIC_CFLAGS='-xcode=pic32'
1382     else
1383         DSO_PIC_CFLAGS='-KPIC'
1384     fi
1385     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1386 else
1387     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1388     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1390     DSO_LDOPTS='-shared'
1391     if test "$GNU_LD"; then
1392         # Don't allow undefined symbols in libraries
1393         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1394     fi
1396     DSO_CFLAGS=''
1397     DSO_PIC_CFLAGS='-KPIC'
1398     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1401 if test "$GNU_CXX"; then
1402     # FIXME: Let us build with strict aliasing. bug 414641.
1403     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1405     # Turn on GNU-specific warnings:
1406     # -Wall - turn on a lot of warnings
1407     # -Wpointer-arith - good to have
1408     # -Woverloaded-virtual - ???
1409     # -Werror=return-type - catches missing returns, zero false positives
1410     # -Wtype-limits - catches overflow bugs, few false positives
1411     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1412     # -Wsign-compare - catches comparison of signed and unsigned types
1413     #
1414     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1415     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1416     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1417     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1418     MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1420     # Turn off the following warnings that -Wall turns on:
1421     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1422     #
1423     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1425     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1426        # Don't use -Wcast-align with ICC or clang
1427        case "$CPU_ARCH" in
1428            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1429            hppa | ia64 | sparc | arm)
1430            ;;
1431            *)
1432         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1433            ;;
1434        esac
1435     fi
1437     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1438     _USE_CPP_INCLUDE_FLAG=1
1440     # Recent clang and gcc support C++11 deleted functions without warnings if
1441     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1442     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1443     # unused.  But clang's warning can be disabled, so when compiling with clang
1444     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1445     # deleted function syntax.
1446     if test "$CLANG_CXX"; then
1447         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1448         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1449     fi
1451 else
1452     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1455 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1456 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1457 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1458 dnl normal behavior.
1459 dnl ========================================================
1460 MKSHLIB_FORCE_ALL=
1461 MKSHLIB_UNFORCE_ALL=
1463 if test "$COMPILE_ENVIRONMENT"; then
1464 if test "$GNU_CC"; then
1465   AC_MSG_CHECKING(whether ld has archive extraction flags)
1466   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1467    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1468     ac_cv_mkshlib_force_and_unforce="no"
1469     exec 3<&0 <<LOOP_INPUT
1470         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1471         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1472         force="-Wl,-all";              unforce="-Wl,-none"
1473 LOOP_INPUT
1474     while read line
1475     do
1476       eval $line
1477       LDFLAGS=$force
1478       LIBS=$unforce
1479       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1480     done
1481     exec 0<&3 3<&-
1482     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1483    ])
1484   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1485     AC_MSG_RESULT(no)
1486   else
1487     AC_MSG_RESULT(yes)
1488     eval $ac_cv_mkshlib_force_and_unforce
1489     MKSHLIB_FORCE_ALL=$force
1490     MKSHLIB_UNFORCE_ALL=$unforce
1491   fi
1492 fi # GNU_CC
1493 fi # COMPILE_ENVIRONMENT
1495 dnl ========================================================
1496 dnl Checking for 64-bit OS
1497 dnl ========================================================
1498 if test "$COMPILE_ENVIRONMENT"; then
1499 AC_LANG_SAVE
1500 AC_LANG_C
1501 AC_MSG_CHECKING(for 64-bit OS)
1502 AC_TRY_COMPILE([$configure_static_assert_macros],
1503                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1504                result="yes", result="no")
1505 AC_MSG_RESULT("$result")
1506 if test "$result" = "yes"; then
1507     AC_DEFINE(HAVE_64BIT_OS)
1508     HAVE_64BIT_OS=1
1510 AC_SUBST(HAVE_64BIT_OS)
1511 AC_LANG_RESTORE
1512 fi # COMPILE_ENVIRONMENT
1514 dnl ========================================================
1515 dnl Enable high-memory support on OS/2 by default.
1516 dnl ========================================================
1517 MOZ_OS2_HIGH_MEMORY=1
1518 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1519 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1520     MOZ_OS2_HIGH_MEMORY=,
1521     MOZ_OS2_HIGH_MEMORY=1 )
1522 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1524 dnl ========================================================
1525 dnl = Use profiling compile flags
1526 dnl ========================================================
1527 MOZ_ARG_ENABLE_BOOL(profiling,
1528 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1529     MOZ_PROFILING=1,
1530     MOZ_PROFILING= )
1532 dnl ========================================================
1533 dnl = Turn on systrace for android/b2g.
1534 dnl ========================================================
1535 MOZ_ARG_ENABLE_BOOL(systrace,
1536 [  --enable-systrace       Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1537     MOZ_USE_SYSTRACE=1,
1538     MOZ_USE_SYSTRACE= )
1539 if test -n "$MOZ_USE_SYSTRACE"; then
1540     AC_DEFINE(MOZ_USE_SYSTRACE)
1543 # For profiling builds keep the symbol information
1544 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1545     case "$OS_TARGET" in
1546     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1547         STRIP_FLAGS="--strip-debug"
1548         ;;
1549     esac
1552 dnl ========================================================
1553 dnl = Use incremental GC
1554 dnl ========================================================
1555 JSGC_INCREMENTAL=1
1556 MOZ_ARG_DISABLE_BOOL(gcincremental,
1557 [  --disable-gcincremental Disable incremental GC],
1558     JSGC_INCREMENTAL= )
1559 if test -n "$JSGC_INCREMENTAL"; then
1560     AC_DEFINE(JSGC_INCREMENTAL)
1563 dnl ========================================================
1564 dnl = Use generational GC
1565 dnl ========================================================
1566 MOZ_ARG_ENABLE_BOOL(gcgenerational,
1567 [  --enable-gcgenerational Enable generational GC],
1568     JSGC_GENERATIONAL=1,
1569     JSGC_GENERATIONAL= )
1570 if test -n "$JSGC_GENERATIONAL"; then
1571     AC_DEFINE(JSGC_GENERATIONAL)
1574 dnl ========================================================
1575 dnl = Perform moving GC stack rooting analysis
1576 dnl ========================================================
1577 MOZ_ARG_ENABLE_BOOL(root-analysis,
1578 [  --enable-root-analysis  Enable moving GC stack root analysis],
1579     JSGC_ROOT_ANALYSIS=1,
1580     JSGC_ROOT_ANALYSIS= )
1581 if test -n "$JSGC_ROOT_ANALYSIS"; then
1582     AC_DEFINE(JSGC_ROOT_ANALYSIS)
1585 dnl ========================================================
1586 dnl = Use exact stack rooting for GC
1587 dnl ========================================================
1588 MOZ_ARG_ENABLE_BOOL(exact-rooting,
1589 [  --enable-exact-rooting  Enable use of exact stack roots for GC],
1590     JSGC_USE_EXACT_ROOTING=1,
1591     JSGC_USE_EXACT_ROOTING= )
1592 if test -n "$JSGC_USE_EXACT_ROOTING"; then
1593     AC_DEFINE(JSGC_USE_EXACT_ROOTING)
1596 dnl ========================================================
1597 dnl = Use Valgrind
1598 dnl ========================================================
1599 MOZ_ARG_ENABLE_BOOL(valgrind,
1600 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1601     MOZ_VALGRIND=1,
1602     MOZ_VALGRIND= )
1603 if test -n "$MOZ_VALGRIND"; then
1604     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1605         AC_MSG_ERROR(
1606             [--enable-valgrind specified but Valgrind is not installed]))
1607     AC_DEFINE(MOZ_VALGRIND)
1609 AC_SUBST(MOZ_VALGRIND)
1611 dnl ========================================================
1612 dnl jprof
1613 dnl ========================================================
1614 MOZ_ARG_ENABLE_BOOL(jprof,
1615 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1616     MOZ_JPROF=1,
1617     MOZ_JPROF= )
1618 if test -n "$MOZ_JPROF"; then
1619     MOZ_PROFILING=1
1620     AC_DEFINE(MOZ_JPROF)
1623 dnl ========================================================
1624 dnl SPS Profiler
1625 dnl ========================================================
1626 MOZ_ENABLE_PROFILER_SPS=1
1628 case "${OS_TARGET}" in
1629 Android)
1630     case "${CPU_ARCH}" in
1631     x86 | arm) ;;
1632     *)
1633         MOZ_ENABLE_PROFILER_SPS=
1634     esac
1635     ;;
1636 Linux)
1637     case "${CPU_ARCH}" in
1638     x86 | x86_64) ;;
1639     *)
1640         MOZ_ENABLE_PROFILER_SPS=
1641     esac
1642     ;;
1643 WINNT|Darwin) ;;
1645     MOZ_ENABLE_PROFILER_SPS=
1646     ;;
1647 esac
1649 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1650     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1653 dnl ========================================================
1654 dnl shark
1655 dnl ========================================================
1656 MOZ_ARG_ENABLE_BOOL(shark,
1657 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1658     MOZ_SHARK=1,
1659     MOZ_SHARK= )
1660 if test -n "$MOZ_SHARK"; then
1661     MOZ_PROFILING=1
1662     AC_DEFINE(MOZ_SHARK)
1665 dnl ========================================================
1666 dnl instruments
1667 dnl ========================================================
1668 MOZ_ARG_ENABLE_BOOL(instruments,
1669 [  --enable-instruments    Enable instruments remote profiling. Implies --enable-profiling.],
1670     MOZ_INSTRUMENTS=1,
1671     MOZ_INSTRUMENTS= )
1672 if test -n "$MOZ_INSTRUMENTS"; then
1673     MOZ_PROFILING=1
1674     AC_DEFINE(MOZ_INSTRUMENTS)
1677 dnl ========================================================
1678 dnl callgrind
1679 dnl ========================================================
1680 MOZ_ARG_ENABLE_BOOL(callgrind,
1681 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1682     MOZ_CALLGRIND=1,
1683     MOZ_CALLGRIND= )
1684 if test -n "$MOZ_CALLGRIND"; then
1685     MOZ_PROFILING=1
1686     AC_DEFINE(MOZ_CALLGRIND)
1689 dnl ========================================================
1690 dnl vtune
1691 dnl ========================================================
1692 MOZ_ARG_ENABLE_BOOL(vtune,
1693 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1694     MOZ_VTUNE=1,
1695     MOZ_VTUNE= )
1696 if test -n "$MOZ_VTUNE"; then
1697     MOZ_PROFILING=1
1698     AC_DEFINE(MOZ_VTUNE)
1701 dnl ========================================================
1702 dnl Profiling
1703 dnl ========================================================
1704 if test -n "$MOZ_PROFILING"; then
1705     AC_DEFINE(MOZ_PROFILING)
1708 dnl ========================================================
1709 dnl System overrides of the defaults for host
1710 dnl ========================================================
1711 case "$host" in
1712 *mingw*)
1713     if test -n "$_WIN32_MSVC"; then
1714         HOST_AR=lib
1715         HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1716         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1717         HOST_RANLIB='echo ranlib'
1718     else
1719         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1720     fi
1721     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1722     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1723     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1724     HOST_BIN_SUFFIX=.exe
1725     case "$host" in
1726     *mingw*)
1727         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1728         ;;
1729     esac
1731     case "${host_cpu}" in
1732     i*86)
1733         if test -n "$_WIN32_MSVC"; then
1734             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1735         fi
1736         ;;
1737     x86_64)
1738         if test -n "$_WIN32_MSVC"; then
1739             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1740         fi
1741         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1742         ;;
1743     esac
1744     ;;
1746 *-darwin*)
1747     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1748     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1749     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1750     ;;
1752 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1753     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1754     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1755     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1756     ;;
1758 *os2*)
1759     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1760     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1761     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1762     HOST_BIN_SUFFIX=.exe
1763     MOZ_FIX_LINK_PATHS=
1764     ;;
1767     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1768     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1769     ;;
1770 esac
1772 dnl Check for using a custom <inttypes.h> implementation
1773 dnl ========================================================
1774 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1775 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1776   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1777   AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1778 else
1779   AC_MSG_RESULT(none specified)
1782 dnl Get mozilla version from central milestone file
1783 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1784 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
1785 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
1787 dnl Get version of various core apps from the version files.
1788 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1790 if test -z "$FIREFOX_VERSION"; then
1791     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1794 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1795 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1796 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1797 AC_SUBST(MOZILLA_SYMBOLVERSION)
1799 MOZ_DOING_LTO(lto_is_enabled)
1801 dnl ========================================================
1802 dnl System overrides of the defaults for target
1803 dnl ========================================================
1805 case "$target" in
1806 *-aix*)
1807     AC_DEFINE(AIX)
1808     if test ! "$GNU_CC"; then
1809         if test ! "$HAVE_64BIT_OS"; then
1810             # Compiling with Visual Age C++ object model compat is the
1811             # default. To compile with object model ibm, add
1812             # AIX_OBJMODEL=ibm to .mozconfig.
1813             if test "$AIX_OBJMODEL" = "ibm"; then
1814                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1815             else
1816                 AIX_OBJMODEL=compat
1817             fi
1818         else
1819             AIX_OBJMODEL=compat
1820         fi
1821         AC_SUBST(AIX_OBJMODEL)
1822         DSO_LDOPTS='-qmkshrobj=1'
1823         DSO_CFLAGS='-qflag=w:w'
1824         DSO_PIC_CFLAGS=
1825         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1826         MOZ_FIX_LINK_PATHS=
1827         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1828         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1829         if test "$COMPILE_ENVIRONMENT"; then
1830             AC_LANG_SAVE
1831             AC_LANG_CPLUSPLUS
1832             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1833             AC_TRY_COMPILE([],
1834                 [#if (__IBMCPP__ < 900)
1835                  #error "Bad compiler"
1836                  #endif],
1837                 _BAD_COMPILER=,_BAD_COMPILER=1)
1838             if test -n "$_BAD_COMPILER"; then
1839                 AC_MSG_RESULT([no])
1840                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1841             else
1842                 AC_MSG_RESULT([yes])
1843             fi
1844             AC_LANG_RESTORE
1845             TARGET_COMPILER_ABI="ibmc"
1846             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1847             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1848         fi
1849     fi
1850     case "${target_os}" in
1851     aix4.1*)
1852         DLL_SUFFIX='_shr.a'
1853         ;;
1854     esac
1855     if test "$COMPILE_ENVIRONMENT"; then
1856         MOZ_CHECK_HEADERS(sys/inttypes.h)
1857     fi
1858     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1859     ;;
1861 *-darwin*)
1862     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1863     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1864     MOZ_OPTIMIZE_FLAGS="-O3"
1865     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1866     if test "$HAVE_64BIT_OS"; then
1867         MOZ_MEMORY=1
1868     fi
1869     DLL_SUFFIX=".dylib"
1870     DSO_LDOPTS=''
1871     STRIP_FLAGS="$STRIP_FLAGS -x -S"
1872     # Check whether we're targeting OS X or iOS
1873     AC_CACHE_CHECK(for iOS target,
1874                    ac_cv_ios_target,
1875                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1876 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1877 #error not iOS
1878 #endif],
1879                                    [],
1880                                    ac_cv_ios_target="yes",
1881                                    ac_cv_ios_target="no")])
1882     if test "$ac_cv_ios_target" = "yes"; then
1883         AC_DEFINE(XP_IOS)
1884         AC_DEFINE(XP_DARWIN)
1885         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1886     else
1887         AC_DEFINE(XP_MACOSX)
1888         AC_DEFINE(XP_DARWIN)
1889         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1890         # The ExceptionHandling framework is needed for Objective-C exception
1891         # logging code in nsObjCExceptions.h. Currently we only use that in debug
1892         # builds.
1893         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1894     fi
1895     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1898     if test "x$lto_is_enabled" = "xyes"; then
1899         echo "Skipping -dead_strip because lto is enabled."
1900     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1901     dnl ===================================================================
1902     elif test "x$enable_dtrace" = "xyes"; then
1903         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1904     else
1905         dnl check for the presence of the -dead_strip linker flag
1906         AC_MSG_CHECKING([for -dead_strip option to ld])
1907         _SAVE_LDFLAGS=$LDFLAGS
1908         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1909         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1910         if test -n "$_HAVE_DEAD_STRIP" ; then
1911             AC_MSG_RESULT([yes])
1912             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1913         else
1914             AC_MSG_RESULT([no])
1915         fi
1917         LDFLAGS=$_SAVE_LDFLAGS
1918     fi
1920     dnl With newer linkers we need to pass -allow_heap_execute because of
1921     dnl Microsoft Silverlight (5.1.10411.0 at least).
1922     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
1923     _SAVE_LDFLAGS=$LDFLAGS
1924     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
1925     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
1926                 _HAVE_ALLOW_HEAP_EXECUTE=)
1927     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
1928         AC_MSG_RESULT([yes])
1929         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
1930     else
1931         AC_MSG_RESULT([no])
1932     fi
1933     LDFLAGS=$_SAVE_LDFLAGS
1935     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1936     ;;
1938 ia64*-hpux*)
1939     DLL_SUFFIX=".so"
1940     if test ! "$GNU_CC"; then
1941        DSO_LDOPTS='-b'
1942        DSO_CFLAGS=""
1943        DSO_PIC_CFLAGS=
1944        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1945        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1946        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1947     else
1948        DSO_LDOPTS='-b -E'
1949        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1950        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1951     fi
1952     MOZ_FIX_LINK_PATHS=
1953     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1954     AC_DEFINE(_LARGEFILE64_SOURCE)
1955     ;;
1957 *-hpux*)
1958     DLL_SUFFIX=".sl"
1959     if test ! "$GNU_CC"; then
1960         DSO_LDOPTS='-b -Wl,+s'
1961         DSO_CFLAGS=""
1962         DSO_PIC_CFLAGS="+Z"
1963         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1964         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1965         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1966     else
1967         DSO_LDOPTS='-b -E +s'
1968         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1969         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1970     fi
1971     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1972     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1973     ;;
1975 *-android*|*-linuxandroid*)
1976     AC_DEFINE(NO_PW_GECOS)
1977     no_x=yes
1978     if test -n "$gonkdir"; then
1979         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
1980         _PLATFORM_HAVE_RIL=1
1981         MOZ_B2G_FM=1
1982         MOZ_SYNTH_PICO=1
1983     else
1984         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
1985         MOZ_LINKER=1
1986     fi
1987     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1989     MOZ_GFX_OPTIMIZE_MOBILE=1
1990     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
1991     ;;
1993 *-*linux*)
1994     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1995     # Similarly for GNU_CXX and INTEL_CXX.
1996     if test "$INTEL_CC" -o "$INTEL_CXX"; then
1997         # -Os has been broken on Intel's C/C++ compilers for quite a
1998         # while; Intel recommends against using it.
1999         MOZ_OPTIMIZE_FLAGS="-O2"
2000     elif test "$GNU_CC" -o "$GNU_CXX"; then
2001         case $GCC_VERSION in
2002         4.5.*)
2003             # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2004             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2005         esac
2006         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2007         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2008     fi
2010     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2012     MOZ_MEMORY=1
2014     case "${target_cpu}" in
2015     alpha*)
2016         CFLAGS="$CFLAGS -mieee"
2017         CXXFLAGS="$CXXFLAGS -mieee"
2018     ;;
2019     esac
2021     if test -z "$MC"; then
2022         MC=mc.exe
2023     fi
2024     ;;
2025 *-mingw*)
2026     DSO_CFLAGS=
2027     DSO_PIC_CFLAGS=
2028     DLL_SUFFIX=.dll
2029     RC=rc.exe
2030     MC=mc.exe
2031     # certain versions of cygwin's makedepend barf on the
2032     # #include <string> vs -I./dist/include/string issue so don't use it
2033     XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
2034     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2035         CC="$CC -mwindows"
2036         CXX="$CXX -mwindows"
2037         CPP="$CPP -mwindows"
2038         CFLAGS="$CFLAGS -mms-bitfields"
2039         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2040         DSO_LDOPTS='-shared'
2041         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2042         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2043         RC='$(WINDRES)'
2044         # Use static libgcc and libstdc++
2045         LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
2046         NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2047         # Use temp file for windres (bug 213281)
2048         RCFLAGS='-O coff --use-temp-file'
2049         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2050         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2051         MOZ_FIX_LINK_PATHS=
2052         DLL_PREFIX=
2053         IMPORT_LIB_SUFFIX=dll.a
2055         # We use mix of both POSIX and Win32 printf format across the tree, so format
2056         # warnings are useless on mingw.
2057         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2058         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2059     else
2060         TARGET_COMPILER_ABI=msvc
2061         HOST_CC='$(CC)'
2062         HOST_CXX='$(CXX)'
2063         HOST_LD='$(LD)'
2064         if test "$AS_BIN"; then
2065             AS="$(basename "$AS_BIN")"
2066         fi
2067         AR='lib'
2068         AR_FLAGS='-NOLOGO -OUT:$@'
2069         AR_EXTRACT=
2070         RANLIB='echo not_ranlib'
2071         STRIP='echo not_strip'
2072         PKG_SKIP_STRIP=1
2073         XARGS=xargs
2074         ZIP=zip
2075         UNZIP=unzip
2076         DOXYGEN=:
2077         ASM_SUFFIX=asm
2078         OBJ_SUFFIX=obj
2079         LIB_SUFFIX=lib
2080         DLL_PREFIX=
2081         LIB_PREFIX=
2082         IMPORT_LIB_SUFFIX=lib
2083         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2084         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2085         MKSHLIB_FORCE_ALL=
2086         MKSHLIB_UNFORCE_ALL=
2087         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2088         _USE_CPP_INCLUDE_FLAG=1
2089         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2090         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2091         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2092         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2093         if test "$_CC_SUITE" -ge "12"; then
2094             dnl VS2013+ requires -FS when parallel building by make -jN.
2095             dnl If nothing, compiler sometimes causes C1041 error.
2096             dnl
2097             dnl Visual Studio 2013 supports -Gw flags
2098             dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
2099             CFLAGS="$CFLAGS -FS -Gw"
2100             CXXFLAGS="$CXXFLAGS -FS -Gw"
2101         fi
2102         # khuey says we can safely ignore MSVC warning C4251
2103         # MSVC warning C4244 (implicit type conversion may lose data) warns
2104         # and requires workarounds for perfectly valid code.  Also, GCC/clang
2105         # don't warn about it by default. So for consistency/sanity, we turn
2106         # it off on MSVC, too.
2107         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2108         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2109         # MSVC warning C4482 warns when an enum value is refered specifing the
2110         # name of the enum itself.  This behavior is allowed in C++11, and the
2111         # warning has been removed in VS2012.
2112         # MSVC warning C4800 warns when a value is implicitly cast to bool,
2113         # because this also forces narrowing to a single byte, which can be a
2114         # perf hit.  But this matters so little in practice (and often we want
2115         # that behavior) that it's better to turn it off.
2116         # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2117         # on non-Western system locales even if it is in a comment.
2118         CFLAGS="$CFLAGS -wd4244 -wd4819"
2119         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2120         # make 'foo == bar;' error out
2121         CFLAGS="$CFLAGS -we4553"
2122         CXXFLAGS="$CXXFLAGS -we4553"
2123         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2124         MOZ_DEBUG_FLAGS='-Zi'
2125         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2126         WARNINGS_AS_ERRORS='-WX'
2127         MOZ_OPTIMIZE_FLAGS='-O1'
2128         MOZ_FIX_LINK_PATHS=
2129         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2130         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2131         if test -z "$DEVELOPER_OPTIONS"; then
2132             LDFLAGS="$LDFLAGS -RELEASE"
2133         fi
2134         dnl For profile-guided optimization
2135         PROFILE_GEN_CFLAGS="-GL"
2136         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2137         dnl XXX: PGO builds can fail with warnings treated as errors,
2138         dnl specifically "no profile data available" appears to be
2139         dnl treated as an error sometimes. This might be a consequence
2140         dnl of using WARNINGS_AS_ERRORS in some modules, combined
2141         dnl with the linker doing most of the work in the whole-program
2142         dnl optimization/PGO case. I think it's probably a compiler bug,
2143         dnl but we work around it here.
2144         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2145         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2146         dnl Probably also a compiler bug, but what can you do?
2147         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2148         LDFLAGS="$LDFLAGS -DYNAMICBASE"
2149         dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2150         dnl both SSSE3 and SSE4.1.
2151         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2152         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2153     fi
2154     AC_DEFINE(HAVE_SNPRINTF)
2155     AC_DEFINE(_WINDOWS)
2156     AC_DEFINE(WIN32)
2157     AC_DEFINE(XP_WIN)
2158     AC_DEFINE(XP_WIN32)
2159     AC_DEFINE(HW_THREADS)
2160     AC_DEFINE(STDC_HEADERS)
2161     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2162     TARGET_MD_ARCH=win32
2163     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2164     BIN_SUFFIX='.exe'
2165     MOZ_USER_DIR="Mozilla"
2167     dnl Hardcode to win95 for now - cls
2168     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2170     dnl set NO_X11 defines here as the general check is skipped on win32
2171     no_x=yes
2172     AC_DEFINE(NO_X11)
2174     case "$host" in
2175     *-mingw*)
2176         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2177         if test -n "$L10NBASEDIR"; then
2178             L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2179         fi
2180         ;;
2181     esac
2183     case "$host" in
2184     *-mingw*)
2185         if test -z "$MOZ_TOOLS"; then
2186             AC_MSG_ERROR([MOZ_TOOLS is not set])
2187         fi
2188         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2189         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2190             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2191         fi
2192         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2193         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2194             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2195         fi
2196         ;;
2197     esac
2199     case "$host_os" in
2200     cygwin*|msvc*|mks*)
2201         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.])
2202         ;;
2203     esac
2205     case "$target" in
2206     i*86-*)
2207         if test "$HAVE_64BIT_OS"; then
2208             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2209         fi
2211         if test -n "$GNU_CC"; then
2212             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2213             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2214             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2215         else
2216             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2217             LDFLAGS="$LDFLAGS -SAFESEH"
2218         fi
2220         AC_DEFINE(_X86_)
2221         ;;
2222     x86_64-*)
2223         if test -n "$_WIN32_MSVC"; then
2224             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2225         fi
2226         AC_DEFINE(_AMD64_)
2227         ;;
2228     *)
2229         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2230         ;;
2231     esac
2232     ;;
2234 *-netbsd*)
2235     DSO_CFLAGS=''
2236     CFLAGS="$CFLAGS -Dunix"
2237     CXXFLAGS="$CXXFLAGS -Dunix"
2238     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2239         DLL_SUFFIX=".so"
2240         DSO_PIC_CFLAGS='-fPIC -DPIC'
2241         DSO_LDOPTS='-shared'
2242         BIN_FLAGS='-Wl,--export-dynamic'
2243     else
2244         DSO_PIC_CFLAGS='-fPIC -DPIC'
2245         DLL_SUFFIX=".so.1.0"
2246         DSO_LDOPTS='-shared'
2247     fi
2248     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2249     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2250     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2251     if test "$LIBRUNPATH"; then
2252         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2253     fi
2254     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
2255     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
2256     ;;
2258 *-openbsd*)
2259     if test "$SO_VERSION"; then
2260         DLL_SUFFIX=".so.$SO_VERSION"
2261     else
2262         DLL_SUFFIX=".so.1.0"
2263     fi
2264     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2265     DSO_CFLAGS=''
2266     DSO_PIC_CFLAGS='-fPIC'
2267     DSO_LDOPTS='-shared -fPIC'
2268     if test "$LIBRUNPATH"; then
2269         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2270     fi
2271     ;;
2273 *-os2*)
2274     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2275     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2276     AC_DEFINE(OS2)
2277     AC_DEFINE(XP_OS2)
2278     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2279     AC_DEFINE(TCPV40HDRS)
2280     DLL_PREFIX=
2281     LIB_PREFIX=
2282     LIB_SUFFIX=lib
2283     BIN_SUFFIX=".exe"
2284     DLL_SUFFIX=".dll"
2285     IMPORT_LIB_SUFFIX=lib
2286     DSO_PIC_CFLAGS=
2287     AR=emxomfar
2288     AR_FLAGS='r $@'
2289     CFLAGS="$CFLAGS -Zomf"
2290     CXXFLAGS="$CXXFLAGS -Zomf"
2291     DSO_LDOPTS='-Zdll'
2292     BIN_FLAGS='-Zlinker /ST:0x100000'
2293     IMPLIB='emximp -o'
2294     FILTER='true'
2295     LDFLAGS='-Zmap'
2296     WARNINGS_AS_ERRORS='-Werror'
2297     MOZ_DEBUG_FLAGS="-g -fno-inline"
2298     MOZ_OPTIMIZE_FLAGS="-O2"
2299     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2300     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2301     TARGET_MD_ARCH=os2
2302     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2303     RC=rc.exe
2304     MC=mc.exe
2305     RCFLAGS='-n'
2306     MOZ_USER_DIR="Mozilla"
2307     ZIP="$ZIP -X"
2308     STRIP=lxlite
2309     STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
2311     if test "$MOZTOOLS"; then
2312         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2313     else
2314         AC_MSG_ERROR([MOZTOOLS is not set])
2315     fi
2316     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2317         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2318         LDFLAGS="$LDFLAGS -Zhigh-mem"
2319         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2320         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2321     fi
2323     # GCC for OS/2 currently predefines these, but we don't want them
2324     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2325     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2327     AC_CACHE_CHECK(for __declspec(dllexport),
2328         ac_os2_declspec,
2329         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2330                         [return 0;],
2331                         ac_os2_declspec="yes",
2332                         ac_os2_declspec="no")])
2333     if test "$ac_os2_declspec" != "yes"; then
2334         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2335     fi
2336     ;;
2338 *-solaris*)
2339     AC_DEFINE(SOLARIS)
2340     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2341     MOZ_FIX_LINK_PATHS=
2342     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2343     # libraries one level up (e.g. libnspr4.so)
2344     if test "$SOLARIS_SUNPRO_CC"; then
2345        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2346        LIBS="-lCrun -lCstd -lc $LIBS"
2347        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2348        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2349        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2350        LDFLAGS="-xildoff $LDFLAGS"
2351        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2352            _SAVE_LDFLAGS=$LDFLAGS
2353            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2354            AC_TRY_LINK([#include <stdio.h>],
2355                        [printf("Hello World\n");],
2356                        ,
2357                        [LDFLAGS=$_SAVE_LDFLAGS])
2358        fi
2359        MOZ_OPTIMIZE_FLAGS="-xO4"
2360        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2361        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
2362        MKSHLIB_FORCE_ALL='-z allextract'
2363        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2364        DSO_LDOPTS='-G'
2365        AR_LIST="$AR t"
2366        AR_EXTRACT="$AR x"
2367        AR_DELETE="$AR d"
2368        AR='$(CXX) -xar'
2369        AR_FLAGS='-o $@'
2370        AS='/usr/ccs/bin/as'
2371        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2372        AS_DASH_C_FLAG=''
2373        TARGET_COMPILER_ABI="sunc"
2374        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2375        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2376        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2377        AC_LANG_SAVE
2378        AC_LANG_CPLUSPLUS
2379        AC_TRY_COMPILE([],
2380            [#if (__SUNPRO_CC < 0x590)
2381            #error "Denied"
2382            #endif],
2383            _BAD_COMPILER=,_BAD_COMPILER=1)
2384        if test -n "$_BAD_COMPILER"; then
2385            _res="no"
2386            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2387        else
2388            _res="yes"
2389        fi
2390        AC_TRY_COMPILE([],
2391            [#if (__SUNPRO_CC >= 0x5100)
2392            #error "Sun C++ 5.10 or above"
2393            #endif],
2394            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2395        if test "$_ABOVE_SS12U1"; then
2396            # disable xannotate
2397            CXXFLAGS="$CXXFLAGS -xannotate=no"
2398        fi
2399        AC_MSG_RESULT([$_res])
2400        AC_LANG_RESTORE
2401     else
2402        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2403        LIBS="-lc $LIBS"
2404        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2405        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2406        ASFLAGS="$ASFLAGS -fPIC"
2407        DSO_LDOPTS='-shared'
2408        WARNINGS_AS_ERRORS='-Werror'
2409        _WARNINGS_CFLAGS=''
2410        _WARNINGS_CXXFLAGS=''
2411        if test "$OS_RELEASE" = "5.3"; then
2412            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2413        fi
2414     fi
2415     if test "$OS_RELEASE" = "5.5.1"; then
2416         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2417     fi
2418     ;;
2420 *-sunos*)
2421     DSO_LDOPTS='-Bdynamic'
2422     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2423     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2424     AC_DEFINE(SUNOS4)
2425     AC_DEFINE(SPRINTF_RETURNS_STRING)
2426     case "$(target_os)" in
2427     sunos4.1*)
2428         DLL_SUFFIX='.so.1.0'
2429         ;;
2430     esac
2431     ;;
2433 *-os2*)
2434     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2435     ;;
2437 esac
2439 case "$target" in
2440 *-*linux*)
2441     # Includes linux-android
2442     AC_DEFINE(XP_LINUX)
2443     ;;
2444 esac
2446 AC_SUBST(MOZ_LINKER)
2447 if test -n "$MOZ_LINKER"; then
2448   AC_DEFINE(MOZ_LINKER)
2451 dnl Only one oddball right now (QNX), but this gives us flexibility
2452 dnl if any other platforms need to override this in the future.
2453 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2455 dnl ========================================================
2456 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2457 dnl by now will not have any way to link most binaries (tests
2458 dnl as well as viewer, apprunner, etc.), because some symbols
2459 dnl will be left out of the "composite" .so's by ld as unneeded.
2460 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2461 dnl they can link in the static libs that provide the missing
2462 dnl symbols.
2463 dnl ========================================================
2464 NO_LD_ARCHIVE_FLAGS=
2465 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2466     NO_LD_ARCHIVE_FLAGS=1
2468 case "$target" in
2469 *-os2*)
2470     NO_LD_ARCHIVE_FLAGS=
2471     ;;
2472 *-aix4.3*|*-aix5*)
2473     NO_LD_ARCHIVE_FLAGS=
2474     ;;
2475 *-mingw*)
2476     if test -z "$GNU_CC"; then
2477         NO_LD_ARCHIVE_FLAGS=
2478     fi
2479     ;;
2480 esac
2481 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2483 dnl ========================================================
2484 dnl = Flags to strip unused symbols from .so components and
2485 dnl = to export jemalloc symbols when linking a program
2486 dnl ========================================================
2487 case "$target" in
2488     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2489         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2490         ;;
2491     *-solaris*)
2492         if test -z "$GNU_CC"; then
2493          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2494         else
2495          if test -z "$GCC_USE_GNU_LD"; then
2496           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2497          else
2498           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2499          fi
2500         fi
2501         ;;
2502     *-darwin*)
2503         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2504         ;;
2505     *-mingw*)
2506         if test -n "$GNU_CC"; then
2507            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2508         fi
2509         ;;
2510 esac
2512 if test -z "$COMPILE_ENVIRONMENT"; then
2513     SKIP_COMPILER_CHECKS=1
2514     SKIP_LIBRARY_CHECKS=1
2515 else
2516     MOZ_COMPILER_OPTS
2519 if test -z "$SKIP_COMPILER_CHECKS"; then
2520 dnl Checks for typedefs, structures, and compiler characteristics.
2521 dnl ========================================================
2522 AC_HEADER_STDC
2523 AC_C_CONST
2524 AC_TYPE_MODE_T
2525 AC_TYPE_OFF_T
2526 AC_TYPE_PID_T
2527 AC_TYPE_SIZE_T
2528 AC_LANG_CPLUSPLUS
2529 AC_LANG_C
2530 AC_MSG_CHECKING(for ssize_t)
2531 AC_CACHE_VAL(ac_cv_type_ssize_t,
2532  [AC_TRY_COMPILE([#include <stdio.h>
2533                   #include <sys/types.h>],
2534                  [ssize_t foo = 0;],
2535                  [ac_cv_type_ssize_t=true],
2536                  [ac_cv_type_ssize_t=false])])
2537 if test "$ac_cv_type_ssize_t" = true ; then
2538   AC_DEFINE(HAVE_SSIZE_T)
2539   AC_MSG_RESULT(yes)
2540 else
2541   AC_MSG_RESULT(no)
2543 AC_STRUCT_ST_BLKSIZE
2544 AC_MSG_CHECKING(for siginfo_t)
2545 AC_CACHE_VAL(ac_cv_siginfo_t,
2546  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2547                   #include <signal.h>],
2548                  [siginfo_t* info;],
2549                  [ac_cv_siginfo_t=true],
2550                  [ac_cv_siginfo_t=false])])
2551 if test "$ac_cv_siginfo_t" = true ; then
2552   AC_DEFINE(HAVE_SIGINFO_T)
2553   AC_MSG_RESULT(yes)
2554 else
2555   AC_MSG_RESULT(no)
2558 AC_LANG_CPLUSPLUS
2560 MOZ_CXX11
2562 AC_LANG_C
2564 dnl Check for .hidden assembler directive and visibility attribute.
2565 dnl Borrowed from glibc configure.in
2566 dnl ===============================================================
2567 if test "$GNU_CC"; then
2568   AC_CACHE_CHECK(for visibility(hidden) attribute,
2569                  ac_cv_visibility_hidden,
2570                  [cat > conftest.c <<EOF
2571                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2573                   ac_cv_visibility_hidden=no
2574                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2575                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2576                       ac_cv_visibility_hidden=yes
2577                     fi
2578                   fi
2579                   rm -f conftest.[cs]
2580                  ])
2581   if test "$ac_cv_visibility_hidden" = "yes"; then
2582     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2584     AC_CACHE_CHECK(for visibility(default) attribute,
2585                    ac_cv_visibility_default,
2586                    [cat > conftest.c <<EOF
2587                     int foo __attribute__ ((visibility ("default"))) = 1;
2589                     ac_cv_visibility_default=no
2590                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2591                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2592                         ac_cv_visibility_default=yes
2593                       fi
2594                     fi
2595                     rm -f conftest.[cs]
2596                    ])
2597     if test "$ac_cv_visibility_default" = "yes"; then
2598       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2600       AC_CACHE_CHECK(for visibility pragma support,
2601                      ac_cv_visibility_pragma,
2602                      [cat > conftest.c <<EOF
2603 #pragma GCC visibility push(hidden)
2604                       int foo_hidden = 1;
2605 #pragma GCC visibility push(default)
2606                       int foo_default = 1;
2608                       ac_cv_visibility_pragma=no
2609                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2610                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2611                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2612                             ac_cv_visibility_pragma=yes
2613                           fi
2614                         fi
2615                       fi
2616                       rm -f conftest.[cs]
2617                     ])
2618       if test "$ac_cv_visibility_pragma" = "yes"; then
2619         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2620                        ac_cv_have_visibility_class_bug,
2621                        [cat > conftest.c <<EOF
2622 #pragma GCC visibility push(hidden)
2623 struct __attribute__ ((visibility ("default"))) TestStruct {
2624   static void Init();
2626 __attribute__ ((visibility ("default"))) void TestFunc() {
2627   TestStruct::Init();
2630                        ac_cv_have_visibility_class_bug=no
2631                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2632                          ac_cv_have_visibility_class_bug=yes
2633                        else
2634                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2635                            ac_cv_have_visibility_class_bug=yes
2636                          fi
2637                        fi
2638                        rm -rf conftest.{c,S}
2639                        ])
2641         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2642                        ac_cv_have_visibility_builtin_bug,
2643                        [cat > conftest.c <<EOF
2644 #pragma GCC visibility push(hidden)
2645 #pragma GCC visibility push(default)
2646 #include <string.h>
2647 #pragma GCC visibility pop
2649 __attribute__ ((visibility ("default"))) void Func() {
2650   char c[[100]];
2651   memset(c, 0, sizeof(c));
2654                        ac_cv_have_visibility_builtin_bug=no
2655                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2656                          ac_cv_have_visibility_builtin_bug=yes
2657                        else
2658                          if test `grep -c "@PLT" conftest.S` = 0; then
2659                            ac_cv_visibility_builtin_bug=yes
2660                          fi
2661                        fi
2662                        rm -f conftest.{c,S}
2663                        ])
2664         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2665                 "$ac_cv_have_visibility_class_bug" = "no"; then
2666           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2667           WRAP_SYSTEM_INCLUDES=1
2668           STL_FLAGS='-I$(DIST)/stl_wrappers'
2669           WRAP_STL_INCLUDES=1
2670         else
2671           VISIBILITY_FLAGS='-fvisibility=hidden'
2672         fi # have visibility pragma bug
2673       fi   # have visibility pragma
2674     fi     # have visibility(default) attribute
2675   fi       # have visibility(hidden) attribute
2676 fi         # GNU_CC
2678 # visibility hidden flag for Sun Studio on Solaris
2679 if test "$SOLARIS_SUNPRO_CC"; then
2680 VISIBILITY_FLAGS='-xldscope=hidden'
2681 fi         # Sun Studio on Solaris
2683 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2684 AC_SUBST(VISIBILITY_FLAGS)
2686 MOZ_GCC_PR49911
2687 MOZ_GCC_PR39608
2688 if test "$OS_TARGET" != WINNT; then
2689     # Only run this test with clang on non-Windows platforms, because clang
2690     # cannot do enough code gen for now to make this test work correctly.
2691     MOZ_LLVM_PR8927
2694 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2695 dnl ========================================================
2696 if test "$GNU_CC"; then
2697   CFLAGS_save="${CFLAGS}"
2698   CFLAGS="${CFLAGS} -Werror"
2699   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2700                  ac_cv_force_align_arg_pointer,
2701                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2702                                  [],
2703                                  ac_cv_force_align_arg_pointer="yes",
2704                                  ac_cv_force_align_arg_pointer="no")])
2705   CFLAGS="${CFLAGS_save}"
2706   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2707     HAVE_GCC_ALIGN_ARG_POINTER=1
2708   else
2709     HAVE_GCC_ALIGN_ARG_POINTER=
2710   fi
2712 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2714 dnl Checks for header files.
2715 dnl ========================================================
2716 AC_HEADER_DIRENT
2717 case "$target_os" in
2718 freebsd*|openbsd*)
2719 # for stuff like -lXshm
2720     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2721     ;;
2722 esac
2723 MOZ_CHECK_COMMON_HEADERS
2725 dnl These are all the places some variant of statfs can be hiding.
2726 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2728 dnl Quota support
2729 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2730 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2732 dnl SCTP support - needs various network include headers
2733 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2735 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2737 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2738 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2739                    ac_cv_sockaddr_in_sin_len,
2740                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2741                                     #include <sys/types.h>
2742                                     #endif
2743                                     #include <netinet/in.h>
2744                                     struct sockaddr_in x;
2745                                     void *foo = (void*) &x.sin_len;],
2746                                    [],
2747                                    [ac_cv_sockaddr_in_sin_len=true],
2748                                    [ac_cv_sockaddr_in_sin_len=false])])
2749 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2750   AC_DEFINE(HAVE_SIN_LEN)
2751 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2752   AC_DEFINE(HAVE_SCONN_LEN)
2755 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2756                ac_cv_sockaddr_in6_sin6_len,
2757                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2758                                 #include <sys/types.h>
2759                                 #endif
2760                                 #include <netinet/in.h>
2761                                 struct sockaddr_in6 x;
2762                                 void *foo = (void*) &x.sin6_len;],
2763                                [],
2764                                [ac_cv_sockaddr_in6_sin6_len=true],
2765                                [ac_cv_sockaddr_in6_sin6_len=false])])
2766 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2767   AC_DEFINE(HAVE_SIN6_LEN)
2770 AC_CACHE_CHECK(for sockaddr.sa_len,
2771                ac_cv_sockaddr_sa_len,
2772                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2773                                 #include <sys/types.h>
2774                                 #endif
2775                                 #include <sys/socket.h>
2776                                 struct sockaddr x;
2777                                 void *foo = (void*) &x.sa_len;],
2778                                [],
2779                                [ac_cv_sockaddr_sa_len=true],
2780                                [ac_cv_sockaddr_sa_len=false])])
2781 if test "$ac_cv_sockaddr_sa_len" = true ; then
2782   AC_DEFINE(HAVE_SA_LEN)
2785 AC_ARG_ENABLE(dtrace,
2786               [  --enable-dtrace         build with dtrace support if available (default=no)],
2787               [enable_dtrace="yes"],)
2788 if test "x$enable_dtrace" = "xyes"; then
2789   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2790   if test -n "$HAVE_DTRACE"; then
2791       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2792   else
2793       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2794   fi
2796 AC_SUBST(HAVE_DTRACE)
2798 case $target in
2799 *-aix4.3*|*-aix5*)
2800         ;;
2802         MOZ_CHECK_HEADERS(sys/cdefs.h)
2803         ;;
2804 esac
2806 MOZ_LINUX_PERF_EVENT
2808 dnl Checks for libraries.
2809 dnl ========================================================
2810 case $target in
2811 *-hpux11.*)
2812         ;;
2814         AC_CHECK_LIB(c_r, gethostbyname_r)
2815         ;;
2816 esac
2818 dnl We don't want to link with libdl even if it's present on OS X, since
2819 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2820 dnl in libc.
2821 dnl We don't want to link against libm or libpthread on Darwin since
2822 dnl they both are just symlinks to libSystem and explicitly linking
2823 dnl against libSystem causes issues when debugging (see bug 299601).
2824 case $target in
2825 *-darwin*)
2826     ;;
2827 *-os2*)
2828     ;;
2830     AC_SEARCH_LIBS(dlopen, dl,
2831         MOZ_CHECK_HEADER(dlfcn.h,
2832         AC_DEFINE(HAVE_DLOPEN)))
2833     ;;
2834 esac
2836 _SAVE_CFLAGS="$CFLAGS"
2837 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2838 AC_CHECK_FUNCS(dladdr memmem)
2839 CFLAGS="$_SAVE_CFLAGS"
2841 if test ! "$GNU_CXX"; then
2843     case $target in
2844     *-aix*)
2845         AC_CHECK_LIB(C_r, demangle)
2846         ;;
2847      *)
2848         AC_CHECK_LIB(C, demangle)
2849         ;;
2850      esac
2853 dnl OS/2 has socket in libc.
2854 case $target in
2855 *-os2*)
2856     ;;
2858     AC_CHECK_LIB(socket, socket)
2859 esac
2861 XLDFLAGS="$X_LIBS"
2862 XLIBS="$X_EXTRA_LIBS"
2864 dnl ========================================================
2865 dnl Checks for X libraries.
2866 dnl Ordering is important.
2867 dnl Xt is dependent upon SM as of X11R6
2868 dnl ========================================================
2869 if test "$no_x" = "yes"; then
2870     AC_DEFINE(NO_X11)
2871 else
2872     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2873         XLIBS="-lX11 $XLIBS"
2874         _SAVE_LDFLAGS="$LDFLAGS"
2875         LDFLAGS="$XLDFLAGS $LDFLAGS"
2876         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2877                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2878         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2879                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2881         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2882         unset ac_cv_lib_Xt_XtFree
2883             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2884             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2885         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2886                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2887         ])
2889     # AIX needs the motif library linked before libXt to prevent
2890     # crashes in plugins linked against Motif - Bug #98892
2891     case "${target_os}" in
2892     aix*)
2893         XT_LIBS="-lXm $XT_LIBS"
2894         ;;
2895     esac
2897     dnl ========================================================
2898     dnl = Check for XShm
2899     dnl ========================================================
2900     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2901         $XLIBS $XEXT_LIBS)
2903     dnl ========================================================
2904     dnl = Check for Xss
2905     dnl ========================================================
2906     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2907         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2908             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2909              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2911         LDFLAGS="$_SAVE_LDFLAGS"
2912 fi # $no_x
2914 AC_SUBST(XCFLAGS)
2915 AC_SUBST(XLDFLAGS)
2916 AC_SUBST(XLIBS)
2917 AC_SUBST(XEXT_LIBS)
2918 AC_SUBST(XT_LIBS)
2919 AC_SUBST(XSS_LIBS)
2921 dnl ========================================================
2922 dnl = pthread support
2923 dnl = Start by checking whether the system support pthreads
2924 dnl ========================================================
2925 case "$target_os" in
2926 darwin*)
2927     MOZ_USE_PTHREADS=1
2928     ;;
2930     MOZ_CHECK_PTHREADS(pthreads,
2931         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2932         MOZ_CHECK_PTHREADS(pthread,
2933             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2934             MOZ_CHECK_PTHREADS(c_r,
2935                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2936                 MOZ_CHECK_PTHREADS(c,
2937                     MOZ_USE_PTHREADS=1
2938                 )
2939             )
2940         )
2941     )
2942     ;;
2943 esac
2945 dnl ========================================================
2946 dnl Check the command line for --with-pthreads
2947 dnl ========================================================
2948 MOZ_ARG_WITH_BOOL(pthreads,
2949 [  --with-pthreads         Force use of system pthread library with NSPR ],
2950 [ if test "$MOZ_USE_PTHREADS"x = x; then
2951     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2952 fi],
2953     MOZ_USE_PTHREADS=
2954     _PTHREAD_LDFLAGS=
2957 dnl ========================================================
2958 dnl Do the platform specific pthread hackery
2959 dnl ========================================================
2960 if test "$MOZ_USE_PTHREADS"x != x
2961 then
2962         dnl
2963         dnl See if -pthread is supported.
2964         dnl
2965         rm -f conftest*
2966         ac_cv_have_dash_pthread=no
2967         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2968         echo 'int main() { return 0; }' | cat > conftest.c
2969         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2970         if test $? -eq 0; then
2971                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2972                         ac_cv_have_dash_pthread=yes
2973                 case "$target_os" in
2974                 freebsd*)
2975 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2976                 ;;
2977                 *)
2978                             CFLAGS="$CFLAGS -pthread"
2979                             CXXFLAGS="$CXXFLAGS -pthread"
2980                 ;;
2981                 esac
2982                 fi
2983         fi
2984         rm -f conftest*
2985     AC_MSG_RESULT($ac_cv_have_dash_pthread)
2987         dnl
2988         dnl See if -pthreads is supported.
2989         dnl
2990     ac_cv_have_dash_pthreads=no
2991     if test "$ac_cv_have_dash_pthread" = "no"; then
2992             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2993         echo 'int main() { return 0; }' | cat > conftest.c
2994             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2995         if test $? -eq 0; then
2996                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2997                             ac_cv_have_dash_pthreads=yes
2998                             CFLAGS="$CFLAGS -pthreads"
2999                             CXXFLAGS="$CXXFLAGS -pthreads"
3000                     fi
3001             fi
3002             rm -f conftest*
3003         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3004     fi
3006         case "$target" in
3007             *-*-freebsd*)
3008                         AC_DEFINE(_REENTRANT)
3009                         AC_DEFINE(_THREAD_SAFE)
3010                         dnl -pthread links in -lpthread, so don't specify it explicitly.
3011                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3012                                 _PTHREAD_LDFLAGS="-pthread"
3013                         fi
3014                         ;;
3016             *-*-openbsd*|*-*-bsdi*)
3017                         AC_DEFINE(_REENTRANT)
3018                         AC_DEFINE(_THREAD_SAFE)
3019                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3020                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3021                 _PTHREAD_LDFLAGS="-pthread"
3022                         fi
3023                         ;;
3025             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3026                         AC_DEFINE(_REENTRANT)
3027                         ;;
3029             *-aix4.3*|*-aix5*)
3030                         AC_DEFINE(_REENTRANT)
3031                         ;;
3033             *-hpux11.*)
3034                         AC_DEFINE(_REENTRANT)
3035                         ;;
3037             *-*-solaris*)
3038                         AC_DEFINE(_REENTRANT)
3039                         if test "$SOLARIS_SUNPRO_CC"; then
3040                                 CFLAGS="$CFLAGS -mt"
3041                                 CXXFLAGS="$CXXFLAGS -mt"
3042                         fi
3043                         ;;
3044         esac
3045     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3046     AC_SUBST(MOZ_USE_PTHREADS)
3050 dnl Checks for library functions.
3051 dnl ========================================================
3052 AC_PROG_GCC_TRADITIONAL
3053 AC_FUNC_MEMCMP
3054 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r)
3056 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3057 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3058                ac_cv_clock_monotonic,
3059                [for libs in "" -lrt; do
3060                     _SAVE_LIBS="$LIBS"
3061                     LIBS="$LIBS $libs"
3062                     AC_TRY_LINK([#include <time.h>],
3063                                  [ struct timespec ts;
3064                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3065                                  ac_cv_clock_monotonic=$libs
3066                                  LIBS="$_SAVE_LIBS"
3067                                  break,
3068                                  ac_cv_clock_monotonic=no)
3069                     LIBS="$_SAVE_LIBS"
3070                 done])
3071 if test "$ac_cv_clock_monotonic" != "no"; then
3072     HAVE_CLOCK_MONOTONIC=1
3073     REALTIME_LIBS=$ac_cv_clock_monotonic
3074     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3075     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3076     AC_SUBST(REALTIME_LIBS)
3079 dnl check for wcrtomb/mbrtowc
3080 dnl =======================================================================
3081 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3082 AC_LANG_SAVE
3083 AC_LANG_CPLUSPLUS
3084 AC_CACHE_CHECK(for wcrtomb,
3085     ac_cv_have_wcrtomb,
3086     [AC_TRY_LINK([#include <wchar.h>],
3087                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3088                  ac_cv_have_wcrtomb="yes",
3089                  ac_cv_have_wcrtomb="no")])
3090 if test "$ac_cv_have_wcrtomb" = "yes"; then
3091     AC_DEFINE(HAVE_WCRTOMB)
3093 AC_CACHE_CHECK(for mbrtowc,
3094     ac_cv_have_mbrtowc,
3095     [AC_TRY_LINK([#include <wchar.h>],
3096                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3097                  ac_cv_have_mbrtowc="yes",
3098                  ac_cv_have_mbrtowc="no")])
3099 if test "$ac_cv_have_mbrtowc" = "yes"; then
3100     AC_DEFINE(HAVE_MBRTOWC)
3102 AC_LANG_RESTORE
3105 AC_CACHE_CHECK(
3106     [for res_ninit()],
3107     ac_cv_func_res_ninit,
3108     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
3109         dnl no need for res_ninit() on NetBSD and OpenBSD
3110         ac_cv_func_res_ninit=no
3111      else
3112         AC_TRY_LINK([
3113             #ifdef linux
3114             #define _BSD_SOURCE 1
3115             #endif
3116             #include <sys/types.h>
3117             #include <netinet/in.h>
3118             #include <arpa/nameser.h>
3119             #include <resolv.h>
3120             ],
3121             [int foo = res_ninit(&_res);],
3122             [ac_cv_func_res_ninit=yes],
3123             [ac_cv_func_res_ninit=no])
3124      fi
3125     ])
3127 if test "$ac_cv_func_res_ninit" = "yes"; then
3128     AC_DEFINE(HAVE_RES_NINIT)
3129 dnl must add the link line we do something as foolish as this... dougt
3130 dnl else
3131 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3132 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3135 AC_LANG_CPLUSPLUS
3137 case $target_os in
3138     darwin*|mingw*|os2*)
3139         ;;
3140     *)
3142 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3143     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3144         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3145 _SAVE_LIBS=$LIBS
3146 LIBS="$LIBS $_ICONV_LIBS"
3147 AC_CACHE_CHECK(
3148     [for iconv()],
3149     ac_cv_func_iconv,
3150     [AC_TRY_LINK([
3151         #include <stdlib.h>
3152         #include <iconv.h>
3153         ],
3154         [
3155             iconv_t h = iconv_open("", "");
3156             iconv(h, NULL, NULL, NULL, NULL);
3157             iconv_close(h);
3158         ],
3159         [ac_cv_func_iconv=yes],
3160         [ac_cv_func_iconv=no]
3161         )]
3162     )
3163 if test "$ac_cv_func_iconv" = "yes"; then
3164     AC_DEFINE(HAVE_ICONV)
3165     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3166     LIBICONV="$_ICONV_LIBS"
3167     AC_CACHE_CHECK(
3168         [for iconv() with const input],
3169         ac_cv_func_const_iconv,
3170         [AC_TRY_COMPILE([
3171             #include <stdlib.h>
3172             #include <iconv.h>
3173             ],
3174             [
3175                 const char *input = "testing";
3176                 iconv_t h = iconv_open("", "");
3177                 iconv(h, &input, NULL, NULL, NULL);
3178                 iconv_close(h);
3179             ],
3180             [ac_cv_func_const_iconv=yes],
3181             [ac_cv_func_const_iconv=no]
3182             )]
3183         )
3184     if test "$ac_cv_func_const_iconv" = "yes"; then
3185         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3186     fi
3188 LIBS=$_SAVE_LIBS
3190     ;;
3191 esac
3193 AM_LANGINFO_CODESET
3195 AC_LANG_C
3197 dnl **********************
3198 dnl *** va_copy checks ***
3199 AC_CACHE_CHECK([for an implementation of va_copy()],
3200                ac_cv_va_copy,
3201     [AC_TRY_COMPILE([#include <stdarg.h>
3202                      #include <stdlib.h>
3203         void f (int i, ...) {
3204             va_list args1, args2;
3205             va_start (args1, i);
3206             va_copy (args2, args1);
3207             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3208                 exit (1);
3209             va_end (args1); va_end (args2);
3210         }],
3211         [f(0, 42); return 0],
3212         [ac_cv_va_copy=yes],
3213         [ac_cv_va_copy=no]
3214     )]
3216 AC_CACHE_CHECK([whether va_list can be copied by value],
3217                ac_cv_va_val_copy,
3218     [AC_TRY_COMPILE([#include <stdarg.h>
3219                      #include <stdlib.h>
3220         void f (int i, ...) {
3221             va_list args1, args2;
3222             va_start (args1, i);
3223             args2 = args1;
3224             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3225                 exit (1);
3226             va_end (args1); va_end (args2);
3227         }],
3228         [f(0, 42); return 0],
3229         [ac_cv_va_val_copy=yes],
3230         [ac_cv_va_val_copy=no],
3231     )]
3233 if test "x$ac_cv_va_copy" = "xyes"; then
3234     AC_DEFINE(VA_COPY, va_copy)
3235     AC_DEFINE(HAVE_VA_COPY)
3238 if test "x$ac_cv_va_val_copy" = "xno"; then
3239    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3242 dnl ===================================================================
3243 dnl ========================================================
3244 dnl Put your C++ language/feature checks below
3245 dnl ========================================================
3246 AC_LANG_CPLUSPLUS
3248 ARM_ABI_PREFIX=
3249 if test "$GNU_CC"; then
3250   if test "$CPU_ARCH" = "arm" ; then
3251     AC_CACHE_CHECK(for ARM EABI,
3252         ac_cv_gcc_arm_eabi,
3253         [AC_TRY_COMPILE([],
3254                         [
3255 #if defined(__ARM_EABI__)
3256   return 0;
3257 #else
3258 #error Not ARM EABI.
3259 #endif
3260                         ],
3261                         ac_cv_gcc_arm_eabi="yes",
3262                         ac_cv_gcc_arm_eabi="no")])
3263     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3264         HAVE_ARM_EABI=1
3265         ARM_ABI_PREFIX=eabi-
3266     else
3267         ARM_ABI_PREFIX=oabi-
3268     fi
3269   fi
3271   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3274 dnl Check to see if we can resolve ambiguity with |using|.
3275 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3276                ac_cv_cpp_ambiguity_resolving_using,
3277                [AC_TRY_COMPILE(class X {
3278                                  public: int go(const X&) {return 3;}
3279                                          int jo(const X&) {return 3;}
3280                                };
3281                                class Y : public X {
3282                                  public:  int go(int) {return 2;}
3283                                           int jo(int) {return 2;}
3284                                           using X::jo;
3285                                  private: using X::go;
3286                                };,
3287                                X x; Y y; y.jo(x);,
3288                                ac_cv_cpp_ambiguity_resolving_using=yes,
3289                                ac_cv_cpp_ambiguity_resolving_using=no)])
3290 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3291    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3294 dnl See if a dynamic_cast to void* gives the most derived object.
3295 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3296                ac_cv_cpp_dynamic_cast_void_ptr,
3297                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3298                             class Y { int j; public: virtual ~Y() { } };
3299                             class Z : public X, public Y { int k; };
3301                             int main() {
3302                                  Z mdo;
3303                                  X *subx = (X*)&mdo;
3304                                  Y *suby = (Y*)&mdo;
3305                                  return !((((void*)&mdo != (void*)subx) &&
3306                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3307                                           (((void*)&mdo != (void*)suby) &&
3308                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3309                             }],
3310                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3311                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3312                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3313 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3314    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3318 dnl note that this one is reversed - if the test fails, then
3319 dnl we require implementations of unused virtual methods. Which
3320 dnl really blows because it means we'll have useless vtable
3321 dnl bloat.
3322 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3323                ac_cv_cpp_unused_required,
3324                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3325                                X x;,
3326                                ac_cv_cpp_unused_required=no,
3327                                ac_cv_cpp_unused_required=yes)])
3328 if test "$ac_cv_cpp_unused_required" = yes ; then
3329    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3333 dnl Some compilers have trouble comparing a constant reference to a templatized
3334 dnl class to zero, and require an explicit operator==() to be defined that takes
3335 dnl an int. This test separates the strong from the weak.
3337 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3338                ac_cv_trouble_comparing_to_zero,
3339                [AC_TRY_COMPILE([#include <algorithm>
3340                                 template <class T> class Foo {};
3341                                 class T2;
3342                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3343                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3344                                [Foo<int> f; return (0 != f);],
3345                                ac_cv_trouble_comparing_to_zero=no,
3346                                ac_cv_trouble_comparing_to_zero=yes)])
3347 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3348   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3351 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3352 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3353 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3354 # linking XUL.
3355 _SAVE_LDFLAGS=$LDFLAGS
3356 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3357 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3358                ac_cv_thread_keyword,
3359                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3360                             [return tlsIsMainThread;],
3361                             ac_cv_thread_keyword=yes,
3362                             ac_cv_thread_keyword=no)])
3363 LDFLAGS=$_SAVE_LDFLAGS
3364 # The custom dynamic linker doesn't support TLS variables
3365 MOZ_TLS=
3366 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3367   # mips builds fail with TLS variables because of a binutils bug.
3368   # See bug 528687
3369   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3370   case "${target}" in
3371     mips*-*)
3372       :
3373       ;;
3374     *-android*|*-linuxandroid*)
3375       :
3376       ;;
3377     *-openbsd*)
3378       :
3379       ;;
3380     *)
3381       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3382       MOZ_TLS=1
3383       ;;
3384   esac
3387 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3388 if test -n "$MOZ_LINKER"; then
3389   if test "$CPU_ARCH" = arm; then
3390     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3391     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3392       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3393       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3394     fi
3395   fi
3398 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3399 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3400 dnl We however want to avoid these text relocations, and this can be done
3401 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3402 dnl doesn't contain anything at all, beside placeholders for some sections,
3403 dnl and crtbegin only contains a finalizer function that calls
3404 dnl __cxa_finalize. The custom linker actually takes care of calling
3405 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3406 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3407 dnl link crtbegin and crtend at all.
3408 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3409   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3410     ac_cv_crt_has_text_relocations,
3411     [echo 'int foo() { return 0; }' > conftest.cpp
3412      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3413         test -s conftest${DLL_SUFFIX}; then
3414        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3415          ac_cv_crt_has_text_relocations=yes
3416        else
3417          ac_cv_crt_has_text_relocations=no
3418        fi
3419      else
3420        AC_ERROR([couldn't compile a simple C file])
3421      fi
3422      rm -rf conftest*])
3423   if test "$ac_cv_crt_has_text_relocations" = yes; then
3424     dnl While we want libraries to skip the CRT files, we don't want
3425     dnl executables to be treated the same way. We thus set the flag
3426     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3427     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3428     dnl Using LDFLAGS in nspr is safe, since we only really build
3429     dnl libraries there.
3430     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3431     NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3432   fi
3435 dnl Check for the existence of various allocation headers/functions
3437 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3438 MALLOC_H=
3440 for file in $MALLOC_HEADERS; do
3441   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3442   if test "$MALLOC_H" != ""; then
3443     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3444     break
3445   fi
3446 done
3448 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3450 AC_CHECK_FUNCS(malloc_usable_size)
3452 dnl See if compiler supports some gcc-style attributes
3454 AC_CACHE_CHECK(for __attribute__((always_inline)),
3455                ac_cv_attribute_always_inline,
3456                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3457                                [],
3458                                ac_cv_attribute_always_inline=yes,
3459                                ac_cv_attribute_always_inline=no)])
3461 AC_CACHE_CHECK(for __attribute__((malloc)),
3462                ac_cv_attribute_malloc,
3463                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3464                                [],
3465                                ac_cv_attribute_malloc=yes,
3466                                ac_cv_attribute_malloc=no)])
3468 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3469                ac_cv_attribute_warn_unused,
3470                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3471                                [],
3472                                ac_cv_attribute_warn_unused=yes,
3473                                ac_cv_attribute_warn_unused=no)])
3475 dnl End of C++ language/feature checks
3476 AC_LANG_C
3478 dnl ========================================================
3479 dnl =  Internationalization checks
3480 dnl ========================================================
3482 dnl Internationalization and Locale support is different
3483 dnl on various UNIX platforms.  Checks for specific i18n
3484 dnl features go here.
3486 dnl check for LC_MESSAGES
3487 AC_CACHE_CHECK(for LC_MESSAGES,
3488                 ac_cv_i18n_lc_messages,
3489                 [AC_TRY_COMPILE([#include <locale.h>],
3490                                 [int category = LC_MESSAGES;],
3491                                 ac_cv_i18n_lc_messages=yes,
3492                                 ac_cv_i18n_lc_messages=no)])
3493 if test "$ac_cv_i18n_lc_messages" = yes; then
3494    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3497 AC_HAVE_FUNCS(localeconv)
3498 fi # ! SKIP_COMPILER_CHECKS
3500 TARGET_XPCOM_ABI=
3501 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3502     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3505 dnl Mozilla specific options
3506 dnl ========================================================
3507 dnl The macros used for command line options
3508 dnl are defined in build/autoconf/altoptions.m4.
3510 dnl If the compiler supports these attributes, define them as
3511 dnl convenience macros.
3512 if test "$ac_cv_attribute_malloc" = yes ; then
3513   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3514 else
3515   AC_DEFINE(NS_ATTR_MALLOC,)
3518 if test "$ac_cv_attribute_warn_unused" = yes ; then
3519   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3520 else
3521   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3524 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3525 dnl features that Windows actually does support.
3527 if test -n "$SKIP_COMPILER_CHECKS"; then
3528    dnl Windows has malloc.h
3529    AC_DEFINE(MALLOC_H, [<malloc.h>])
3530    AC_DEFINE(HAVE_FORCEINLINE)
3531    AC_DEFINE(HAVE_LOCALECONV)
3532 fi # SKIP_COMPILER_CHECKS
3534 dnl ========================================================
3535 dnl =
3536 dnl = Check for external package dependencies
3537 dnl =
3538 dnl ========================================================
3539 MOZ_ARG_HEADER(External Packages)
3541 MOZ_ARG_WITH_STRING(libxul-sdk,
3542 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3543   LIBXUL_SDK_DIR=$withval)
3545 if test "$LIBXUL_SDK_DIR" = "yes"; then
3546     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3547 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3548     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3550     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
3551         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
3552     fi
3555 AC_SUBST(LIBXUL_SDK)
3557 if test -n "$LIBXUL_SDK"; then
3558     LIBXUL_DIST="$LIBXUL_SDK"
3559 else
3560     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3562 AC_SUBST(LIBXUL_DIST)
3564 SYSTEM_LIBXUL=
3566 MOZ_ARG_WITH_BOOL(system-libxul,
3567 [  --with-system-libxul    Use system installed libxul SDK],
3568     SYSTEM_LIBXUL=1)
3570 dnl ========================================================
3571 dnl = If NSPR was not detected in the system,
3572 dnl = use the one in the source tree (mozilla/nsprpub)
3573 dnl ========================================================
3574 MOZ_ARG_WITH_BOOL(system-nspr,
3575 [  --with-system-nspr      Use system installed NSPR],
3576     _USE_SYSTEM_NSPR=1 )
3578 if test -n "$_USE_SYSTEM_NSPR"; then
3579     AM_PATH_NSPR(4.10.2, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3582 if test -n "$MOZ_NATIVE_NSPR"; then
3583     _SAVE_CFLAGS=$CFLAGS
3584     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3585     AC_TRY_COMPILE([#include "prtypes.h"],
3586                 [#ifndef PR_STATIC_ASSERT
3587                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
3588                  #endif],
3589                 [MOZ_NATIVE_NSPR=1],
3590                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
3591     AC_TRY_COMPILE([#include "prtypes.h"],
3592                 [#ifndef PR_UINT64
3593                  #error PR_UINT64 not defined or requires including prtypes.h
3594                  #endif],
3595                 [MOZ_NATIVE_NSPR=1],
3596                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
3597     CFLAGS=$_SAVE_CFLAGS
3598 else
3599     if test -z "$LIBXUL_SDK"; then
3600         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
3601         if test -n "$GNU_CC"; then
3602             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
3603         else
3604             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
3605         fi
3606     else
3607         NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
3608         NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
3609     fi
3612 dnl set GRE_MILESTONE
3613 dnl ========================================================
3614 if test -n "$LIBXUL_SDK"; then
3615     GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3616 else
3617     GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3619 AC_SUBST(GRE_MILESTONE)
3621 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3622 # The logic works like this:
3623 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3624 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3625 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3626 case "$GRE_MILESTONE" in
3627   *a1*)
3628       NIGHTLY_BUILD=1
3629       AC_DEFINE(NIGHTLY_BUILD)
3630       ;;
3631   *a*)
3632       ;;
3633   *)
3634       RELEASE_BUILD=1
3635       AC_DEFINE(RELEASE_BUILD)
3636       ;;
3637 esac
3638 AC_SUBST(NIGHTLY_BUILD)
3639 AC_SUBST(RELEASE_BUILD)
3641 dnl ========================================================
3642 dnl Disable compiling sources in unified mode.
3643 dnl ========================================================
3645 if test -z "$NIGHTLY_BUILD"; then
3646     MOZ_DISABLE_UNIFIED_COMPILATION=1
3649 MOZ_ARG_DISABLE_BOOL(unified-compilation,
3650 [  --disable-unified-compilation
3651                           Disable unified compilation of some C/C++ sources],
3652     MOZ_DISABLE_UNIFIED_COMPILATION=1,
3653     MOZ_DISABLE_UNIFIED_COMPILATION=)
3654 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
3656 dnl system libevent Support
3657 dnl ========================================================
3658 MOZ_ARG_WITH_STRING(system-libevent,
3659 [  --with-system-libevent[=PFX]
3660                           Use system libevent [installed at prefix PFX]],
3661     LIBEVENT_DIR=$withval)
3663 _SAVE_CFLAGS=$CFLAGS
3664 _SAVE_LDFLAGS=$LDFLAGS
3665 _SAVE_LIBS=$LIBS
3666 if test "$LIBEVENT_DIR" = yes; then
3667     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3668         MOZ_NATIVE_LIBEVENT=1,
3669         LIBEVENT_DIR=/usr)
3671 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3672     MOZ_NATIVE_LIBEVENT=
3673 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3674     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3675     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3676     MOZ_CHECK_HEADER(event.h,
3677         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3678              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3679          fi],
3680         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3681     AC_CHECK_LIB(event, event_init,
3682                  [MOZ_NATIVE_LIBEVENT=1
3683                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3684                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3685                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3687 CFLAGS=$_SAVE_CFLAGS
3688 LDFLAGS=$_SAVE_LDFLAGS
3689 LIBS=$_SAVE_LIBS
3691 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3692 AC_SUBST(MOZ_LIBEVENT_CFLAGS)
3693 AC_SUBST(MOZ_LIBEVENT_LIBS)
3695 dnl ========================================================
3696 dnl = If NSS was not detected in the system,
3697 dnl = use the one in the source tree (mozilla/security/nss)
3698 dnl ========================================================
3700 MOZ_ARG_WITH_BOOL(system-nss,
3701 [  --with-system-nss       Use system installed NSS],
3702     _USE_SYSTEM_NSS=1 )
3704 if test -n "$_USE_SYSTEM_NSS"; then
3705     AM_PATH_NSS(3.15.4, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3708 if test -n "$MOZ_NATIVE_NSS"; then
3709    NSS_LIBS="$NSS_LIBS -lcrmf"
3710 else
3711    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3713    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
3714        NSS_LIBS="\
3715         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3716         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3717         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3718         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3719         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3720    else
3721        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3722    fi
3725 dnl ======================
3726 dnl Detect yasm
3727 dnl ======================
3729 AC_MSG_CHECKING([for YASM assembler])
3730 AC_CHECK_PROGS(YASM, yasm, "")
3732 if test -n "$YASM"; then
3733   dnl Pull out yasm's version string
3734   YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3735   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3736   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3737   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3738   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3741 if test -z "$SKIP_LIBRARY_CHECKS"; then
3742 dnl system JPEG support
3743 dnl ========================================================
3744 MOZ_ARG_WITH_STRING(system-jpeg,
3745 [  --with-system-jpeg[=PFX]
3746                           Use system libjpeg [installed at prefix PFX]],
3747     JPEG_DIR=$withval)
3749 _SAVE_CFLAGS=$CFLAGS
3750 _SAVE_LDFLAGS=$LDFLAGS
3751 _SAVE_LIBS=$LIBS
3752 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3753     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3754     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3756 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3757     MOZ_NATIVE_JPEG=
3758 else
3759     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3762 if test "$MOZ_NATIVE_JPEG" = 1; then
3763     AC_TRY_COMPILE([ #include <stdio.h>
3764                      #include <sys/types.h>
3765                      #include <jpeglib.h> ],
3766                    [ #if JPEG_LIB_VERSION < $MOZJPEG
3767                      #error "Insufficient JPEG library version ($MOZJPEG required)."
3768                      #endif
3769                      #ifndef JCS_EXTENSIONS
3770                      #error "libjpeg-turbo JCS_EXTENSIONS required"
3771                      #endif
3772                      ],
3773                    MOZ_NATIVE_JPEG=1,
3774                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3776 CFLAGS=$_SAVE_CFLAGS
3777 LDFLAGS=$_SAVE_LDFLAGS
3778 LIBS=$_SAVE_LIBS
3780 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3781     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3782     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3784 fi # SKIP_LIBRARY_CHECKS
3786 dnl system ZLIB support
3787 dnl ========================================================
3788 MOZ_ZLIB_CHECK([1.2.3])
3790 if test "$MOZ_NATIVE_ZLIB" != 1; then
3791     MOZ_ZLIB_CFLAGS=
3792     MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
3795 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3796     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3799 MOZ_PNG_ARM_NEON=
3801 if test -z "$SKIP_LIBRARY_CHECKS"; then
3802 dnl system BZIP2 Support
3803 dnl ========================================================
3804 MOZ_ARG_WITH_STRING(system-bz2,
3805 [  --with-system-bz2[=PFX]
3806                           Use system libbz2 [installed at prefix PFX]],
3807     BZ2_DIR=$withval)
3809 _SAVE_CFLAGS=$CFLAGS
3810 _SAVE_LDFLAGS=$LDFLAGS
3811 _SAVE_LIBS=$LIBS
3812 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3813     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3814     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3816 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3817     MOZ_NATIVE_BZ2=
3818 else
3819     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3820         [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3822 CFLAGS=$_SAVE_CFLAGS
3823 LDFLAGS=$_SAVE_LDFLAGS
3824 LIBS=$_SAVE_LIBS
3826 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3827     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3828     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3831 dnl ========================================================
3832 dnl system PNG Support
3833 dnl ========================================================
3834 MOZ_ARG_WITH_STRING(system-png,
3835 [  --with-system-png[=PFX]
3836                           Use system libpng [installed at prefix PFX]],
3837     PNG_DIR=$withval)
3839 _SAVE_CFLAGS=$CFLAGS
3840 _SAVE_LDFLAGS=$LDFLAGS
3841 _SAVE_LIBS=$LIBS
3842 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3843     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3844     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3846 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3847     MOZ_NATIVE_PNG=
3848 else
3849     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3850                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3851     AC_CHECK_LIB(png, png_get_acTL, ,
3852                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3854 if test "$MOZ_NATIVE_PNG" = 1; then
3855     AC_TRY_COMPILE([ #include <stdio.h>
3856                      #include <sys/types.h>
3857                      #include <png.h> ],
3858                    [ #if PNG_LIBPNG_VER < $MOZPNG
3859                      #error "Insufficient libpng version ($MOZPNG required)."
3860                      #endif
3861                      #ifndef PNG_UINT_31_MAX
3862                      #error "Insufficient libpng version."
3863                      #endif ],
3864                    MOZ_NATIVE_PNG=1,
3865                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3867 CFLAGS=$_SAVE_CFLAGS
3868 LDFLAGS=$_SAVE_LDFLAGS
3869 LIBS=$_SAVE_LIBS
3871 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3872     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3873     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3876 MOZ_PNG_ARM_NEON_CHECK=
3877 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3878     MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3879         [  --enable-png-arm-neon-support=TYPE
3880              Options include:
3881                  no
3882                  check (default)
3883                  nocheck (faster but unsafe)],
3884         [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3885     case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3886         no)
3887             # enable-png-arm-neon-support = no
3888             ;;
3889         nocheck)
3890             # enable-png-arm-neon-support = nocheck
3891             MOZ_PNG_ARM_NEON=1
3892             ;;
3893         *)
3894             MOZ_PNG_ARM_NEON=1
3895             MOZ_PNG_ARM_NEON_CHECK=1
3896             ;;
3897     esac
3900 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3902 fi # SKIP_LIBRARY_CHECKS
3904 AC_SUBST(MOZ_PNG_ARM_NEON)
3906 dnl ========================================================
3907 dnl system HunSpell Support
3908 dnl ========================================================
3909 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3910 [  --enable-system-hunspell
3911                           Use system hunspell (located with pkgconfig)],
3912     MOZ_NATIVE_HUNSPELL=1 )
3914 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3915     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3918 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3920 dnl ========================================================
3921 dnl system libffi Support
3922 dnl ========================================================
3923 MOZ_ARG_ENABLE_BOOL(system-ffi,
3924 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
3925     MOZ_NATIVE_FFI=1 )
3927 if test -n "$MOZ_NATIVE_FFI"; then
3928     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
3929     # for non-GCC compilers.
3930     if test -z "$GNU_CC"; then
3931         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
3932     else
3933         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
3934     fi
3935     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
3938 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
3939 if test "$OS_ARCH" = "WINNT"; then
3940   JS_SHARED_LIBRARY=1
3943 MOZ_ARG_ENABLE_BOOL(shared-js,
3944 [  --enable-shared-js
3945                           Create a shared JavaScript library.],
3946     JS_SHARED_LIBRARY=1,
3947     JS_SHARED_LIBRARY=)
3949 dnl ========================================================
3950 dnl System ICU Support
3951 dnl ========================================================
3952 MOZ_NATIVE_ICU=
3953 MOZ_ARG_WITH_BOOL(system-icu,
3954 [  --with-system-icu
3955                           Use system ICU (located with pkgconfig)],
3956     MOZ_NATIVE_ICU=1)
3958 if test -n "$MOZ_NATIVE_ICU"; then
3959     PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
3960     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
3961     MOZ_SHARED_ICU=1
3964 AC_SUBST(MOZ_NATIVE_ICU)
3966 dnl ========================================================
3967 dnl Java SDK support
3968 dnl ========================================================
3970 JAVA_BIN_PATH=
3971 MOZ_ARG_WITH_STRING(java-bin-path,
3972 [  --with-java-bin-path=dir
3973                           Location of Java binaries (java, javac, jar)],
3974     JAVA_BIN_PATH=$withval)
3976 dnl ========================================================
3977 dnl =
3978 dnl = Application
3979 dnl =
3980 dnl ========================================================
3982 MOZ_ARG_HEADER(Application)
3984 ENABLE_TESTS=1
3985 ENABLE_SYSTEM_EXTENSION_DIRS=1
3986 MOZ_BRANDING_DIRECTORY=
3987 MOZ_OFFICIAL_BRANDING=
3988 MOZ_FEEDS=1
3989 MOZ_WEBAPP_RUNTIME=
3990 MOZ_JSDEBUGGER=1
3991 MOZ_AUTH_EXTENSION=1
3992 MOZ_OGG=1
3993 MOZ_RAW=
3994 MOZ_VORBIS=
3995 MOZ_TREMOR=
3996 MOZ_WAVE=1
3997 MOZ_SAMPLE_TYPE_FLOAT32=
3998 MOZ_SAMPLE_TYPE_S16=
3999 MOZ_OPUS=1
4000 MOZ_WEBM=1
4001 MOZ_DIRECTSHOW=
4002 MOZ_WMF=
4003 MOZ_FMP4=
4004 MOZ_WEBRTC=1
4005 MOZ_PEERCONNECTION=
4006 MOZ_SRTP=
4007 MOZ_WEBRTC_SIGNALING=
4008 MOZ_WEBRTC_ASSERT_ALWAYS=1
4009 MOZ_SCTP=
4010 MOZ_MEDIA_PLUGINS=
4011 MOZ_MEDIA_NAVIGATOR=
4012 MOZ_OMX_PLUGIN=
4013 MOZ_VPX=
4014 MOZ_VPX_ERROR_CONCEALMENT=
4015 MOZ_WEBSPEECH=1
4016 VPX_AS=
4017 VPX_ASFLAGS=
4018 VPX_AS_DASH_C_FLAG=
4019 VPX_AS_CONVERSION=
4020 VPX_ASM_SUFFIX=
4021 VPX_X86_ASM=
4022 VPX_ARM_ASM=
4023 LIBJPEG_TURBO_AS=
4024 LIBJPEG_TURBO_ASFLAGS=
4025 LIBJPEG_TURBO_X86_ASM=
4026 LIBJPEG_TURBO_X64_ASM=
4027 LIBJPEG_TURBO_ARM_ASM=
4028 MOZ_PERMISSIONS=1
4029 MOZ_PLACES=1
4030 MOZ_SOCIAL=1
4031 MOZ_PREF_EXTENSIONS=1
4032 MOZ_PROFILELOCKING=1
4033 MOZ_REFLOW_PERF=
4034 MOZ_SAFE_BROWSING=
4035 MOZ_HELP_VIEWER=
4036 MOZ_SPELLCHECK=1
4037 MOZ_ANDROID_OMTC=
4038 MOZ_TOOLKIT_SEARCH=1
4039 MOZ_UI_LOCALE=en-US
4040 MOZ_UNIVERSALCHARDET=1
4041 MOZ_URL_CLASSIFIER=
4042 MOZ_XUL=1
4043 MOZ_ZIPWRITER=1
4044 NS_PRINTING=1
4045 MOZ_PDF_PRINTING=
4046 MOZ_DISABLE_CRYPTOLEGACY=
4047 NSS_DISABLE_DBM=
4048 NECKO_COOKIES=1
4049 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
4050 if test -n "$MOZ_RTSP"; then
4051   NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
4053 USE_ARM_KUSER=
4054 BUILD_CTYPES=1
4055 MOZ_USE_NATIVE_POPUP_WINDOWS=
4056 MOZ_ANDROID_HISTORY=
4057 MOZ_WEBSMS_BACKEND=
4058 MOZ_ANDROID_BEAM=
4059 MOZ_ANDROID_SYNTHAPKS=
4060 ACCESSIBILITY=1
4061 MOZ_TIME_MANAGER=
4062 MOZ_PAY=
4063 MOZ_AUDIO_CHANNEL_MANAGER=
4064 NSS_NO_LIBPKIX=
4065 MOZ_CONTENT_SANDBOX=
4066 MOZ_CONTENT_SANDBOX_REPORTER=
4068 case "$target_os" in
4069     mingw*)
4070         NS_ENABLE_TSF=1
4071         AC_DEFINE(NS_ENABLE_TSF)
4072         ;;
4073 esac
4075 case "${target}" in
4076     *-android*|*-linuxandroid*)
4077         if test "$CPU_ARCH" = "arm" ; then
4078           USE_ARM_KUSER=1
4079         fi
4081         NSS_DISABLE_DBM=1
4082         MOZ_THEME_FASTSTRIPE=1
4083         MOZ_TREE_FREETYPE=1
4084         MOZ_MEMORY=1
4085         MOZ_RAW=1
4086         ;;
4088 esac
4090 MOZ_ARG_WITH_STRING(external-source-dir,
4091 [  --with-external-source-dir=dir
4092                           External directory containing additional build files.],
4093 [ EXTERNAL_SOURCE_DIR=$withval])
4094 AC_SUBST(EXTERNAL_SOURCE_DIR)
4096 MOZ_ARG_ENABLE_STRING(application,
4097 [  --enable-application=APP
4098                           Options include:
4099                             browser (Firefox)
4100                             xulrunner
4101                             tools/update-packaging (AUS-related packaging tools)],
4102 [ MOZ_BUILD_APP=$enableval ] )
4104 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4105 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4106   XULRUNNER_STUB_NAME=$withval)
4108 if test -z "$XULRUNNER_STUB_NAME"; then
4109   case "$target_os" in
4110   darwin*)
4111     XULRUNNER_STUB_NAME=xulrunner
4112     ;;
4113   *)
4114     XULRUNNER_STUB_NAME=xulrunner-stub
4115   esac
4117 AC_SUBST(XULRUNNER_STUB_NAME)
4119 AC_MSG_CHECKING([for application to build])
4120 if test -z "$MOZ_BUILD_APP"; then
4121   AC_MSG_RESULT([browser])
4122   MOZ_BUILD_APP=browser
4123 else
4124   # "mobile" no longer exists.
4125   if test "$MOZ_BUILD_APP" = "mobile" ; then
4126     AC_MSG_RESULT([none])
4127     AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4128   fi
4129   # We have a valid application only if it has a build.mk file in its top
4130   # directory.
4131   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4132     AC_MSG_RESULT([none])
4133     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4134   else
4135     AC_MSG_RESULT([$MOZ_BUILD_APP])
4136   fi
4139 # The app update channel is 'default' when not supplied. The value is used in
4140 # the application's confvars.sh so it must be set before confvars.sh is called.
4141 MOZ_ARG_ENABLE_STRING([update-channel],
4142 [  --enable-update-channel=CHANNEL
4143                           Select application update channel (default=default)],
4144     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4146 if test -z "$MOZ_UPDATE_CHANNEL"; then
4147     MOZ_UPDATE_CHANNEL=default
4149 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4150 AC_SUBST(MOZ_UPDATE_CHANNEL)
4152 # Allow to specify a Google API key file that contains the secret key to be
4153 # used for various Google API requests.
4154 MOZ_ARG_WITH_STRING(google-api-keyfile,
4155 [  --with-google-api-keyfile=file   Use the secret key contained in the given keyfile for Google API requests],
4156   MOZ_GOOGLE_API_KEY=`cat $withval`)
4157 if test -z "$MOZ_GOOGLE_API_KEY"; then
4158     MOZ_GOOGLE_API_KEY=no-google-api-key
4160 AC_SUBST(MOZ_GOOGLE_API_KEY)
4162 # Allow the application to influence configure with a confvars.sh script.
4163 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4164 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4165   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4166   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4167 else
4168   AC_MSG_RESULT([no])
4171 # Allow influencing configure with a defines.sh script.
4172 . "${srcdir}/build/defines.sh"
4174 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4175 # set in defines.sh
4176 if test "$BUILDING_RELEASE"; then
4177   # Override value in defines.sh, if any
4178   EARLY_BETA_OR_EARLIER=
4179 elif test "$EARLY_BETA_OR_EARLIER"; then
4180   AC_DEFINE(EARLY_BETA_OR_EARLIER)
4182 AC_SUBST(EARLY_BETA_OR_EARLIER)
4184 # Allow the application to provide a subconfigure script
4185 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4186   do_output_subdirs() {
4187     if test -n "$_subconfigure_subdirs"; then
4188       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4189      fi
4190     _subconfigure_subdir="$1"
4191     _subconfigure_config_args="$ac_configure_args"
4192   }
4193   tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4194   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4195      "${srcdir}/build/autoconf/altoptions.m4" \
4196      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4197   . $tmpscript
4198   rm -f $tmpscript
4201 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4202 MOZ_ARG_WITH_STRING(app-name,
4203 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4204 WITH_APP_NAME=$withval,
4207 if test -n "$WITH_APP_NAME" ; then
4208     MOZ_APP_NAME="$WITH_APP_NAME"
4211 MOZ_ARG_WITH_STRING(app-basename,
4212 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4213 WITH_APP_BASENAME=$withval,
4216 if test -n "$WITH_APP_BASENAME" ; then
4217     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4220 # Now is a good time to test for logic errors, define mismatches, etc.
4221 case "$MOZ_BUILD_APP" in
4222 xulrunner)
4223   if test "$LIBXUL_SDK"; then
4224     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4225   fi
4226   ;;
4227 esac
4229 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4230 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4231 # MOZ_BUILD_APP.
4232 case "$MOZ_BUILD_APP" in
4233 browser)
4234   AC_DEFINE(MOZ_PHOENIX)
4235   ;;
4237 xulrunner)
4238   AC_DEFINE(MOZ_XULRUNNER)
4239   ;;
4240 b2g)
4241   AC_DEFINE(MOZ_B2G)
4242   ;;
4243 esac
4245 AC_SUBST(MOZ_BUILD_APP)
4246 AC_SUBST(MOZ_PHOENIX)
4247 AC_SUBST(MOZ_XULRUNNER)
4248 AC_SUBST(MOZ_B2G)
4250 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4252 dnl ========================================================
4253 dnl Check android sdk version depending on mobile target
4254 dnl ========================================================
4256 if test -z "$gonkdir" ; then
4257     # Minimum Android SDK API Level we require.
4258     case "$MOZ_BUILD_APP" in
4259     mobile/android)
4260         android_min_api_level=16
4261         case "$target" in
4262         *-android*|*-linuxandroid*)
4263             :
4264             ;;
4265         *)
4266             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])
4267             ;;
4268         esac
4269         ;;
4270     esac
4272     MOZ_ANDROID_SDK($android_min_api_level)
4275 dnl ========================================================
4276 dnl =
4277 dnl = Toolkit Options
4278 dnl =
4279 dnl ========================================================
4280 MOZ_ARG_HEADER(Toolkit Options)
4282     dnl ========================================================
4283     dnl = Select the default toolkit
4284     dnl ========================================================
4285         MOZ_ARG_ENABLE_STRING(default-toolkit,
4286         [  --enable-default-toolkit=TK
4287                           Select default toolkit
4288                           Platform specific defaults:
4289                             Mac OS X - cairo-cocoa
4290                             OS/2 - cairo-os2
4291                             Win32 - cairo-windows
4292                             * - cairo-gtk2
4293                             * - cairo-gtk3
4294                             * - cairo-qt],
4295     [ _DEFAULT_TOOLKIT=$enableval ],
4296     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4298     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4299         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4300         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4301         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4302         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4303         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4304         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4305         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4306         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4307         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4308     then
4309         dnl nglayout only supports building with one toolkit,
4310         dnl so ignore everything after the first comma (",").
4311         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4312     else
4313         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4314     fi
4316 MOZ_ARG_WITHOUT_BOOL(x,
4317 [  --without-x              Build without X11],
4318     WITHOUT_X11=1)
4320 dnl ========================================================
4321 dnl = Enable the toolkit as needed                         =
4322 dnl ========================================================
4324 MOZ_WIDGET_GTK=
4326 case "$MOZ_WIDGET_TOOLKIT" in
4328 cairo-windows)
4329     MOZ_WIDGET_TOOLKIT=windows
4330     MOZ_WEBGL=1
4331     MOZ_PDF_PRINTING=1
4332     MOZ_INSTRUMENT_EVENT_LOOP=1
4333     if test -n "$GNU_CC"; then
4334         MOZ_FOLD_LIBS=
4335     fi
4336     ;;
4338 cairo-gtk3)
4339     MOZ_WIDGET_TOOLKIT=gtk3
4340     MOZ_ENABLE_GTK=1
4341     MOZ_ENABLE_GTK3=1
4342     MOZ_ENABLE_XREMOTE=1
4343     MOZ_WEBGL=1
4344     MOZ_GL_DEFAULT_PROVIDER=GLX
4346     AC_DEFINE(MOZ_X11)
4347     MOZ_X11=1
4348     USE_FC_FREETYPE=1
4350     TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4351     TK_LIBS='$(MOZ_GTK3_LIBS)'
4352     MOZ_WIDGET_GTK=3
4353     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4354     MOZ_PDF_PRINTING=1
4355     MOZ_INSTRUMENT_EVENT_LOOP=1
4356     ;;
4358 cairo-gtk2|cairo-gtk2-x11)
4359     MOZ_WIDGET_TOOLKIT=gtk2
4360     MOZ_ENABLE_GTK=1
4361     MOZ_ENABLE_GTK2=1
4362     MOZ_ENABLE_XREMOTE=1
4363     MOZ_WEBGL=1
4364     MOZ_GL_DEFAULT_PROVIDER=GLX
4366     AC_DEFINE(MOZ_X11)
4367     MOZ_X11=1
4368     USE_FC_FREETYPE=1
4370     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4371     TK_LIBS='$(MOZ_GTK2_LIBS)'
4372     AC_DEFINE(MOZ_WIDGET_GTK2)
4373     MOZ_WIDGET_GTK=2
4374     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4375     MOZ_PDF_PRINTING=1
4376     MOZ_INSTRUMENT_EVENT_LOOP=1
4377     ;;
4379 cairo-qt)
4380     MOZ_WIDGET_TOOLKIT=qt
4381     MOZ_ENABLE_QT=1
4382     if test -z "$WITHOUT_X11"; then
4383       MOZ_ENABLE_XREMOTE=1
4384       MOZ_GL_DEFAULT_PROVIDER=GLX
4385       MOZ_X11=1
4386       AC_DEFINE(MOZ_X11)
4387       XT_LIBS=
4388     fi
4390     MOZ_WEBGL=1
4391     USE_FC_FREETYPE=1
4392     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4393     TK_LIBS='$(MOZ_QT_LIBS)'
4394     AC_DEFINE(MOZ_WIDGET_QT)
4395     MOZ_PDF_PRINTING=1
4396     AC_DEFINE(QT_NO_KEYWORDS)
4397     ;;
4399 cairo-os2)
4400     MOZ_WIDGET_TOOLKIT=os2
4401     USE_FC_FREETYPE=1
4402     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4403     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4404     MOZ_PDF_PRINTING=1
4405     ;;
4407 cairo-cocoa)
4408     MOZ_WIDGET_TOOLKIT=cocoa
4409     AC_DEFINE(MOZ_WIDGET_COCOA)
4410     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4411     TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4412     TK_CFLAGS="-DNO_X11"
4413     CFLAGS="$CFLAGS $TK_CFLAGS"
4414     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4415     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4416     MOZ_USER_DIR="Mozilla"
4417     MOZ_FS_LAYOUT=bundle
4418     MOZ_WEBGL=1
4419     MOZ_INSTRUMENT_EVENT_LOOP=1
4420     ;;
4422 cairo-uikit)
4423     MOZ_WIDGET_TOOLKIT=uikit
4424     AC_DEFINE(MOZ_WIDGET_UIKIT)
4425     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4426     TK_CFLAGS="-DNO_X11"
4427     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4428     CFLAGS="$CFLAGS $TK_CFLAGS"
4429     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4430     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
4431     MOZ_USER_DIR="Mozilla"
4432     MOZ_FS_LAYOUT=bundle
4433     ;;
4435 cairo-android)
4436     AC_DEFINE(MOZ_WIDGET_ANDROID)
4437     MOZ_WIDGET_TOOLKIT=android
4438     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4439     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4440     MOZ_WEBGL=1
4441     MOZ_PDF_PRINTING=1
4442     MOZ_INSTRUMENT_EVENT_LOOP=1
4443     ;;
4445 cairo-gonk)
4446     XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
4447     AC_DEFINE(MOZ_WIDGET_GONK)
4448     AC_DEFINE(MOZ_TOUCH)
4449     MOZ_WIDGET_TOOLKIT=gonk
4450     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4451     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4452     MOZ_WEBGL=1
4453     MOZ_PDF_PRINTING=1
4454     MOZ_TOUCH=1
4455     ;;
4457 esac
4459 AC_SUBST(MOZ_PDF_PRINTING)
4460 if test "$MOZ_PDF_PRINTING"; then
4461    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4462    AC_DEFINE(MOZ_PDF_PRINTING)
4465 if test "$MOZ_ENABLE_XREMOTE"; then
4466     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4469 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4470    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4473 if test "$COMPILE_ENVIRONMENT"; then
4474   if test "$MOZ_ENABLE_GTK3"; then
4475     PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4476   fi
4477   if test "$MOZ_ENABLE_GTK2"; then
4478     if test "$MOZ_X11"; then
4479       GDK_PACKAGES=gdk-x11-2.0
4480     fi
4482     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4483   fi
4485 fi # COMPILE_ENVIRONMENT
4487 AC_SUBST(MOZ_FS_LAYOUT)
4489 dnl ========================================================
4490 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4491 dnl their usage and use them in spidermonkey.
4492 dnl ========================================================
4493 MOZ_ARG_WITH_BOOL(arm-kuser,
4494 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4495     USE_ARM_KUSER=1,)
4496 if test -n "$USE_ARM_KUSER"; then
4497    AC_DEFINE(USE_ARM_KUSER)
4500 dnl ========================================================
4501 dnl = startup-notification support module
4502 dnl ========================================================
4504 if test "$MOZ_ENABLE_GTK"
4505 then
4506     MOZ_ENABLE_STARTUP_NOTIFICATION=
4508     MOZ_ARG_ENABLE_BOOL(startup-notification,
4509     [  --enable-startup-notification
4510                           Enable startup-notification support (default: disabled) ],
4511         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4512         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4513     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4514     then
4515         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4516                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4517         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4518             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4519             then
4520                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4521             fi
4522             MOZ_ENABLE_STARTUP_NOTIFICATION=
4523         ])
4524     fi
4526     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4527         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4528     fi
4530     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4532 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4533 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4534 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4536 dnl ========================================================
4537 dnl = QT support
4538 dnl ========================================================
4539 if test "$MOZ_ENABLE_QT"
4540 then
4541     MOZ_ARG_WITH_STRING(qtdir,
4542     [  --with-qtdir=\$dir       Specify Qt directory ],
4543     [ QTDIR=$withval])
4545     if test -z "$QTDIR"; then
4546         AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4547     else
4548         HOST_QMAKE="$QTDIR/bin/qmake"
4549     fi
4550     QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4552     if test -z "$QTDIR"; then
4553         case $QT_VERSION in
4554         5.*)
4555             AC_MSG_RESULT("Using qt5: $QT_VERSION")
4556             PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5OpenGL Qt5Widgets Qt5PrintSupport, ,
4557             [
4558               AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4559             ])
4560             QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4561             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4562             ;;
4563         4.*)
4564             AC_MSG_RESULT("Using qt4: $QT_VERSION")
4565             PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL, ,
4566             [
4567               AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt4 development package, (On Ubuntu, you might try installing the packages libqt4-dev libqt4-opengl-dev.)])
4568             ])
4569             ;;
4570         *)
4571             AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4572             ;;
4573         esac
4575         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4576         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4577     else
4578         MOZ_QT_CFLAGS="-DQT_SHARED"
4579         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4580         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4581         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4582         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4583         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4584         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4586         case $QT_VERSION in
4587         5.*)
4588             AC_MSG_RESULT("Using qt5: $QT_VERSION")
4589             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
4590             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4591             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4592             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4593             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4594             ;;
4595         4.*)
4596             AC_MSG_RESULT("Using qt4: $QT_VERSION")
4597             MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4598             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4599             ;;
4600         *)
4601             AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4602             ;;
4603         esac
4605         HOST_MOC="$QTDIR/bin/moc"
4606         HOST_RCC="$QTDIR/bin/rcc"
4607     fi
4608     if test -z "$HOST_MOC"; then
4609         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4610 incorrect])
4611     fi
4612     if test -z "$HOST_RCC"; then
4613         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4614 incorrect])
4615     fi
4617     MOC=$HOST_MOC
4618     RCC=$HOST_RCC
4620     MOZ_ENABLE_QMSYSTEM2=
4621     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4622                       MOZ_ENABLE_QMSYSTEM2=1,
4623                       MOZ_ENABLE_QMSYSTEM2=)
4625     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4626       MOZ_ENABLE_QMSYSTEM2=1
4627       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4628       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4629       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4630     fi
4632     MOZ_ENABLE_QTNETWORK=
4633     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4634                       MOZ_ENABLE_QTNETWORK=1,
4635                       MOZ_ENABLE_QTNETWORK=)
4637     if test "$MOZ_ENABLE_QTNETWORK"; then
4638       MOZ_ENABLE_QTNETWORK=1
4639       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4640     fi
4642     MOZ_ENABLE_QTMOBILITY=
4643     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4644                       MOZ_ENABLE_QTMOBILITY=1,
4645                       MOZ_ENABLE_QTMOBILITY=)
4646     if test "$MOZ_ENABLE_QTMOBILITY"; then
4647        MOZ_ENABLE_QTMOBILITY=1
4648        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4649        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4650        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4651        AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4652     else
4653        AC_CHECK_LIB(QtSensors, main, [
4654           MOZ_ENABLE_QTMOBILITY=1
4655           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4656           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4657           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4658           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4659           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4660        ])
4661     fi
4663     if test "$MOZ_ENABLE_CONTENTACTION"; then
4664       MOZ_ENABLE_CONTENTACTION=1
4665       AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4666     fi
4668     MOZ_ENABLE_CONTENTACTION=
4669     PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4670     if test "$MOZ_ENABLE_CONTENTACTION"; then
4671        MOZ_ENABLE_CONTENTACTION=1
4672        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4673        MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4674        AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4675        AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4676     fi
4679 AC_SUBST(GTK_CONFIG)
4680 AC_SUBST(TK_CFLAGS)
4681 AC_SUBST(TK_LIBS)
4683 AC_SUBST(MOZ_ENABLE_GTK2)
4684 AC_SUBST(MOZ_ENABLE_GTK3)
4685 AC_SUBST(MOZ_ENABLE_GTK)
4686 AC_SUBST(MOZ_ENABLE_QT)
4687 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4688 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4689 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4690 AC_SUBST(MOZ_ENABLE_XREMOTE)
4691 AC_SUBST(MOZ_GTK2_CFLAGS)
4692 AC_SUBST(MOZ_GTK2_LIBS)
4693 AC_SUBST(MOZ_GTK3_CFLAGS)
4694 AC_SUBST(MOZ_GTK3_LIBS)
4695 AC_SUBST(MOZ_WIDGET_GTK)
4696 AC_SUBST(MOZ_QT_CFLAGS)
4697 AC_SUBST(MOZ_QT_LIBS)
4699 AC_SUBST(MOC)
4700 AC_SUBST(RCC)
4702 AC_SUBST(MOZ_X11)
4704 dnl ========================================================
4705 dnl =
4706 dnl = Components & Features
4707 dnl =
4708 dnl ========================================================
4709 MOZ_ARG_HEADER(Components and Features)
4711 dnl ========================================================
4712 dnl = Localization
4713 dnl ========================================================
4714 MOZ_ARG_ENABLE_STRING(ui-locale,
4715 [  --enable-ui-locale=ab-CD
4716                           Select the user interface locale (default: en-US)],
4717     MOZ_UI_LOCALE=$enableval )
4718 AC_SUBST(MOZ_UI_LOCALE)
4720 dnl ========================================================
4721 dnl = Trademarked Branding
4722 dnl ========================================================
4723 MOZ_ARG_ENABLE_BOOL(official-branding,
4724 [  --enable-official-branding
4725                           Enable Official mozilla.org Branding
4726                           Do not distribute builds with
4727                           --enable-official-branding unless you have
4728                           permission to use trademarks per
4729                           http://www.mozilla.org/foundation/trademarks/ .],
4731   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4732     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4733   else
4734     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4735     MOZ_OFFICIAL_BRANDING=1
4736   fi
4737 ], MOZ_OFFICIAL_BRANDING=)
4739 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4740 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4741   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4744 MOZ_ARG_WITH_STRING(branding,
4745 [  --with-branding=dir     Use branding from the specified directory.],
4746     MOZ_BRANDING_DIRECTORY=$withval)
4748 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4749 if test -z "$REAL_BRANDING_DIRECTORY"; then
4750   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4753 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4754   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4757 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4759 dnl ========================================================
4760 dnl = Distribution ID
4761 dnl ========================================================
4762 MOZ_ARG_WITH_STRING(distribution-id,
4763 [  --with-distribution-id=ID
4764                           Set distribution-specific id (default=org.mozilla)],
4765 [ val=`echo $withval`
4766     MOZ_DISTRIBUTION_ID="$val"])
4768 if test -z "$MOZ_DISTRIBUTION_ID"; then
4769    MOZ_DISTRIBUTION_ID="org.mozilla"
4772 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4773 AC_SUBST(MOZ_DISTRIBUTION_ID)
4776 dnl ========================================================
4777 dnl = Pango
4778 dnl ========================================================
4779 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4780 then
4781     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4783     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4784     AC_SUBST(MOZ_PANGO_CFLAGS)
4785     AC_SUBST(MOZ_PANGO_LIBS)
4788 dnl ========================================================
4789 dnl = GnomeVFS, GIO and GConf support module
4790 dnl ========================================================
4792 if test "$MOZ_X11"
4793 then
4794     dnl build the GIO extension by default only when the
4795     dnl GTK2 toolkit is in use.
4796     if test "$MOZ_ENABLE_GTK"
4797     then
4798         MOZ_ENABLE_GIO=1
4799         MOZ_ENABLE_GCONF=1
4800     fi
4802     dnl ========================================================
4803     dnl = GnomeVFS support module
4804     dnl ========================================================
4805     MOZ_ARG_ENABLE_BOOL(gnomevfs,
4806     [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
4807         MOZ_ENABLE_GNOMEVFS=force,
4808         MOZ_ENABLE_GNOMEVFS=)
4810     if test "$MOZ_ENABLE_GNOMEVFS"
4811     then
4812         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4813             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4814             MOZ_ENABLE_GNOMEVFS=1
4815             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4816         ],[
4817             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4818             then
4819                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4820             fi
4821             MOZ_ENABLE_GNOMEVFS=
4822         ])
4823     fi
4825     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4826     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4827     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4829     dnl ========================================================
4830     dnl = GIO support module
4831     dnl ========================================================
4832     MOZ_ARG_DISABLE_BOOL(gio,
4833     [  --disable-gio           Disable GIO support],
4834         MOZ_ENABLE_GIO=,
4835         MOZ_ENABLE_GIO=force)
4837     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4838     then
4839         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4840                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4841         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4842             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4843             MOZ_ENABLE_GIO=1
4844             AC_DEFINE(MOZ_ENABLE_GIO)
4845         ],[
4846             if test "$MOZ_ENABLE_GIO" = "force"
4847             then
4848                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4849             fi
4850             MOZ_ENABLE_GIO=
4851         ])
4852     fi
4854     AC_SUBST(MOZ_ENABLE_GIO)
4855     AC_SUBST(MOZ_GIO_CFLAGS)
4856     AC_SUBST(MOZ_GIO_LIBS)
4858     dnl ========================================================
4859     dnl = GConf support module
4860     dnl ========================================================
4861     MOZ_ARG_DISABLE_BOOL(gconf,
4862     [  --disable-gconf      Disable Gconf support ],
4863         MOZ_ENABLE_GCONF=,
4864         MOZ_ENABLE_GCONF=force)
4866     if test "$MOZ_ENABLE_GCONF"
4867     then
4868         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4869             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4870             MOZ_ENABLE_GCONF=1
4871         ],[
4872             if test "$MOZ_ENABLE_GCONF" = "force"
4873             then
4874                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4875             fi
4876             MOZ_ENABLE_GCONF=
4877         ])
4878     fi
4880     if test "$MOZ_ENABLE_GCONF"; then
4881         AC_DEFINE(MOZ_ENABLE_GCONF)
4882     fi
4884     AC_SUBST(MOZ_ENABLE_GCONF)
4885     AC_SUBST(MOZ_GCONF_CFLAGS)
4886     AC_SUBST(MOZ_GCONF_LIBS)
4889 dnl ========================================================
4890 dnl = libproxy support
4891 dnl ========================================================
4893 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4894 then
4895     MOZ_ENABLE_LIBPROXY=
4897     MOZ_ARG_ENABLE_BOOL(libproxy,
4898     [  --enable-libproxy         Enable libproxy support ],
4899     MOZ_ENABLE_LIBPROXY=1,
4900     MOZ_ENABLE_LIBPROXY=)
4902     if test "$MOZ_ENABLE_LIBPROXY"
4903     then
4904         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4905         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4906     fi
4908 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4909 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
4910 AC_SUBST(MOZ_LIBPROXY_LIBS)
4912 dnl ========================================================
4913 dnl = GNOME component (mozgnome)
4914 dnl ========================================================
4916 if test "$MOZ_ENABLE_GTK2"
4917 then
4918     MOZ_ENABLE_GNOME_COMPONENT=1
4920 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4922 dnl ========================================================
4923 dnl = libgnomeui support module
4924 dnl ========================================================
4926 if test "$MOZ_ENABLE_GTK"
4927 then
4928     MOZ_ARG_ENABLE_BOOL(gnomeui,
4929     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
4930         MOZ_ENABLE_GNOMEUI=force,
4931         MOZ_ENABLE_GNOMEUI=)
4933     if test "$MOZ_ENABLE_GNOMEUI"
4934     then
4935         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4936         [
4937             MOZ_ENABLE_GNOMEUI=1
4938         ],[
4939             if test "$MOZ_ENABLE_GNOMEUI" = "force"
4940             then
4941                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4942             fi
4943             MOZ_ENABLE_GNOMEUI=
4944         ])
4945     fi
4947     if test "$MOZ_ENABLE_GNOMEUI"; then
4948         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4949     fi
4952 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4953 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
4955 dnl ========================================================
4956 dnl = dbus support
4957 dnl ========================================================
4959 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4960 then
4961     MOZ_ENABLE_DBUS=1
4963     MOZ_ARG_DISABLE_BOOL(dbus,
4964     [  --disable-dbus          Disable dbus support ],
4965         MOZ_ENABLE_DBUS=,
4966         MOZ_ENABLE_DBUS=1)
4968     if test "$MOZ_ENABLE_DBUS"
4969     then
4970         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4971         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4972         AC_DEFINE(MOZ_ENABLE_DBUS)
4973     fi
4975 AC_SUBST(MOZ_ENABLE_DBUS)
4976 AC_SUBST(MOZ_DBUS_CFLAGS)
4977 AC_SUBST(MOZ_DBUS_LIBS)
4978 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
4979 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
4981 dnl ========================================================
4982 dnl = Enable Android History instead of Places
4983 dnl ========================================================
4984 if test -n "$MOZ_ANDROID_HISTORY"; then
4985     if test -z "$MOZ_PLACES"; then
4986         AC_DEFINE(MOZ_ANDROID_HISTORY)
4987     else
4988         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4989     fi
4992 dnl ========================================================
4993 dnl = Build with the Android compositor
4994 dnl ========================================================
4995 if test -n "$MOZ_ANDROID_OMTC"; then
4996      dnl Do this if defined in confvars.sh
4997      AC_DEFINE(MOZ_ANDROID_OMTC)
5000 dnl ========================================================
5001 dnl = Disable WebSMS backend
5002 dnl ========================================================
5003 MOZ_ARG_DISABLE_BOOL(websms-backend,
5004 [  --disable-websms-backend
5005                            Disable WebSMS backend],
5006     MOZ_WEBSMS_BACKEND=,
5007     MOZ_WEBSMS_BACKEND=1)
5009 if test -n "$MOZ_WEBSMS_BACKEND"; then
5010     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5013 dnl ========================================================
5014 dnl = Enable NFC permission on Android
5015 dnl ========================================================
5016 if test -n "$MOZ_ANDROID_BEAM"; then
5017     AC_DEFINE(MOZ_ANDROID_BEAM)
5020 dnl ========================================================
5021 dnl = Synthesized Webapp APKs on Android
5022 dnl ========================================================
5023 MOZ_ARG_ENABLE_BOOL(android-synthapks,
5024 [  --enable-android-synthapks       Enable synthesized APKs],
5025     MOZ_ANDROID_SYNTHAPKS=1,
5026     MOZ_ANDROID_SYNTHAPKS=)
5028 if test -n "$MOZ_ANDROID_SYNTHAPKS"; then
5029     AC_DEFINE(MOZ_ANDROID_SYNTHAPKS)
5032 dnl ========================================================
5033 dnl = JS Debugger XPCOM component (js/jsd)
5034 dnl ========================================================
5035 MOZ_ARG_DISABLE_BOOL(jsd,
5036 [  --disable-jsd           Disable JavaScript debug library],
5037     MOZ_JSDEBUGGER=,
5038     MOZ_JSDEBUGGER=1)
5041 dnl ========================================================
5042 dnl = Enable IPDL's "expensive" unit tests
5043 dnl ========================================================
5044 MOZ_IPDL_TESTS=
5046 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5047 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5048     MOZ_IPDL_TESTS=1,
5049     MOZ_IPDL_TESTS=)
5051 if test -n "$MOZ_IPDL_TESTS"; then
5052     AC_DEFINE(MOZ_IPDL_TESTS)
5055 AC_SUBST(MOZ_IPDL_TESTS)
5057 dnl ========================================================
5058 dnl = Disable building dbm
5059 dnl ========================================================
5060 MOZ_ARG_DISABLE_BOOL(dbm,
5061 [  --disable-dbm           Disable building dbm],
5062     NSS_DISABLE_DBM=1,
5063     NSS_DISABLE_DBM=)
5065 dnl bi-directional support always on
5066 IBMBIDI=1
5067 AC_DEFINE(IBMBIDI)
5069 dnl ========================================================
5070 dnl accessibility support on by default on all platforms
5071 dnl ========================================================
5072 MOZ_ARG_DISABLE_BOOL(accessibility,
5073 [  --disable-accessibility Disable accessibility support],
5074     ACCESSIBILITY=,
5075     ACCESSIBILITY=1 )
5076 if test "$ACCESSIBILITY"; then
5077     case "$target" in
5078     *-mingw*)
5079         if test -z "$MIDL"; then
5080             if test "$GCC" != "yes"; then
5081                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5082             else
5083                 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.])
5084             fi
5085         fi
5086     esac
5087     AC_DEFINE(ACCESSIBILITY)
5090 dnl ========================================================
5091 dnl Accessibility is required for the linuxgl widget
5092 dnl backend
5093 dnl ========================================================
5094 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5095     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5098 dnl ========================================================
5099 dnl Disable printing
5100 dnl ========================================================
5101 MOZ_ARG_DISABLE_BOOL(printing,
5102 [  --disable-printing      Disable printing support],
5103     NS_PRINTING=,
5104     NS_PRINTING=1)
5106 if test "$NS_PRINTING"; then
5107     AC_DEFINE(NS_PRINTING)
5108     AC_DEFINE(NS_PRINT_PREVIEW)
5111 dnl Turn off webrtc for OS's we don't handle yet, but allow 
5112 dnl --enable-webrtc to override.  Can disable for everything in
5113 dnl the master list above.
5114 if test -n "$MOZ_WEBRTC"; then
5115     case "$target" in
5116     *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
5117         dnl Leave enabled
5118         ;;
5119     *)
5120         dnl default to disabled for all others
5121         MOZ_WEBRTC=
5122         ;;
5123     esac
5126 AC_TRY_COMPILE([#include <linux/ethtool.h>],
5127                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
5128                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
5130 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
5132 # target_arch is from {ia32|x64|arm|ppc}
5133 case "$CPU_ARCH" in
5134 x86_64 | arm | x86 | ppc* | ia64)
5135     :
5136     ;;
5138 # unsupported arch for webrtc
5139     MOZ_WEBRTC=
5140     ;;
5142 esac
5144 dnl ========================================================
5145 dnl = Disable WebRTC code
5146 dnl ========================================================
5147 MOZ_ARG_DISABLE_BOOL(webrtc,
5148 [  --disable-webrtc        Disable support for WebRTC],
5149     MOZ_WEBRTC=,
5150     MOZ_WEBRTC=1)
5152 if test -n "$MOZ_WEBRTC"; then
5153     AC_DEFINE(MOZ_WEBRTC)
5154     dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5155     dnl opt/production builds (via MOZ_CRASH())
5156     AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5157     MOZ_RAW=1
5158     MOZ_VPX=1
5159     MOZ_VPX_ERROR_CONCEALMENT=1
5161 dnl enable once Signaling lands
5162     MOZ_WEBRTC_SIGNALING=1
5163     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5164 dnl enable once PeerConnection lands
5165     MOZ_PEERCONNECTION=1
5166     AC_DEFINE(MOZ_PEERCONNECTION)
5167     MOZ_SCTP=1
5168     MOZ_SRTP=1
5169     AC_DEFINE(MOZ_SCTP)
5170     AC_DEFINE(MOZ_SRTP)
5173 AC_SUBST(MOZ_WEBRTC)
5174 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5175 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5176 AC_SUBST(MOZ_PEERCONNECTION)
5177 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5178 AC_SUBST(MOZ_SCTP)
5179 AC_SUBST(MOZ_SRTP)
5181 dnl Use integers over floats for audio on B2G and Android, because audio
5182 dnl backends for those platforms don't support floats.
5183 if test "$OS_TARGET" = "Android"; then
5184     MOZ_SAMPLE_TYPE_S16=1
5185     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5186     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5187 else
5188     MOZ_SAMPLE_TYPE_FLOAT32=1
5189     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5190     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5193 dnl ========================================================
5194 dnl = Disable Speech API code
5195 dnl ========================================================
5196 MOZ_ARG_DISABLE_BOOL(webspeech,
5197 [  --disable-webspeech        Disable support for HTML Speech API],
5198     MOZ_WEBSPEECH=,
5199     MOZ_WEBSPEECH=1)
5201 if test -n "$MOZ_WEBSPEECH"; then
5202     AC_DEFINE(MOZ_WEBSPEECH)
5205 AC_SUBST(MOZ_WEBSPEECH)
5207 dnl ========================================================
5208 dnl = Enable Raw Codecs
5209 dnl ========================================================
5210 MOZ_ARG_ENABLE_BOOL(raw,
5211 [  --enable-raw           Enable support for RAW media],
5212     MOZ_RAW=1,
5213     MOZ_RAW=)
5215 if test -n "$MOZ_RAW"; then
5216     AC_DEFINE(MOZ_RAW)
5219 AC_SUBST(MOZ_RAW)
5221 dnl ========================================================
5222 dnl = Disable Ogg Codecs
5223 dnl ========================================================
5224 MOZ_ARG_DISABLE_BOOL(ogg,
5225 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5226     MOZ_OGG=,
5227     MOZ_OGG=1)
5229 if test -n "$MOZ_OGG"; then
5230     AC_DEFINE(MOZ_OGG)
5232     dnl Checks for __attribute__(aligned()) directive
5233     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5234         [ac_cv_c_attribute_aligned],
5235         [ac_cv_c_attribute_aligned=0
5236          CFLAGS_save="${CFLAGS}"
5237          CFLAGS="${CFLAGS} -Werror"
5238          for ac_cv_c_attr_align_try in 64 32 16 8; do
5239            echo "trying $ac_cv_c_attr_align_try"
5240            AC_TRY_COMPILE([],
5241                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5242                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5243            if test "$ac_cv_c_attribute_aligned" != 0; then
5244              break;
5245            fi
5246          done
5247            CFLAGS="${CFLAGS_save}"])
5248     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5249       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5250                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5251     fi
5254 dnl ========================================================
5255 dnl = Disable Opus audio codec support
5256 dnl ========================================================
5257 MOZ_ARG_DISABLE_BOOL(opus,
5258 [  --disable-opus          Disable support for Opus audio],
5259     MOZ_OPUS=,
5260     MOZ_OPUS=1)
5262 dnl ========================================================
5263 dnl = Disable VP8 decoder support
5264 dnl ========================================================
5265 MOZ_ARG_DISABLE_BOOL(webm,
5266 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5267     MOZ_WEBM=,
5268     MOZ_WEBM=1)
5270 if test -n "$MOZ_WEBM"; then
5271     AC_DEFINE(MOZ_WEBM)
5272     MOZ_VPX=1
5275 dnl ========================================================
5276 dnl = DirectShow support
5277 dnl ========================================================
5278 if test "$OS_ARCH" = "WINNT"; then
5279     dnl Enable DirectShow support by default.
5280     MOZ_DIRECTSHOW=1
5283 MOZ_ARG_DISABLE_BOOL(directshow,
5284 [  --disable-directshow  Disable support for DirectShow],
5285     MOZ_DIRECTSHOW=,
5286     MOZ_DIRECTSHOW=1)
5288 if test -n "$MOZ_DIRECTSHOW"; then
5289     AC_DEFINE(MOZ_DIRECTSHOW)
5292 dnl ========================================================
5293 dnl = Windows Media Foundation support
5294 dnl ========================================================
5295 if test "$OS_ARCH" = "WINNT"; then
5296     dnl Enable Windows Media Foundation support by default.
5297     dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5298     dnl guaranteed to have a recent-enough SDK to build WMF.
5299     MOZ_WMF=1
5302 MOZ_ARG_DISABLE_BOOL(wmf,
5303 [  --disable-wmf  Disable support for Windows Media Foundation],
5304     MOZ_WMF=,
5305     MOZ_WMF=1)
5307 if test -n "$MOZ_WMF"; then
5308     AC_DEFINE(MOZ_WMF)
5311 dnl ========================================================
5312 dnl = Built-in fragmented MP4 support.
5313 dnl ========================================================
5314 if test -n "$MOZ_WMF"; then
5315     dnl Enable fragmented MP4 parser on Windows by default.
5316     dnl We will also need to enable it on other platforms as we implement
5317     dnl platform decoder support there too.
5318     MOZ_FMP4=1
5321 MOZ_ARG_DISABLE_BOOL(fmp4,
5322 [  --disable-fmp4  Disable support for in built Fragmented MP4 parsing],
5323     MOZ_FMP4=,
5324     MOZ_FMP4=1)
5326 if test -n "$MOZ_FMP4"; then
5327     AC_DEFINE(MOZ_FMP4)
5331 dnl ========================================================
5332 dnl = Enable media plugin support
5333 dnl ========================================================
5334 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5335   dnl Enable support on android by default
5336   MOZ_MEDIA_PLUGINS=1
5339 MOZ_ARG_ENABLE_BOOL(media-plugins,
5340 [  --enable-media-plugins  Enable support for media plugins],
5341     MOZ_MEDIA_PLUGINS=1,
5342     MOZ_MEDIA_PLUGINS=)
5344 if test -n "$MOZ_MEDIA_PLUGINS"; then
5345   AC_DEFINE(MOZ_MEDIA_PLUGINS)
5348 dnl ========================================================
5349 dnl = Disable platform MP3 decoder on OSX
5350 dnl ========================================================
5351 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5352   MOZ_APPLEMEDIA=1
5355 MOZ_ARG_DISABLE_BOOL(apple-media,
5356 [  --disable-apple-media  Disable support for Apple AudioToolbox/VideoToolbox],
5357     MOZ_APPLEMEDIA=,
5358     MOZ_APPLEMEDIA=1)
5360 if test -n "$MOZ_APPLEMEDIA"; then
5361   AC_DEFINE(MOZ_APPLEMEDIA)
5364 dnl ========================================================
5365 dnl = Enable getUserMedia support
5366 dnl ========================================================
5367 MOZ_ARG_ENABLE_BOOL(media-navigator,
5368 [  --enable-media-navigator  Enable support for getUserMedia],
5369     MOZ_MEDIA_NAVIGATOR=1,
5370     MOZ_MEDIA_NAVIGATOR=)
5372 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5373   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5376 dnl ========================================================
5377 dnl = Enable building OMX media plugin (B2G or Android)
5378 dnl ========================================================
5379 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5380   dnl Enable support on android by default
5381   MOZ_OMX_PLUGIN=1
5384 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5385 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5386     MOZ_OMX_PLUGIN=1,
5387     MOZ_OMX_PLUGIN=)
5389 if test -n "$MOZ_OMX_PLUGIN"; then
5390     if test "$OS_TARGET" = "Android"; then
5391         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5392         AC_DEFINE(MOZ_OMX_PLUGIN)
5393     else
5394        dnl fail if we're not building on Gonk or Android
5395        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5396     fi
5399 dnl system libvpx Support
5400 dnl ========================================================
5401 MOZ_ARG_WITH_BOOL(system-libvpx,
5402 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5403     MOZ_NATIVE_LIBVPX=1)
5405 MOZ_LIBVPX_CFLAGS=
5406 MOZ_LIBVPX_LIBS=
5408 if test -n "$MOZ_VPX"; then
5409     AC_DEFINE(MOZ_VPX)
5410     if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5411         AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5412     fi
5414     if test -n "$MOZ_NATIVE_LIBVPX"; then
5415         dnl ============================
5416         dnl === libvpx Version check ===
5417         dnl ============================
5418         dnl Check to see if we have a system libvpx package.
5419         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5421         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
5422          [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.])])
5424         _SAVE_LIBS=$LIBS
5425         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
5426          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5427         LIBS=$_SAVE_LIBS
5428     fi
5431 AC_SUBST(MOZ_NATIVE_LIBVPX)
5432 AC_SUBST(MOZ_LIBVPX_CFLAGS)
5433 AC_SUBST(MOZ_LIBVPX_LIBS)
5435 if test "$MOZ_WEBM" -o "$MOZ_OGG"; then
5436     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5437         MOZ_VORBIS=1
5438     else
5439         MOZ_TREMOR=1
5440     fi
5443 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5445     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5446     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5447     dnl We currently require gcc on all arm platforms.
5448     VPX_AS=$YASM
5449     VPX_ASM_SUFFIX=asm
5450     VPX_NEED_OBJ_INT_EXTRACT=
5452     dnl See if we have assembly on this platform.
5453     case "$OS_ARCH:$CPU_ARCH" in
5454     Darwin:x86)
5455       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5456       VPX_X86_ASM=1
5457     ;;
5458     Darwin:x86_64)
5459       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5460       VPX_X86_ASM=1
5461     ;;
5462     WINNT:x86_64)
5463       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5464       VPX_X86_ASM=1
5465     ;;
5466     WINNT:x86)
5467       dnl Check for yasm 1.1 or greater.
5468       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5469         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.])
5470       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5471         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.])
5472       else
5473         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5474         VPX_X86_ASM=1
5475         dnl The encoder needs obj_int_extract to get asm offsets.
5476       fi
5477     ;;
5478     *:arm*)
5479       if test -n "$GNU_AS" ; then
5480         VPX_AS=$AS
5481         dnl These flags are a lie; they're just used to enable the requisite
5482         dnl opcodes; actual arch detection is done at runtime.
5483         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5484         VPX_DASH_C_FLAG="-c"
5485         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5486         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5487         VPX_ARM_ASM=1
5488       fi
5489     ;;
5490     *:x86)
5491       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5492         VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5493         VPX_X86_ASM=1
5494       fi
5495     ;;
5496     *:x86_64)
5497       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5498         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5499         VPX_X86_ASM=1
5500       fi
5501     ;;
5502     esac
5504     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5505       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.])
5506     fi
5508     if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5509       dnl We prefer to get asm offsets using inline assembler, which the above
5510       dnl compilers can do. When we're not using one of those, we have to fall
5511       dnl back to obj_int_extract, which reads them from a compiled object
5512       dnl file. Unfortunately, that only works if we're compiling on a system
5513       dnl with the header files for the appropriate object file format.
5514       VPX_NEED_OBJ_INT_EXTRACT=1
5515     fi
5517     if test -n "$VPX_X86_ASM"; then
5518       AC_DEFINE(VPX_X86_ASM)
5519     elif test -n "$VPX_ARM_ASM"; then
5520       AC_DEFINE(VPX_ARM_ASM)
5521     else
5522       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5523     fi
5526 dnl ========================================================
5527 dnl = Disable Wave decoder support
5528 dnl ========================================================
5529 MOZ_ARG_DISABLE_BOOL(wave,
5530 [  --disable-wave          Disable Wave decoder support],
5531     MOZ_WAVE=,
5532     MOZ_WAVE=1)
5534 if test -n "$MOZ_WAVE"; then
5535     AC_DEFINE(MOZ_WAVE)
5538 dnl ========================================================
5539 dnl = Handle dependent MEDIA defines
5540 dnl ========================================================
5542 if test -n "$MOZ_OPUS" -a -z "$MOZ_OGG"; then
5543     AC_MSG_ERROR([MOZ_OPUS requires MOZ_OGG which is disabled.])
5546 if test -n "$MOZ_VORBIS" -a -z "$MOZ_OGG"; then
5547     AC_MSG_ERROR([MOZ_VORBIS requires MOZ_OGG which is disabled.
5548 Note that you need vorbis support for WebM playback.])
5551 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5552     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/])
5555 if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
5556     AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
5559 if test -n "$MOZ_VORBIS"; then
5560     AC_DEFINE(MOZ_VORBIS)
5563 if test -n "$MOZ_TREMOR"; then
5564     AC_DEFINE(MOZ_TREMOR)
5567 if test -n "$MOZ_OPUS"; then
5568     AC_DEFINE(MOZ_OPUS)
5571 dnl ==================================
5572 dnl = Check alsa availability on Linux
5573 dnl ==================================
5575 dnl If using Linux, ensure that the alsa library is available
5576 if test "$OS_TARGET" = "Linux"; then
5577     MOZ_ALSA=1
5580 MOZ_ARG_ENABLE_BOOL(alsa,
5581 [  --enable-alsa          Enable Alsa support (default on Linux)],
5582    MOZ_ALSA=1,
5583    MOZ_ALSA=)
5585 if test -n "$MOZ_ALSA"; then
5586     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5587          [echo "$MOZ_ALSA_PKG_ERRORS"
5588           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.)])])
5591 AC_SUBST(MOZ_ALSA)
5592 AC_SUBST(MOZ_ALSA_CFLAGS)
5593 AC_SUBST(MOZ_ALSA_LIBS)
5595 dnl ========================================================
5596 dnl = Disable PulseAudio
5597 dnl ========================================================
5599 dnl If using Linux, ensure that the PA library is available
5600 case "$OS_TARGET" in
5601 WINNT|Darwin|Android|OpenBSD)
5602     ;;
5604     if test -z "$MOZ_B2G"; then
5605         MOZ_PULSEAUDIO=1
5606     fi
5607     ;;
5608 esac
5610 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5611 [  --disable-pulseaudio          Disable PulseAudio support],
5612    MOZ_PULSEAUDIO=,
5613    MOZ_PULSEAUDIO=1)
5615 if test -n "$MOZ_PULSEAUDIO"; then
5616     if test -z "$gonkdir"; then
5617         PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5618              [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5619               AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5620     else
5621         MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5622     fi
5625 AC_SUBST(MOZ_PULSEAUDIO)
5626 AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
5628 dnl ========================================================
5629 dnl = Enable GStreamer
5630 dnl ========================================================
5631 case "$OS_TARGET" in
5632 WINNT|Darwin|Android)
5633     ;;
5635     MOZ_GSTREAMER=1
5636     ;;
5637 esac
5639 MOZ_ARG_ENABLE_BOOL(gstreamer,
5640 [  --enable-gstreamer           Enable GStreamer support],
5641 MOZ_GSTREAMER=1,
5642 MOZ_GSTREAMER=)
5644 if test "$MOZ_GSTREAMER"; then
5645     # API version, eg 0.10, 1.0 etc
5646     GST_API_VERSION=0.10
5647     # core/base release number
5648     GST_VERSION=0.10.25
5649     PKG_CHECK_MODULES(GSTREAMER,
5650                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5651                       gstreamer-app-$GST_API_VERSION
5652                       gstreamer-plugins-base-$GST_API_VERSION, ,
5653                       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]))
5654     if test -n "$GSTREAMER_LIBS"; then
5655        _SAVE_LDFLAGS=$LDFLAGS
5656        LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5657        AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5658        if test -n "$_HAVE_LIBGSTVIDEO" ; then
5659           GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5660        else
5661           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.])
5662        fi
5663        LDFLAGS=$_SAVE_LDFLAGS
5664     else
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     fi
5668 AC_SUBST(GSTREAMER_CFLAGS)
5669 AC_SUBST(GSTREAMER_LIBS)
5670 AC_SUBST(MOZ_GSTREAMER)
5672 if test -n "$MOZ_GSTREAMER"; then
5673    AC_DEFINE(MOZ_GSTREAMER)
5677 dnl ========================================================
5678 dnl Permissions System
5679 dnl ========================================================
5680 MOZ_ARG_DISABLE_BOOL(permissions,
5681 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5682     MOZ_PERMISSIONS=,
5683     MOZ_PERMISSIONS=1
5686 dnl ========================================================
5687 dnl Child permissions, currently only used for b2g
5688 dnl ========================================================
5689 if test -n "$MOZ_B2G"; then
5690     if test -n "$MOZ_PERMISSIONS"; then
5691         MOZ_CHILD_PERMISSIONS=1
5692     else
5693         AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5694     fi
5696 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5698 dnl ========================================================
5699 dnl NegotiateAuth
5700 dnl ========================================================
5701 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5702 [  --disable-negotiateauth Disable GSS-API negotiation ],
5703     MOZ_AUTH_EXTENSION=,
5704     MOZ_AUTH_EXTENSION=1 )
5706 dnl ========================================================
5707 dnl Pref extensions (autoconfig)
5708 dnl ========================================================
5709 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5710 [  --disable-pref-extensions
5711                           Disable pref extensions such as autoconfig],
5712   MOZ_PREF_EXTENSIONS=,
5713   MOZ_PREF_EXTENSIONS=1 )
5715 dnl ========================================================
5716 dnl Searching of system directories for extensions.
5717 dnl Note: this switch is meant to be used for test builds
5718 dnl whose behavior should not depend on what happens to be
5719 dnl installed on the local machine.
5720 dnl ========================================================
5721 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5722 [  --disable-system-extension-dirs
5723                           Disable searching system- and account-global
5724                           directories for extensions of any kind; use
5725                           only profile-specific extension directories],
5726   ENABLE_SYSTEM_EXTENSION_DIRS=,
5727   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5728 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5729   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5732 dnl ========================================================
5733 dnl = Universalchardet
5734 dnl ========================================================
5735 MOZ_ARG_DISABLE_BOOL(universalchardet,
5736 [  --disable-universalchardet
5737                           Disable universal encoding detection],
5738   MOZ_UNIVERSALCHARDET=,
5739   MOZ_UNIVERSALCHARDET=1 )
5741 if test -n "${JAVA_BIN_PATH}"; then
5742   dnl Look for javac and jar in the specified path.
5743   JAVA_PATH="$JAVA_BIN_PATH"
5744 else
5745   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5746   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5749 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5750 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5751 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5752 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5753 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5754 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5756 if test -n "${JAVA_BIN_PATH}" -o \
5757   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5758   if test -z "$JAVA" -o "$JAVA" = ":"; then
5759     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}])
5760   fi
5761   if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5762     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}])
5763   fi
5764   if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5765     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}])
5766   fi
5767   if test -z "$JAR" -o "$JAR" = ":"; then
5768     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}])
5769   fi
5770   if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5771     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}])
5772   fi
5773   if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5774     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}])
5775   fi
5778 dnl ========================================================
5779 dnl = ANGLE OpenGL->D3D translator for WebGL
5780 dnl = * only applies to win32
5781 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5782 dnl ========================================================
5783 MOZ_ANGLE_RENDERER=
5784 MOZ_DIRECTX_SDK_PATH=
5785 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5786 MOZ_D3DCOMPILER_CAB=
5787 MOZ_D3DCOMPILER_DLL=
5788 case "$target_os" in
5789 *mingw*)
5790     MOZ_ANGLE_RENDERER=1
5791     ;;
5792 esac
5794 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5795 case "${target_cpu}" in
5796 i*86)
5797   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5798   ;;
5799 x86_64)
5800   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5801   ;;
5802 esac
5804 MOZ_ARG_DISABLE_BOOL(webgl,
5805 [  --disable-webgl     Disable building of the WebGL implementation],
5806     MOZ_WEBGL_DISABLED=1,
5807     MOZ_WEBGL_DISABLED=)
5809 if test -n "$MOZ_WEBGL_DISABLED"; then
5810   MOZ_WEBGL=
5811   MOZ_ANGLE_RENDERER=
5814 if test -n "$MOZ_WEBGL"; then
5815   AC_DEFINE(MOZ_WEBGL)
5818 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5819   AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5822 # Locate a DirectX SDK here so we can use it for both ANGLE and
5823 # Joystick support.
5824 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
5825   # Get the SDK path from the registry.
5826   # First try to get the June 2010 SDK
5827   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5828   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5829     # Otherwise just take whatever comes first
5830     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5831   fi
5832   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'`
5835 if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
5836   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5837     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.])
5838   fi
5840   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5841      test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
5842          test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5843     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5844   else
5845     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.])
5846   fi
5848   # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5849   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'`
5851   if test -z "$MOZ_D3DX9_VERSION" ; then
5852         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.])
5853   fi
5855   MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5857   if test -z "$MOZ_D3DCOMPILER_CAB"; then
5858     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.])
5859   fi
5861   MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5864 dnl ========================================================
5865 dnl Gamepad support
5866 dnl ========================================================
5867 MOZ_GAMEPAD=
5868 MOZ_GAMEPAD_BACKEND=stub
5870 # Gamepad DOM is built on supported platforms by default.
5871 case "$OS_TARGET" in
5872      Darwin|WINNT|Linux)
5873        MOZ_GAMEPAD=1
5874        ;;
5875      *)
5876        ;;
5877 esac
5879 MOZ_ARG_DISABLE_BOOL(gamepad,
5880 [  --disable-gamepad   Disable gamepad support],
5881     MOZ_GAMEPAD=,
5882     MOZ_GAMEPAD=1)
5884 if test "$MOZ_GAMEPAD"; then
5885     case "$OS_TARGET" in
5886     Darwin)
5887         MOZ_GAMEPAD_BACKEND=cocoa
5888         ;;
5889     WINNT)
5890         if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5891             if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5892                MOZ_GAMEPAD=
5893             fi
5894         elif test "$GCC" != "yes"; then
5895             MOZ_GAMEPAD=
5896         fi
5897         if test -z "$MOZ_GAMEPAD"; then
5898            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.])
5899         fi
5900         MOZ_GAMEPAD_BACKEND=windows
5901         ;;
5902     Linux)
5903         MOZ_CHECK_HEADER([linux/joystick.h])
5904         if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5905           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.])
5906         fi
5907         MOZ_GAMEPAD_BACKEND=linux
5908         ;;
5909     *)
5910         ;;
5911    esac
5913   AC_DEFINE(MOZ_GAMEPAD)
5915 AC_SUBST(MOZ_GAMEPAD)
5916 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5918 dnl ========================================================
5919 dnl = Breakpad crash reporting (on by default on supported platforms)
5920 dnl ========================================================
5922 case $target in
5923 i?86-*-mingw*|x86_64-*-mingw*)
5924   MOZ_CRASHREPORTER=1
5925   ;;
5926 i?86-apple-darwin*|x86_64-apple-darwin*)
5927   MOZ_CRASHREPORTER=1
5928   ;;
5929 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5930   if test "$MOZ_ENABLE_GTK"; then
5931     MOZ_CRASHREPORTER=1
5932   fi
5933   ;;
5934 *-android*|*-linuxandroid*)
5935   MOZ_CRASHREPORTER=1
5936   ;;
5937 *solaris*)
5938   MOZ_CRASHREPORTER=1
5939   ;;
5940 esac
5942 MOZ_ARG_DISABLE_BOOL(crashreporter,
5943 [  --disable-crashreporter Disable breakpad crash reporting],
5944     [MOZ_CRASHREPORTER=],
5945     [MOZ_CRASHREPORTER=F # Force enable breakpad])
5947 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
5948   if test "$MOZ_CRASHREPORTER" = F; then
5949     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
5950   fi
5951   MOZ_CRASHREPORTER=
5954 if test -n "$MOZ_CRASHREPORTER"; then
5955    AC_DEFINE(MOZ_CRASHREPORTER)
5957   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
5958     test -z "$SKIP_LIBRARY_CHECKS"; then
5959     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5960     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5961     AC_SUBST(MOZ_GTHREAD_LIBS)
5962   fi
5964   if test "$OS_ARCH" = "WINNT"; then
5965     if test -z "$HAVE_64BIT_OS"; then
5966       MOZ_CRASHREPORTER_INJECTOR=1
5967       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
5968     fi
5969   fi
5972 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5973 [  --with-crashreporter-enable-percent=NN
5974                           Enable sending crash reports by default on NN% of users. (default=100)],
5975 [ val=`echo $withval | sed 's/[^0-9]//g'`
5976     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5978 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5979    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5981 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5983 dnl ========================================================
5984 dnl = libjpeg-turbo configuration
5985 dnl ========================================================
5986 MOZ_LIBJPEG_TURBO=
5987 if test -z "$MOZ_NATIVE_JPEG"; then
5988     MOZ_LIBJPEG_TURBO=1
5991 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5992 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
5993     MOZ_LIBJPEG_TURBO=,
5994     MOZ_LIBJPEG_TURBO=1)
5996 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5997     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6000 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6001 dnl files.
6003 if test -n "$MOZ_LIBJPEG_TURBO"; then
6005   dnl Do we support libjpeg-turbo on this platform?
6006   case "$OS_ARCH:$OS_TEST" in
6007   Darwin:i?86)
6008     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6009     LIBJPEG_TURBO_X86_ASM=1
6010   ;;
6011   Darwin:x86_64)
6012     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6013     LIBJPEG_TURBO_X64_ASM=1
6014   ;;
6015   WINNT:x86|WINNT:i?86)
6016     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6017     LIBJPEG_TURBO_X86_ASM=1
6018   ;;
6019   WINNT:x86_64)
6020     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6021     LIBJPEG_TURBO_X64_ASM=1
6022   ;;
6023   *:arm*)
6024     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6025     LIBJPEG_TURBO_ARM_ASM=1
6026   ;;
6027   *:x86|*:i?86)
6028     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6029       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6030       LIBJPEG_TURBO_X86_ASM=1
6031     fi
6032   ;;
6033   *:x86_64)
6034     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6035       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6036       LIBJPEG_TURBO_X64_ASM=1
6037     fi
6038   ;;
6039   esac
6043 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6044 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6045 dnl it doesn't exist or we have too old of a version.
6046 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6047     LIBJPEG_TURBO_AS=$YASM
6049     if test -z "$LIBJPEG_TURBO_AS" ; then
6050         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.])
6051     fi
6053     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6054     dnl on Linux and 1.1 or newer everywhere else.
6055     if test "$OS_ARCH" = "Linux" ; then
6056         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
6057             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.])
6058         fi
6059     else
6060         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6061             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.])
6062         fi
6063     fi
6066 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6067 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6068 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6069     echo "Using $AS as the assembler for ARM code."
6070     LIBJPEG_TURBO_AS=$AS
6073 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6074     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6075 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6076     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6077 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6078     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6079 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6080     dnl Warn if we're not building the optimized routines, even though the user
6081     dnl didn't specify --disable-libjpeg-turbo.
6082     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6085 dnl ========================================================
6086 dnl = Enable compilation of specific extension modules
6087 dnl ========================================================
6089 MOZ_ARG_ENABLE_STRING(extensions,
6090 [  --enable-extensions     Enable extensions],
6091 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6092     if test "$option" = "yes" -o "$option" = "all"; then
6093         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6094     elif test "$option" = "no" -o "$option" = "none"; then
6095         MOZ_EXTENSIONS=""
6096     elif test "$option" = "default"; then
6097         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6098     elif test `echo "$option" | grep -c \^-` != 0; then
6099         option=`echo $option | sed 's/^-//'`
6100         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6101     else
6102         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6103     fi
6104 done],
6105     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6107 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6108     # Suppress warning on non-X11 platforms
6109     if test -n "$MOZ_X11"; then
6110         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6111     fi
6112     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6115 dnl Do not build gnomevfs with libxul based apps
6116 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6117     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6120 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6121     # Suppress warning on non-X11 platforms
6122     if test -n "$MOZ_X11"; then
6123         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6124     fi
6125     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6128 dnl Do not build gio with libxul based apps
6129 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6130     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6133 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6134     MOZ_GIO_COMPONENT=1
6135     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6137 AC_SUBST(MOZ_GIO_COMPONENT)
6139 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6140     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6141     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6144 dnl Remove dupes
6145 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6147 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6148 dnl when trying to build a nonexistent extension.
6149 for extension in $MOZ_EXTENSIONS; do
6150     if test ! -d "${srcdir}/extensions/${extension}"; then
6151         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6152     fi
6153 done
6155 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6156   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6159 dnl ========================================================
6160 dnl Build Freetype in the tree
6161 dnl ========================================================
6162 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6163 [  --enable-tree-freetype  Enable Tree FreeType],
6164     MOZ_TREE_FREETYPE=1,
6165     MOZ_TREE_FREETYPE= )
6166 if test -n "$MOZ_TREE_FREETYPE"; then
6167    if test -n "$_WIN32_MSVC"; then
6168       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6169    fi
6170    AC_DEFINE(MOZ_TREE_FREETYPE)
6171    AC_SUBST(MOZ_TREE_FREETYPE)
6172    MOZ_ENABLE_CAIRO_FT=1
6173    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6174    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6175    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6176    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6177    CAIRO_FT_OSLIBS=''
6178    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6179    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6180    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6181    AC_SUBST(CAIRO_FT_CFLAGS)
6184 dnl ========================================================
6185 dnl Installer
6186 dnl ========================================================
6187 dnl Abort Windows build if the required major version and
6188 dnl minimum minor version of Unicode NSIS isn't in the path
6189 dnl (unless in case of cross compiling, for which Unicode
6190 dnl is not yet sufficient).
6191 if test "$OS_ARCH" = "WINNT"; then
6192     REQ_NSIS_MAJOR_VER=2
6193     MIN_NSIS_MINOR_VER=46
6194     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensis)
6195     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6196       AC_MSG_RESULT([yes])
6197       changequote(,)
6198       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6199       changequote([,])
6200       if test ! "$MAKENSISU_VER" = ""; then
6201           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6202           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6203       fi
6204       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6205       if test "$MAKENSISU_VER" = "" || \
6206          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6207               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6208           AC_MSG_RESULT([no])
6209           if test -z "$CROSS_COMPILE"; then
6210             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.])
6211           else
6212             MAKENSISU=
6213           fi
6214       fi
6215     elif test -z "$CROSS_COMPILE"; then
6216       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.])
6217     else
6218       MAKENSISU=
6219     fi
6222 dnl ========================================================
6223 dnl Web App Runtime
6224 dnl ========================================================
6225 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6226 [  --disable-webapp-runtime  Disable Web App Runtime],
6227     MOZ_WEBAPP_RUNTIME=,
6228     MOZ_WEBAPP_RUNTIME=1)
6229 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
6230     MOZ_WEBAPP_RUNTIME=
6232 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6233     MOZ_WEBAPP_RUNTIME=
6235 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6236 if test "$MOZ_WEBAPP_RUNTIME"; then
6237     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6240 AC_MSG_CHECKING([for tar archiver])
6241 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6242 if test -z "$TAR"; then
6243     AC_MSG_ERROR([no tar archiver found in \$PATH])
6245 AC_MSG_RESULT([$TAR])
6246 AC_SUBST(TAR)
6248 AC_MSG_CHECKING([for wget])
6249 AC_CHECK_PROGS(WGET, wget, "")
6250 AC_MSG_RESULT([$WGET])
6251 AC_SUBST(WGET)
6253 dnl ========================================================
6254 dnl Signing
6255 dnl ========================================================
6257 if test -n "$MOZ_SIGN_CMD"; then
6258     AC_DEFINE(MOZ_SIGNING)
6261 dnl ========================================================
6262 dnl Maintenance Service
6263 dnl ========================================================
6265 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6266 [  --enable-maintenance-service       Enable building of maintenanceservice],
6267     MOZ_MAINTENANCE_SERVICE=1,
6268     MOZ_MAINTENANCE_SERVICE= )
6270 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6271   if test "$OS_ARCH" = "WINNT"; then
6272     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6273   else
6274     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6275   fi
6278 dnl ========================================================
6279 dnl Verify MAR signatures
6280 dnl ========================================================
6282 MOZ_ARG_ENABLE_BOOL(verify-mar,
6283 [  --enable-verify-mar     Enable verifying MAR signatures],
6284     MOZ_VERIFY_MAR_SIGNATURE=1,
6285     MOZ_VERIFY_MAR_SIGNATURE= )
6287 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6288   if test "$OS_ARCH" = "WINNT"; then
6289     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6290   else
6291     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6292   fi
6295 dnl ========================================================
6296 dnl Enable building the signmar program.
6297 dnl This option is much different than the --enable-verify-mar option.
6298 dnl --enable-verify-mar is for enabling the verification check on MAR
6299 dnl files in the updater.  The --enable-signmar option is for building
6300 dnl the signmar program.
6301 dnl ========================================================
6303 MOZ_ARG_ENABLE_BOOL(signmar,
6304 [  --enable-signmar     Enable building the signmar program],
6305     MOZ_ENABLE_SIGNMAR=1,
6306     MOZ_ENABLE_SIGNMAR= )
6308 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6309   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6312 dnl ========================================================
6313 dnl Updater
6314 dnl ========================================================
6316 MOZ_ARG_DISABLE_BOOL(updater,
6317 [  --disable-updater       Disable building of updater],
6318     MOZ_UPDATER=,
6319     MOZ_UPDATER=1 )
6321 if test -n "$MOZ_UPDATER"; then
6322     AC_DEFINE(MOZ_UPDATER)
6325 # tools/update-packaging is not checked out by default.
6326 MOZ_ARG_ENABLE_BOOL(update-packaging,
6327 [  --enable-update-packaging
6328                           Enable tools/update-packaging],
6329     MOZ_UPDATE_PACKAGING=1,
6330     MOZ_UPDATE_PACKAGING= )
6331 AC_SUBST(MOZ_UPDATE_PACKAGING)
6333 dnl ========================================================
6334 dnl build the tests by default
6335 dnl ========================================================
6336 MOZ_ARG_DISABLE_BOOL(tests,
6337 [  --disable-tests         Do not build test libraries & programs],
6338     ENABLE_TESTS=,
6339     ENABLE_TESTS=1 )
6341 if test -n "$ENABLE_TESTS"; then
6342     GTEST_HAS_RTTI=0
6343     AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6344     AC_SUBST(GTEST_HAS_RTTI)
6345     if test -n "$_WIN32_MSVC"; then
6346           AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6347     fi
6348     if test "${OS_TARGET}" = "Android"; then
6349         AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6350         AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6351         AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6352         AC_SUBST(GTEST_OS_LINUX_ANDROID)
6353         AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6354         AC_SUBST(GTEST_HAS_CLONE)
6355     fi
6358 dnl ========================================================
6359 dnl parental controls (for Windows Vista)
6360 dnl ========================================================
6361 MOZ_ARG_DISABLE_BOOL(parental-controls,
6362 [  --disable-parental-controls
6363                           Do not build parental controls],
6364    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6365    MOZ_DISABLE_PARENTAL_CONTROLS=)
6366 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6367     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6370 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6372 dnl ========================================================
6373 dnl = Disable DOMCrypto
6374 dnl ========================================================
6375 if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
6376     AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
6378 AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
6380 dnl ========================================================
6381 dnl = Disable libpkix
6382 dnl ========================================================
6383 if test -n "$NSS_NO_LIBPKIX"; then
6384     AC_DEFINE(NSS_NO_LIBPKIX)
6386 AC_SUBST(NSS_NO_LIBPKIX)
6388 dnl ========================================================
6389 dnl = Content process sandboxing
6390 dnl ========================================================
6391 if test -n "$gonkdir"; then
6392     MOZ_CONTENT_SANDBOX=1
6395 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6396 [  --enable-content-sandbox        Enable sandboxing support for content-processes],
6397     MOZ_CONTENT_SANDBOX=1,
6398     MOZ_CONTENT_SANDBOX=)
6400 if test -n "$MOZ_CONTENT_SANDBOX"; then
6401     AC_DEFINE(MOZ_CONTENT_SANDBOX)
6404 AC_SUBST(MOZ_CONTENT_SANDBOX)
6406 MOZ_ARG_ENABLE_BOOL(content-sandbox-reporter,
6407 [ --enable-content-sandbox-reporter        Enable syscall reporter to troubleshoot syscalls denied by the content-processes sandbox],
6408     MOZ_CONTENT_SANDBOX_REPORTER=1,
6409     MOZ_CONTENT_SANDBOX_REPORTER=)
6411 if test -n "$MOZ_CONTENT_SANDBOX_REPORTER"; then
6412     AC_DEFINE(MOZ_CONTENT_SANDBOX_REPORTER)
6415 AC_SUBST(MOZ_CONTENT_SANDBOX_REPORTER)
6417 dnl ========================================================
6418 dnl =
6419 dnl = Module specific options
6420 dnl =
6421 dnl ========================================================
6422 MOZ_ARG_HEADER(Individual module options)
6424 dnl ========================================================
6425 dnl = Disable feed handling components
6426 dnl ========================================================
6427 MOZ_ARG_DISABLE_BOOL(feeds,
6428 [  --disable-feeds         Disable feed handling and processing components],
6429     MOZ_FEEDS=,
6430     MOZ_FEEDS=1 )
6431 if test -n "$MOZ_FEEDS"; then
6432     AC_DEFINE(MOZ_FEEDS)
6433 else
6434     if test "$MOZ_BUILD_APP" = "browser"; then
6435         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6436     fi
6439 dnl ========================================================
6440 dnl Check for sqlite
6441 dnl ========================================================
6443 MOZ_NATIVE_SQLITE=
6444 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6445 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6446 MOZ_NATIVE_SQLITE=1,
6447 MOZ_NATIVE_SQLITE= )
6449 if test -z "$MOZ_NATIVE_SQLITE"
6450 then
6451     SQLITE_CFLAGS=
6452     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6453 else
6454     dnl ============================
6455     dnl === SQLite Version check ===
6456     dnl ============================
6457     dnl Check to see if the system SQLite package is new enough.
6458     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6460     dnl ==================================
6461     dnl === SQLITE_SECURE_DELETE check ===
6462     dnl ==================================
6463     dnl Check to see if the system SQLite package is compiled with
6464     dnl SQLITE_SECURE_DELETE enabled.
6465     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6466     _SAVE_CFLAGS="$CFLAGS"
6467     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6468     _SAVE_LIBS="$LIBS"
6469     LIBS="$LIBS $SQLITE_LIBS"
6470     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6471         AC_TRY_RUN([
6472             #include "sqlite3.h"
6474             int main(int argc, char **argv){
6475               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6476             }],
6477             ac_cv_sqlite_secure_delete=yes,
6478             ac_cv_sqlite_secure_delete=no,
6479             ac_cv_sqlite_secure_delete=no
6480         )
6481     ])
6482     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6483     CFLAGS="$_SAVE_CFLAGS"
6484     LIBS="$_SAVE_LIBS"
6485     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6486         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6487     fi
6489     dnl ===============================
6490     dnl === SQLITE_THREADSAFE check ===
6491     dnl ===============================
6492     dnl Check to see if the system SQLite package is compiled with
6493     dnl SQLITE_THREADSAFE enabled.
6494     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6495     _SAVE_CFLAGS="$CFLAGS"
6496     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6497     _SAVE_LIBS="$LIBS"
6498     LIBS="$LIBS $SQLITE_LIBS"
6499     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6500         AC_TRY_RUN([
6501             #include "sqlite3.h"
6503             int main(int argc, char **argv){
6504               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6505             }],
6506             ac_cv_sqlite_threadsafe=yes,
6507             ac_cv_sqlite_threadsafe=no,
6508             ac_cv_sqlite_threadsafe=no
6509         )
6510     ])
6511     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6512     CFLAGS="$_SAVE_CFLAGS"
6513     LIBS="$_SAVE_LIBS"
6514     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6515         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6516     fi
6518     dnl ================================
6519     dnl === SQLITE_ENABLE_FTS3 check ===
6520     dnl ================================
6521     dnl check to see if the system SQLite package is compiled with
6522     dnl SQLITE_ENABLE_FTS3 enabled.
6523     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6524     _SAVE_CFLAGS="$CFLAGS"
6525     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6526     _SAVE_LIBS="$LIBS"
6527     LIBS="$LIBS $SQLITE_LIBS"
6528     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6529         AC_TRY_RUN([
6530             #include "sqlite3.h"
6532             int main(int argc, char **argv){
6533               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6534             }],
6535             ac_cv_sqlite_enable_fts3=yes,
6536             ac_cv_sqlite_enable_fts3=no,
6537             ac_cv_sqlite_enable_fts3=no
6538         )
6539     ])
6540     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6541     CFLAGS="$_SAVE_CFLAGS"
6542     LIBS="$_SAVE_LIBS"
6543     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6544         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6545     fi
6547     dnl =========================================
6548     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6549     dnl =========================================
6550     dnl check to see if the system SQLite package is compiled with
6551     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6552     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6553     _SAVE_CFLAGS="$CFLAGS"
6554     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6555     _SAVE_LIBS="$LIBS"
6556     LIBS="$LIBS $SQLITE_LIBS"
6557     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6558         AC_TRY_RUN([
6559             #include "sqlite3.h"
6561             int main(int argc, char **argv){
6562               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6563             }],
6564             ac_cv_sqlite_enable_unlock_notify=yes,
6565             ac_cv_sqlite_enable_unlock_notify=no,
6566             ac_cv_sqlite_enable_unlock_notify=no
6567         )
6568     ])
6569     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6570     CFLAGS="$_SAVE_CFLAGS"
6571     LIBS="$_SAVE_LIBS"
6572     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6573         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6574     fi
6577 if test -n "$MOZ_NATIVE_SQLITE"; then
6578     AC_DEFINE(MOZ_NATIVE_SQLITE)
6580 AC_SUBST(MOZ_NATIVE_SQLITE)
6582 dnl ========================================================
6583 dnl = Enable help viewer (off by default)
6584 dnl ========================================================
6585 if test -n "$MOZ_HELP_VIEWER"; then
6586      dnl Do this if defined in confvars.sh
6587      AC_DEFINE(MOZ_HELP_VIEWER)
6590 dnl ========================================================
6591 dnl = Enable safe browsing (anti-phishing)
6592 dnl ========================================================
6593 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6594 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6595     MOZ_SAFE_BROWSING=1,
6596     MOZ_SAFE_BROWSING= )
6597 if test -n "$MOZ_SAFE_BROWSING"; then
6598     AC_DEFINE(MOZ_SAFE_BROWSING)
6600 AC_SUBST(MOZ_SAFE_BROWSING)
6602 dnl ========================================================
6603 dnl = Enable url-classifier
6604 dnl ========================================================
6605 dnl Implicitly enabled by default if building with safe-browsing
6606 if test -n "$MOZ_SAFE_BROWSING"; then
6607     MOZ_URL_CLASSIFIER=1
6609 MOZ_ARG_ENABLE_BOOL(url-classifier,
6610 [  --enable-url-classifier Enable url classifier module],
6611     MOZ_URL_CLASSIFIER=1,
6612     MOZ_URL_CLASSIFIER= )
6613 if test -n "$MOZ_URL_CLASSIFIER"; then
6614     AC_DEFINE(MOZ_URL_CLASSIFIER)
6616 AC_SUBST(MOZ_URL_CLASSIFIER)
6618 dnl ========================================================
6619 dnl = Disable zipwriter
6620 dnl ========================================================
6621 MOZ_ARG_DISABLE_BOOL(zipwriter,
6622 [  --disable-zipwriter     Disable zipwriter component],
6623     MOZ_ZIPWRITER=,
6624     MOZ_ZIPWRITER=1 )
6625 AC_SUBST(MOZ_ZIPWRITER)
6627 dnl ========================================================
6628 dnl GL provider
6629 dnl ========================================================
6630 MOZ_GL_PROVIDER=
6631 MOZ_ARG_WITH_STRING(gl-provider,
6632 [  --with-gl-provider=ID
6633                           Set GL provider backend type],
6634 [ val=`echo $withval`
6635     MOZ_GL_PROVIDER="$val"])
6637 if test -n "$MOZ_GL_PROVIDER"; then
6638 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6639 AC_SUBST(MOZ_GL_PROVIDER)
6640 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6642 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6643 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6645 dnl ========================================================
6646 dnl = faststripe theme
6647 dnl ========================================================
6648 MOZ_ARG_ENABLE_BOOL(faststripe,
6649 [  --enable-faststripe     Use faststripe theme],
6650     MOZ_THEME_FASTSTRIPE=1,
6651     MOZ_THEME_FASTSTRIPE= )
6652 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6654 dnl ========================================================
6655 dnl =
6656 dnl = Feature options that require extra sources to be pulled
6657 dnl =
6658 dnl ========================================================
6659 dnl MOZ_ARG_HEADER(Features that require extra sources)
6661 dnl ========================================================
6662 dnl =
6663 dnl = Runtime debugging and Optimization Options
6664 dnl =
6665 dnl ========================================================
6666 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6668 dnl ========================================================
6669 dnl enable mobile optimizations
6670 dnl ========================================================
6671 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6672 [  --enable-mobile-optimize
6673                           Enable mobile optimizations],
6674     MOZ_GFX_OPTIMIZE_MOBILE=1)
6676 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6678 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6679     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6682 dnl ========================================================
6683 dnl = Enable code optimization. ON by default.
6684 dnl ========================================================
6685 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6686         MOZ_OPTIMIZE_FLAGS="-O"
6689 MOZ_ARG_ENABLE_STRING(optimize,
6690 [  --disable-optimize      Disable compiler optimization
6691   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6692 [ if test "$enableval" != "no"; then
6693     MOZ_OPTIMIZE=1
6694     if test -n "$enableval" -a "$enableval" != "yes"; then
6695         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6696         MOZ_OPTIMIZE=2
6697     fi
6698 else
6699     MOZ_OPTIMIZE=
6700 fi ], MOZ_OPTIMIZE=1)
6702 MOZ_SET_FRAMEPTR_FLAGS
6704 if test "$COMPILE_ENVIRONMENT"; then
6705 if test -n "$MOZ_OPTIMIZE"; then
6706     AC_MSG_CHECKING([for valid optimization flags])
6707     _SAVE_CFLAGS=$CFLAGS
6708     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6709     AC_TRY_COMPILE([#include <stdio.h>],
6710         [printf("Hello World\n");],
6711         _results=yes,
6712         _results=no)
6713     AC_MSG_RESULT([$_results])
6714     if test "$_results" = "no"; then
6715         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6716     fi
6717     CFLAGS=$_SAVE_CFLAGS
6719 fi # COMPILE_ENVIRONMENT
6721 AC_SUBST(MOZ_OPTIMIZE)
6722 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6723 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6724 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6725 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6726 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6727 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6729 dnl ========================================================
6730 dnl = Enable any treating of compile warnings as errors
6731 dnl ========================================================
6732 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
6733 [  --enable-warnings-as-errors
6734                           Enable treating of warnings as errors],
6735     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
6736     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
6737 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6738    WARNINGS_AS_ERRORS=''
6739 elif test "$GNU_CC"; then
6740     # Prevent the following GCC warnings from being treated as errors:
6741     # -Wuninitialized - too many false positives
6742     # -Wmaybe-uninitialized - too many false positives
6743     # -Wdeprecated-declarations - we don't want our builds held hostage when a
6744     #   platform-specific API becomes deprecated.
6745     MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6746     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6747     MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6748     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6749     MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6750     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6753 dnl ========================================================
6754 dnl = Disable runtime logging checks
6755 dnl ========================================================
6756 MOZ_ARG_DISABLE_BOOL(logging,
6757 [  --disable-logging       Disable logging facilities],
6758     NS_DISABLE_LOGGING=1,
6759     NS_DISABLE_LOGGING= )
6760 if test "$NS_DISABLE_LOGGING"; then
6761     AC_DEFINE(NS_DISABLE_LOGGING)
6762 else
6763     AC_DEFINE(MOZ_LOGGING)
6766 dnl ========================================================
6767 dnl = This will enable logging of addref, release, ctor, dtor.
6768 dnl ========================================================
6769 _ENABLE_LOGREFCNT=42
6770 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6771 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6772     _ENABLE_LOGREFCNT=1,
6773     _ENABLE_LOGREFCNT= )
6774 if test "$_ENABLE_LOGREFCNT" = "1"; then
6775     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6776 elif test -z "$_ENABLE_LOGREFCNT"; then
6777     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6780 dnl ========================================================
6781 dnl moz_dump_painting
6782 dnl ========================================================
6783 MOZ_ARG_ENABLE_BOOL(dump-painting,
6784 [  --enable-dump-painting          Enable paint debugging.],
6785     MOZ_DUMP_PAINTING=1,
6786     MOZ_DUMP_PAINTING= )
6787 if test -n "$MOZ_DUMP_PAINTING"; then
6788     AC_DEFINE(MOZ_DUMP_PAINTING)
6789     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6791 if test -n "$MOZ_DEBUG"; then
6792     AC_DEFINE(MOZ_DUMP_PAINTING)
6795 dnl ========================================================
6796 dnl = Enable trace malloc
6797 dnl ========================================================
6798 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6799 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6800 [  --enable-trace-malloc   Enable malloc tracing; also disables DMD and jemalloc],
6801     NS_TRACE_MALLOC=1,
6802     NS_TRACE_MALLOC= )
6803 if test "$NS_TRACE_MALLOC"; then
6804   # Please, Mr. Linker Man, don't take away our symbol names
6805   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6806   AC_DEFINE(NS_TRACE_MALLOC)
6808 AC_SUBST(NS_TRACE_MALLOC)
6810 dnl ========================================================
6811 dnl = Enable DMD
6812 dnl ========================================================
6814 MOZ_ARG_ENABLE_BOOL(dmd,
6815 [  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc],
6816     MOZ_DMD=1,
6817     MOZ_DMD= )
6819 dnl The two options are conflicting. Fails the configure to alert the user.
6820 if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
6821     AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
6824 if test "$MOZ_DMD"; then
6825     AC_DEFINE(MOZ_DMD)
6827     if test "${CPU_ARCH}" = "arm"; then
6828         CFLAGS="$CFLAGS -funwind-tables"
6829         CXXFLAGS="$CXXFLAGS -funwind-tables"
6830     fi
6832     MOZ_MEMORY=1                        # DMD enables jemalloc
6833     MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
6835 AC_SUBST(MOZ_DMD)
6837 dnl ========================================================
6838 dnl = Enable jemalloc
6839 dnl ========================================================
6840 MOZ_ARG_ENABLE_BOOL(jemalloc,
6841 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6842     MOZ_MEMORY=1,
6843     MOZ_MEMORY=)
6845 if test "$NS_TRACE_MALLOC"; then
6846     MOZ_MEMORY=
6849 if test "${OS_TARGET}" = "Android"; then
6850   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
6851   :
6852 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
6853   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
6854   if test -z "$GNU_CC"; then
6855     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6856   else
6857     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
6858   fi
6859 else
6860   dnl On other Unix systems, we only want to link executables against mozglue
6861   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
6862   dnl On other Unix systems, where mozglue is a static library, jemalloc is
6863   dnl separated for the SDK, so we need to add it here.
6864   if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
6865     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
6866   fi
6867   MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
6868   if test -n "$GNU_CC"; then
6869     dnl And we need mozglue symbols to be exported.
6870     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
6871   fi
6872   if test "$MOZ_LINKER" = 1; then
6873     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
6874   fi
6877 dnl ========================================================
6878 dnl = Enable dynamic replacement of malloc implementation
6879 dnl ========================================================
6880 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6881 [  --enable-replace-malloc   Enable ability to dynamically replace the malloc implementation],
6882     MOZ_REPLACE_MALLOC=1,
6883     MOZ_REPLACE_MALLOC= )
6885 dnl The two options are conflicting. Fails the configure to alert the user.
6886 if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
6887     AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
6890 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6891     dnl We don't want to enable jemalloc unconditionally because it may be a
6892     dnl deliberate choice not to enable it (bug 702250, for instance)
6893     AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6894 elif test -n "$MOZ_REPLACE_MALLOC"; then
6895     MOZ_NATIVE_JEMALLOC=
6897     dnl Replace-malloc Mac linkage quirks
6898     if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6899         AC_CACHE_CHECK([how to do weak dynamic linking],
6900             ac_cv_weak_dynamic_linking,
6901             [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6902              if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6903                 test -s conftest${DLL_SUFFIX}; then
6904                  dnl There are several ways the linker can put link edit rules in a binary:
6905                  dnl - classic info only (for OSX < 10.6)
6906                  dnl - dyld info only
6907                  dnl - both
6908                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6909                      _CLASSIC_INFO=
6910                  else
6911                      _CLASSIC_INFO=1
6912                  fi
6913                  if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
6914                      _DYLD_INFO=1
6915                  else
6916                      _DYLD_INFO=
6917                  fi
6918                  dnl With classic info, we need to build with -flat_namespace.
6919                  dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
6920                  dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
6921                  dnl forgets to set the weak flag in the dyld info.
6922                  dnl See http://glandium.org/blog/?p=2764 for more details.
6923                  dnl
6924                  dnl Values for ac_cv_weak_dynamic_linking, and subsequently
6925                  dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
6926                  dnl - "flat namespace" when -flat_namespace alone is needed
6927                  dnl - "dummy library" when a dummy library and -flat_namespace are needed
6928                  dnl - "compiler support" when nothing is needed
6929                  if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
6930                      if test -n "$_CLASSIC_INFO"; then
6931                          ac_cv_weak_dynamic_linking="flat namespace"
6932                      else
6933                          ac_cv_weak_dynamic_linking="compiler support"
6934                      fi
6935                  else
6936                      if test -n "$_DYLD_INFO"; then
6937                          ac_cv_weak_dynamic_linking="dummy library"
6938                      else
6939                          ac_cv_weak_dynamic_linking="flat namespace"
6940                      fi
6941                  fi
6942              else
6943                  AC_ERROR([couldn't compile a simple C file])
6944              fi
6945              rm -rf conftest*])
6946         MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
6947     fi
6949 AC_SUBST(MOZ_REPLACE_MALLOC)
6950 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
6952 dnl ========================================================
6953 dnl = Jemalloc build setup
6954 dnl ========================================================
6955 if test -z "$MOZ_MEMORY"; then
6956   if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
6957     MOZ_NATIVE_JEMALLOC=1
6958     AC_CHECK_FUNCS(mallctl nallocm,,
6959       [MOZ_NATIVE_JEMALLOC=
6960        break])
6961     if test -n "$MOZ_NATIVE_JEMALLOC"; then
6962       MOZ_MEMORY=1
6963       AC_DEFINE(MOZ_MEMORY)
6964       AC_DEFINE(MOZ_JEMALLOC3)
6965       AC_DEFINE(MOZ_NATIVE_JEMALLOC)
6966     fi
6967   fi
6968   case "${target}" in
6969     *-mingw*)
6970       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6971         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.])
6972       fi
6973       ;;
6974   esac
6975 else
6976   AC_DEFINE(MOZ_MEMORY)
6977   if test -n "$MOZ_JEMALLOC3"; then
6978     AC_DEFINE(MOZ_JEMALLOC3)
6979   fi
6980   if test "x$MOZ_DEBUG" = "x1"; then
6981     AC_DEFINE(MOZ_MEMORY_DEBUG)
6982   fi
6983   dnl The generic feature tests that determine how to compute ncpus are long and
6984   dnl complicated.  Therefore, simply define special cpp variables for the
6985   dnl platforms we have special knowledge of.
6986   case "${target}" in
6987   *-darwin*)
6988     AC_DEFINE(MOZ_MEMORY_DARWIN)
6989     ;;
6990   *-*freebsd*)
6991     AC_DEFINE(MOZ_MEMORY_BSD)
6992     ;;
6993   *-android*|*-linuxandroid*)
6994     AC_DEFINE(MOZ_MEMORY_LINUX)
6995     AC_DEFINE(MOZ_MEMORY_ANDROID)
6996     if test -z "$gonkdir"; then
6997       _WRAP_MALLOC=1
6998     else
6999       AC_DEFINE(MOZ_MEMORY_GONK)
7000     fi
7001     MOZ_GLUE_LDFLAGS=
7002     ;;
7003   *-*linux*)
7004     AC_DEFINE(MOZ_MEMORY_LINUX)
7005     ;;
7006   *-netbsd*)
7007     AC_DEFINE(MOZ_MEMORY_BSD)
7008     ;;
7009   *-solaris*)
7010     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7011     ;;
7012   *-mingw*)
7013     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7014     if test -z "$MOZ_DEBUG"; then
7015       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7016     else
7017       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7018     fi
7019     dnl Look for a broken crtdll.obj
7020     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7021     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7022     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7023       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7024       dnl Also pass this to NSPR/NSS
7025       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7026     else
7027       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7028     fi
7029     rm crtdll.obj
7031     export DLLFLAGS
7032     ;;
7033   *)
7034     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7035     ;;
7036   esac
7037 fi # MOZ_MEMORY
7038 AC_SUBST(MOZ_MEMORY)
7039 AC_SUBST(MOZ_JEMALLOC3)
7040 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7041 AC_SUBST(MOZ_GLUE_LDFLAGS)
7042 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7043 AC_SUBST(WIN32_CRT_LIBS)
7044 dnl Need to set this for make because NSS doesn't have configure
7045 AC_SUBST(DLLFLAGS)
7047 dnl We need to wrap dlopen and related functions on Android because we use
7048 dnl our own linker.
7049 if test "$OS_TARGET" = Android; then
7050     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7051     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7052     if test -z "$gonkdir" -o "$ANDROID_VERSION" -le 18; then
7053         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7054     fi
7055     if test -z "$gonkdir"; then
7056         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7057         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"
7058     fi
7059     if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7060         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=__pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2"
7061     fi
7064 dnl ========================================================
7065 dnl = Use malloc wrapper lib
7066 dnl ========================================================
7067 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7068 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7069     _WRAP_MALLOC=1,
7070     _WRAP_MALLOC= )
7072 if test -n "$_WRAP_MALLOC"; then
7073     if test -n "$GNU_CC"; then
7074         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7075         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7076         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7077         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7078         dnl Wrap operator new and operator delete on Android.
7079         if test "$OS_TARGET" = "Android"; then
7080             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
7081             dnl Wrap the nothrow variants too.
7082             WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
7083         fi
7084     else
7085         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7086     fi
7089 dnl ========================================================
7090 dnl = Location of malloc wrapper lib
7091 dnl ========================================================
7092 MOZ_ARG_WITH_STRING(wrap-malloc,
7093 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7094     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7096 dnl ========================================================
7097 dnl = Use JS Call tracing
7098 dnl ========================================================
7099 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7100 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7101     MOZ_TRACE_JSCALLS=1,
7102     MOZ_TRACE_JSCALLS= )
7103 if test -n "$MOZ_TRACE_JSCALLS"; then
7104     AC_DEFINE(MOZ_TRACE_JSCALLS)
7107 dnl ========================================================
7108 dnl = Use incremental GC
7109 dnl ========================================================
7110 JSGC_INCREMENTAL=1
7111 MOZ_ARG_DISABLE_BOOL(gcincremental,
7112 [  --disable-gcincremental Disable incremental GC],
7113     JSGC_INCREMENTAL= )
7114 if test -n "$JSGC_INCREMENTAL"; then
7115     AC_DEFINE(JSGC_INCREMENTAL)
7118 dnl ========================================================
7119 dnl Zealous JavaScript GC
7120 dnl ========================================================
7121 MOZ_ARG_ENABLE_BOOL(gczeal,
7122 [  --enable-gczeal         Enable zealous JavaScript GCing],
7123     JS_GC_ZEAL=1,
7124     JS_GC_ZEAL= )
7125 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
7126     AC_DEFINE(JS_GC_ZEAL)
7129 dnl ========================================================
7130 dnl JS opt-mode assertions and minidump instrumentation
7131 dnl ========================================================
7132 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7133 [  --enable-js-diagnostics
7134                           Enable JS diagnostic assertions and breakpad data],
7135     JS_CRASH_DIAGNOSTICS=1,
7136     JS_CRASH_DIAGNOSTICS= )
7137 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7138     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7141 MOZ_CHECK_CCACHE
7142 MOZ_CHECK_COMPILER_WRAPPER
7144 dnl ========================================================
7145 dnl = Enable static checking using gcc-dehydra
7146 dnl ========================================================
7148 MOZ_ARG_WITH_STRING(static-checking,
7149 [  --with-static-checking=path/to/gcc_dehydra.so
7150                           Enable static checking of code using GCC-dehydra],
7151     DEHYDRA_PATH=$withval,
7152     DEHYDRA_PATH= )
7154 if test -n "$DEHYDRA_PATH"; then
7155     if test ! -f "$DEHYDRA_PATH"; then
7156         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7157     fi
7158     AC_DEFINE(NS_STATIC_CHECKING)
7160 AC_SUBST(DEHYDRA_PATH)
7162 dnl ========================================================
7163 dnl = Enable using the clang plugin to build
7164 dnl ========================================================
7166 MOZ_ARG_ENABLE_BOOL(clang-plugin,
7167 [  --enable-clang-plugin   Enable building with the mozilla clang plugin ],
7168    ENABLE_CLANG_PLUGIN=1,
7169    ENABLE_CLANG_PLUGIN= )
7170 if test -n "$ENABLE_CLANG_PLUGIN"; then
7171     if test -z "$CLANG_CC"; then
7172         AC_MSG_ERROR([Can't use clang plugin without clang.])
7173     fi
7174     AC_DEFINE(MOZ_CLANG_PLUGIN)
7177 AC_SUBST(ENABLE_CLANG_PLUGIN)
7179 dnl ========================================================
7180 dnl = Enable stripping of libs & executables
7181 dnl ========================================================
7182 MOZ_ARG_ENABLE_BOOL(strip,
7183 [  --enable-strip          Enable stripping of libs & executables ],
7184     ENABLE_STRIP=1,
7185     ENABLE_STRIP= )
7187 dnl ========================================================
7188 dnl = Enable stripping of libs & executables when packaging
7189 dnl ========================================================
7190 MOZ_ARG_ENABLE_BOOL(install-strip,
7191 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7192     PKG_SKIP_STRIP= ,
7193     PKG_SKIP_STRIP=1)
7195 dnl ========================================================
7196 dnl = --disable-elf-hack
7197 dnl ========================================================
7199 USE_ELF_HACK=1
7200 MOZ_ARG_DISABLE_BOOL(elf-hack,
7201 [  --disable-elf-hack      Disable elf hacks],
7202     [USE_ELF_HACK=],
7203     [USE_ELF_HACK=F # Force enable elf-hack])
7205 # Disable elf hack for profiling because the built in profiler
7206 # doesn't read the segments properly with elf hack. This is
7207 # temporary and should be fixed soon in the profiler.
7208 if test "$MOZ_PROFILING" = 1; then
7209   if test "$USE_ELF_HACK" = F; then
7210     AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
7211   fi
7212   USE_ELF_HACK=
7215 # Only enable elfhack where supported
7216 if test "$USE_ELF_HACK" = 1; then
7217     case "${HOST_OS_ARCH},${OS_ARCH}" in
7218     Linux,Linux)
7219         case "${CPU_ARCH}" in
7220         arm | x86 | x86_64)
7221             USE_ELF_HACK=1
7222             ;;
7223         *)
7224             USE_ELF_HACK=
7225             ;;
7226         esac
7227         ;;
7228     *)
7229         USE_ELF_HACK=
7230         ;;
7231     esac
7234 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7235     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7236     dnl memory addresses it maps to. The result is that by the time elfhack
7237     dnl kicks in, it is not possible to apply relocations because of that,
7238     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7239     dnl segment. It makes elfhack mostly useless, so considering the problems
7240     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7241     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7242     dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7243     dnl elfhack enabled, disable PT_GNU_RELRO instead.
7244     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7245         LINK_WITH_PT_GNU_RELRO,
7246         [echo "int main() {return 0;}" > conftest.${ac_ext}
7247          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7248             test -s conftest${ac_exeext}; then
7249             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7250                 LINK_WITH_PT_GNU_RELRO=yes
7251             else
7252                 LINK_WITH_PT_GNU_RELRO=no
7253             fi
7254          else
7255              dnl We really don't expect to get here, but just in case
7256              AC_ERROR([couldn't compile a simple C file])
7257          fi
7258          rm -rf conftest*])
7259     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7260         if test "$USE_ELF_HACK" = F; then
7261             AC_MSG_CHECKING([for -z norelro option to ld])
7262             _SAVE_LDFLAGS=$LDFLAGS
7263             LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7264             AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7265                         [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7266                         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.]))
7267             USE_ELF_HACK=1
7268         else
7269             AC_MSG_WARN([Disabling elfhack])
7270             USE_ELF_HACK=
7271         fi
7272     fi
7275 dnl ========================================================
7276 dnl = libstdc++ compatibility hacks
7277 dnl ========================================================
7279 STDCXX_COMPAT=
7280 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7281 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7282     STDCXX_COMPAT=1)
7284 if test -n "$STDCXX_COMPAT"; then
7285    eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7286    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7287    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7290 dnl ========================================================
7291 dnl =
7292 dnl = Profiling and Instrumenting
7293 dnl =
7294 dnl ========================================================
7295 MOZ_ARG_HEADER(Profiling and Instrumenting)
7297 dnl ========================================================
7298 dnl = Enable runtime visual profiling logger
7299 dnl ========================================================
7300 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7301 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7302     MOZ_VISUAL_EVENT_TRACER=1,
7303     MOZ_VISUAL_EVENT_TRACER=)
7304 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7305     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7308 dnl ========================================================
7309 dnl Turn on reflow counting
7310 dnl ========================================================
7311 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7312 [  --enable-reflow-perf    Enable reflow performance tracing],
7313     MOZ_REFLOW_PERF=1,
7314     MOZ_REFLOW_PERF= )
7315 if test -n "$MOZ_REFLOW_PERF"; then
7316     AC_DEFINE(MOZ_REFLOW_PERF)
7319 dnl ========================================================
7320 dnl = Enable Radio Interface for B2G (Gonk usually)
7321 dnl ========================================================
7322 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7323 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7324     MOZ_B2G_RIL=1,
7325     MOZ_B2G_RIL=,
7326     MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7327 if test -n "$MOZ_B2G_RIL"; then
7328     if test -n "$_PLATFORM_HAVE_RIL"; then
7329         AC_DEFINE(MOZ_B2G_RIL)
7330     else
7331         AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7332     fi
7334 AC_SUBST(MOZ_B2G_RIL)
7336 dnl ========================================================
7337 dnl = Enable Radio FM for B2G (Gonk usually)
7338 dnl ========================================================
7339 if test -n "$MOZ_B2G_FM"; then
7340     AC_DEFINE(MOZ_B2G_FM)
7342 AC_SUBST(MOZ_B2G_FM)
7344 dnl ========================================================
7345 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7346 dnl ========================================================
7347 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7348 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7349     MOZ_B2G_BT=1,
7350     MOZ_B2G_BT= )
7351 if test -n "$MOZ_B2G_BT"; then
7352     AC_DEFINE(MOZ_B2G_BT)
7354 AC_SUBST(MOZ_B2G_BT)
7355 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7356 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7358 dnl ========================================================
7359 dnl = Enable NFC Interface for B2G (Gonk usually)
7360 dnl ========================================================
7361 MOZ_ARG_ENABLE_BOOL(nfc,
7362 [  --enable-nfc         Set compile flags necessary for compiling NFC API ],
7363     MOZ_NFC=1,
7364     MOZ_NFC= )
7365 if test -n "$MOZ_NFC"; then
7366    AC_DEFINE(MOZ_NFC)
7368 AC_SUBST(MOZ_NFC)
7370 dnl ========================================================
7371 dnl = Enable Pico Speech Synthesis (Gonk usually)
7372 dnl ========================================================
7373 MOZ_ARG_ENABLE_BOOL(synth-pico,
7374 [  --enable-synth-pico  Set compile flags necessary for compiling Pico Web Speech API ],
7375     MOZ_SYNTH_PICO=1,
7376     MOZ_SYNTH_PICO= )
7377 if test -n "$MOZ_SYNTH_PICO"; then
7378     AC_DEFINE(MOZ_SYNTH_PICO)
7380 AC_SUBST(MOZ_SYNTH_PICO)
7382 dnl ========================================================
7383 dnl = Enable Support for Time Manager API
7384 dnl ========================================================
7385 if test -n "$MOZ_TIME_MANAGER"; then
7386     AC_DEFINE(MOZ_TIME_MANAGER)
7388 AC_SUBST(MOZ_TIME_MANAGER)
7390 dnl ========================================================
7391 dnl = Enable Camera Interface for B2G (Gonk usually)
7392 dnl ========================================================
7393 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7394 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7395     MOZ_B2G_CAMERA=1,
7396     MOZ_B2G_CAMERA= )
7397 if test -n "$MOZ_B2G_CAMERA"; then
7398    AC_DEFINE(MOZ_B2G_CAMERA)
7400 AC_SUBST(MOZ_B2G_CAMERA)
7402 dnl ========================================================
7403 dnl = Enable Support B2G-specific changes to the NSS
7404 dnl = certificate trust database.
7405 dnl ========================================================
7406 if test -n "$MOZ_B2G_CERTDATA"; then
7407     AC_DEFINE(MOZ_B2G_CERTDATA)
7409 AC_SUBST(MOZ_B2G_CERTDATA)
7411 dnl ========================================================
7412 dnl = Enable Support for Payment API
7413 dnl ========================================================
7414 if test -n "$MOZ_PAY"; then
7415     AC_DEFINE(MOZ_PAY)
7417 AC_SUBST(MOZ_PAY)
7419 dnl ========================================================
7420 dnl = Enable Browser Support for Activities
7421 dnl ========================================================
7422 if test -n "$MOZ_ACTIVITIES"; then
7423     AC_DEFINE(MOZ_ACTIVITIES)
7425 AC_SUBST(MOZ_ACTIVITIES)
7427 dnl ========================================================
7428 dnl = Enable Support for AudioChannelManager API
7429 dnl ========================================================
7430 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7431     AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7433 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7435 dnl ========================================================
7436 dnl = Support for demangling undefined symbols
7437 dnl ========================================================
7438 if test -z "$SKIP_LIBRARY_CHECKS"; then
7439     AC_LANG_SAVE
7440     AC_LANG_CPLUSPLUS
7441     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7442     AC_LANG_RESTORE
7445 # Demangle only for debug or trace-malloc or DMD builds
7446 MOZ_DEMANGLE_SYMBOLS=
7447 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
7448     MOZ_DEMANGLE_SYMBOLS=1
7449     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7451 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7453 dnl ========================================================
7454 dnl = Support for gcc stack unwinding (from gcc 3.3)
7455 dnl ========================================================
7456 if test -z "$SKIP_LIBRARY_CHECKS"; then
7457     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7460 dnl ========================================================
7461 dnl JIT observers
7462 dnl ========================================================
7464 MOZ_ARG_WITH_STRING(jitreport-granularity,
7465 [  --jitreport-granularity=N
7466                            Default granularity at which to report JIT code
7467                            to external tools
7468                              0 - no info
7469                              1 - code ranges for whole functions only
7470                              2 - per-line information
7471                              3 - per-op information],
7472   JITREPORT_GRANULARITY=$withval,
7473   JITREPORT_GRANULARITY=3)
7475 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7477 dnl ========================================================
7478 dnl =
7479 dnl = Misc. Options
7480 dnl =
7481 dnl ========================================================
7482 MOZ_ARG_HEADER(Misc. Options)
7484 dnl ========================================================
7485 dnl update xterm title
7486 dnl ========================================================
7487 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7488 [  --enable-xterm-updates  Update XTERM titles with current command.],
7489     MOZ_UPDATE_XTERM=1,
7490     MOZ_UPDATE_XTERM= )
7492 dnl =========================================================
7493 dnl = Chrome format
7494 dnl =========================================================
7495 MOZ_ARG_ENABLE_STRING([chrome-format],
7496 [  --enable-chrome-format=jar|flat|omni
7497                           Select FORMAT of chrome files during packaging],
7498     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7500 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7501     MOZ_CHROME_FILE_FORMAT=jar
7504 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7505     AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7508 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7509     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7510     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7511     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7514 dnl =========================================================
7515 dnl Omnijar packaging (bug 552121)
7516 dnl =========================================================
7517 dnl Omnijar packaging is compatible with flat packaging.
7518 dnl In unpackaged builds, omnijar looks for files as if
7519 dnl things were flat packaged. After packaging, all files
7520 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7521 dnl is set to flat since putting files into jars is only
7522 dnl done during packaging with omnijar.
7523 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7524     MOZ_OMNIJAR=1
7525     AC_DEFINE(MOZ_OMNIJAR)
7527 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7528 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7529     MOZ_CHROME_FILE_FORMAT=flat
7530 else
7531     MOZ_CHROME_FILE_FORMAT=symlink
7534 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7535     dnl Fennec's static resources live in the assets/ folder of the
7536     dnl APK.  Adding a path to the name here works because we only
7537     dnl have one omnijar file in the final package (which is not the
7538     dnl case on desktop), and necessitates some contortions during
7539     dnl packaging so that the resources in the omnijar are considered
7540     dnl as rooted at / and not as rooted at assets/ (which again is
7541     dnl not the case on desktop: there are omnijars rooted at webrtc/,
7542     dnl etc). packager.mk handles changing the rooting of the single
7543     dnl omnijar.
7544     OMNIJAR_NAME=assets/omni.ja
7545 else
7546     OMNIJAR_NAME=omni.ja
7549 AC_SUBST(OMNIJAR_NAME)
7550 AC_SUBST(MOZ_OMNIJAR)
7551 AC_SUBST(MOZ_PACKAGER_FORMAT)
7553 dnl ========================================================
7554 dnl = Define default location for MOZILLA_FIVE_HOME
7555 dnl ========================================================
7556 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7557 [  --with-default-mozilla-five-home
7558                           Set the default value for MOZILLA_FIVE_HOME],
7559 [ val=`echo $withval`
7560   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7562 dnl ========================================================
7563 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7564 dnl ========================================================
7565 MOZ_ARG_WITH_STRING(user-appdir,
7566 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7567 [ val=`echo $withval`
7568 if echo "$val" | grep "\/" >/dev/null; then
7569     AC_MSG_ERROR("Homedir must be single relative path.")
7570 else
7571     MOZ_USER_DIR="$val"
7572 fi])
7574 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7576 dnl ========================================================
7577 dnl = Doxygen configuration
7578 dnl ========================================================
7579 dnl Use commas to specify multiple dirs to this arg
7580 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7581 MOZ_ARG_WITH_STRING(doc-input-dirs,
7582 [  --with-doc-input-dirs=DIRS
7583                           Header/idl dirs to create docs from],
7584 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7585 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7587 dnl Use commas to specify multiple dirs to this arg
7588 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7589 MOZ_ARG_WITH_STRING(doc-include-dirs,
7590 [  --with-doc-include-dirs=DIRS
7591                           Include dirs to preprocess doc headers],
7592 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7593 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7595 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7596 MOZ_ARG_WITH_STRING(doc-output-dir,
7597 [  --with-doc-output-dir=DIR
7598                           Dir to generate docs into],
7599 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7600 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7602 if test -z "$SKIP_COMPILER_CHECKS"; then
7603 dnl ========================================================
7604 dnl =
7605 dnl = Compiler Options
7606 dnl =
7607 dnl ========================================================
7608 MOZ_ARG_HEADER(Compiler Options)
7610 dnl ========================================================
7611 dnl Check for gcc -pipe support
7612 dnl ========================================================
7613 AC_MSG_CHECKING([for -pipe support])
7614 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7615     dnl Any gcc that supports firefox supports -pipe.
7616     CFLAGS="$CFLAGS -pipe"
7617     CXXFLAGS="$CXXFLAGS -pipe"
7618     AC_MSG_RESULT([yes])
7619 else
7620     AC_MSG_RESULT([no])
7623 dnl ========================================================
7624 dnl Profile guided optimization (gcc checks)
7625 dnl ========================================================
7626 dnl Test for profiling options
7627 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7629 _SAVE_CFLAGS="$CFLAGS"
7630 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7632 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7633 AC_TRY_COMPILE([], [return 0;],
7634                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7635                  result="yes" ], result="no")
7636 AC_MSG_RESULT([$result])
7638 if test $result = "yes"; then
7639   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7640   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7641   PROFILE_USE_LDFLAGS="-fprofile-use"
7644 CFLAGS="$_SAVE_CFLAGS"
7646 if test -n "$INTEL_CC"; then
7647   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7648   PROFILE_GEN_LDFLAGS=
7649   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7650   PROFILE_USE_LDFLAGS=
7653 dnl Sun Studio on Solaris
7654 if test "$SOLARIS_SUNPRO_CC"; then
7655   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7656   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7657   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7658   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7661 AC_SUBST(PROFILE_GEN_CFLAGS)
7662 AC_SUBST(PROFILE_GEN_LDFLAGS)
7663 AC_SUBST(PROFILE_USE_CFLAGS)
7664 AC_SUBST(PROFILE_USE_LDFLAGS)
7666 AC_LANG_CPLUSPLUS
7668 dnl ========================================================
7669 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7670 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7671 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7672 dnl ========================================================
7673 _SAVE_CXXFLAGS=$CXXFLAGS
7674 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7675 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7676     ac_nscap_nonconst_opeq_bug,
7677     [AC_TRY_COMPILE([
7678                       template <class T>
7679                       class Pointer
7680                         {
7681                         public:
7682                           T* myPtr;
7683                         };
7685                       template <class T, class U>
7686                       int operator==(const Pointer<T>& rhs, U* lhs)
7687                         {
7688                           return rhs.myPtr == lhs;
7689                         }
7691                       template <class T, class U>
7692                       int operator==(const Pointer<T>& rhs, const U* lhs)
7693                         {
7694                           return rhs.myPtr == lhs;
7695                         }
7696                     ],
7697                     [
7698                       Pointer<int> foo;
7699                       const int* bar;
7700                       return foo == bar;
7701                     ],
7702                     ac_nscap_nonconst_opeq_bug="no",
7703                     ac_nscap_nonconst_opeq_bug="yes")])
7704 CXXFLAGS="$_SAVE_CXXFLAGS"
7706 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7707     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7709 fi # ! SKIP_COMPILER_CHECKS
7711 AC_DEFINE(CPP_THROW_NEW, [throw()])
7712 AC_LANG_C
7714 if test "$COMPILE_ENVIRONMENT"; then
7715 MOZ_EXPAND_LIBS
7716 fi # COMPILE_ENVIRONMENT
7718 dnl ========================================================
7719 dnl =
7720 dnl = Build depencency options
7721 dnl =
7722 dnl ========================================================
7723 MOZ_ARG_HEADER(Build dependencies)
7725 if test "$GNU_CC" -a "$GNU_CXX"; then
7726   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7727 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7728 elif test "$SOLARIS_SUNPRO_CC"; then
7729   _DEPEND_CFLAGS=
7730 else
7731   dnl Don't override this for MSVC
7732   if test -z "$_WIN32_MSVC"; then
7733     _USE_CPP_INCLUDE_FLAG=
7734     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7735     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7736   else
7737     echo '#include <stdio.h>' > dummy-hello.c
7738     changequote(,)
7739     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7740     changequote([,])
7741     if test -z "$CL_INCLUDES_PREFIX"; then
7742         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7743     fi
7744     AC_SUBST(CL_INCLUDES_PREFIX)
7745     rm -f dummy-hello.c
7746   fi
7749 dnl Make sure that the build system can handle non-ASCII characters
7750 dnl in environment variables to prevent it from breking silently on
7751 dnl non-English systems.
7752 NONASCII=$'\241\241'
7753 AC_SUBST(NONASCII)
7755 dnl ========================================================
7756 dnl =
7757 dnl = Static Build Options
7758 dnl =
7759 dnl ========================================================
7760 MOZ_ARG_HEADER(Static build options)
7762 if test -n "$JS_SHARED_LIBRARY"; then
7763   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7764 else
7765   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7766   AC_DEFINE(MOZ_STATIC_JS)
7768 AC_SUBST(JS_SHARED_LIBRARY)
7770 AC_SUBST(LIBXUL_LIBS)
7771 XPCOM_LIBS="$LIBXUL_LIBS"
7773 if test "$OS_ARCH" = "WINNT"; then
7774   GKMEDIAS_SHARED_LIBRARY=1
7776 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7778 if test -z "$MOZ_NATIVE_ZLIB"; then
7779 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7780   ZLIB_IN_MOZGLUE=1
7781   AC_DEFINE(ZLIB_IN_MOZGLUE)
7785 AC_SUBST(ZLIB_IN_MOZGLUE)
7787 dnl ========================================================
7788 dnl =
7789 dnl = Standalone module options
7790 dnl =
7791 dnl ========================================================
7792 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7794 dnl Check for GLib.
7795 dnl ========================================================
7797 if test -z "$SKIP_PATH_CHECKS"; then
7798 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7799     if test "$MOZ_ENABLE_GTK" ; then
7800         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7801     fi
7805 if test -z "${GLIB_GMODULE_LIBS}" \
7806    -a -n "${GLIB_CONFIG}"\
7807     -a "${GLIB_CONFIG}" != no\
7808 ; then
7809     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7812 AC_SUBST(GLIB_CFLAGS)
7813 AC_SUBST(GLIB_LIBS)
7814 AC_SUBST(GLIB_GMODULE_LIBS)
7816 dnl ========================================================
7817 dnl Graphics checks.
7818 dnl ========================================================
7820 if test "${OS_TARGET}" = "WINNT"; then
7821   if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
7822     MOZ_ENABLE_DIRECT2D1_1=1
7823     AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
7824   fi
7827 if test "${OS_TARGET}" = "WINNT" -o \
7828         "${OS_ARCH}" = "Darwin" -o \
7829         "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7830         "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7831         "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7832         "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7833     case "${target_cpu}" in
7834     i*86*|x86_64|arm)
7835         MOZ_ENABLE_SKIA=1
7836         ;;
7837     *)
7838         MOZ_ENABLE_SKIA=
7839         ;;
7840     esac
7841 else
7842 MOZ_ENABLE_SKIA=
7845 MOZ_ARG_ENABLE_BOOL(skia,
7846 [  --enable-skia   Enable use of Skia],
7847 MOZ_ENABLE_SKIA=1,
7848 MOZ_ENABLE_SKIA=)
7850 if test "$USE_FC_FREETYPE"; then
7851     if test "$COMPILE_ENVIRONMENT"; then
7852         dnl ========================================================
7853         dnl = Check for freetype2 and its functionality
7854         dnl ========================================================
7855         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7857         if test "$_HAVE_FREETYPE2"; then
7858             _SAVE_LIBS="$LIBS"
7859             _SAVE_CFLAGS="$CFLAGS"
7860             LIBS="$LIBS $FT2_LIBS"
7861             CFLAGS="$CFLAGS $FT2_CFLAGS"
7863             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7864                 ac_cv_member_FT_Bitmap_Size_y_ppem,
7865                 [AC_TRY_COMPILE([#include <ft2build.h>
7866                                  #include FT_FREETYPE_H],
7867                                 [FT_Bitmap_Size s;
7868                                  if (sizeof s.y_ppem) return 0;
7869                                  return 1],
7870                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7871                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7872             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7873                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7874             else
7875                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7876             fi
7877             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7878                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7879                                [FT_Bitmap_Size structure includes y_ppem field])
7881             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
7883             LIBS="$_SAVE_LIBS"
7884             CFLAGS="$_SAVE_CFLAGS"
7885         fi
7887         _SAVE_CPPFLAGS="$CPPFLAGS"
7888         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7889         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7890             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7891         CPPFLAGS="$_SAVE_CPPFLAGS"
7892     else
7893         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7894     fi
7896     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7897     [
7898         if test "$MOZ_PANGO"; then
7899             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7900             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7901         else
7902             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7903             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7904         fi
7905     ])
7908 dnl ========================================================
7909 dnl Check for pixman and cairo
7910 dnl ========================================================
7912 MOZ_TREE_CAIRO=1
7913 MOZ_ARG_ENABLE_BOOL(system-cairo,
7914 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
7915 MOZ_TREE_CAIRO=,
7916 MOZ_TREE_CAIRO=1 )
7918 MOZ_TREE_PIXMAN=1
7919 MOZ_ARG_ENABLE_BOOL(system-pixman,
7920 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7921 MOZ_TREE_PIXMAN=,
7922 MOZ_TREE_PIXMAN=force,
7923 MOZ_TREE_PIXMAN=1 )
7925 # System cairo depends on system pixman
7926 if test "$MOZ_TREE_PIXMAN" = "force"; then
7927     if test -z "$MOZ_TREE_CAIRO"; then
7928         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7929     else
7930         MOZ_TREE_PIXMAN=1
7931     fi
7932 elif test -z "$MOZ_TREE_CAIRO"; then
7933     MOZ_TREE_PIXMAN=
7936 if test "$MOZ_TREE_PIXMAN"; then
7937     AC_DEFINE(MOZ_TREE_PIXMAN)
7938     MOZ_PIXMAN_CFLAGS=""
7939     MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
7940 else
7941     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7942     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7943     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7945 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7946 AC_SUBST(MOZ_PIXMAN_LIBS)
7948 # Check for headers defining standard int types.
7949 if test -n "$COMPILE_ENVIRONMENT"; then
7950     MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7953 if test "$MOZ_TREE_CAIRO"; then
7954     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7955     AC_DEFINE(MOZ_TREE_CAIRO)
7957     # For now we assume that we will have a uint64_t available through
7958     # one of the above headers or mozstdint.h.
7959     AC_DEFINE(HAVE_UINT64_T)
7961     # Define macros for cairo-features.h
7962     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7963     if test "$MOZ_X11"; then
7964         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7965         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7966         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7967         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7968         MOZ_ENABLE_CAIRO_FT=1
7969         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7970     fi
7971     case "$MOZ_WIDGET_TOOLKIT" in
7972       qt)
7973         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7974         ;;
7975       cocoa | uikit)
7976         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7977         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7978         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7979         ;;
7980       windows)
7981         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7982         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7983         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7984             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7985             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7986             MOZ_ENABLE_D2D_SURFACE=1
7987             MOZ_ENABLE_DWRITE_FONT=1
7988         else
7989             WIN32_DWRITE_FONT_FEATURE=
7990             WIN32_D2D_SURFACE_FEATURE=
7991         fi
7993         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7995         dnl D3D10 Layers depend on D2D Surfaces.
7996         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7997           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7998         fi
7999         ;;
8000       os2)
8001         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8002         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8003         MOZ_ENABLE_CAIRO_FT=1
8004         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8005         CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
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_OSLIBS='${CAIRO_FT_OSLIBS}'
8040     if test "$MOZ_X11"; then
8041         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8042     fi
8044     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8045 else
8046     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8047     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8048     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8049     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8050     if test "$MOZ_X11"; then
8051         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8052         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8053         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8054         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8055     fi
8058 AC_SUBST(MOZ_TREE_CAIRO)
8059 AC_SUBST(MOZ_CAIRO_CFLAGS)
8060 AC_SUBST(MOZ_CAIRO_LIBS)
8061 AC_SUBST(MOZ_CAIRO_OSLIBS)
8062 AC_SUBST(MOZ_TREE_PIXMAN)
8064 dnl ========================================================
8065 dnl Skia 
8066 dnl ========================================================
8067 if test "$MOZ_ENABLE_SKIA"; then
8068   AC_DEFINE(MOZ_ENABLE_SKIA)
8069   AC_DEFINE(USE_SKIA)
8070   if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8071     AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8072   elif test "$OS_ARCH" = "WINNT"; then
8073     AC_DEFINE(SKIA_DLL)
8074     AC_DEFINE(GR_DLL)
8075   fi
8077   if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
8078     MOZ_ENABLE_SKIA_GPU=1
8079     AC_DEFINE(USE_SKIA_GPU)
8080     AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8081   fi
8083 AC_SUBST(MOZ_ENABLE_SKIA)
8085 dnl ========================================================
8086 dnl disable xul
8087 dnl ========================================================
8088 MOZ_ARG_DISABLE_BOOL(xul,
8089 [  --disable-xul           Disable XUL],
8090     MOZ_XUL= )
8091 if test "$MOZ_XUL"; then
8092   AC_DEFINE(MOZ_XUL)
8093 else
8094   dnl remove extensions that require XUL
8095   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8098 AC_SUBST(MOZ_XUL)
8100 dnl ========================================================
8101 dnl disable profile locking
8102 dnl   do no use this in applications that can have more than
8103 dnl   one process accessing the profile directory.
8104 dnl ========================================================
8105 MOZ_ARG_DISABLE_BOOL(profilelocking,
8106 [  --disable-profilelocking
8107                           Disable profile locking],
8108     MOZ_PROFILELOCKING=,
8109     MOZ_PROFILELOCKING=1 )
8110 if test "$MOZ_PROFILELOCKING"; then
8111   AC_DEFINE(MOZ_PROFILELOCKING)
8114 dnl ========================================================
8115 dnl necko configuration options
8116 dnl ========================================================
8119 dnl option to disable various necko protocols
8121 MOZ_ARG_ENABLE_STRING(necko-protocols,
8122 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8123                           Enable/disable specific protocol handlers],
8124 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8125     if test "$option" = "yes" -o "$option" = "all"; then
8126         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8127     elif test "$option" = "no" -o "$option" = "none"; then
8128         NECKO_PROTOCOLS=""
8129     elif test "$option" = "default"; then
8130         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8131     elif test `echo "$option" | grep -c \^-` != 0; then
8132         option=`echo $option | sed 's/^-//'`
8133         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8134     else
8135         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8136     fi
8137 done],
8138     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8139 dnl Remove dupes
8140 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8141 AC_SUBST_SET(NECKO_PROTOCOLS)
8142 for p in $NECKO_PROTOCOLS; do
8143     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8144     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8145 done
8148 dnl option to disable necko's wifi scanner
8151 case "$OS_TARGET" in
8152   Android)
8153     if test -n "$gonkdir"; then
8154       NECKO_WIFI=1
8155     fi
8156     ;;
8157   Darwin|SunOS|WINNT)
8158     NECKO_WIFI=1
8159     ;;
8160   Linux)
8161     NECKO_WIFI=1
8162     NECKO_WIFI_DBUS=1
8163     ;;
8164 esac
8166 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8167 [  --disable-necko-wifi    Disable necko wifi scanner],
8168     NECKO_WIFI=,
8169     NECKO_WIFI=1)
8171 if test "$NECKO_WIFI"; then
8172   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8173     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8174   fi
8175   AC_DEFINE(NECKO_WIFI)
8176   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8178 AC_SUBST(NECKO_WIFI)
8179 AC_SUBST(NECKO_WIFI_DBUS)
8182 dnl option to disable cookies
8184 MOZ_ARG_DISABLE_BOOL(cookies,
8185 [  --disable-cookies       Disable cookie support],
8186     NECKO_COOKIES=,
8187     NECKO_COOKIES=1)
8188 AC_SUBST(NECKO_COOKIES)
8189 if test "$NECKO_COOKIES"; then
8190     AC_DEFINE(NECKO_COOKIES)
8191     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8195 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8197 MOZ_ARG_DISABLE_BOOL(ctypes,
8198 [  --disable-ctypes        Disable js-ctypes],
8199     BUILD_CTYPES=,
8200     BUILD_CTYPES=1)
8201 AC_SUBST(BUILD_CTYPES)
8202 if test "$BUILD_CTYPES"; then
8203     AC_DEFINE(BUILD_CTYPES)
8206 dnl Build Places if required
8207 if test "$MOZ_PLACES"; then
8208   AC_DEFINE(MOZ_PLACES)
8211 dnl Build SocialAPI if required
8212 if test "$MOZ_SOCIAL"; then
8213   AC_DEFINE(MOZ_SOCIAL)
8216 dnl Build Common JS modules provided by services.
8217 AC_SUBST(MOZ_SERVICES_COMMON)
8218 if test -n "$MOZ_SERVICES_COMMON"; then
8219   AC_DEFINE(MOZ_SERVICES_COMMON)
8222 dnl Build Services crypto component (used by Sync)
8223 AC_SUBST(MOZ_SERVICES_CRYPTO)
8224 if test -n "$MOZ_SERVICES_CRYPTO"; then
8225   AC_DEFINE(MOZ_SERVICES_CRYPTO)
8228 dnl Build Firefox Health Reporter Service
8229 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8230 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8231   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8234 dnl Build Services metrics component
8235 AC_SUBST(MOZ_SERVICES_METRICS)
8236 if test -n "$MOZ_SERVICES_METRICS"; then
8237   AC_DEFINE(MOZ_SERVICES_METRICS)
8240 dnl Build Notifications if required
8241 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8242 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8243   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8246 dnl Build Sync Services if required
8247 AC_SUBST(MOZ_SERVICES_SYNC)
8248 if test -n "$MOZ_SERVICES_SYNC"; then
8249   AC_DEFINE(MOZ_SERVICES_SYNC)
8252 dnl Build Captive Portal Detector if required
8253 AC_SUBST(MOZ_CAPTIVEDETECT)
8254 if test -n "$MOZ_CAPTIVEDETECT"; then
8255   AC_DEFINE(MOZ_CAPTIVEDETECT)
8258 dnl ========================================================
8259 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
8260     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8263 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8264   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8267 if test "$MOZ_APP_COMPONENT_MODULES"; then
8268   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8271 dnl ========================================================
8272 dnl =
8273 dnl = Maintainer debug option (no --enable equivalent)
8274 dnl =
8275 dnl ========================================================
8277 AC_SUBST(AR)
8278 AC_SUBST(AR_FLAGS)
8279 AC_SUBST(AR_LIST)
8280 AC_SUBST(AR_EXTRACT)
8281 AC_SUBST(AR_DELETE)
8282 AC_SUBST(AS)
8283 AC_SUBST(ASFLAGS)
8284 AC_SUBST(AS_DASH_C_FLAG)
8285 AC_SUBST(LD)
8286 AC_SUBST(RC)
8287 AC_SUBST(RCFLAGS)
8288 AC_SUBST(MC)
8289 AC_SUBST(WINDRES)
8290 AC_SUBST(IMPLIB)
8291 AC_SUBST(FILTER)
8292 AC_SUBST(BIN_FLAGS)
8293 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8294 AC_SUBST(MOZ_UPDATE_XTERM)
8295 AC_SUBST(MOZ_AUTH_EXTENSION)
8296 AC_SUBST(MOZ_PERMISSIONS)
8297 AC_SUBST(MOZ_PREF_EXTENSIONS)
8298 AC_SUBST(MOZ_JS_LIBS)
8299 AC_SUBST(MOZ_DEBUG)
8300 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8301 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8302 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8303 AC_SUBST(MOZ_DEBUG_FLAGS)
8304 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8305 AC_SUBST(WARNINGS_AS_ERRORS)
8306 AC_SUBST(MOZ_EXTENSIONS)
8307 AC_SUBST(MOZ_JSDEBUGGER)
8308 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8309 AC_SUBST(MOZ_JPROF)
8310 AC_SUBST(MOZ_SHARK)
8311 AC_SUBST(MOZ_INSTRUMENTS)
8312 AC_SUBST(MOZ_CALLGRIND)
8313 AC_SUBST(MOZ_VTUNE)
8314 AC_SUBST(MOZ_PROFILING)
8315 AC_SUBST(LIBICONV)
8316 AC_SUBST(MOZ_PLACES)
8317 AC_SUBST(MOZ_SOCIAL)
8318 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8319 AC_SUBST(MOZ_FEEDS)
8320 AC_SUBST(NS_PRINTING)
8321 AC_SUBST(MOZ_WEBGL)
8322 AC_SUBST(MOZ_HELP_VIEWER)
8323 AC_SUBST(TOOLCHAIN_PREFIX)
8325 AC_SUBST(JAVA)
8326 AC_SUBST(JAVAC)
8327 AC_SUBST(JAVAH)
8328 AC_SUBST(JAR)
8329 AC_SUBST(JARSIGNER)
8330 AC_SUBST(KEYTOOL)
8332 AC_SUBST(MOZ_PROFILELOCKING)
8334 AC_SUBST(ENABLE_TESTS)
8335 AC_SUBST(ENABLE_MARIONETTE)
8336 AC_SUBST(IBMBIDI)
8337 AC_SUBST(MOZ_UNIVERSALCHARDET)
8338 AC_SUBST(ACCESSIBILITY)
8339 AC_SUBST(MOZ_SPELLCHECK)
8340 AC_SUBST(MOZ_ANDROID_OMTC)
8341 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8342 AC_SUBST(MOZ_CRASHREPORTER)
8343 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8344 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8345 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8346 AC_SUBST(MOZ_STUB_INSTALLER)
8347 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8348 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8349 AC_SUBST(MOZ_UPDATER)
8350 AC_SUBST(MOZ_ANGLE_RENDERER)
8351 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8352 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8353 AC_SUBST(MOZ_D3DX9_VERSION)
8354 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8355 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8356 AC_SUBST(MOZ_METRO)
8358 AC_SUBST(MOZ_ANDROID_HISTORY)
8359 AC_SUBST(MOZ_WEBSMS_BACKEND)
8360 AC_SUBST(MOZ_ANDROID_BEAM)
8361 AC_SUBST(MOZ_ANDROID_SYNTHAPKS)
8362 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8363 AC_SUBST(ENABLE_STRIP)
8364 AC_SUBST(PKG_SKIP_STRIP)
8365 AC_SUBST(STRIP_FLAGS)
8366 AC_SUBST(USE_ELF_HACK)
8367 AC_SUBST(INCREMENTAL_LINKER)
8368 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8369 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8371 AC_SUBST(MOZ_FIX_LINK_PATHS)
8372 AC_SUBST(XPCOM_LIBS)
8373 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8374 AC_SUBST(XPCOM_GLUE_LDOPTS)
8375 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8376 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
8377 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
8379 AC_SUBST(USE_DEPENDENT_LIBS)
8381 AC_SUBST(MOZ_BUILD_ROOT)
8382 AC_SUBST(MOZ_OS2_TOOLS)
8384 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8385 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8386 AC_SUBST(MOZ_LINKER_EXTRACT)
8388 AC_SUBST(MOZ_JSDOWNLOADS)
8389 if test -n "$MOZ_JSDOWNLOADS"; then
8390   AC_DEFINE(MOZ_JSDOWNLOADS)
8393 dnl ========================================================
8394 dnl = Mac bundle name prefix
8395 dnl ========================================================
8396 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8397 [  --with-macbundlename-prefix=prefix
8398                           Prefix for MOZ_MACBUNDLE_NAME],
8399 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8401 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8402 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8403   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8406 if test "$MOZ_DEBUG"; then
8407   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8408 else
8409   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8411 AC_SUBST(MOZ_MACBUNDLE_NAME)
8413 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8414 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8415 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8416 if test "$MOZ_DEBUG"; then
8417   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8420 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8421 AC_SUBST(MOZ_MACBUNDLE_ID)
8423 dnl ========================================================
8424 dnl = Child Process Name for IPC
8425 dnl ========================================================
8426 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8427   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8428 else
8429   # We want to let Android unpack the file at install time, but it only does
8430   # so if the file is named libsomething.so. The lib/ path is also required
8431   # because the unpacked file will be under the lib/ subdirectory and will
8432   # need to be executed from that path.
8433   MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8435 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8437 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8438 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8440 # The following variables are available to branding and application
8441 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8442 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8443 # impacts profile location and user-visible fields.
8444 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8445 # versions of a given application (e.g. Aurora and Firefox both use
8446 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8447 # for application.ini's "Name" field, which controls profile location in
8448 # the absence of a "Profile" field (see below), and various system
8449 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8450 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8451 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8452 # builds (e.g. Aurora for Firefox).
8453 # - MOZ_APP_VERSION: Defines the application version number.
8454 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8455 # defaults to a lowercase form of MOZ_APP_BASENAME.
8456 # - MOZ_APP_PROFILE: When set, used for application.ini's
8457 # "Profile" field, which controls profile location.
8458 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8459 # crash reporter server url.
8460 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8461 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8463 if test -z "$MOZ_APP_NAME"; then
8464    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8467 # For extensions and langpacks, we require a max version that is compatible
8468 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8469 # 10.0a1 and 10.0a2 aren't affected
8470 # 10.0 becomes 10.0.*
8471 # 10.0.1 becomes 10.0.*
8472 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8473 if test -z "$IS_ALPHA"; then
8474   changequote(,)
8475   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8476   changequote([,])
8477 else
8478   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8481 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8482 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8483 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8485 AC_SUBST(MOZ_APP_NAME)
8486 AC_SUBST(MOZ_APP_DISPLAYNAME)
8487 AC_SUBST(MOZ_APP_BASENAME)
8488 AC_SUBST(MOZ_APP_VENDOR)
8489 AC_SUBST(MOZ_APP_PROFILE)
8490 AC_SUBST(MOZ_APP_ID)
8491 AC_SUBST(MAR_CHANNEL_ID)
8492 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8493 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8494 AC_SUBST(MOZ_EXTENSION_MANAGER)
8495 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8496 AC_SUBST(MOZ_APP_UA_NAME)
8497 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8498 AC_SUBST(MOZ_APP_VERSION)
8499 AC_SUBST(MOZ_APP_MAXVERSION)
8500 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8501 AC_SUBST(FIREFOX_VERSION)
8502 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8503 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8504   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8507 AC_SUBST(MOZ_APP_STATIC_INI)
8509 AC_SUBST(MOZ_PKG_SPECIAL)
8511 AC_SUBST(MOZILLA_OFFICIAL)
8513 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8514 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8516 if test "$MOZ_TELEMETRY_REPORTING"; then
8517     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8519     # Enable Telemetry by default for nightly and aurora channels
8520     if test -z "$RELEASE_BUILD"; then
8521       AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8522     fi
8525 dnl If we have any service that uploads data (and requires data submission
8526 dnl policy alert), set MOZ_DATA_REPORTING.
8527 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8528 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8529   MOZ_DATA_REPORTING=1
8530   AC_DEFINE(MOZ_DATA_REPORTING)
8531   AC_SUBST(MOZ_DATA_REPORTING)
8534 dnl win32 options
8535 AC_SUBST(MOZ_BROWSE_INFO)
8536 AC_SUBST(MOZ_TOOLS_DIR)
8537 AC_SUBST(WIN32_REDIST_DIR)
8538 AC_SUBST(MAKENSISU)
8540 dnl Echo the CFLAGS to remove extra whitespace.
8541 CFLAGS=`echo \
8542         $_WARNINGS_CFLAGS \
8543         $CFLAGS`
8545 CXXFLAGS=`echo \
8546         $_WARNINGS_CXXFLAGS \
8547         $CXXFLAGS`
8549 COMPILE_CFLAGS=`echo \
8550     $_DEFINES_CFLAGS \
8551         $_DEPEND_CFLAGS \
8552     $COMPILE_CFLAGS`
8554 COMPILE_CXXFLAGS=`echo \
8555     $_DEFINES_CXXFLAGS \
8556         $_DEPEND_CFLAGS \
8557     $COMPILE_CXXFLAGS`
8559 HOST_CFLAGS=`echo \
8560     $HOST_CFLAGS \
8561     $_DEPEND_CFLAGS`
8563 HOST_CXXFLAGS=`echo \
8564     $HOST_CXXFLAGS \
8565     $_DEPEND_CFLAGS`
8567 AC_SUBST(SYSTEM_LIBXUL)
8568 AC_SUBST(MOZ_NATIVE_JPEG)
8569 AC_SUBST(MOZ_NATIVE_PNG)
8570 AC_SUBST(MOZ_NATIVE_BZ2)
8572 AC_SUBST(MOZ_JPEG_CFLAGS)
8573 AC_SUBST(MOZ_JPEG_LIBS)
8574 AC_SUBST(MOZ_BZ2_CFLAGS)
8575 AC_SUBST(MOZ_BZ2_LIBS)
8576 AC_SUBST(MOZ_PNG_CFLAGS)
8577 AC_SUBST(MOZ_PNG_LIBS)
8579 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8580     export MOZ_NUWA_PROCESS
8581     AC_DEFINE(MOZ_NUWA_PROCESS)
8583 AC_SUBST(MOZ_NUWA_PROCESS)
8585 AC_SUBST(NSPR_CFLAGS)
8586 AC_SUBST(NSPR_LIBS)
8587 AC_SUBST(MOZ_NATIVE_NSPR)
8589 AC_SUBST(NSS_CFLAGS)
8590 AC_SUBST(NSS_LIBS)
8591 AC_SUBST(MOZ_NATIVE_NSS)
8592 AC_SUBST(NSS_DISABLE_DBM)
8594 OS_CFLAGS="$CFLAGS"
8595 OS_CXXFLAGS="$CXXFLAGS"
8596 OS_CPPFLAGS="$CPPFLAGS"
8597 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8598 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8599 OS_LDFLAGS="$LDFLAGS"
8600 OS_LIBS="$LIBS"
8601 AC_SUBST(OS_CFLAGS)
8602 AC_SUBST(OS_CXXFLAGS)
8603 AC_SUBST(OS_CPPFLAGS)
8604 AC_SUBST(OS_COMPILE_CFLAGS)
8605 AC_SUBST(OS_COMPILE_CXXFLAGS)
8606 AC_SUBST(OS_LDFLAGS)
8607 AC_SUBST(OS_LIBS)
8608 AC_SUBST(CROSS_COMPILE)
8609 AC_SUBST(WCHAR_CFLAGS)
8611 AC_SUBST(HOST_CC)
8612 AC_SUBST(HOST_CXX)
8613 AC_SUBST(HOST_CFLAGS)
8614 AC_SUBST(HOST_CXXFLAGS)
8615 AC_SUBST(HOST_LDFLAGS)
8616 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8617 AC_SUBST(HOST_AR)
8618 AC_SUBST(HOST_AR_FLAGS)
8619 AC_SUBST(HOST_LD)
8620 AC_SUBST(HOST_RANLIB)
8621 AC_SUBST(HOST_NSPR_MDCPUCFG)
8622 AC_SUBST(HOST_BIN_SUFFIX)
8623 AC_SUBST(HOST_OS_ARCH)
8625 AC_SUBST(TARGET_CPU)
8626 AC_SUBST(TARGET_VENDOR)
8627 AC_SUBST(TARGET_OS)
8628 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8629 AC_SUBST(TARGET_MD_ARCH)
8630 AC_SUBST(TARGET_XPCOM_ABI)
8631 AC_SUBST(OS_TARGET)
8632 AC_SUBST(OS_ARCH)
8633 AC_SUBST(OS_RELEASE)
8634 AC_SUBST(OS_TEST)
8635 AC_SUBST(CPU_ARCH)
8636 AC_SUBST(INTEL_ARCHITECTURE)
8637 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8638 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8640 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8642 AC_SUBST(WRAP_LDFLAGS)
8643 AC_SUBST(MKSHLIB)
8644 AC_SUBST(MKCSHLIB)
8645 AC_SUBST(MKSHLIB_FORCE_ALL)
8646 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8647 AC_SUBST(DSO_CFLAGS)
8648 AC_SUBST(DSO_PIC_CFLAGS)
8649 AC_SUBST(DSO_LDOPTS)
8650 AC_SUBST(LIB_PREFIX)
8651 AC_SUBST(DLL_PREFIX)
8652 AC_SUBST(DLL_SUFFIX)
8653 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8654 AC_SUBST(LIB_SUFFIX)
8655 AC_SUBST(OBJ_SUFFIX)
8656 AC_SUBST(BIN_SUFFIX)
8657 AC_SUBST(ASM_SUFFIX)
8658 AC_SUBST(IMPORT_LIB_SUFFIX)
8659 AC_SUBST(USE_N32)
8660 AC_SUBST(CC_VERSION)
8661 AC_SUBST(CXX_VERSION)
8662 AC_SUBST(MSMANIFEST_TOOL)
8663 AC_SUBST(NS_ENABLE_TSF)
8664 AC_SUBST(MOZ_NSS_PATCH)
8665 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8666 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8668 AC_SUBST(MOZ_WAVE)
8669 AC_SUBST(MOZ_VORBIS)
8670 AC_SUBST(MOZ_TREMOR)
8671 AC_SUBST(MOZ_OPUS)
8672 AC_SUBST(MOZ_WEBM)
8673 AC_SUBST(MOZ_WMF)
8674 AC_SUBST(MOZ_FMP4)
8675 AC_SUBST(MOZ_DIRECTSHOW)
8676 AC_SUBST(MOZ_MEDIA_PLUGINS)
8677 AC_SUBST(MOZ_APPLEMEDIA)
8678 AC_SUBST(MOZ_OMX_PLUGIN)
8679 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8680 AC_SUBST(MOZ_VPX)
8681 AC_SUBST(MOZ_OGG)
8682 AC_SUBST(VPX_AS)
8683 AC_SUBST(VPX_ASFLAGS)
8684 AC_SUBST(VPX_DASH_C_FLAG)
8685 AC_SUBST(VPX_AS_CONVERSION)
8686 AC_SUBST(VPX_ASM_SUFFIX)
8687 AC_SUBST(VPX_X86_ASM)
8688 AC_SUBST(VPX_ARM_ASM)
8689 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8690 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8691 AC_SUBST(LIBJPEG_TURBO_AS)
8692 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8693 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8694 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8695 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8697 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8698 AC_SUBST(MOZ_FOLD_LIBS)
8700 AC_SUBST(MOZ_ENABLE_SZIP)
8701 AC_SUBST(MOZ_SZIP_FLAGS)
8703 if test -n "$COMPILE_ENVIRONMENT"; then
8704 AC_MSG_CHECKING([for posix_fallocate])
8705 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8706   #include <fcntl.h>],
8707                  [posix_fallocate(0, 0, 0);],
8708                  [ac_cv___posix_fallocate=true],
8709                  [ac_cv___posix_fallocate=false])
8711 if test "$ac_cv___posix_fallocate" = true ; then
8712   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8713   AC_MSG_RESULT(yes)
8714 else
8715   AC_MSG_RESULT(no)
8718 dnl Check for missing components
8719 if test "$MOZ_X11"; then
8720     if test "$WITHOUT_X11"; then
8721         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8722     fi
8723     dnl ====================================================
8724     dnl = Check if X headers exist
8725     dnl ====================================================
8726     _SAVE_CFLAGS=$CFLAGS
8727     CFLAGS="$CFLAGS $XCFLAGS"
8728     AC_TRY_COMPILE([
8729         #include <stdio.h>
8730         #include <stdlib.h>
8731         #include <X11/Xlib.h>
8732         #include <X11/Intrinsic.h>
8733         #include <X11/extensions/XShm.h>
8734     ],
8735     [
8736         Display *dpy = 0;
8737         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8738             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8739             exit(1);
8740         }
8741     ], [],
8742     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8743     CFLAGS="$_SAVE_CFLAGS"
8745     if test -n "$MISSING_X"; then
8746         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8747     fi
8749 fi # MOZ_X11
8751 fi # COMPILE_ENVIRONMENT
8753 dnl Set various defines and substitutions
8754 dnl ========================================================
8756 if test "$OS_ARCH" = "Darwin"; then
8757   AC_DEFINE(XP_UNIX)
8758 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8759   AC_DEFINE(XP_UNIX)
8762 if test "$MOZ_DEBUG"; then
8763     AC_DEFINE(MOZ_REFLOW_PERF)
8764     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8767 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8768     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8769     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8770     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8771     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8772     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8773     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8774     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8775     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8778 AC_SUBST(MOZILLA_VERSION)
8780 AC_SUBST(ac_configure_args)
8782 dnl Spit out some output
8783 dnl ========================================================
8785 dnl The following defines are used by xpcom
8786 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8787 CPP_THROW_NEW
8788 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8789 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8790 HAVE_CPP_PARTIAL_SPECIALIZATION
8791 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8792 NEED_CPP_UNUSED_IMPLEMENTATIONS
8793 HAVE_GETPAGESIZE
8794 HAVE_ICONV
8795 HAVE_ICONV_WITH_CONST_INPUT
8796 HAVE_MBRTOWC
8797 HAVE_WCRTOMB
8798 HAVE_STATVFS64
8799 HAVE_STATVFS
8800 HAVE_STATFS64
8801 HAVE_STATFS
8802 HAVE_SYS_STATVFS_H
8803 HAVE_SYS_STATFS_H
8804 HAVE_SYS_VFS_H
8805 HAVE_SYS_MOUNT_H
8808 AC_SUBST(STLPORT_LIBS)
8810 MOZ_ARG_WITH_STRING(intl-api,
8811 [  --with-intl-api, --with-intl-api=build, --without-intl-api
8812     Determine the status of the ECMAScript Internationalization API.  The first
8813     (or lack of any of these) builds and exposes the API.  The second builds it
8814     but doesn't use ICU or expose the API to script.  The third doesn't build
8815     ICU at all.],
8816     _INTL_API=$withval,
8817     _INTL_API=yes)
8819 WITH_INTL="--with-intl-api=$_INTL_API"
8820 ENABLE_INTL_API=
8821 case "$_INTL_API" in
8823     ;;
8824 build)
8825     ENABLE_INTL_API=1
8826     ;;
8827 yes)
8828     ENABLE_INTL_API=1
8829     ;;
8831     AC_MSG_ERROR([Invalid value passed to --with-intl-api: $_INTL_API])
8832     ;;
8833 esac
8835 if test -n "$ENABLE_INTL_API"; then
8836 if test "$MOZ_BUILD_APP" = "browser"; then
8837     WITH_INTL="--with-intl-api"
8838 else
8839     # Internationalization isn't built or exposed by default in non-desktop
8840     # builds.  Bugs to enable:
8841     #
8842     #   Android:  bug 864843
8843     #   B2G:      bug 866301
8844     WITH_INTL="--without-intl-api"
8845     ENABLE_INTL_API=
8849 dnl Settings for the implementation of the ECMAScript Internationalization API
8850 if test -n "$ENABLE_INTL_API"; then
8851     AC_DEFINE(ENABLE_INTL_API)
8853     MOZ_CONFIG_ICU()
8855     dnl Build ICU as a shared library for shared js builds.
8856     if test -z "$MOZ_NATIVE_ICU" -a -n "$JS_SHARED_LIBRARY"; then
8857         case "$OS_TARGET" in
8858             WINNT)
8859                 ICU_LIB_NAMES="icuin icuuc icudt"
8860                 DBG_SUFFIX=
8861                 if test -n "$MOZ_DEBUG"; then
8862                     DBG_SUFFIX=d
8863                 fi
8864                 MOZ_ICU_LIBS='$(foreach lib,$(ICU_LIB_NAMES),$(DEPTH)/js/src/intl/icu/target/lib/$(LIB_PREFIX)$(lib)$(DBG_SUFFIX).$(LIB_SUFFIX))'
8865                 ;;
8866             Darwin)
8867                 ICU_LIB_NAMES="icui18n icuuc icudata"
8868                 MOZ_ICU_LIBS='$(foreach lib,$(ICU_LIB_NAMES),$(DEPTH)/js/src/intl/icu/target/lib/$(DLL_PREFIX)$(lib).$(MOZ_ICU_VERSION)$(DLL_SUFFIX))'
8869                 ;;
8870             Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
8871                 ICU_LIB_NAMES="icui18n icuuc icudata"
8872                 MOZ_ICU_LIBS='$(foreach lib,$(ICU_LIB_NAMES),$(DEPTH)/js/src/intl/icu/target/lib/$(DLL_PREFIX)$(lib)$(DLL_SUFFIX).$(MOZ_ICU_VERSION))'
8873                 ;;
8874             *)
8875                 AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform])
8876         esac
8877     fi
8880 AC_SUBST(DBG_SUFFIX)
8881 AC_SUBST(ENABLE_INTL_API)
8882 AC_SUBST(ICU_LIB_NAMES)
8883 AC_SUBST(MOZ_ICU_LIBS)
8885 export WRITE_MOZINFO=1
8886 AC_OUTPUT()
8887 unset WRITE_MOZINFO
8889 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8890 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8891 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8892 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8893 # (apparently) only need this hack when egrep's "pattern" is particularly long
8894 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
8895 # bug 655339.
8896 case "$host" in
8897 *-apple-darwin11*)
8898     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8899     ;;
8901     FIXED_EGREP="egrep"
8902     ;;
8903 esac
8905 # Run jemalloc configure script
8907 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
8908   ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
8909   if test -n "$MOZ_REPLACE_MALLOC"; then
8910     # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
8911     ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
8912     ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
8913   fi
8914   if test -n "$MOZ_JEMALLOC3"; then
8915     case "${OS_ARCH}" in
8916       WINNT|Darwin)
8917         # We want jemalloc functions to be kept hidden on both Mac and Windows
8918         # See memory/build/mozmemory_wrap.h for details.
8919         ac_configure_args="$ac_configure_args --without-export"
8920         ;;
8921     esac
8922   elif test "${OS_ARCH}" = Darwin; then
8923     # When building as a replace-malloc lib, disabling the zone allocator
8924     # forces to use pthread_atfork.
8925     ac_configure_args="$ac_configure_args --disable-zone-allocator"
8926   fi
8927   _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
8928   JEMALLOC_WRAPPER=
8929   if test -z "$MOZ_REPLACE_MALLOC"; then
8930     case "$OS_ARCH" in
8931       Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
8932         MANGLE=$_MANGLE
8933         ;;
8934     esac
8935   elif test -z "$MOZ_JEMALLOC3"; then
8936     MANGLE=$_MANGLE
8937     JEMALLOC_WRAPPER=replace_
8938   fi
8939   if test -n "$MANGLE"; then
8940     MANGLED=
8941     if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
8942       JEMALLOC_WRAPPER=__wrap_
8943     fi
8944     for mangle in ${MANGLE}; do
8945       if test -n "$MANGLED"; then
8946         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8947       else
8948         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8949       fi
8950     done
8951     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8952   fi
8953   unset CONFIG_FILES
8954   if test -z "$MOZ_TLS"; then
8955     ac_configure_args="$ac_configure_args --disable-tls"
8956   fi
8957   EXTRA_CFLAGS="$CFLAGS"
8958   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8959     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8960   done
8961   if test "$CROSS_COMPILE"; then
8962     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8963   fi
8964   _save_cache_file="$cache_file"
8965   cache_file=$_objdir/memory/jemalloc/src/config.cache
8967   if ! test -e memory/jemalloc; then
8968     mkdir -p memory/jemalloc
8969   fi
8971   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
8972   cache_file="$_save_cache_file"
8973   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8976 # Run freetype configure script
8978 if test "$MOZ_TREE_FREETYPE"; then
8979    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
8980    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
8981    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
8982    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
8983    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
8984    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png"
8986    if ! test -e modules; then
8987      mkdir modules
8988    fi
8990    AC_OUTPUT_SUBDIRS(modules/freetype2)
8993 if test -z "$direct_nspr_config"; then
8994     dnl ========================================================
8995     dnl = Setup a nice relatively clean build environment for
8996     dnl = sub-configures.
8997     dnl ========================================================
8998     CC="$_SUBDIR_CC"
8999     CXX="$_SUBDIR_CXX"
9000     CFLAGS="$_SUBDIR_CFLAGS"
9001     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9002     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9003     LDFLAGS="$_SUBDIR_LDFLAGS"
9004     HOST_CC="$_SUBDIR_HOST_CC"
9005     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9006     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9007     RC=
9010 unset MAKEFILES
9011 unset CONFIG_FILES
9013 # Run all configure scripts specified by a subconfigure
9014 if test -n "$_subconfigure_subdir"; then
9015   _save_ac_configure_args="$ac_configure_args"
9016   ac_configure_args="$_subconfigure_config_args"
9017   AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
9018   ac_configure_args="$_save_ac_configure_args"
9021 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9022 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9024 export WRAP_LDFLAGS
9026 if test -n "$_WRAP_MALLOC"; then
9027     # Avoid doubling wrap malloc arguments
9028     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9031 if test -z "$MOZ_NATIVE_NSPR"; then
9032     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9033     if test -z "$MOZ_DEBUG"; then
9034         ac_configure_args="$ac_configure_args --disable-debug"
9035     else
9036         ac_configure_args="$ac_configure_args --enable-debug"
9037     fi
9038     if test "$MOZ_OPTIMIZE" = "1"; then
9039         ac_configure_args="$ac_configure_args --enable-optimize"
9040     elif test -z "$MOZ_OPTIMIZE"; then
9041         ac_configure_args="$ac_configure_args --disable-optimize"
9042     fi
9043     if test -n "$HAVE_64BIT_OS"; then
9044         ac_configure_args="$ac_configure_args --enable-64bit"
9045     fi
9046     if test -n "$USE_ARM_KUSER"; then
9047         ac_configure_args="$ac_configure_args --with-arm-kuser"
9048     fi
9049     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9051     # Save these, so we can mess with them for the subconfigure ..
9052     _SAVE_CFLAGS="$CFLAGS"
9053     _SAVE_CPPFLAGS="$CPPFLAGS"
9054     _SAVE_LDFLAGS="$LDFLAGS"
9056     if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9057       # dladdr is supported by the new linker, even when the system linker doesn't
9058       # support it. Trick nspr into using dladdr when it's not supported.
9059       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9060     fi
9061     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9062     export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
9064     AC_OUTPUT_SUBDIRS(nsprpub)
9066     # .. and restore them
9067     unset CFLAGS
9068     unset CPPFLAGS
9069     unset LDFLAGS
9070     CFLAGS="$_SAVE_CFLAGS"
9071     CPPFLAGS="$_SAVE_CPPFLAGS"
9072     LDFLAGS="$_SAVE_LDFLAGS"
9074     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9077 dnl ========================================================
9078 dnl = Setup a nice relatively clean build environment for
9079 dnl = sub-configures.
9080 dnl ========================================================
9081 CC="$_SUBDIR_CC"
9082 CXX="$_SUBDIR_CXX"
9083 CFLAGS="$_SUBDIR_CFLAGS"
9084 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9085 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9086 LDFLAGS="$_SUBDIR_LDFLAGS"
9087 HOST_CC="$_SUBDIR_HOST_CC"
9088 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9089 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9092 if test -n "$ENABLE_CLANG_PLUGIN"; then
9093     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9094     AC_OUTPUT_SUBDIRS(build/clang-plugin)
9098 # Run the SpiderMonkey 'configure' script.
9099 dist=$MOZ_BUILD_ROOT/dist
9100 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9101 ac_configure_args="$ac_configure_args --enable-threadsafe"
9103 ac_configure_args="$ac_configure_args $WITH_INTL"
9105 if test "$BUILD_CTYPES"; then
9106     # Build js-ctypes on the platforms we can.
9107     ac_configure_args="$ac_configure_args --enable-ctypes"
9109 if test -z "$JS_SHARED_LIBRARY" ; then
9110     ac_configure_args="$ac_configure_args --disable-shared-js"
9111     if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9112         ac_configure_args="$ac_configure_args --disable-export-js"
9113     fi
9115 if test -z "$MOZ_NATIVE_NSPR"; then
9116     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9117     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9119 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9120 ac_configure_args="$ac_configure_args --prefix=$dist"
9121 if test "$MOZ_MEMORY"; then
9122    ac_configure_args="$ac_configure_args --enable-jemalloc"
9124 if test -n "$MOZ_GLUE_LDFLAGS"; then
9125    export MOZ_GLUE_LDFLAGS
9127 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9128    export MOZ_GLUE_PROGRAM_LDFLAGS
9130 if test -n "$ZLIB_IN_MOZGLUE"; then
9131    MOZ_ZLIB_LIBS=
9133 export MOZ_NATIVE_ZLIB
9134 export MOZ_ZLIB_CFLAGS
9135 export MOZ_ZLIB_LIBS
9136 export MOZ_APP_NAME
9137 export DONT_POPULATE_VIRTUALENV=1
9138 export PYTHON
9139 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9140 export STLPORT_CPPFLAGS
9141 export STLPORT_LDFLAGS
9142 export STLPORT_LIBS
9143 export JS_STANDALONE=no
9144 export MOZ_LINKER
9145 export ZLIB_IN_MOZGLUE
9147 if ! test -e js; then
9148     mkdir js
9151 AC_OUTPUT_SUBDIRS(js/src)
9152 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9154 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR