Bumping manifests a=b2g-bump
[gecko.git] / configure.in
blobf898162b23bf864060e7c3ae93f908ac3a3fb808
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
10 AC_PREREQ(2.13)
11 AC_INIT(config/config.mk)
12 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
13 AC_CANONICAL_SYSTEM
14 TARGET_CPU="${target_cpu}"
15 TARGET_VENDOR="${target_vendor}"
16 TARGET_OS="${target_os}"
18 dnl ========================================================
19 dnl =
20 dnl = Don't change the following two lines.  Doing so breaks:
21 dnl =
22 dnl = CFLAGS="-foo" ./configure
23 dnl =
24 dnl ========================================================
25 CFLAGS="${CFLAGS=}"
26 CPPFLAGS="${CPPFLAGS=}"
27 CXXFLAGS="${CXXFLAGS=}"
28 LDFLAGS="${LDFLAGS=}"
29 HOST_CFLAGS="${HOST_CFLAGS=}"
30 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
31 HOST_LDFLAGS="${HOST_LDFLAGS=}"
33 dnl ========================================================
34 dnl = Preserve certain environment flags passed to configure
35 dnl = We want sub projects to receive the same flags
36 dnl = untainted by this configure script
37 dnl ========================================================
38 _SUBDIR_CC="$CC"
39 _SUBDIR_CXX="$CXX"
40 _SUBDIR_CFLAGS="$CFLAGS"
41 _SUBDIR_CPPFLAGS="$CPPFLAGS"
42 _SUBDIR_CXXFLAGS="$CXXFLAGS"
43 _SUBDIR_LDFLAGS="$LDFLAGS"
44 _SUBDIR_HOST_CC="$HOST_CC"
45 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
46 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
47 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
48 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
50 dnl Set the version number of the libs included with mozilla
51 dnl ========================================================
52 MOZJPEG=62
53 MOZPNG=10616
54 NSPR_VERSION=4
55 NSPR_MINVER=4.10.10
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.22.0
64 GTK2_VERSION=2.18.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.9
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`
95 dnl TODO Don't exempt L10N builds once bug 842760 is resolved.
96 if test "$_topsrcdir" = "$_objdir" -a "${with_l10n_base+set}" != set; then
97   echo "  ***"
98   echo "  * Building directly in the main source directory is not allowed."
99   echo "  *"
100   echo "  * To build, you must run configure from a separate directory"
101   echo "  * (referred to as an object directory)."
102   echo "  *"
103   echo "  * If you are building with a mozconfig, you will need to change your"
104   echo "  * mozconfig to point to a different object directory."
105   echo "  ***"
106   exit 1
109 # Check for a couple representative files in the source tree
110 _conflict_files=
111 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
112   if test -f $file; then
113     _conflict_files="$_conflict_files $file"
114   fi
115 done
116 if test "$_conflict_files"; then
117   echo "***"
118   echo "*   Your source tree contains these files:"
119   for file in $_conflict_files; do
120     echo "*         $file"
121   done
122   cat 1>&2 <<-EOF
123   *   This indicates that you previously built in the source tree.
124   *   A source tree build can confuse the separate objdir build.
125   *
126   *   To clean up the source tree:
127   *     1. cd $_topsrcdir
128   *     2. gmake distclean
129   ***
131   exit 1
132   break
134 MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd`
136 MOZ_PYTHON
138 MOZ_DEFAULT_COMPILER
140 COMPILE_ENVIRONMENT=1
141 MOZ_ARG_DISABLE_BOOL(compile-environment,
142 [  --disable-compile-environment
143                           Disable compiler/library checks.],
144     COMPILE_ENVIRONMENT= )
145 AC_SUBST(COMPILE_ENVIRONMENT)
147 MOZ_ARG_WITH_STRING(l10n-base,
148 [  --with-l10n-base=DIR    path to l10n repositories],
149     L10NBASEDIR=$withval)
150 if test -n "$L10NBASEDIR"; then
151     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
152         AC_MSG_ERROR([--with-l10n-base must specify a path])
153     elif test -d "$L10NBASEDIR"; then
154         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
155     else
156         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
157     fi
159 AC_SUBST(L10NBASEDIR)
161 dnl Check for Perl first -- needed for win32 SDK checks
162 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
163 if test -z "$PERL" -o "$PERL" = ":"; then
164     AC_MSG_ERROR([perl not found in \$PATH])
167 if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
168     AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
171 AC_SUBST(GAIADIR)
172 if test -n "$GAIADIR" ; then
173     AC_DEFINE(PACKAGE_GAIA)
176 if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
177     AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
180 if test -n "$FXOS_SIMULATOR" ; then
181     AC_DEFINE(FXOS_SIMULATOR)
182     AC_SUBST(FXOS_SIMULATOR)
185 if test -n "$MOZTTDIR" -a ! -d "$MOZTTDIR" ; then
186     AC_MSG_ERROR([MOZTTDIR '$MOZTTDIR' isn't a valid directory])
189 AC_SUBST(MOZTTDIR)
190 if test -n "$MOZTTDIR" ; then
191     AC_DEFINE(PACKAGE_MOZTT)
194 MOZ_ARG_WITH_STRING(gonk,
195 [  --with-gonk=DIR
196                location of gonk dir],
197     gonkdir=$withval)
199 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
200 [  --with-gonk-toolchain-prefix=DIR
201                           prefix to gonk toolchain commands],
202     gonk_toolchain_prefix=$withval)
204 if test -n "$gonkdir" ; then
205     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
206     android_source="$gonkdir"
207     ANDROID_SOURCE="$android_source"
208     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
209     dnl Default to ICS
210     ANDROID_VERSION=15
211     if test -n "${PLATFORM_SDK_VERSION}"; then
212         ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
213     fi
215     dnl set up compilers
216     TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
217     AS="$gonk_toolchain_prefix"as
218     CC="$gonk_toolchain_prefix"gcc
219     CXX="$gonk_toolchain_prefix"g++
220     CPP="$gonk_toolchain_prefix"cpp
221     LD="$gonk_toolchain_prefix"ld
222     AR="$gonk_toolchain_prefix"ar
223     RANLIB="$gonk_toolchain_prefix"ranlib
224     STRIP="$gonk_toolchain_prefix"strip
225     OBJCOPY="$gonk_toolchain_prefix"objcopy
227     if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
228         AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
229     fi
230     STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
232     case "$ANDROID_VERSION" in
233     15)
234         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/ -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"
235         MOZ_B2G_BT=1
236         MOZ_B2G_BT_BLUEZ=1
237         MOZ_NFC=1
238         MOZ_B2G_CAMERA=1
239         MOZ_OMX_DECODER=1
240         AC_SUBST(MOZ_OMX_DECODER)
241         MOZ_RTSP=1
242         MOZ_FMP4=1
243         MOZ_SECUREELEMENT=1
244         ;;
245     17|18)
246         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"
247         if test -d "$gonkdir/external/bluetooth/bluez"; then
248           GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
249             MOZ_B2G_BT=1
250             MOZ_B2G_BT_BLUEZ=1
251         elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
252             MOZ_B2G_BT=1
253             MOZ_B2G_BT_BLUEDROID=1
254             if test -d "$gonkdir/system/bluetoothd"; then
255                 MOZ_B2G_BT_DAEMON=1
256             fi
257         fi
259         MOZ_RTSP=1
260         MOZ_NFC=1
261         MOZ_B2G_CAMERA=1
262         MOZ_OMX_DECODER=1
263         AC_SUBST(MOZ_OMX_DECODER)
264         MOZ_OMX_ENCODER=1
265         AC_SUBST(MOZ_OMX_ENCODER)
266         AC_DEFINE(MOZ_OMX_ENCODER)
267         MOZ_FMP4=1
268         MOZ_SECUREELEMENT=1
269         ;;
270     19)
271         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"
272         MOZ_B2G_CAMERA=1
273         MOZ_B2G_BT=1
274         MOZ_B2G_BT_BLUEDROID=1
275         if test -d "$gonkdir/system/bluetoothd"; then
276             MOZ_B2G_BT_DAEMON=1
277         fi
278         MOZ_NFC=1
279         MOZ_RTSP=1
280         MOZ_OMX_DECODER=1
281         MOZ_OMX_ENCODER=1
282         AC_DEFINE(MOZ_OMX_ENCODER)
283         MOZ_AUDIO_OFFLOAD=1
284         MOZ_SECUREELEMENT=1
285         AC_SUBST(MOZ_AUDIO_OFFLOAD)
286         AC_DEFINE(MOZ_AUDIO_OFFLOAD)
287         MOZ_FMP4=1
288         ;;
289     21|22)
290         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"
291         MOZ_AUDIO_OFFLOAD=1
292         MOZ_OMX_DECODER=1
293         MOZ_OMX_ENCODER=1
294         AC_DEFINE(MOZ_OMX_ENCODER)
295         AC_SUBST(MOZ_AUDIO_OFFLOAD)
296         AC_DEFINE(MOZ_AUDIO_OFFLOAD)
297         MOZ_FMP4=
298         MOZ_B2G_CAMERA=1
299         MOZ_B2G_BT=1
300         MOZ_B2G_BT_BLUEDROID=1
301         if test -d "$gonkdir/system/bluetoothd"; then
302             MOZ_B2G_BT_DAEMON=1
303         fi
304         MOZ_NFC=1
305         MOZ_RTSP=1
306         ;;
307     *)
308         AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
309         ;;
310     esac
311     CPPFLAGS="-DANDROID $TARGET_C_INCLUDES -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"
312     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
313     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
314     dnl Add -llog by default, since we use it all over the place.
315     LIBS="$LIBS -llog"
317     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"
319     dnl prevent cross compile section from using these flags as host flags
320     if test -z "$HOST_CPPFLAGS" ; then
321         HOST_CPPFLAGS=" "
322     fi
323     if test -z "$HOST_CFLAGS" ; then
324         HOST_CFLAGS=" "
325     fi
326     if test -z "$HOST_CXXFLAGS" ; then
327         HOST_CXXFLAGS=" "
328     fi
329     if test -z "$HOST_LDFLAGS" ; then
330         HOST_LDFLAGS=" "
331     fi
333     AC_DEFINE(ANDROID)
334     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
335     AC_SUBST(ANDROID_VERSION)
336     AC_DEFINE(HAVE_SYS_UIO_H)
337     AC_DEFINE(HAVE_PTHREADS)
338     MOZ_CHROME_FILE_FORMAT=omni
339     direct_nspr_config=1
340 else
341     MOZ_ANDROID_NDK
343     case "$target" in
344     *-android*|*-linuxandroid*)
345         if test -z "$ANDROID_PACKAGE_NAME" ; then
346             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
347         fi
348         MOZ_CHROME_FILE_FORMAT=omni
349         ZLIB_DIR=yes
350         ;;
351     *-linux*)
352         AC_PATH_PROG(OBJCOPY,objcopy)
353         ;;
354     esac
357 AC_SUBST(ANDROID_SOURCE)
358 AC_SUBST(ANDROID_PACKAGE_NAME)
359 AC_SUBST(OBJCOPY)
361 dnl ========================================================
362 dnl Checks for compilers.
363 dnl ========================================================
365 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
366 AR_FLAGS='crs $@'
368 if test "$COMPILE_ENVIRONMENT"; then
370 if test "$target" != "$host"; then
371     MOZ_CROSS_COMPILER
372 else
373     AC_PROG_CC
374     case "$target" in
375     *-mingw*)
376       # Work around the conftest.exe access problem on Windows
377       sleep 2
378     esac
379     AC_PROG_CXX
380     AC_PROG_RANLIB
381     MOZ_PATH_PROGS(AS, $AS as, $CC)
382     AC_CHECK_PROGS(AR, ar, :)
383     AC_CHECK_PROGS(LD, ld, :)
384     AC_CHECK_PROGS(STRIP, strip, :)
385     AC_CHECK_PROGS(WINDRES, windres, :)
386     AC_CHECK_PROGS(OTOOL, otool, :)
387     if test -z "$HOST_CC"; then
388         HOST_CC="$CC"
389     fi
390     if test -z "$HOST_CFLAGS"; then
391         HOST_CFLAGS="$CFLAGS"
392     fi
393     if test -z "$HOST_CXX"; then
394         HOST_CXX="$CXX"
395     fi
396     if test -z "$HOST_CXXFLAGS"; then
397         HOST_CXXFLAGS="$CXXFLAGS"
398     fi
399     if test -z "$HOST_LDFLAGS"; then
400         HOST_LDFLAGS="$LDFLAGS"
401     fi
402     if test -z "$HOST_RANLIB"; then
403         HOST_RANLIB="$RANLIB"
404     fi
405     if test -z "$HOST_AR"; then
406         HOST_AR="$AR"
407     fi
408     if test -z "$HOST_AR_FLAGS"; then
409         HOST_AR_FLAGS="$AR_FLAGS"
410     fi
413 if test -n "$MOZ_WINCONSOLE"; then
414     AC_DEFINE(MOZ_WINCONSOLE)
417 MOZ_TOOL_VARIABLES
419 MOZ_CHECK_COMPILER_WRAPPER
421 dnl ========================================================
422 dnl Special win32 checks
423 dnl ========================================================
425 MOZ_ARG_ENABLE_BOOL(metro,
426 [  --enable-metro           Enable Windows Metro build targets],
427     MOZ_METRO=1,
428     MOZ_METRO=)
429 if test -n "$MOZ_METRO"; then
430     AC_DEFINE(MOZ_METRO)
431     # toolkit/library/makefile.in needs these, see nsDllMain.
432     CRTDLLVERSION=110
433     CRTEXPDLLVERSION=1-1-0
436 AC_SUBST(CRTDLLVERSION)
437 AC_SUBST(CRTEXPDLLVERSION)
439 # Target the Windows 8.1 SDK by default
440 WINSDK_TARGETVER=603
441 WINVER=502
443 MOZ_ARG_WITH_STRING(windows-version,
444 [  --with-windows-version=WINSDK_TARGETVER
445                           Windows SDK version to target. Win8.1 (603) is
446                           currently the minimum supported version.],
447   WINSDK_TARGETVER=$withval)
449 # Currently only version 603 is allowed
450 case "$WINSDK_TARGETVER" in
451 603)
452     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
453     ;;
456     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
457     ;;
458 esac
460 case "$target" in
461 *-mingw*)
462     if test "$GCC" != "yes"; then
463         # Check to see if we are really running in a msvc environemnt
464         _WIN32_MSVC=1
465         AC_CHECK_PROGS(MIDL, midl)
467         # Make sure compilers are valid
468         CFLAGS="$CFLAGS -TC -nologo"
469         CXXFLAGS="$CXXFLAGS -TP -nologo"
470         AC_LANG_SAVE
471         AC_LANG_C
472         AC_TRY_COMPILE([#include <stdio.h>],
473             [ printf("Hello World\n"); ],,
474             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
476         AC_LANG_CPLUSPLUS
477         AC_TRY_COMPILE([#include <new.h>],
478             [ unsigned *test = new unsigned(42); ],,
479             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
480         AC_LANG_RESTORE
482         changequote(,)
483         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
484         changequote([,])
486         # Determine compiler version
487         _CC_MAJOR_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 1-2`
488         _CC_MINOR_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 3-4`
489         _CC_BUILD_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 5-`
490         _MSC_VER=${CC_VERSION}
492         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | cut -c 1-2`
494         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
495             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
496         fi
498         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
499         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
501         if test "$_CC_MAJOR_VERSION" = "18" -a "$_CC_BUILD_VERSION" -ge "30723"; then
502             _CC_SUITE=12
503             MSVS_VERSION=2013
504             MSVC_C_RUNTIME_DLL=msvcr120.dll
505             MSVC_CXX_RUNTIME_DLL=msvcp120.dll
506         else
507             AC_MSG_ERROR([This version (${_CC_MAJOR_VERSION}.${_CC_MINOR_VERSION}.${_CC_BUILD_VERSION}) of the MSVC compiler is unsupported.
508 You must install Visual C++ 2013 Update 3 or newer in order to build.
509 See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
510         fi
511         AC_SUBST(MSVS_VERSION)
512         AC_SUBST(MSVC_C_RUNTIME_DLL)
513         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
515         # Disable SEH on clang-cl because it doesn't implement them yet.
516         if test -z "$CLANG_CL"; then
517             AC_DEFINE(HAVE_SEH_EXCEPTIONS)
518         else
519             # Send our CFLAGS to NSS
520             MOZ_CFLAGS_NSS=1
521             AC_DEFINE_UNQUOTED(GTEST_HAS_SEH, 0)
522         fi
524         if test -n "$WIN32_REDIST_DIR"; then
525           if test ! -d "$WIN32_REDIST_DIR"; then
526             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
527           fi
528           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
529         fi
531         dnl Confirm we have the pri tools on win8 builds
532         if test -n "$MOZ_METRO"; then
533           AC_MSG_CHECKING([for makepri])
534           AC_CHECK_PROGS(MAKEPRI, makepri, "")
535           if test -z "MAKEPRI" ; then
536               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
537           fi
538           AC_SUBST(MAKEPRI)
539         fi
541         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
542         dnl not something else like "magnetic tape manipulation utility".
543         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
544         if test -z "$MSMT_TOOL"; then
545           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
546         fi
548         changequote(,)
549         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
550         changequote([,])
551         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
552         if test -z "$MSMANIFEST_TOOL_VERSION"; then
553           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
554         fi
556         MSMANIFEST_TOOL=1
557         unset MSMT_TOOL
559         # Check linker version
560         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
561         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
562         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
563             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
564         fi
566         INCREMENTAL_LINKER=1
568         # Set midl environment
569         case "$target" in
570         i*86-*)
571             MIDL_FLAGS="${MIDL_FLAGS} -env win32"
572             ;;
573         x86_64-*)
574             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
575             ;;
576         esac
578         unset _MSVC_VER_FILTER
580         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
581             [
582                 AC_LANG_SAVE
583                 AC_LANG_CPLUSPLUS
584                 _SAVE_CXXFLAGS="$CXXFLAGS"
585                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
586                 AC_TRY_COMPILE([#include <exception>],
587                             [std::_Throw(std::exception()); return 0;],
588                             ac_cv_have_std__Throw="yes",
589                             ac_cv_have_std__Throw="no")
590                 CXXFLAGS="$_SAVE_CXXFLAGS"
591                 AC_LANG_RESTORE
592             ])
594         if test "$ac_cv_have_std__Throw" = "yes"; then
595             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
596                            ac_cv_have_dllimport_exception_bug,
597                 [
598                     AC_LANG_SAVE
599                     AC_LANG_CPLUSPLUS
600                     _SAVE_CXXFLAGS="$CXXFLAGS"
601                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
602                     AC_TRY_LINK([#include <vector>],
603                                 [std::vector<int> v; return v.at(1);],
604                                 ac_cv_have_dllimport_exception_bug="no",
605                                 ac_cv_have_dllimport_exception_bug="yes")
606                     CXXFLAGS="$_SAVE_CXXFLAGS"
607                     AC_LANG_RESTORE
608                 ])
609             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
610                 WRAP_STL_INCLUDES=1
611                 MOZ_MSVC_STL_WRAP__Throw=1
612                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
613             fi
614         else
615             AC_CACHE_CHECK(for overridable _RAISE,
616                            ac_cv_have__RAISE,
617                 [
618                     AC_LANG_SAVE
619                     AC_LANG_CPLUSPLUS
620                     _SAVE_CXXFLAGS="$CXXFLAGS"
621                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
622                     AC_TRY_COMPILE([#include <xstddef>
623                                     #undef _RAISE
624                                     #define _RAISE(x) externallyDefinedFunction((x).what())
625                                     #include <vector>
626                                    ],
627                                    [std::vector<int> v; return v.at(1);],
628                                    ac_cv_have__RAISE="no",
629                                    ac_cv_have__RAISE="yes")
630                     CXXFLAGS="$_SAVE_CXXFLAGS"
631                     AC_LANG_RESTORE
632                 ])
633             if test "$ac_cv_have__RAISE" = "yes"; then
634                 WRAP_STL_INCLUDES=1
635                 MOZ_MSVC_STL_WRAP__RAISE=1
636                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
637             else
638                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
639             fi
640         fi
642         if test "$WRAP_STL_INCLUDES" = "1"; then
643             STL_FLAGS='-I$(DIST)/stl_wrappers'
644         fi
645         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
646         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
648         MOZ_FIND_WINSDK_VERSION
649     else
650         # Check w32api version
651         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
652         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
653         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
654         AC_TRY_COMPILE([#include <w32api.h>],
655             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
656                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
657                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
658                 #error "test failed."
659             #endif
660             , [ res=yes ], [ res=no ])
661         AC_MSG_RESULT([$res])
662         if test "$res" != "yes"; then
663             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
664         fi
665         # Check windres version
666         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
667         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
668         AC_MSG_RESULT([$_WINDRES_VERSION])
669         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
670         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
671         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
672         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
673         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
674         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
675         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
676                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
677                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
678                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
679                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
680                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
681         then
682             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
683         fi
685         AC_CHECK_PROGS(MIDL, $target-widl widl)
686         if test -n "$MIDL"; then
687             case "$target" in
688             i*86-*)
689                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
690                 ;;
691             x86_64-*)
692                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
693                 ;;
694             esac
695         fi
697         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
698         # causing problems with local implementations with the same name.
699         AC_DEFINE(STRSAFE_NO_DEPRECATE)
701         MOZ_WINSDK_MAXVER=0x06030000
702     fi # !GNU_CC
704     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
705     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
706     # Require OS features provided by IE 6.0 SP2 (XP SP2)
707     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
709     # If the maximum version supported by this SDK is lower than the target
710     # version, error out
711     AC_MSG_CHECKING([for Windows SDK being recent enough])
712     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
713         AC_MSG_RESULT("yes")
714     else
715         AC_MSG_RESULT("no")
716         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.])
717     fi
719     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
720     # Definitions matching sdkddkver.h
721     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
722     AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
723     AC_SUBST(MOZ_WINSDK_MAXVER)
724     ;;
725 esac
727 AC_PROG_CPP
728 AC_PROG_CXXCPP
730 if test -n "$_WIN32_MSVC"; then
731     SKIP_PATH_CHECKS=1
732     SKIP_COMPILER_CHECKS=1
733     SKIP_LIBRARY_CHECKS=1
735     # Since we're skipping compiler and library checks, hard-code
736     # some facts here.
737     AC_DEFINE(HAVE_IO_H)
738     AC_DEFINE(HAVE_SETBUF)
739     AC_DEFINE(HAVE_ISATTY)
742 fi # COMPILE_ENVIRONMENT
744 AC_SUBST(MIDL_FLAGS)
745 AC_SUBST(_MSC_VER)
747 AC_SUBST(GNU_AS)
748 AC_SUBST(GNU_LD)
749 AC_SUBST(GNU_CC)
750 AC_SUBST(GNU_CXX)
751 AC_SUBST(INTEL_CC)
752 AC_SUBST(INTEL_CXX)
754 AC_SUBST(STL_FLAGS)
755 AC_SUBST(WRAP_STL_INCLUDES)
756 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
757 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
759 dnl ========================================================
760 dnl Checks for programs.
761 dnl ========================================================
762 AC_PROG_INSTALL
763 AC_PROG_LN_S
765 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
766 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
767 _perl_res=$?
768 AC_MSG_RESULT([$_perl_version])
770 if test "$_perl_res" != 0; then
771     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
774 AC_MSG_CHECKING([for full perl installation])
775 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
776 _perl_res=$?
777 if test "$_perl_res" != 0; then
778     AC_MSG_RESULT([no])
779     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
780 else
781     AC_MSG_RESULT([yes])
784 if test -z "$COMPILE_ENVIRONMENT"; then
785     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
787 AC_SUBST(NSINSTALL_BIN)
789 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
790 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
791 MOZ_PATH_PROGS(UNZIP, unzip)
792 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
793     AC_MSG_ERROR([unzip not found in \$PATH])
795 MOZ_PATH_PROGS(ZIP, zip)
796 if test -z "$ZIP" -o "$ZIP" = ":"; then
797     AC_MSG_ERROR([zip not found in \$PATH])
799 MOZ_PATH_PROG(XARGS, xargs)
800 if test -z "$XARGS" -o "$XARGS" = ":"; then
801     AC_MSG_ERROR([xargs not found in \$PATH .])
804 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
805 AC_SUBST(RPMBUILD)
807 if test "$COMPILE_ENVIRONMENT"; then
809 dnl ========================================================
810 dnl = Mac OS X toolchain support
811 dnl ========================================================
813 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
814 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
815 dnl when we can run target binaries.
816 AC_SUBST(UNIVERSAL_BINARY)
817 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
819 MOZ_ARG_WITH_STRING(unify-dist,
820 [  --with-unify-dist=dir   Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
821     UNIFY_DIST=$withval)
822 if test -n "$UNIVERSAL_BINARY"; then
823     if test -z "$UNIFY_DIST"; then
824         AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
825     fi
826     case "$UNIFY_DIST" in
827     /*)
828         ;;
829     *)
830         UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
831         ;;
832     esac
834 AC_SUBST(UNIFY_DIST)
836 dnl ========================================================
837 dnl Check for MacOS deployment target version
838 dnl ========================================================
840 MOZ_ARG_ENABLE_STRING(macos-target,
841                       [  --enable-macos-target=VER (default=10.6)
842                           Set the minimum MacOS version needed at runtime],
843                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
845 case "$target" in
846 *-darwin*)
847     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
848         dnl Use the specified value
849         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
850     else
851         dnl No value specified on the command line or in the environment,
852         dnl use architecture minimum.
853         export MACOSX_DEPLOYMENT_TARGET=10.6
854     fi
855     ;;
856 esac
858 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
860 dnl ========================================================
861 dnl = Mac OS X SDK support
862 dnl ========================================================
863 MACOS_SDK_DIR=
864 MOZ_ARG_WITH_STRING(macos-sdk,
865 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
866     MACOS_SDK_DIR=$withval)
868 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
869 MOZ_ARG_WITH_STRING(macos-private-frameworks,
870 [  --with-macos-private-frameworks=dir    Location of private frameworks to use (Mac OS X only)],
871     MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
872     MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
873     MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
875 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
876   if test -z "$CROSS_COMPILE"; then
877     AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
878   fi
879   if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
880     AC_MSG_ERROR([PrivateFrameworks directory not found.])
881   fi
884 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
885 AC_SUBST(MACOS_SDK_DIR)
886 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
888 if test "$MACOS_SDK_DIR"; then
889   dnl Sync this section with the ones in NSPR and NSS.
890   dnl Changes to the cross environment here need to be accounted for in
891   dnl the libIDL checks (below) and xpidl build.
893   if test ! -d "$MACOS_SDK_DIR"; then
894     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
895 specify a valid SDK.  SDKs are installed when the optional cross-development
896 tools are selected during the Xcode/Developer Tools installation.])
897   fi
899   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
900   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
902   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
903   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
904   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
906   AC_LANG_SAVE
907   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
908   AC_LANG_CPLUSPLUS
909   AC_TRY_COMPILE([#include <new>],[],
910    result=yes,
911    result=no)
912   AC_LANG_RESTORE
913   AC_MSG_RESULT($result)
915   if test "$result" = "no" ; then
916     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
917   fi
920 fi # COMPILE_ENVIRONMENT
922 if test -n "$MAKE"; then
923   if test `echo $MAKE | grep -c make.py` != 1; then
924      NOT_PYMAKE=$MAKE
925   fi
928 case "$host_os" in
929 mingw*)
930     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
931     ;;
933     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
934     ;;
935 esac
936 if test "$GMAKE" = ":"; then
937    AC_MSG_ERROR([GNU make not found])
939 AC_SUBST(GMAKE)
941 if test -z "$MAKE"; then
942   MAKE=$GMAKE
945 if test "$COMPILE_ENVIRONMENT"; then
947 AC_PATH_XTRA
949 XCFLAGS="$X_CFLAGS"
951 fi # COMPILE_ENVIRONMENT
953 dnl ========================================================
954 dnl set the defaults first
955 dnl ========================================================
956 AS_BIN=$AS
957 AR_LIST='$(AR) t'
958 AR_EXTRACT='$(AR) x'
959 AR_DELETE='$(AR) d'
960 AS='$(CC)'
961 AS_DASH_C_FLAG='-c'
962 DLL_PREFIX=lib
963 LIB_PREFIX=lib
964 DLL_SUFFIX=.so
965 OBJ_SUFFIX=o
966 LIB_SUFFIX=a
967 ASM_SUFFIX=s
968 IMPORT_LIB_SUFFIX=
969 TARGET_MD_ARCH=unix
970 DIRENT_INO=d_ino
971 MOZ_USER_DIR=".mozilla"
973 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
975 MOZ_FS_LAYOUT=unix
977 USE_DEPENDENT_LIBS=1
979 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
981 if test -n "$CROSS_COMPILE"; then
982     OS_TARGET="${target_os}"
983     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
984     OS_RELEASE=
985     case "${target_os}" in
986         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
987         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
988         gnu*)         OS_ARCH=GNU ;;
989         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
990         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
991         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
992         dragonfly*)   OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
993         freebsd*)     OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
994         netbsd*)      OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
995         openbsd*)     OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
996     esac
997     case "${target}" in
998         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
999     esac
1000 else
1001     OS_TARGET=`uname -s`
1002     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1003     OS_RELEASE=`uname -r`
1006 # Before this used `uname -m` when not cross compiling
1007 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1008 OS_TEST="${target_cpu}"
1010 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1012 #######################################################################
1013 # Master "Core Components" macros for getting the OS target           #
1014 #######################################################################
1017 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1018 # cross-compilation.
1022 # Define and override various archtecture-specific variables, including
1023 # HOST_OS_ARCH
1024 # OS_ARCH
1025 # OS_TEST
1026 # OS_TARGET
1027 # OS_RELEASE
1028 # OS_MINOR_RELEASE
1031 case "$HOST_OS_ARCH" in
1032 mingw*)
1033     HOST_OS_ARCH=WINNT
1034     ;;
1035 darwin*)
1036     HOST_OS_ARCH=Darwin
1037     ;;
1038 linux*)
1039     HOST_OS_ARCH=Linux
1040     ;;
1041 kfreebsd*-gnu)
1042     HOST_OS_ARCH=GNU_kFreeBSD
1043     ;;
1044 gnu*)
1045     HOST_OS_ARCH=GNU
1046     ;;
1047 dragonfly*)
1048     HOST_OS_ARCH=DragonFly
1049     ;;
1050 freebsd*)
1051     HOST_OS_ARCH=FreeBSD
1052     ;;
1053 netbsd*)
1054     HOST_OS_ARCH=NetBSD
1055     ;;
1056 openbsd*)
1057     HOST_OS_ARCH=OpenBSD
1058     ;;
1059 solaris*)
1060     HOST_OS_ARCH=SunOS
1061     SOLARIS_SUNPRO_CC=
1062     SOLARIS_SUNPRO_CXX=
1063     if test -z "$GNU_CC"; then
1064         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1065             SOLARIS_SUNPRO_CC=1
1066        fi
1067     fi
1069     if test -z "$GNU_CXX"; then
1070        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1071            SOLARIS_SUNPRO_CXX=1
1072        fi
1073     fi
1074     AC_SUBST(SOLARIS_SUNPRO_CC)
1075     AC_SUBST(SOLARIS_SUNPRO_CXX)
1076     ;;
1077 esac
1079 case "$OS_ARCH" in
1080 WINNT)
1081     if test -z "$CROSS_COMPILE" ; then
1082         OS_TEST=`uname -p`
1083     fi
1084     ;;
1085 Windows_NT)
1087 # If uname -s returns "Windows_NT", we assume that we are using
1088 # the uname.exe in MKS toolkit.
1090 # The -r option of MKS uname only returns the major version number.
1091 # So we need to use its -v option to get the minor version number.
1092 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1094     OS_ARCH=WINNT
1095     OS_TARGET=WINNT
1096     OS_MINOR_RELEASE=`uname -v`
1097     if test "$OS_MINOR_RELEASE" = "00"; then
1098         OS_MINOR_RELEASE=0
1099     fi
1100     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1101     ;;
1102 MINGW*_NT*)
1104 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1105 # the uname.exe in the MSYS tools.
1107     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1108     OS_ARCH=WINNT
1109     OS_TARGET=WINNT
1110     ;;
1111 AIX)
1112     OS_RELEASE=`uname -v`.`uname -r`
1113     OS_TEST=${target_cpu}
1114     ;;
1115 Darwin)
1116     case "${target_cpu}" in
1117     powerpc*)
1118         OS_TEST=ppc
1119         ;;
1120     i*86*)
1121         OS_TEST=i386
1122         ;;
1123     x86_64)
1124         OS_TEST=x86_64
1125         ;;
1126     *)
1127         if test -z "$CROSS_COMPILE" ; then
1128             OS_TEST=`uname -p`
1129         fi
1130         ;;
1131     esac
1132     ;;
1133 esac
1135 # Only set CPU_ARCH if we recognize the value of OS_TEST
1137 case "$OS_TEST" in
1138 *86 | i86pc)
1139     CPU_ARCH=x86
1140     ;;
1142 powerpc64 | ppc64 | powerpc64le | ppc64le)
1143     CPU_ARCH=ppc64
1144     ;;
1146 powerpc | ppc | rs6000)
1147     CPU_ARCH=ppc
1148     ;;
1150 Alpha | alpha | ALPHA)
1151     CPU_ARCH=Alpha
1152     ;;
1154 s390)
1155     CPU_ARCH=s390
1156     ;;
1158 s390x)
1159     CPU_ARCH=s390x
1160     ;;
1162 hppa* | parisc)
1163     CPU_ARCH=hppa
1164     ;;
1166 sun4u | sparc*)
1167     CPU_ARCH=sparc
1168     ;;
1170 x86_64 | ia64)
1171     CPU_ARCH="$OS_TEST"
1172     ;;
1174 arm*)
1175     CPU_ARCH=arm
1176     ;;
1178 mips|mipsel)
1179     CPU_ARCH="mips"
1180     ;;
1182 aarch64*)
1183     CPU_ARCH=aarch64
1184     ;;
1185 esac
1187 if test -z "$OS_TARGET"; then
1188     OS_TARGET=$OS_ARCH
1190 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1192 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1193 dnl ===============================================================
1194 INTEL_ARCHITECTURE=
1195 case "$OS_TEST" in
1196     x86_64|i?86)
1197       INTEL_ARCHITECTURE=1
1198 esac
1200 dnl Configure platform-specific CPU architecture compiler options.
1201 dnl ==============================================================
1202 MOZ_ARCH_OPTS
1204 dnl =================================================================
1205 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1206 dnl which is bad when cross compiling.
1207 dnl =================================================================
1208 if test "$COMPILE_ENVIRONMENT"; then
1209 configure_static_assert_macros='
1210 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1211 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1212 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1215 dnl test that the macros actually work:
1216 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1217 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1218  [AC_LANG_SAVE
1219   AC_LANG_C
1220   ac_cv_static_assertion_macros_work="yes"
1221   AC_TRY_COMPILE([$configure_static_assert_macros],
1222                  [CONFIGURE_STATIC_ASSERT(1)],
1223                  ,
1224                  ac_cv_static_assertion_macros_work="no")
1225   AC_TRY_COMPILE([$configure_static_assert_macros],
1226                  [CONFIGURE_STATIC_ASSERT(0)],
1227                  ac_cv_static_assertion_macros_work="no",
1228                  )
1229   AC_LANG_CPLUSPLUS
1230   AC_TRY_COMPILE([$configure_static_assert_macros],
1231                  [CONFIGURE_STATIC_ASSERT(1)],
1232                  ,
1233                  ac_cv_static_assertion_macros_work="no")
1234   AC_TRY_COMPILE([$configure_static_assert_macros],
1235                  [CONFIGURE_STATIC_ASSERT(0)],
1236                  ac_cv_static_assertion_macros_work="no",
1237                  )
1238   AC_LANG_RESTORE
1239  ])
1240 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1241 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1242     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1244 fi # COMPILE_ENVIRONMENT
1246 dnl ========================================================
1247 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1248 dnl computed above.
1249 dnl ========================================================
1251 MOZ_ANDROID_STLPORT
1253 dnl ========================================================
1254 dnl Suppress Clang Argument Warnings
1255 dnl ========================================================
1256 if test -n "${CLANG_CC}${CLANG_CL}"; then
1257     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1258     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1260 if test -n "${CLANG_CXX}${CLANG_CL}"; then
1261     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1264 dnl ========================================================
1265 dnl = Use Address Sanitizer
1266 dnl ========================================================
1267 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1268 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1269     MOZ_ASAN=1,
1270     MOZ_ASAN= )
1271 if test -n "$MOZ_ASAN"; then
1272     MOZ_LLVM_HACKS=1
1273     if test -n "$CLANG_CL"; then
1274         # Look for clang_rt.asan_dynamic-i386.dll
1275         MOZ_CLANG_RT_ASAN_LIB=clang_rt.asan_dynamic-i386.dll
1276         # We use MOZ_PATH_PROG in order to get a Windows style path.
1277         MOZ_PATH_PROG(MOZ_CLANG_RT_ASAN_LIB_PATH, $MOZ_CLANG_RT_ASAN_LIB)
1278         if test -z "$MOZ_CLANG_RT_ASAN_LIB_PATH"; then
1279             AC_MSG_ERROR([Couldn't find $MOZ_CLANG_RT_ASAN_LIB.  It should be available in the same location as clang-cl.])
1280         fi
1281         AC_SUBST(MOZ_CLANG_RT_ASAN_LIB_PATH)
1282     fi
1283     AC_DEFINE(MOZ_ASAN)
1284     MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1286 AC_SUBST(MOZ_ASAN)
1288 dnl ========================================================
1289 dnl = Use Memory Sanitizer
1290 dnl ========================================================
1291 MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
1292 [  --enable-memory-sanitizer       Enable Memory Sanitizer (default=no)],
1293     MOZ_MSAN=1,
1294     MOZ_MSAN= )
1295 if test -n "$MOZ_MSAN"; then
1296     MOZ_LLVM_HACKS=1
1297     AC_DEFINE(MOZ_MSAN)
1298     MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1300 AC_SUBST(MOZ_MSAN)
1302 dnl ========================================================
1303 dnl = Use Thread Sanitizer
1304 dnl ========================================================
1305 MOZ_ARG_ENABLE_BOOL(thread-sanitizer,
1306 [  --enable-thread-sanitizer       Enable Thread Sanitizer (default=no)],
1307    MOZ_TSAN=1,
1308    MOZ_TSAN= )
1309 if test -n "$MOZ_TSAN"; then
1310     MOZ_LLVM_HACKS=1
1311     AC_DEFINE(MOZ_TSAN)
1312     MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1314 AC_SUBST(MOZ_TSAN)
1316 # The LLVM symbolizer is used by all sanitizers
1317 AC_SUBST(LLVM_SYMBOLIZER)
1319 dnl ========================================================
1320 dnl = Enable hacks required for LLVM instrumentations
1321 dnl ========================================================
1322 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1323 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1324     MOZ_LLVM_HACKS=1,
1325     MOZ_LLVM_HACKS= )
1326 if test -n "$MOZ_LLVM_HACKS"; then
1327     MOZ_NO_WLZDEFS=1
1328     MOZ_CFLAGS_NSS=1
1330 AC_SUBST(MOZ_NO_WLZDEFS)
1331 AC_SUBST(MOZ_CFLAGS_NSS)
1333 dnl ========================================================
1334 dnl = Enable treating compiler warnings as errors
1335 dnl ========================================================
1336 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
1337 [  --enable-warnings-as-errors
1338                           Enable treating warnings as errors],
1339     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
1340     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
1342 dnl ========================================================
1343 dnl GNU specific defaults
1344 dnl ========================================================
1345 if test "$GNU_CC"; then
1346     MMX_FLAGS="-mmmx"
1347     SSE_FLAGS="-msse"
1348     SSE2_FLAGS="-msse2"
1349     # Per bug 719659 comment 2, some of the headers on ancient build machines
1350     # may require gnu89 inline semantics.  But otherwise, we use C99.
1351     # But on OS X we just use C99 plus GNU extensions, in order to fix
1352     # bug 917526.
1353     CFLAGS="$CFLAGS -std=gnu99"
1354     if test "${OS_ARCH}" != Darwin; then
1355         CFLAGS="$CFLAGS -fgnu89-inline"
1356     fi
1357     # FIXME: Let us build with strict aliasing. bug 414641.
1358     CFLAGS="$CFLAGS -fno-strict-aliasing"
1359     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1360     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1361     WARNINGS_AS_ERRORS='-Werror'
1362     DSO_CFLAGS=''
1363     DSO_PIC_CFLAGS='-fPIC'
1364     ASFLAGS="$ASFLAGS -fPIC"
1365     AC_MSG_CHECKING([for --noexecstack option to as])
1366     _SAVE_CFLAGS=$CFLAGS
1367     CFLAGS="$CFLAGS -Wa,--noexecstack"
1368     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1369                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1370                      AC_MSG_RESULT([no]))
1371     CFLAGS=$_SAVE_CFLAGS
1372     AC_MSG_CHECKING([for -z noexecstack option to ld])
1373     _SAVE_LDFLAGS=$LDFLAGS
1374     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1375     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1376                   AC_MSG_RESULT([no])
1377                   LDFLAGS=$_SAVE_LDFLAGS)
1379     AC_MSG_CHECKING([for -z text option to ld])
1380     _SAVE_LDFLAGS=$LDFLAGS
1381     LDFLAGS="$LDFLAGS -Wl,-z,text"
1382     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1383                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1384                   AC_MSG_RESULT([no])
1385                   LDFLAGS=$_SAVE_LDFLAGS)
1387     AC_MSG_CHECKING([for --build-id option to ld])
1388     _SAVE_LDFLAGS=$LDFLAGS
1389     LDFLAGS="$LDFLAGS -Wl,--build-id"
1390     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1391                   [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1392                   AC_MSG_RESULT([no])
1393                   LDFLAGS=$_SAVE_LDFLAGS)
1395     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
1396     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
1397     _SAVE_LDFLAGS=$LDFLAGS
1398     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
1399     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1400                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
1401                   AC_MSG_RESULT([no]))
1402     LDFLAGS=$_SAVE_LDFLAGS
1404     # Check for -mssse3 on $CC
1405     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1406     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1407     _SAVE_CFLAGS=$CFLAGS
1408     CFLAGS="$CFLAGS -mssse3"
1409     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1410                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1411                      AC_MSG_RESULT([no]))
1412     CFLAGS=$_SAVE_CFLAGS
1414     # Check for -msse4.1 on $CC
1415     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1416     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1417     _SAVE_CFLAGS=$CFLAGS
1418     CFLAGS="$CFLAGS -msse4.1"
1419     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1420                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1421                      AC_MSG_RESULT([no]))
1422     CFLAGS=$_SAVE_CFLAGS
1424     case "${CPU_ARCH}" in
1425     x86 | x86_64)
1426       AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
1427       AC_TRY_COMPILE([],
1428                      [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
1429                      result="yes", result="no")
1430       AC_MSG_RESULT("$result")
1431       if test "$result" = "yes"; then
1432           HAVE_X86_AVX2=1
1433       fi
1434     esac
1436     DSO_LDOPTS='-shared'
1437     if test "$GCC_USE_GNU_LD"; then
1438         # Some tools like ASan use a runtime library that is only
1439         # linked against executables, so we must allow undefined
1440         # symbols for shared objects in some cases.
1441         if test -z "$MOZ_NO_WLZDEFS"; then
1442             # Don't allow undefined symbols in libraries
1443             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1445             # BSDs need `environ' exposed for posix_spawn (bug 753046)
1446             case "$OS_TARGET" in
1447             DragonFly|FreeBSD|NetBSD|OpenBSD)
1448                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
1449                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
1450                 else
1451                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
1452                 fi
1453                 ;;
1454             esac
1455         fi
1456     fi
1458     # Turn on gcc/clang warnings:
1459     # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
1460     #
1461     # -Wall - turn on a lot of warnings
1462     # -Wchar-subscripts - catches array index using signed char
1463     # -Wcomment - catches nested comments
1464     # -Wdeclaration-after-statement - MSVC doesn't like these
1465     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1466     # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
1467     # -Wenum-compare - catches comparison of different enum types
1468     # -Wignored-qualifiers - catches returns types with qualifiers like const
1469     # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
1470     # -Wmultichar - catches multicharacter integer constants like 'THIS'
1471     # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
1472     # -Wnonnull - catches NULL used with functions arguments marked as non-null
1473     # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
1474     # -Wpointer-sign - catches mixing pointers to signed and unsigned types
1475     # -Wpointer-to-int-cast - catches casts from pointer to different sized int
1476     # -Wreturn-type - catches missing returns, zero false positives
1477     # -Wsequence-point - catches undefined order behavior like `a = a++`
1478     # -Wsign-compare - catches comparison of signed and unsigned types
1479     # -Wtrigraphs - catches unlikely use of trigraphs
1480     # -Wtype-limits - catches overflow bugs, few false positives
1481     # -Wunknown-pragmas - catches unexpected #pragma directives
1482     #
1483     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall"
1484     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wdeclaration-after-statement"
1485     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wempty-body"
1486     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wpointer-to-int-cast"
1487     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wsign-compare"
1488     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wtype-limits"
1490     # Treat some warnings as errors if --enable-warnings-as-errors:
1491     if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
1492         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=char-subscripts"
1493         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=comment"
1494         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=endif-labels"
1495         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=enum-compare"
1496         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=ignored-qualifiers"
1497         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=int-to-pointer-cast"
1498         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=multichar"
1499         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=nonnull"
1500         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-arith"
1501         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-sign"
1502         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=return-type"
1503         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=sequence-point"
1504         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=trigraphs"
1505         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=unknown-pragmas"
1507         MOZ_C_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_c_has_werror_non_literal_null_conversion)
1508     fi
1510     # Turn off the following warnings that -Wall turns on:
1511     # -Wno-unused - lots of violations in third-party code
1512     #
1513     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1515     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1516        # Don't use -Wcast-align with ICC or clang
1517        case "$CPU_ARCH" in
1518            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1519            hppa | ia64 | sparc | arm)
1520            ;;
1521            *)
1522         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1523            ;;
1524        esac
1525     fi
1527     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1528     _USE_CPP_INCLUDE_FLAG=1
1529     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1531 elif test "$SOLARIS_SUNPRO_CC"; then
1532     DSO_CFLAGS=''
1533     if test "$CPU_ARCH" = "sparc"; then
1534         # for Sun Studio on Solaris/SPARC
1535         DSO_PIC_CFLAGS='-xcode=pic32'
1536     else
1537         DSO_PIC_CFLAGS='-KPIC'
1538     fi
1539     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1540 else
1541     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1542     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1544     DSO_LDOPTS='-shared'
1545     if test "$GNU_LD"; then
1546         # Don't allow undefined symbols in libraries
1547         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1548     fi
1550     DSO_CFLAGS=''
1551     DSO_PIC_CFLAGS='-KPIC'
1552     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1555 if test "$GNU_CXX"; then
1556     # FIXME: Let us build with strict aliasing. bug 414641.
1557     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1559     # Turn on gcc/clang warnings:
1560     # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
1561     #
1562     # -Wall - turn on a lot of warnings
1563     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1564     # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
1565     # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
1566     # -Wmissing-braces - catches aggregate initializers missing nested braces
1567     # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
1568     # -Woverloaded-virtual - function declaration hides virtual function from base class
1569     # -Wparentheses - catches `if (a=b)` and operator precedence bugs
1570     # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
1571     # -Wreturn-type - catches missing returns, zero false positives
1572     # -Wsequence-point - catches undefined order behavior like `a = a++`
1573     # -Wsign-compare - catches comparison of signed and unsigned types
1574     # -Wswitch - catches switches without all enum cases or default case
1575     # -Wtrigraphs - catches unlikely use of trigraphs
1576     # -Wtype-limits - catches overflow bugs, few false positives
1577     # -Wunused-label - catches unused goto labels
1578     # -Wwrite-strings - catches non-const char* pointers to string literals
1579     #
1580     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall"
1581     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wempty-body"
1582     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Woverloaded-virtual"
1583     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wsign-compare"
1584     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wwrite-strings"
1586     # Treat some warnings as errors if --enable-warnings-as-errors:
1587     if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
1588         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=endif-labels"
1589         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=int-to-pointer-cast"
1590         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=missing-braces"
1591         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=parentheses"
1592         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=pointer-arith"
1593         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1594         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=sequence-point"
1595         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=switch"
1596         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=trigraphs"
1597         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=type-limits"
1598         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=unused-label"
1600         MOZ_CXX_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_cxx_has_werror_non_literal_null_conversion)
1601     fi
1603     # Turn off the following warnings that -Wall turns on:
1604     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1605     # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
1606     #   for performance reasons, and because GCC and clang accept it (though
1607     #   clang warns about it).
1608     #
1609     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof"
1611     MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
1613     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1614        # Don't use -Wcast-align with ICC or clang
1615        case "$CPU_ARCH" in
1616            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1617            hppa | ia64 | sparc | arm)
1618            ;;
1619            *)
1620         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1621            ;;
1622        esac
1623     fi
1625     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1626     _USE_CPP_INCLUDE_FLAG=1
1628     # Recent clang and gcc support C++11 deleted functions without warnings if
1629     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1630     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1631     # unused.  But clang's warning can be disabled, so when compiling with clang
1632     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1633     # deleted function syntax.
1634     if test "$CLANG_CXX"; then
1635         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1636         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1637     fi
1639 else
1640     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1643 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1644 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1645 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1646 dnl normal behavior.
1647 dnl ========================================================
1648 MKSHLIB_FORCE_ALL=
1649 MKSHLIB_UNFORCE_ALL=
1651 if test "$COMPILE_ENVIRONMENT"; then
1652 if test "$GNU_CC"; then
1653   AC_MSG_CHECKING(whether ld has archive extraction flags)
1654   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1655    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1656     ac_cv_mkshlib_force_and_unforce="no"
1657     exec 3<&0 <<LOOP_INPUT
1658   force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1659   force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1660   force="-Wl,-all";              unforce="-Wl,-none"
1661 LOOP_INPUT
1662     while read line
1663     do
1664       eval $line
1665       LDFLAGS=$force
1666       LIBS=$unforce
1667       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1668     done
1669     exec 0<&3 3<&-
1670     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1671    ])
1672   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1673     AC_MSG_RESULT(no)
1674   else
1675     AC_MSG_RESULT(yes)
1676     eval $ac_cv_mkshlib_force_and_unforce
1677     MKSHLIB_FORCE_ALL=$force
1678     MKSHLIB_UNFORCE_ALL=$unforce
1679   fi
1680 fi # GNU_CC
1681 fi # COMPILE_ENVIRONMENT
1683 dnl ========================================================
1684 dnl Checking for 64-bit OS
1685 dnl ========================================================
1686 if test "$COMPILE_ENVIRONMENT"; then
1687 AC_LANG_SAVE
1688 AC_LANG_C
1689 AC_MSG_CHECKING(for 64-bit OS)
1690 AC_TRY_COMPILE([$configure_static_assert_macros],
1691                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1692                result="yes", result="no")
1693 AC_MSG_RESULT("$result")
1694 if test "$result" = "yes"; then
1695     AC_DEFINE(HAVE_64BIT_BUILD)
1696     HAVE_64BIT_BUILD=1
1698 AC_SUBST(HAVE_64BIT_BUILD)
1699 AC_LANG_RESTORE
1700 fi # COMPILE_ENVIRONMENT
1702 dnl ========================================================
1703 dnl = Use profiling compile flags
1704 dnl ========================================================
1705 MOZ_ARG_ENABLE_BOOL(profiling,
1706 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1707     MOZ_PROFILING=1,
1708     MOZ_PROFILING= )
1710 dnl ========================================================
1711 dnl = Turn on systrace for android/b2g.
1712 dnl ========================================================
1713 MOZ_ARG_ENABLE_BOOL(systrace,
1714 [  --enable-systrace       Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1715     MOZ_USE_SYSTRACE=1,
1716     MOZ_USE_SYSTRACE= )
1717 if test -n "$MOZ_USE_SYSTRACE"; then
1718     AC_DEFINE(MOZ_USE_SYSTRACE)
1721 # For profiling builds keep the symbol information
1722 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1723     case "$OS_TARGET" in
1724     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1725         STRIP_FLAGS="--strip-debug"
1726         ;;
1727     esac
1730 dnl ========================================================
1731 dnl = Use Valgrind
1732 dnl ========================================================
1733 MOZ_ARG_ENABLE_BOOL(valgrind,
1734 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1735     MOZ_VALGRIND=1,
1736     MOZ_VALGRIND= )
1737 if test -n "$MOZ_VALGRIND"; then
1738     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1739         AC_MSG_ERROR(
1740             [--enable-valgrind specified but Valgrind is not installed]))
1741     AC_DEFINE(MOZ_VALGRIND)
1743 AC_SUBST(MOZ_VALGRIND)
1745 dnl ========================================================
1746 dnl jprof
1747 dnl ========================================================
1748 MOZ_ARG_ENABLE_BOOL(jprof,
1749 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1750     MOZ_JPROF=1,
1751     MOZ_JPROF= )
1752 if test -n "$MOZ_JPROF"; then
1753     MOZ_PROFILING=1
1754     AC_DEFINE(MOZ_JPROF)
1757 dnl ========================================================
1758 dnl SPS Profiler
1759 dnl ========================================================
1760 MOZ_ENABLE_PROFILER_SPS=1
1762 case "${OS_TARGET}" in
1763 Android)
1764     case "${CPU_ARCH}" in
1765     x86 | arm) ;;
1766     *)
1767         MOZ_ENABLE_PROFILER_SPS=
1768     esac
1769     ;;
1770 Linux)
1771     case "${CPU_ARCH}" in
1772     x86 | x86_64) ;;
1773     *)
1774         MOZ_ENABLE_PROFILER_SPS=
1775     esac
1776     ;;
1777 WINNT|Darwin) ;;
1779     MOZ_ENABLE_PROFILER_SPS=
1780     ;;
1781 esac
1783 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1784     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1787 dnl ========================================================
1788 dnl shark
1789 dnl ========================================================
1790 MOZ_ARG_ENABLE_BOOL(shark,
1791 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1792     MOZ_SHARK=1,
1793     MOZ_SHARK= )
1794 if test -n "$MOZ_SHARK"; then
1795     MOZ_PROFILING=1
1796     AC_DEFINE(MOZ_SHARK)
1799 dnl ========================================================
1800 dnl instruments
1801 dnl ========================================================
1802 MOZ_ARG_ENABLE_BOOL(instruments,
1803 [  --enable-instruments    Enable instruments remote profiling. Implies --enable-profiling.],
1804     MOZ_INSTRUMENTS=1,
1805     MOZ_INSTRUMENTS= )
1806 if test -n "$MOZ_INSTRUMENTS"; then
1807     MOZ_PROFILING=1
1808     AC_DEFINE(MOZ_INSTRUMENTS)
1811 dnl ========================================================
1812 dnl callgrind
1813 dnl ========================================================
1814 MOZ_ARG_ENABLE_BOOL(callgrind,
1815 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1816     MOZ_CALLGRIND=1,
1817     MOZ_CALLGRIND= )
1818 if test -n "$MOZ_CALLGRIND"; then
1819     MOZ_PROFILING=1
1820     AC_DEFINE(MOZ_CALLGRIND)
1823 dnl ========================================================
1824 dnl vtune
1825 dnl ========================================================
1826 MOZ_ARG_ENABLE_BOOL(vtune,
1827 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1828     MOZ_VTUNE=1,
1829     MOZ_VTUNE= )
1830 if test -n "$MOZ_VTUNE"; then
1831     MOZ_PROFILING=1
1832     AC_DEFINE(MOZ_VTUNE)
1835 dnl ========================================================
1836 dnl Profiling
1837 dnl ========================================================
1838 if test -n "$MOZ_PROFILING"; then
1839     AC_DEFINE(MOZ_PROFILING)
1842 dnl ========================================================
1843 dnl System overrides of the defaults for host
1844 dnl ========================================================
1845 case "$host" in
1846 *mingw*)
1847     if test -n "$_WIN32_MSVC"; then
1848         HOST_AR=lib
1849         HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1850         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1851         HOST_RANLIB='echo ranlib'
1852     else
1853         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1854     fi
1855     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1856     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1857     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1858     HOST_BIN_SUFFIX=.exe
1859     case "$host" in
1860     *mingw*)
1861         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1862         ;;
1863     esac
1865     case "${host_cpu}" in
1866     i*86)
1867         if test -n "$_WIN32_MSVC"; then
1868             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1869         fi
1870         ;;
1871     x86_64)
1872         if test -n "$_WIN32_MSVC"; then
1873             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1874         fi
1875         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1876         ;;
1877     esac
1878     ;;
1880 *-darwin*)
1881     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1882     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1883     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1884     ;;
1886 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1887     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1888     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1889     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1890     ;;
1893     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1894     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1895     ;;
1896 esac
1898 dnl ==============================================================
1899 dnl Get mozilla version from central milestone file
1900 dnl ==============================================================
1901 MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
1902 MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
1903 MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
1905 dnl Get version of various core apps from the version files.
1906 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
1908 if test -z "$FIREFOX_VERSION"; then
1909     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
1912 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1913 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1914 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1915 AC_SUBST(MOZILLA_SYMBOLVERSION)
1917 MOZ_DOING_LTO(lto_is_enabled)
1919 dnl ========================================================
1920 dnl System overrides of the defaults for target
1921 dnl ========================================================
1923 case "$target" in
1924 *-aix*)
1925     AC_DEFINE(AIX)
1926     if test ! "$GNU_CC"; then
1927         if test ! "$HAVE_64BIT_BUILD"; then
1928             # Compiling with Visual Age C++ object model compat is the
1929             # default. To compile with object model ibm, add
1930             # AIX_OBJMODEL=ibm to .mozconfig.
1931             if test "$AIX_OBJMODEL" = "ibm"; then
1932                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1933             else
1934                 AIX_OBJMODEL=compat
1935             fi
1936         else
1937             AIX_OBJMODEL=compat
1938         fi
1939         AC_SUBST(AIX_OBJMODEL)
1940         DSO_LDOPTS='-qmkshrobj=1'
1941         DSO_CFLAGS='-qflag=w:w'
1942         DSO_PIC_CFLAGS=
1943         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1944         MOZ_FIX_LINK_PATHS=
1945         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1946         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1947         if test "$COMPILE_ENVIRONMENT"; then
1948             AC_LANG_SAVE
1949             AC_LANG_CPLUSPLUS
1950             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1951             AC_TRY_COMPILE([],
1952                 [#if (__IBMCPP__ < 900)
1953                  #error "Bad compiler"
1954                  #endif],
1955                 _BAD_COMPILER=,_BAD_COMPILER=1)
1956             if test -n "$_BAD_COMPILER"; then
1957                 AC_MSG_RESULT([no])
1958                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1959             else
1960                 AC_MSG_RESULT([yes])
1961             fi
1962             AC_LANG_RESTORE
1963             TARGET_COMPILER_ABI="ibmc"
1964             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1965             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1966         fi
1967     fi
1968     case "${target_os}" in
1969     aix4.1*)
1970         DLL_SUFFIX='_shr.a'
1971         ;;
1972     esac
1973     if test "$COMPILE_ENVIRONMENT"; then
1974         MOZ_CHECK_HEADERS(sys/inttypes.h)
1975     fi
1976     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1977     ;;
1979 *-darwin*)
1980     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1981     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1982     MOZ_OPTIMIZE_FLAGS="-O3"
1983     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
1984     if test "$HAVE_64BIT_BUILD"; then
1985         MOZ_MEMORY=1
1986     fi
1987     DLL_SUFFIX=".dylib"
1988     DSO_LDOPTS=''
1989     STRIP_FLAGS="$STRIP_FLAGS -x -S"
1990     # Check whether we're targeting OS X or iOS
1991     AC_CACHE_CHECK(for iOS target,
1992                    ac_cv_ios_target,
1993                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
1994 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1995 #error not iOS
1996 #endif],
1997                                    [],
1998                                    ac_cv_ios_target="yes",
1999                                    ac_cv_ios_target="no")])
2000     if test "$ac_cv_ios_target" = "yes"; then
2001         AC_DEFINE(XP_IOS)
2002         AC_DEFINE(XP_DARWIN)
2003         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
2004     else
2005         AC_DEFINE(XP_MACOSX)
2006         AC_DEFINE(XP_DARWIN)
2007         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2008         # The ExceptionHandling framework is needed for Objective-C exception
2009         # logging code in nsObjCExceptions.h. Currently we only use that in debug
2010         # builds.
2011         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2012     fi
2013     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2015     if test "x$lto_is_enabled" = "xyes"; then
2016         echo "Skipping -dead_strip because lto is enabled."
2017     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2018     dnl ===================================================================
2019     elif test "x$enable_dtrace" = "xyes"; then
2020         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2021     else
2022         dnl check for the presence of the -dead_strip linker flag
2023         AC_MSG_CHECKING([for -dead_strip option to ld])
2024         _SAVE_LDFLAGS=$LDFLAGS
2025         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2026         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2027         if test -n "$_HAVE_DEAD_STRIP" ; then
2028             AC_MSG_RESULT([yes])
2029             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2030         else
2031             AC_MSG_RESULT([no])
2032         fi
2034         LDFLAGS=$_SAVE_LDFLAGS
2035     fi
2037     dnl With newer linkers we need to pass -allow_heap_execute because of
2038     dnl Microsoft Silverlight (5.1.10411.0 at least).
2039     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
2040     _SAVE_LDFLAGS=$LDFLAGS
2041     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
2042     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
2043                 _HAVE_ALLOW_HEAP_EXECUTE=)
2044     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
2045         AC_MSG_RESULT([yes])
2046         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
2047     else
2048         AC_MSG_RESULT([no])
2049     fi
2050     LDFLAGS=$_SAVE_LDFLAGS
2052     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2053     ;;
2055 ia64*-hpux*)
2056     DLL_SUFFIX=".so"
2057     if test ! "$GNU_CC"; then
2058        DSO_LDOPTS='-b'
2059        DSO_CFLAGS=""
2060        DSO_PIC_CFLAGS=
2061        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2062        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2063        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2064     else
2065        DSO_LDOPTS='-b -E'
2066        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2067        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2068     fi
2069     MOZ_FIX_LINK_PATHS=
2070     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2071     AC_DEFINE(_LARGEFILE64_SOURCE)
2072     ;;
2074 *-hpux*)
2075     DLL_SUFFIX=".sl"
2076     if test ! "$GNU_CC"; then
2077         DSO_LDOPTS='-b -Wl,+s'
2078         DSO_CFLAGS=""
2079         DSO_PIC_CFLAGS="+Z"
2080         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2081         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2082         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2083     else
2084         DSO_LDOPTS='-b -E +s'
2085         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2086         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2087     fi
2088     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2089     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2090     ;;
2092 *-android*|*-linuxandroid*)
2093     AC_DEFINE(NO_PW_GECOS)
2094     no_x=yes
2095     if test -n "$gonkdir"; then
2096         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2097         _PLATFORM_HAVE_RIL=1
2098         MOZ_B2G_FM=1
2099         MOZ_SYNTH_PICO=1
2100     else
2101         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2102         MOZ_LINKER=1
2103     fi
2104     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2106     MOZ_GFX_OPTIMIZE_MOBILE=1
2107     MOZ_OPTIMIZE_FLAGS="-Os -fno-reorder-functions"
2108     if test -z "$CLANG_CC"; then
2109        MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2110     fi
2111     ;;
2113 *-*linux*)
2114     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2115     # Similarly for GNU_CXX and INTEL_CXX.
2116     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2117         # -Os has been broken on Intel's C/C++ compilers for quite a
2118         # while; Intel recommends against using it.
2119         MOZ_OPTIMIZE_FLAGS="-O2"
2120     elif test "$GNU_CC" -o "$GNU_CXX"; then
2121         case $GCC_VERSION in
2122         4.5.*)
2123             # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
2124             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2125         esac
2126         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2127         MOZ_OPTIMIZE_FLAGS="-Os $MOZ_OPTIMIZE_SIZE_TWEAK"
2128         if test -z "$CLANG_CC"; then
2129            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2130         fi
2131     fi
2133     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2135     MOZ_MEMORY=1
2137     case "${target_cpu}" in
2138     alpha*)
2139         CFLAGS="$CFLAGS -mieee"
2140         CXXFLAGS="$CXXFLAGS -mieee"
2141     ;;
2142     esac
2144     if test -z "$MC"; then
2145         MC=mc.exe
2146     fi
2147     ;;
2148 *-mingw*)
2149     DSO_CFLAGS=
2150     DSO_PIC_CFLAGS=
2151     DLL_SUFFIX=.dll
2152     RC=rc.exe
2153     MC=mc.exe
2154     # certain versions of cygwin's makedepend barf on the
2155     # #include <string> vs -I./dist/include/string issue so don't use it
2156     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2157         CC="$CC -mwindows"
2158         CXX="$CXX -mwindows"
2159         CPP="$CPP -mwindows"
2160         CFLAGS="$CFLAGS -mms-bitfields"
2161         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2162         DSO_LDOPTS='-shared'
2163         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2164         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2165         RC='$(WINDRES)'
2166         # Use static libgcc and libstdc++
2167         LDFLAGS="$LDFLAGS -static"
2168         NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2169         # Use temp file for windres (bug 213281)
2170         RCFLAGS='-O coff --use-temp-file'
2171         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2172         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2173         MOZ_FIX_LINK_PATHS=
2174         DLL_PREFIX=
2175         IMPORT_LIB_SUFFIX=a
2177         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
2178         WIN32_GUI_EXE_LDFLAGS=-mwindows
2180         # We use mix of both POSIX and Win32 printf format across the tree, so format
2181         # warnings are useless on mingw.
2182         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2183         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2184     else
2185         TARGET_COMPILER_ABI=msvc
2186         HOST_CC='$(CC)'
2187         HOST_CXX='$(CXX)'
2188         HOST_LD='$(LD)'
2189         if test "$AS_BIN"; then
2190             AS="$(basename "$AS_BIN")"
2191         fi
2192         AR='lib'
2193         AR_FLAGS='-NOLOGO -OUT:$@'
2194         AR_EXTRACT=
2195         RANLIB='echo not_ranlib'
2196         STRIP='echo not_strip'
2197         PKG_SKIP_STRIP=1
2198         XARGS=xargs
2199         ZIP=zip
2200         UNZIP=unzip
2201         DOXYGEN=:
2202         ASM_SUFFIX=asm
2203         OBJ_SUFFIX=obj
2204         LIB_SUFFIX=lib
2205         DLL_PREFIX=
2206         LIB_PREFIX=
2207         IMPORT_LIB_SUFFIX=lib
2208         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2209         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2210         MKSHLIB_FORCE_ALL=
2211         MKSHLIB_UNFORCE_ALL=
2212         dnl Set subsystem version 5 for Windows XP.
2213         if test "$CPU_ARCH" = "x86"; then
2214             WIN32_SUBSYSTEM_VERSION=5.01
2215         else
2216             WIN32_SUBSYSTEM_VERSION=6.01
2217         fi
2218         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
2219         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2220         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2221         _USE_CPP_INCLUDE_FLAG=1
2222         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2223         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2224         CFLAGS="$CFLAGS -W3 -Gy"
2225         CXXFLAGS="$CXXFLAGS -W3 -Gy"
2226         if test "$_CC_SUITE" -ge "11" -a "$CPU_ARCH" = "x86"; then
2227             dnl VS2012+ defaults to -arch:SSE2.
2228             CFLAGS="$CFLAGS -arch:IA32"
2229             CXXFLAGS="$CXXFLAGS -arch:IA32"
2230         fi
2231         if test "$_CC_SUITE" -ge "12"; then
2232             dnl VS2013+ requires -FS when parallel building by make -jN.
2233             dnl If nothing, compiler sometimes causes C1041 error.
2234             CFLAGS="$CFLAGS -FS"
2235             CXXFLAGS="$CXXFLAGS -FS"
2236         fi
2237         # khuey says we can safely ignore MSVC warning C4251
2238         # MSVC warning C4244 (implicit type conversion may lose data) warns
2239         # and requires workarounds for perfectly valid code.  Also, GCC/clang
2240         # don't warn about it by default. So for consistency/sanity, we turn
2241         # it off on MSVC, too.
2242         # MSVC warning C4267 warns for narrowing type conversions from size_t
2243         # to 32-bit integer types on 64-bit platforms.  Since this is virtually
2244         # the same thing as C4244, we disable C4267, too.
2245         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2246         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2247         # MSVC warning C4482 warns when an enum value is refered specifing the
2248         # name of the enum itself.  This behavior is allowed in C++11, and the
2249         # warning has been removed in VS2012.
2250         # MSVC warning C4800 warns when a value is implicitly cast to bool,
2251         # because this also forces narrowing to a single byte, which can be a
2252         # perf hit.  But this matters so little in practice (and often we want
2253         # that behavior) that it's better to turn it off.
2254         # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2255         # on non-Western system locales even if it is in a comment.
2256         CFLAGS="$CFLAGS -wd4244 -wd4267 -wd4819"
2257         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2258         if test -n "$CLANG_CL"; then
2259             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
2260             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
2261         fi
2262         # make 'foo == bar;' error out
2263         CFLAGS="$CFLAGS -we4553"
2264         CXXFLAGS="$CXXFLAGS -we4553"
2265         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2266         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2267         WARNINGS_AS_ERRORS='-WX'
2268         MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
2269         MOZ_FIX_LINK_PATHS=
2270         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2271         # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
2272         # autoconf insists on passing $LDFLAGS to the compiler.
2273         if test -z "$CLANG_CL"; then
2274             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2275             if test -z "$DEVELOPER_OPTIONS"; then
2276                 LDFLAGS="$LDFLAGS -RELEASE"
2277             fi
2278         fi
2279         dnl For profile-guided optimization
2280         PROFILE_GEN_CFLAGS="-GL"
2281         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2282         dnl XXX: PGO builds can fail with warnings treated as errors,
2283         dnl specifically "no profile data available" appears to be
2284         dnl treated as an error sometimes. This might be a consequence
2285         dnl of using WARNINGS_AS_ERRORS in some modules, combined
2286         dnl with the linker doing most of the work in the whole-program
2287         dnl optimization/PGO case. I think it's probably a compiler bug,
2288         dnl but we work around it here.
2289         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2290         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2291         dnl Probably also a compiler bug, but what can you do?
2292         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2293         LDFLAGS="$LDFLAGS -DYNAMICBASE"
2294         dnl Minimum reqiurement of Gecko is VS2010 or later which supports
2295         dnl both SSSE3 and SSE4.1.
2296         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2297         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2298         if test "$_CC_SUITE" -ge "11"; then
2299             dnl allow AVX2 code from VS2012
2300             HAVE_X86_AVX2=1
2301         fi
2302         MOZ_MEMORY=1
2303     fi
2304     AC_DEFINE(HAVE_SNPRINTF)
2305     AC_DEFINE(_WINDOWS)
2306     AC_DEFINE(WIN32)
2307     AC_DEFINE(XP_WIN)
2308     AC_DEFINE(XP_WIN32)
2309     AC_DEFINE(HW_THREADS)
2310     AC_DEFINE(STDC_HEADERS)
2311     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2312     TARGET_MD_ARCH=win32
2313     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2314     BIN_SUFFIX='.exe'
2315     MOZ_USER_DIR="Mozilla"
2317     dnl Hardcode to win95 for now - cls
2318     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2320     dnl set NO_X11 defines here as the general check is skipped on win32
2321     no_x=yes
2322     AC_DEFINE(NO_X11)
2324     case "$host" in
2325     *-mingw*)
2326         if test -n "$L10NBASEDIR"; then
2327             L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2328         fi
2329         ;;
2330     esac
2332     case "$host" in
2333     *-mingw*)
2334         if test -z "$MOZ_TOOLS"; then
2335             AC_MSG_ERROR([MOZ_TOOLS is not set])
2336         fi
2337         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2338         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2339             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2340         fi
2341         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2342         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2343             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2344         fi
2345         ;;
2346     esac
2348     case "$host_os" in
2349     cygwin*|msvc*|mks*)
2350         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.])
2351         ;;
2352     esac
2354     case "$target" in
2355     i*86-*)
2356         if test "$HAVE_64BIT_BUILD"; then
2357             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2358         fi
2360         if test -n "$GNU_CC"; then
2361             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2362             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2363             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2364         else
2365             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2366             # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
2367             # autoconf insists on passing $LDFLAGS to the compiler.
2368             if test -z "$CLANG_CL"; then
2369                 LDFLAGS="$LDFLAGS -SAFESEH"
2370             fi
2371         fi
2373         AC_DEFINE(_X86_)
2374         ;;
2375     x86_64-*)
2376         if test -n "$_WIN32_MSVC"; then
2377             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2378         fi
2379         AC_DEFINE(_AMD64_)
2380         ;;
2381     *)
2382         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2383         ;;
2384     esac
2385     ;;
2387 *-netbsd*)
2388     DSO_CFLAGS=''
2389     CFLAGS="$CFLAGS -Dunix"
2390     CXXFLAGS="$CXXFLAGS -Dunix"
2391     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2392         DLL_SUFFIX=".so"
2393         DSO_PIC_CFLAGS='-fPIC -DPIC'
2394         DSO_LDOPTS='-shared'
2395         BIN_FLAGS='-Wl,--export-dynamic'
2396     else
2397         DSO_PIC_CFLAGS='-fPIC -DPIC'
2398         DLL_SUFFIX=".so.1.0"
2399         DSO_LDOPTS='-shared'
2400     fi
2401     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2402     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2403     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2404     if test "$LIBRUNPATH"; then
2405         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2406     fi
2407     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2408     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2409     ;;
2411 *-openbsd*)
2412     if test "$SO_VERSION"; then
2413         DLL_SUFFIX=".so.$SO_VERSION"
2414     else
2415         DLL_SUFFIX=".so.1.0"
2416     fi
2417     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2418     DSO_CFLAGS=''
2419     DSO_PIC_CFLAGS='-fPIC'
2420     DSO_LDOPTS='-shared -fPIC'
2421     if test "$LIBRUNPATH"; then
2422         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2423     fi
2424     ;;
2426 *-solaris*)
2427     AC_DEFINE(SOLARIS)
2428     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2429     MOZ_FIX_LINK_PATHS=
2430     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2431     # libraries one level up (e.g. libnspr4.so)
2432     if test "$SOLARIS_SUNPRO_CC"; then
2433        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2434        LIBS="-lCrun -lCstd -lc $LIBS"
2435        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2436        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2437        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2438        LDFLAGS="-xildoff $LDFLAGS"
2439        MMX_FLAGS="-xarch=mmx -xO4"
2440        SSE_FLAGS="-xarch=sse"
2441        SSE2_FLAGS="-xarch=ssei2 -xO4"
2442        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2443            _SAVE_LDFLAGS=$LDFLAGS
2444            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2445            AC_TRY_LINK([#include <stdio.h>],
2446                        [printf("Hello World\n");],
2447                        ,
2448                        [LDFLAGS=$_SAVE_LDFLAGS])
2449        fi
2450        MOZ_OPTIMIZE_FLAGS="-xO4"
2451        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2452        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2453        MKSHLIB_FORCE_ALL='-z allextract'
2454        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2455        DSO_LDOPTS='-G'
2456        AR_LIST="$AR t"
2457        AR_EXTRACT="$AR x"
2458        AR_DELETE="$AR d"
2459        AR='$(CXX) -xar'
2460        AR_FLAGS='-o $@'
2461        AS='/usr/ccs/bin/as'
2462        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2463        AS_DASH_C_FLAG=''
2464        TARGET_COMPILER_ABI="sunc"
2465        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2466        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2467        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2468        AC_LANG_SAVE
2469        AC_LANG_CPLUSPLUS
2470        AC_TRY_COMPILE([],
2471            [#if (__SUNPRO_CC < 0x590)
2472            #error "Denied"
2473            #endif],
2474            _BAD_COMPILER=,_BAD_COMPILER=1)
2475        if test -n "$_BAD_COMPILER"; then
2476            _res="no"
2477            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2478        else
2479            _res="yes"
2480        fi
2481        AC_TRY_COMPILE([],
2482            [#if (__SUNPRO_CC >= 0x5100)
2483            #error "Sun C++ 5.10 or above"
2484            #endif],
2485            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2486        if test "$_ABOVE_SS12U1"; then
2487            # disable xannotate
2488            CXXFLAGS="$CXXFLAGS -xannotate=no"
2489        fi
2490        AC_MSG_RESULT([$_res])
2491        AC_LANG_RESTORE
2492     else
2493        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2494        LIBS="-lc $LIBS"
2495        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2496        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2497        ASFLAGS="$ASFLAGS -fPIC"
2498        DSO_LDOPTS='-shared'
2499        WARNINGS_AS_ERRORS='-Werror'
2500        _WARNINGS_CFLAGS=''
2501        _WARNINGS_CXXFLAGS=''
2502        if test "$OS_RELEASE" = "5.3"; then
2503            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2504        fi
2505     fi
2506     if test "$OS_RELEASE" = "5.5.1"; then
2507         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2508     fi
2509     ;;
2511 *-sunos*)
2512     DSO_LDOPTS='-Bdynamic'
2513     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2514     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2515     AC_DEFINE(SUNOS4)
2516     AC_DEFINE(SPRINTF_RETURNS_STRING)
2517     case "$(target_os)" in
2518     sunos4.1*)
2519         DLL_SUFFIX='.so.1.0'
2520         ;;
2521     esac
2522     ;;
2524 esac
2526 AC_SUBST_LIST(MMX_FLAGS)
2527 AC_SUBST_LIST(SSE_FLAGS)
2528 AC_SUBST_LIST(SSE2_FLAGS)
2530 case "$target" in
2531 *-*linux*)
2532     # Includes linux-android
2533     AC_DEFINE(XP_LINUX)
2534     ;;
2535 esac
2537 AC_SUBST(MOZ_LINKER)
2538 if test -n "$MOZ_LINKER"; then
2539   AC_DEFINE(MOZ_LINKER)
2542 dnl Only one oddball right now (QNX), but this gives us flexibility
2543 dnl if any other platforms need to override this in the future.
2544 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2546 dnl ========================================================
2547 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2548 dnl by now will not have any way to link most binaries (tests
2549 dnl as well as viewer, apprunner, etc.), because some symbols
2550 dnl will be left out of the "composite" .so's by ld as unneeded.
2551 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2552 dnl they can link in the static libs that provide the missing
2553 dnl symbols.
2554 dnl ========================================================
2555 NO_LD_ARCHIVE_FLAGS=
2556 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2557     NO_LD_ARCHIVE_FLAGS=1
2559 case "$target" in
2560 *-aix4.3*|*-aix5*)
2561     NO_LD_ARCHIVE_FLAGS=
2562     ;;
2563 *-mingw*)
2564     if test -z "$GNU_CC"; then
2565         NO_LD_ARCHIVE_FLAGS=
2566     fi
2567     ;;
2568 esac
2569 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2571 dnl ========================================================
2572 dnl = Flags to strip unused symbols from .so components and
2573 dnl = to export jemalloc symbols when linking a program
2574 dnl ========================================================
2575 case "$target" in
2576     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2577         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2578         ;;
2579     *-solaris*)
2580         if test -z "$GNU_CC"; then
2581          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2582         else
2583          if test -z "$GCC_USE_GNU_LD"; then
2584           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2585          else
2586           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2587          fi
2588         fi
2589         ;;
2590     *-darwin*)
2591         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2592         ;;
2593     *-mingw*)
2594         if test -n "$GNU_CC"; then
2595            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2596         fi
2597         ;;
2598 esac
2600 if test -z "$COMPILE_ENVIRONMENT"; then
2601     SKIP_COMPILER_CHECKS=1
2602     SKIP_LIBRARY_CHECKS=1
2603 else
2604     MOZ_COMPILER_OPTS
2607 if test -z "$SKIP_COMPILER_CHECKS"; then
2608 dnl Checks for typedefs, structures, and compiler characteristics.
2609 dnl ========================================================
2610 AC_HEADER_STDC
2611 AC_C_CONST
2612 AC_TYPE_MODE_T
2613 AC_TYPE_OFF_T
2614 AC_TYPE_PID_T
2615 AC_TYPE_SIZE_T
2616 AC_LANG_CPLUSPLUS
2617 AC_LANG_C
2619 AC_LANG_CPLUSPLUS
2621 MOZ_CXX11
2623 AC_LANG_C
2625 dnl Check for .hidden assembler directive and visibility attribute.
2626 dnl Borrowed from glibc configure.in
2627 dnl ===============================================================
2628 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2629   AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2630   AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2631   case "$OS_TARGET" in
2632   Darwin)
2633     VISIBILITY_FLAGS='-fvisibility=hidden'
2634     ;;
2635   *)
2636     case $GCC_VERSION in
2637     4.4*|4.6*)
2638       VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden_dso_handle.h'
2639       ;;
2640     *)
2641       VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
2642       ;;
2643     esac
2644     WRAP_SYSTEM_INCLUDES=1
2645     ;;
2646   esac
2647 fi         # GNU_CC
2649 # visibility hidden flag for Sun Studio on Solaris
2650 if test "$SOLARIS_SUNPRO_CC"; then
2651 VISIBILITY_FLAGS='-xldscope=hidden'
2652 fi         # Sun Studio on Solaris
2654 case "${OS_TARGET}" in
2655 WINNT|Darwin|Android)
2656   ;;
2658   STL_FLAGS='-I$(DIST)/stl_wrappers'
2659   WRAP_STL_INCLUDES=1
2660   ;;
2661 esac
2663 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2664 AC_SUBST(VISIBILITY_FLAGS)
2666 MOZ_GCC_PR49911
2667 MOZ_LLVM_PR8927
2669 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2670 dnl ========================================================
2671 if test "$GNU_CC"; then
2672   CFLAGS_save="${CFLAGS}"
2673   CFLAGS="${CFLAGS} -Werror"
2674   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2675                  ac_cv_force_align_arg_pointer,
2676                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2677                                  [],
2678                                  ac_cv_force_align_arg_pointer="yes",
2679                                  ac_cv_force_align_arg_pointer="no")])
2680   CFLAGS="${CFLAGS_save}"
2681   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2682     HAVE_GCC_ALIGN_ARG_POINTER=1
2683   else
2684     HAVE_GCC_ALIGN_ARG_POINTER=
2685   fi
2687 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2689 dnl Checks for header files.
2690 dnl ========================================================
2691 AC_HEADER_DIRENT
2692 case "$target_os" in
2693 freebsd*|openbsd*)
2694 # for stuff like -lXshm
2695     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2696     ;;
2697 esac
2698 MOZ_CHECK_COMMON_HEADERS
2700 dnl These are all the places some variant of statfs can be hiding.
2701 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2703 dnl Quota support
2704 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2705 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2707 dnl SCTP support - needs various network include headers
2708 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2710 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2712 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2713 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2714                    ac_cv_sockaddr_in_sin_len,
2715                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2716                                     #include <sys/types.h>
2717                                     #endif
2718                                     #include <netinet/in.h>
2719                                     struct sockaddr_in x;
2720                                     void *foo = (void*) &x.sin_len;],
2721                                    [],
2722                                    [ac_cv_sockaddr_in_sin_len=true],
2723                                    [ac_cv_sockaddr_in_sin_len=false])])
2724 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2725   AC_DEFINE(HAVE_SIN_LEN)
2726 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2727   AC_DEFINE(HAVE_SCONN_LEN)
2730 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2731                ac_cv_sockaddr_in6_sin6_len,
2732                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2733                                 #include <sys/types.h>
2734                                 #endif
2735                                 #include <netinet/in.h>
2736                                 struct sockaddr_in6 x;
2737                                 void *foo = (void*) &x.sin6_len;],
2738                                [],
2739                                [ac_cv_sockaddr_in6_sin6_len=true],
2740                                [ac_cv_sockaddr_in6_sin6_len=false])])
2741 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2742   AC_DEFINE(HAVE_SIN6_LEN)
2745 AC_CACHE_CHECK(for sockaddr.sa_len,
2746                ac_cv_sockaddr_sa_len,
2747                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2748                                 #include <sys/types.h>
2749                                 #endif
2750                                 #include <sys/socket.h>
2751                                 struct sockaddr x;
2752                                 void *foo = (void*) &x.sa_len;],
2753                                [],
2754                                [ac_cv_sockaddr_sa_len=true],
2755                                [ac_cv_sockaddr_sa_len=false])])
2756 if test "$ac_cv_sockaddr_sa_len" = true ; then
2757   AC_DEFINE(HAVE_SA_LEN)
2760 MOZ_ARG_ENABLE_BOOL(dtrace,
2761               [  --enable-dtrace         build with dtrace support if available (default=no)],
2762               [enable_dtrace="yes"],)
2763 if test "x$enable_dtrace" = "xyes"; then
2764   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2765   if test -n "$HAVE_DTRACE"; then
2766       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2767   else
2768       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2769   fi
2771 AC_SUBST(HAVE_DTRACE)
2773 case $target in
2774 *-aix4.3*|*-aix5*)
2775     ;;
2777     MOZ_CHECK_HEADERS(sys/cdefs.h)
2778     ;;
2779 esac
2781 MOZ_LINUX_PERF_EVENT
2783 dnl Checks for libraries.
2784 dnl ========================================================
2785 case $target in
2786 *-hpux11.*)
2787     ;;
2789     AC_CHECK_LIB(c_r, gethostbyname_r)
2790     ;;
2791 esac
2793 dnl We don't want to link with libdl even if it's present on OS X, since
2794 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2795 dnl in libc.
2796 dnl We don't want to link against libm or libpthread on Darwin since
2797 dnl they both are just symlinks to libSystem and explicitly linking
2798 dnl against libSystem causes issues when debugging (see bug 299601).
2799 case $target in
2800 *-darwin*)
2801     ;;
2803     AC_SEARCH_LIBS(dlopen, dl,
2804         MOZ_CHECK_HEADER(dlfcn.h,
2805         AC_DEFINE(HAVE_DLOPEN)))
2806     ;;
2807 esac
2809 _SAVE_CFLAGS="$CFLAGS"
2810 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2811 AC_CHECK_FUNCS(dladdr memmem)
2812 CFLAGS="$_SAVE_CFLAGS"
2814 if test ! "$GNU_CXX"; then
2816     case $target in
2817     *-aix*)
2818         AC_CHECK_LIB(C_r, demangle)
2819         ;;
2820      *)
2821         AC_CHECK_LIB(C, demangle)
2822         ;;
2823      esac
2826 AC_CHECK_LIB(socket, socket)
2828 XLDFLAGS="$X_LIBS"
2829 XLIBS="$X_EXTRA_LIBS"
2831 dnl ========================================================
2832 dnl Checks for X libraries.
2833 dnl Ordering is important.
2834 dnl Xt is dependent upon SM as of X11R6
2835 dnl ========================================================
2836 if test "$no_x" = "yes"; then
2837     AC_DEFINE(NO_X11)
2838 else
2839     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2840     XLIBS="-lX11 $XLIBS"
2841     _SAVE_LDFLAGS="$LDFLAGS"
2842     LDFLAGS="$XLDFLAGS $LDFLAGS"
2843     AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2844         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2845     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2846         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2848     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2849         unset ac_cv_lib_Xt_XtFree
2850         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2851         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2852         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2853             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2854         ])
2856     # AIX needs the motif library linked before libXt to prevent
2857     # crashes in plugins linked against Motif - Bug #98892
2858     case "${target_os}" in
2859     aix*)
2860         XT_LIBS="-lXm $XT_LIBS"
2861         ;;
2862     esac
2864     dnl ========================================================
2865     dnl = Check for XShm
2866     dnl ========================================================
2867     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2868         $XLIBS $XEXT_LIBS)
2870     dnl ========================================================
2871     dnl = Check for Xss
2872     dnl ========================================================
2873     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2874         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2875             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2876              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2878     LDFLAGS="$_SAVE_LDFLAGS"
2879 fi # $no_x
2881 AC_SUBST_LIST(XCFLAGS)
2882 AC_SUBST_LIST(XLDFLAGS)
2883 AC_SUBST_LIST(XLIBS)
2884 AC_SUBST_LIST(XEXT_LIBS)
2885 AC_SUBST_LIST(XT_LIBS)
2886 AC_SUBST_LIST(XSS_LIBS)
2888 dnl ========================================================
2889 dnl = pthread support
2890 dnl = Start by checking whether the system support pthreads
2891 dnl ========================================================
2892 case "$target_os" in
2893 darwin*)
2894     MOZ_USE_PTHREADS=1
2895     ;;
2897     AC_CHECK_LIB(pthreads, pthread_create,
2898         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2899         AC_CHECK_LIB(pthread, pthread_create,
2900             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2901             AC_CHECK_LIB(c_r, pthread_create,
2902                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2903                 AC_CHECK_LIB(c, pthread_create,
2904                     MOZ_USE_PTHREADS=1
2905                 )
2906             )
2907         )
2908     )
2909     ;;
2910 esac
2912 dnl ========================================================
2913 dnl Check the command line for --with-pthreads
2914 dnl ========================================================
2915 MOZ_ARG_WITH_BOOL(pthreads,
2916 [  --with-pthreads         Force use of system pthread library with NSPR ],
2917 [ if test "$MOZ_USE_PTHREADS"x = x; then
2918     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2919 fi],
2920     MOZ_USE_PTHREADS=
2921     _PTHREAD_LDFLAGS=
2924 dnl ========================================================
2925 dnl Do the platform specific pthread hackery
2926 dnl ========================================================
2927 if test "$MOZ_USE_PTHREADS"x != x
2928 then
2929     dnl
2930     dnl See if -pthread is supported.
2931     dnl
2932     rm -f conftest*
2933     ac_cv_have_dash_pthread=no
2934     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2935     echo 'int main() { return 0; }' | cat > conftest.c
2936     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2937     if test $? -eq 0; then
2938         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2939             ac_cv_have_dash_pthread=yes
2940             case "$target_os" in
2941             freebsd*)
2942 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2943                 ;;
2944             *)
2945                 CFLAGS="$CFLAGS -pthread"
2946                 CXXFLAGS="$CXXFLAGS -pthread"
2947                 ;;
2948             esac
2949         fi
2950     fi
2951     rm -f conftest*
2952     AC_MSG_RESULT($ac_cv_have_dash_pthread)
2954     dnl
2955     dnl See if -pthreads is supported.
2956     dnl
2957     ac_cv_have_dash_pthreads=no
2958     if test "$ac_cv_have_dash_pthread" = "no"; then
2959         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2960         echo 'int main() { return 0; }' | cat > conftest.c
2961         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2962         if test $? -eq 0; then
2963             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2964                 ac_cv_have_dash_pthreads=yes
2965                 CFLAGS="$CFLAGS -pthreads"
2966                 CXXFLAGS="$CXXFLAGS -pthreads"
2967             fi
2968         fi
2969         rm -f conftest*
2970         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2971     fi
2973     case "$target" in
2974         *-*-freebsd*)
2975             AC_DEFINE(_REENTRANT)
2976             AC_DEFINE(_THREAD_SAFE)
2977             dnl -pthread links in -lpthread, so don't specify it explicitly.
2978             if test "$ac_cv_have_dash_pthread" = "yes"; then
2979                 _PTHREAD_LDFLAGS="-pthread"
2980             fi
2981             ;;
2983         *-*-openbsd*|*-*-bsdi*)
2984             AC_DEFINE(_REENTRANT)
2985             AC_DEFINE(_THREAD_SAFE)
2986             dnl -pthread links in -lc_r, so don't specify it explicitly.
2987             if test "$ac_cv_have_dash_pthread" = "yes"; then
2988                 _PTHREAD_LDFLAGS="-pthread"
2989             fi
2990             ;;
2992         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2993             AC_DEFINE(_REENTRANT)
2994             ;;
2996         *-aix4.3*|*-aix5*)
2997             AC_DEFINE(_REENTRANT)
2998             ;;
3000         *-hpux11.*)
3001             AC_DEFINE(_REENTRANT)
3002             ;;
3004         *-*-solaris*)
3005             AC_DEFINE(_REENTRANT)
3006             if test "$SOLARIS_SUNPRO_CC"; then
3007                 CFLAGS="$CFLAGS -mt"
3008                 CXXFLAGS="$CXXFLAGS -mt"
3009             fi
3010             ;;
3011     esac
3012     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3013     AC_SUBST(MOZ_USE_PTHREADS)
3017 dnl Checks for library functions.
3018 dnl ========================================================
3019 AC_PROG_GCC_TRADITIONAL
3020 AC_FUNC_MEMCMP
3021 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
3023 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3024 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3025                ac_cv_clock_monotonic,
3026                [for libs in "" -lrt; do
3027                     _SAVE_LIBS="$LIBS"
3028                     LIBS="$LIBS $libs"
3029                     AC_TRY_LINK([#include <time.h>],
3030                                  [ struct timespec ts;
3031                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3032                                  ac_cv_clock_monotonic=$libs
3033                                  LIBS="$_SAVE_LIBS"
3034                                  break,
3035                                  ac_cv_clock_monotonic=no)
3036                     LIBS="$_SAVE_LIBS"
3037                 done])
3038 if test "$ac_cv_clock_monotonic" != "no"; then
3039     HAVE_CLOCK_MONOTONIC=1
3040     REALTIME_LIBS=$ac_cv_clock_monotonic
3041     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3042     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3043     AC_SUBST_LIST(REALTIME_LIBS)
3046 dnl check for wcrtomb/mbrtowc
3047 dnl =======================================================================
3048 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3049 AC_LANG_SAVE
3050 AC_LANG_CPLUSPLUS
3051 AC_CACHE_CHECK(for wcrtomb,
3052     ac_cv_have_wcrtomb,
3053     [AC_TRY_LINK([#include <wchar.h>],
3054                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3055                  ac_cv_have_wcrtomb="yes",
3056                  ac_cv_have_wcrtomb="no")])
3057 if test "$ac_cv_have_wcrtomb" = "yes"; then
3058     AC_DEFINE(HAVE_WCRTOMB)
3060 AC_CACHE_CHECK(for mbrtowc,
3061     ac_cv_have_mbrtowc,
3062     [AC_TRY_LINK([#include <wchar.h>],
3063                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3064                  ac_cv_have_mbrtowc="yes",
3065                  ac_cv_have_mbrtowc="no")])
3066 if test "$ac_cv_have_mbrtowc" = "yes"; then
3067     AC_DEFINE(HAVE_MBRTOWC)
3069 AC_LANG_RESTORE
3072 AC_CACHE_CHECK(
3073     [for res_ninit()],
3074     ac_cv_func_res_ninit,
3075     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
3076         dnl no need for res_ninit() on NetBSD and OpenBSD
3077         ac_cv_func_res_ninit=no
3078      else
3079         AC_TRY_LINK([
3080             #ifdef linux
3081             #define _BSD_SOURCE 1
3082             #endif
3083             #include <sys/types.h>
3084             #include <netinet/in.h>
3085             #include <arpa/nameser.h>
3086             #include <resolv.h>
3087             ],
3088             [int foo = res_ninit(&_res);],
3089             [ac_cv_func_res_ninit=yes],
3090             [ac_cv_func_res_ninit=no])
3091      fi
3092     ])
3094 if test "$ac_cv_func_res_ninit" = "yes"; then
3095     AC_DEFINE(HAVE_RES_NINIT)
3096 dnl must add the link line we do something as foolish as this... dougt
3097 dnl else
3098 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3099 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3102 AC_LANG_CPLUSPLUS
3104 ICONV_LIBS=
3106 case $target_os in
3107     darwin*|mingw*)
3108         ;;
3109     *)
3111 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
3112     AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
3113         AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
3114 _SAVE_LIBS=$LIBS
3115 LIBS="$LIBS $ICONV_LIBS"
3116 AC_CACHE_CHECK(
3117     [for iconv()],
3118     ac_cv_func_iconv,
3119     [AC_TRY_LINK([
3120         #include <stdlib.h>
3121         #include <iconv.h>
3122         ],
3123         [
3124             iconv_t h = iconv_open("", "");
3125             iconv(h, NULL, NULL, NULL, NULL);
3126             iconv_close(h);
3127         ],
3128         [ac_cv_func_iconv=yes],
3129         [ac_cv_func_iconv=no]
3130         )]
3131     )
3132 if test "$ac_cv_func_iconv" = "yes"; then
3133     AC_DEFINE(HAVE_ICONV)
3134     LIBICONV="$ICONV_LIBS"
3135     AC_CACHE_CHECK(
3136         [for iconv() with const input],
3137         ac_cv_func_const_iconv,
3138         [AC_TRY_COMPILE([
3139             #include <stdlib.h>
3140             #include <iconv.h>
3141             ],
3142             [
3143                 const char *input = "testing";
3144                 iconv_t h = iconv_open("", "");
3145                 iconv(h, &input, NULL, NULL, NULL);
3146                 iconv_close(h);
3147             ],
3148             [ac_cv_func_const_iconv=yes],
3149             [ac_cv_func_const_iconv=no]
3150             )]
3151         )
3152     if test "$ac_cv_func_const_iconv" = "yes"; then
3153         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3154     fi
3156 LIBS=$_SAVE_LIBS
3158     ;;
3159 esac
3161 AC_SUBST_LIST(ICONV_LIBS)
3163 AM_LANGINFO_CODESET
3165 AC_LANG_C
3167 dnl **********************
3168 dnl *** va_copy checks ***
3169 AC_CACHE_CHECK([for an implementation of va_copy()],
3170                ac_cv_va_copy,
3171     [AC_TRY_COMPILE([#include <stdarg.h>
3172                      #include <stdlib.h>
3173         void f (int i, ...) {
3174             va_list args1, args2;
3175             va_start (args1, i);
3176             va_copy (args2, args1);
3177             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3178                 exit (1);
3179             va_end (args1); va_end (args2);
3180         }],
3181         [f(0, 42); return 0],
3182         [ac_cv_va_copy=yes],
3183         [ac_cv_va_copy=no]
3184     )]
3186 AC_CACHE_CHECK([whether va_list can be copied by value],
3187                ac_cv_va_val_copy,
3188     [AC_TRY_COMPILE([#include <stdarg.h>
3189                      #include <stdlib.h>
3190         void f (int i, ...) {
3191             va_list args1, args2;
3192             va_start (args1, i);
3193             args2 = args1;
3194             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3195                 exit (1);
3196             va_end (args1); va_end (args2);
3197         }],
3198         [f(0, 42); return 0],
3199         [ac_cv_va_val_copy=yes],
3200         [ac_cv_va_val_copy=no],
3201     )]
3203 if test "x$ac_cv_va_copy" = "xyes"; then
3204     AC_DEFINE(VA_COPY, va_copy)
3205     AC_DEFINE(HAVE_VA_COPY)
3208 if test "x$ac_cv_va_val_copy" = "xno"; then
3209    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3212 dnl ===================================================================
3213 dnl ========================================================
3214 dnl Put your C++ language/feature checks below
3215 dnl ========================================================
3216 AC_LANG_CPLUSPLUS
3218 ARM_ABI_PREFIX=
3219 if test "$GNU_CC"; then
3220   if test "$CPU_ARCH" = "arm" ; then
3221     AC_CACHE_CHECK(for ARM EABI,
3222         ac_cv_gcc_arm_eabi,
3223         [AC_TRY_COMPILE([],
3224                         [
3225 #if defined(__ARM_EABI__)
3226   return 0;
3227 #else
3228 #error Not ARM EABI.
3229 #endif
3230                         ],
3231                         ac_cv_gcc_arm_eabi="yes",
3232                         ac_cv_gcc_arm_eabi="no")])
3233     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3234         HAVE_ARM_EABI=1
3235         ARM_ABI_PREFIX=eabi-
3236     else
3237         ARM_ABI_PREFIX=oabi-
3238     fi
3239   fi
3241   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3244 dnl Check to see if we can resolve ambiguity with |using|.
3245 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3246                ac_cv_cpp_ambiguity_resolving_using,
3247                [AC_TRY_COMPILE(class X {
3248                                  public: int go(const X&) {return 3;}
3249                                          int jo(const X&) {return 3;}
3250                                };
3251                                class Y : public X {
3252                                  public:  int go(int) {return 2;}
3253                                           int jo(int) {return 2;}
3254                                           using X::jo;
3255                                  private: using X::go;
3256                                };,
3257                                X x; Y y; y.jo(x);,
3258                                ac_cv_cpp_ambiguity_resolving_using=yes,
3259                                ac_cv_cpp_ambiguity_resolving_using=no)])
3260 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3261    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3264 dnl See if a dynamic_cast to void* gives the most derived object.
3265 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3266                ac_cv_cpp_dynamic_cast_void_ptr,
3267                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3268                             class Y { int j; public: virtual ~Y() { } };
3269                             class Z : public X, public Y { int k; };
3271                             int main() {
3272                                  Z mdo;
3273                                  X *subx = (X*)&mdo;
3274                                  Y *suby = (Y*)&mdo;
3275                                  return !((((void*)&mdo != (void*)subx) &&
3276                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3277                                           (((void*)&mdo != (void*)suby) &&
3278                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3279                             }],
3280                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3281                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3282                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3283 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3284    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3288 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3289 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3290 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3291 # linking XUL.
3292 _SAVE_LDFLAGS=$LDFLAGS
3293 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3294 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3295                ac_cv_thread_keyword,
3296                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3297                             [return tlsIsMainThread;],
3298                             ac_cv_thread_keyword=yes,
3299                             ac_cv_thread_keyword=no)])
3300 LDFLAGS=$_SAVE_LDFLAGS
3301 # The custom dynamic linker doesn't support TLS variables
3302 MOZ_TLS=
3303 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3304   # mips builds fail with TLS variables because of a binutils bug.
3305   # See bug 528687
3306   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3307   case "${target}" in
3308     mips*-*)
3309       :
3310       ;;
3311     *-android*|*-linuxandroid*)
3312       :
3313       ;;
3314     *-openbsd*)
3315       :
3316       ;;
3317     *)
3318       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3319       MOZ_TLS=1
3320       ;;
3321   esac
3324 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3325 if test -n "$MOZ_LINKER"; then
3326   if test "$CPU_ARCH" = arm; then
3327     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3328     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3329       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3330       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3331     fi
3332   fi
3334 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
3335 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
3336 dnl Since the linker only understands the sysv ones, no need to build the
3337 dnl gnu style tables anyways.
3338   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
3341 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3342 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3343 dnl We however want to avoid these text relocations, and this can be done
3344 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3345 dnl doesn't contain anything at all, beside placeholders for some sections,
3346 dnl and crtbegin only contains a finalizer function that calls
3347 dnl __cxa_finalize. The custom linker actually takes care of calling
3348 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3349 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3350 dnl link crtbegin and crtend at all.
3351 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3352   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3353     ac_cv_crt_has_text_relocations,
3354     [echo 'int foo() { return 0; }' > conftest.cpp
3355      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3356         test -s conftest${DLL_SUFFIX}; then
3357        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3358          ac_cv_crt_has_text_relocations=yes
3359        else
3360          ac_cv_crt_has_text_relocations=no
3361        fi
3362      else
3363        AC_ERROR([couldn't compile a simple C file])
3364      fi
3365      rm -rf conftest*])
3366   if test "$ac_cv_crt_has_text_relocations" = yes; then
3367     dnl While we want libraries to skip the CRT files, we don't want
3368     dnl executables to be treated the same way. We thus set the flag
3369     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3370     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3371     dnl Using LDFLAGS in nspr is safe, since we only really build
3372     dnl libraries there.
3373     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3374     NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3375   fi
3378 dnl Check for the existence of various allocation headers/functions
3380 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3381 MALLOC_H=
3383 for file in $MALLOC_HEADERS; do
3384   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3385   if test "$MALLOC_H" != ""; then
3386     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3387     break
3388   fi
3389 done
3391 MOZ_CHECK_HEADERS(alloca.h)
3393 AC_CHECK_FUNCS(strndup posix_memalign memalign)
3395 AC_CHECK_FUNCS(malloc_usable_size)
3396 MALLOC_USABLE_SIZE_CONST_PTR=const
3397 MOZ_CHECK_HEADERS([malloc.h], [
3398   AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
3399   AC_TRY_COMPILE([#include <malloc.h>
3400                   #include <stddef.h>
3401                   size_t malloc_usable_size(const void *ptr);],
3402                   [return malloc_usable_size(0);],
3403                   AC_MSG_RESULT([yes]),
3404                   AC_MSG_RESULT([no])
3405                   MALLOC_USABLE_SIZE_CONST_PTR=)
3407 AC_DEFINE_UNQUOTED([MALLOC_USABLE_SIZE_CONST_PTR],[$MALLOC_USABLE_SIZE_CONST_PTR])
3410 dnl In newer bionic headers, valloc is built but not defined,
3411 dnl so we check more carefully here.
3412 AC_MSG_CHECKING([for valloc in malloc.h])
3413 AC_EGREP_HEADER(valloc, malloc.h,
3414                 AC_DEFINE(HAVE_VALLOC)
3415                 AC_MSG_RESULT([yes]),
3416                 AC_MSG_RESULT([no]))
3418 AC_MSG_CHECKING([for valloc in unistd.h])
3419 AC_EGREP_HEADER(valloc, unistd.h,
3420                 AC_DEFINE(HAVE_VALLOC)
3421                 AC_MSG_RESULT([yes]),
3422                 AC_MSG_RESULT([no]))
3424 dnl See if compiler supports some gcc-style attributes
3426 AC_CACHE_CHECK(for __attribute__((always_inline)),
3427                ac_cv_attribute_always_inline,
3428                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3429                                [],
3430                                ac_cv_attribute_always_inline=yes,
3431                                ac_cv_attribute_always_inline=no)])
3433 AC_CACHE_CHECK(for __attribute__((malloc)),
3434                ac_cv_attribute_malloc,
3435                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3436                                [],
3437                                ac_cv_attribute_malloc=yes,
3438                                ac_cv_attribute_malloc=no)])
3440 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3441                ac_cv_attribute_warn_unused,
3442                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3443                                [],
3444                                ac_cv_attribute_warn_unused=yes,
3445                                ac_cv_attribute_warn_unused=no)])
3447 dnl End of C++ language/feature checks
3448 AC_LANG_C
3450 dnl ========================================================
3451 dnl =  Internationalization checks
3452 dnl ========================================================
3454 dnl Internationalization and Locale support is different
3455 dnl on various UNIX platforms.  Checks for specific i18n
3456 dnl features go here.
3458 dnl check for LC_MESSAGES
3459 AC_CACHE_CHECK(for LC_MESSAGES,
3460                ac_cv_i18n_lc_messages,
3461                [AC_TRY_COMPILE([#include <locale.h>],
3462                                [int category = LC_MESSAGES;],
3463                                ac_cv_i18n_lc_messages=yes,
3464                                ac_cv_i18n_lc_messages=no)])
3465 if test "$ac_cv_i18n_lc_messages" = yes; then
3466    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3469 AC_HAVE_FUNCS(localeconv)
3470 fi # ! SKIP_COMPILER_CHECKS
3472 TARGET_XPCOM_ABI=
3473 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3474     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3475     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
3478 dnl Mozilla specific options
3479 dnl ========================================================
3480 dnl The macros used for command line options
3481 dnl are defined in build/autoconf/altoptions.m4.
3483 dnl If the compiler supports these attributes, define them as
3484 dnl convenience macros.
3485 if test "$ac_cv_attribute_malloc" = yes ; then
3486   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3487 else
3488   AC_DEFINE(NS_ATTR_MALLOC,)
3491 if test "$ac_cv_attribute_warn_unused" = yes ; then
3492   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3493 else
3494   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3497 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3498 dnl features that Windows actually does support.
3500 if test -n "$SKIP_COMPILER_CHECKS"; then
3501    dnl Windows has malloc.h
3502    AC_DEFINE(MALLOC_H, [<malloc.h>])
3503    AC_DEFINE(HAVE_FORCEINLINE)
3504    AC_DEFINE(HAVE_LOCALECONV)
3505 fi # SKIP_COMPILER_CHECKS
3507 dnl ========================================================
3508 dnl =
3509 dnl = Check for external package dependencies
3510 dnl =
3511 dnl ========================================================
3512 MOZ_ARG_HEADER(External Packages)
3514 MOZ_ARG_WITH_STRING(libxul-sdk,
3515 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3516   AC_MSG_ERROR([--with-libxul-sdk is not supported anymore.]))
3518 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3519 AC_SUBST(LIBXUL_DIST)
3521 MOZ_CONFIG_NSPR()
3523 dnl set GRE_MILESTONE
3524 dnl ========================================================
3525 if test -n "$LIBXUL_SDK"; then
3526     GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3527 else
3528     GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3530 AC_SUBST(GRE_MILESTONE)
3532 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3533 # The logic works like this:
3534 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3535 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3536 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3537 case "$GRE_MILESTONE" in
3538   *a1*)
3539       NIGHTLY_BUILD=1
3540       AC_DEFINE(NIGHTLY_BUILD)
3541       ;;
3542   *a*)
3543       ;;
3544   *)
3545       RELEASE_BUILD=1
3546       AC_DEFINE(RELEASE_BUILD)
3547       ;;
3548 esac
3549 AC_SUBST(NIGHTLY_BUILD)
3550 AC_SUBST(RELEASE_BUILD)
3552 dnl ========================================================
3553 dnl Disable compiling sources in unified mode.
3554 dnl ========================================================
3556 MOZ_ARG_DISABLE_BOOL(unified-compilation,
3557 [  --disable-unified-compilation
3558                           Disable unified compilation of some C/C++ sources],
3559     MOZ_DISABLE_UNIFIED_COMPILATION=1,
3560     MOZ_DISABLE_UNIFIED_COMPILATION=)
3561 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
3563 dnl ========================================================
3564 dnl Multiprocess Firefox Nightly Testing UI
3565 dnl To be removed in Bug 1003313
3566 dnl ========================================================
3567 if test -n "$NIGHTLY_BUILD"; then
3568     E10S_TESTING_ONLY=1
3569     AC_DEFINE(E10S_TESTING_ONLY)
3572 AC_SUBST(E10S_TESTING_ONLY)
3574 dnl ========================================================
3575 dnl system libevent Support
3576 dnl ========================================================
3577 MOZ_ARG_WITH_STRING(system-libevent,
3578 [  --with-system-libevent[=PFX]
3579                           Use system libevent [installed at prefix PFX]],
3580     LIBEVENT_DIR=$withval)
3582 _SAVE_CFLAGS=$CFLAGS
3583 _SAVE_LDFLAGS=$LDFLAGS
3584 _SAVE_LIBS=$LIBS
3585 if test "$LIBEVENT_DIR" = yes; then
3586     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3587         MOZ_NATIVE_LIBEVENT=1,
3588         LIBEVENT_DIR=/usr)
3590 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3591     MOZ_NATIVE_LIBEVENT=
3592 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3593     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3594     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3595     MOZ_CHECK_HEADER(event.h,
3596         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3597              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3598          fi],
3599         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3600     AC_CHECK_LIB(event, event_init,
3601                  [MOZ_NATIVE_LIBEVENT=1
3602                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3603                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3604                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3606 CFLAGS=$_SAVE_CFLAGS
3607 LDFLAGS=$_SAVE_LDFLAGS
3608 LIBS=$_SAVE_LIBS
3610 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3612 dnl ========================================================
3613 dnl = If NSS was not detected in the system,
3614 dnl = use the one in the source tree (mozilla/security/nss)
3615 dnl ========================================================
3617 MOZ_ARG_WITH_BOOL(system-nss,
3618 [  --with-system-nss       Use system installed NSS],
3619     _USE_SYSTEM_NSS=1 )
3621 if test -n "$_USE_SYSTEM_NSS"; then
3622     AM_PATH_NSS(3.19.2.1, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3625 if test -n "$MOZ_NATIVE_NSS"; then
3626    NSS_LIBS="$NSS_LIBS -lcrmf"
3627 else
3628    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3630    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
3631        NSS_LIBS="\
3632         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3633         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3634         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3635         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3636         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3637    else
3638        NSS_LIBS='-L$(LIBXUL_DIST)/lib'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3639    fi
3642 dnl ======================
3643 dnl Detect yasm
3644 dnl ======================
3646 AC_MSG_CHECKING([for YASM assembler])
3647 AC_CHECK_PROGS(YASM, yasm, "")
3649 if test -n "$YASM"; then
3650   dnl Pull out yasm's version string
3651   YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3652   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3653   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3654   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3655   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3658 if test -z "$SKIP_LIBRARY_CHECKS"; then
3659 dnl system JPEG support
3660 dnl ========================================================
3661 MOZ_ARG_WITH_STRING(system-jpeg,
3662 [  --with-system-jpeg[=PFX]
3663                           Use system libjpeg [installed at prefix PFX]],
3664     JPEG_DIR=$withval)
3666 _SAVE_CFLAGS=$CFLAGS
3667 _SAVE_LDFLAGS=$LDFLAGS
3668 _SAVE_LIBS=$LIBS
3669 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3670     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3671     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3673 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3674     MOZ_NATIVE_JPEG=
3675 else
3676     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3679 if test "$MOZ_NATIVE_JPEG" = 1; then
3680     AC_TRY_COMPILE([ #include <stdio.h>
3681                      #include <sys/types.h>
3682                      #include <jpeglib.h> ],
3683                    [ #if JPEG_LIB_VERSION < $MOZJPEG
3684                      #error "Insufficient JPEG library version ($MOZJPEG required)."
3685                      #endif
3686                      #ifndef JCS_EXTENSIONS
3687                      #error "libjpeg-turbo JCS_EXTENSIONS required"
3688                      #endif
3689                      ],
3690                    MOZ_NATIVE_JPEG=1,
3691                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3693 CFLAGS=$_SAVE_CFLAGS
3694 LDFLAGS=$_SAVE_LDFLAGS
3695 LIBS=$_SAVE_LIBS
3697 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3698     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3699     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3701 fi # SKIP_LIBRARY_CHECKS
3703 dnl system ZLIB support
3704 dnl ========================================================
3705 MOZ_ZLIB_CHECK([1.2.3])
3707 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3708     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3711 MOZ_PNG_ARM_NEON=
3713 if test -z "$SKIP_LIBRARY_CHECKS"; then
3714 dnl system BZIP2 Support
3715 dnl ========================================================
3716 MOZ_ARG_WITH_STRING(system-bz2,
3717 [  --with-system-bz2[=PFX]
3718                           Use system libbz2 [installed at prefix PFX]],
3719     BZ2_DIR=$withval)
3721 _SAVE_CFLAGS=$CFLAGS
3722 _SAVE_LDFLAGS=$LDFLAGS
3723 _SAVE_LIBS=$LIBS
3724 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3725     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3726     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3728 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3729     MOZ_NATIVE_BZ2=
3730 else
3731     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3732     [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3734 CFLAGS=$_SAVE_CFLAGS
3735 LDFLAGS=$_SAVE_LDFLAGS
3736 LIBS=$_SAVE_LIBS
3738 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3739     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3740     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3743 dnl ========================================================
3744 dnl system PNG Support
3745 dnl ========================================================
3746 MOZ_ARG_WITH_STRING(system-png,
3747 [  --with-system-png[=PFX]
3748                           Use system libpng [installed at prefix PFX]],
3749     PNG_DIR=$withval)
3751 _SAVE_CFLAGS=$CFLAGS
3752 _SAVE_LDFLAGS=$LDFLAGS
3753 _SAVE_LIBS=$LIBS
3754 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3755     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3756     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3758 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3759     MOZ_NATIVE_PNG=
3760 else
3761     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3762                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3763     AC_CHECK_LIB(png, png_get_acTL, ,
3764                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3766 if test "$MOZ_NATIVE_PNG" = 1; then
3767     AC_TRY_COMPILE([ #include <stdio.h>
3768                      #include <sys/types.h>
3769                      #include <png.h> ],
3770                    [ #if PNG_LIBPNG_VER < $MOZPNG
3771                      #error "Insufficient libpng version ($MOZPNG required)."
3772                      #endif
3773                      #ifndef PNG_UINT_31_MAX
3774                      #error "Insufficient libpng version."
3775                      #endif ],
3776                    MOZ_NATIVE_PNG=1,
3777                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3779 CFLAGS=$_SAVE_CFLAGS
3780 LDFLAGS=$_SAVE_LDFLAGS
3781 LIBS=$_SAVE_LIBS
3783 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3784     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3785     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3788 MOZ_PNG_ARM_NEON_CHECK=
3789 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3790     MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3791         [  --enable-png-arm-neon-support=TYPE
3792              Options include:
3793                  no
3794                  check (default)
3795                  nocheck (faster but unsafe)],
3796         [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3797     case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3798         no)
3799             # enable-png-arm-neon-support = no
3800             ;;
3801         nocheck)
3802             # enable-png-arm-neon-support = nocheck
3803             MOZ_PNG_ARM_NEON=1
3804             ;;
3805         *)
3806             MOZ_PNG_ARM_NEON=1
3807             MOZ_PNG_ARM_NEON_CHECK=1
3808             ;;
3809     esac
3812 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3814 fi # SKIP_LIBRARY_CHECKS
3816 AC_SUBST(MOZ_PNG_ARM_NEON)
3818 dnl ========================================================
3819 dnl system HunSpell Support
3820 dnl ========================================================
3821 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3822 [  --enable-system-hunspell
3823                           Use system hunspell (located with pkgconfig)],
3824     MOZ_NATIVE_HUNSPELL=1 )
3826 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3827     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3830 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3832 dnl ========================================================
3833 dnl system libffi Support
3834 dnl ========================================================
3835 MOZ_CONFIG_FFI()
3837 MOZ_ARG_ENABLE_BOOL(shared-js,
3838 [  --enable-shared-js
3839                           Create a shared JavaScript library.],
3840     JS_SHARED_LIBRARY=1,
3841     JS_SHARED_LIBRARY=)
3843 dnl ========================================================
3844 dnl Java SDK support
3845 dnl ========================================================
3847 JAVA_BIN_PATH=
3848 MOZ_ARG_WITH_STRING(java-bin-path,
3849 [  --with-java-bin-path=dir
3850                           Location of Java binaries (java, javac, jar)],
3851     JAVA_BIN_PATH=$withval)
3853 dnl ========================================================
3854 dnl =
3855 dnl = Application
3856 dnl =
3857 dnl ========================================================
3859 MOZ_ARG_HEADER(Application)
3861 ENABLE_TESTS=1
3862 ENABLE_SYSTEM_EXTENSION_DIRS=1
3863 MOZ_BRANDING_DIRECTORY=
3864 MOZ_OFFICIAL_BRANDING=
3865 MOZ_FEEDS=1
3866 MOZ_WEBAPP_RUNTIME=
3867 MOZ_AUTH_EXTENSION=1
3868 MOZ_RAW=
3869 MOZ_VORBIS=
3870 MOZ_TREMOR=
3871 MOZ_WAVE=1
3872 MOZ_SAMPLE_TYPE_FLOAT32=
3873 MOZ_SAMPLE_TYPE_S16=
3874 MOZ_WEBM=1
3875 MOZ_GSTREAMER=
3876 MOZ_DIRECTSHOW=
3877 MOZ_WMF=
3878 if test -n "$MOZ_FMP4"; then
3879   MOZ_FMP4=1
3880 else
3881   MOZ_FMP4=
3883 MOZ_FFMPEG=
3884 MOZ_WEBRTC=1
3885 MOZ_PEERCONNECTION=
3886 MOZ_SRTP=
3887 MOZ_WEBRTC_SIGNALING=
3888 MOZ_WEBRTC_ASSERT_ALWAYS=1
3889 MOZ_WEBRTC_HARDWARE_AEC_NS=
3890 MOZ_SCTP=
3891 MOZ_ANDROID_OMX=
3892 MOZ_MEDIA_NAVIGATOR=
3893 MOZ_OMX_PLUGIN=
3894 MOZ_VPX=
3895 MOZ_VPX_ERROR_CONCEALMENT=
3896 MOZ_WEBSPEECH=1
3897 VPX_AS=
3898 VPX_ASFLAGS=
3899 VPX_AS_DASH_C_FLAG=
3900 VPX_AS_CONVERSION=
3901 VPX_ASM_SUFFIX=
3902 VPX_X86_ASM=
3903 VPX_ARM_ASM=
3904 LIBJPEG_TURBO_AS=
3905 LIBJPEG_TURBO_ASFLAGS=
3906 LIBJPEG_TURBO_X86_ASM=
3907 LIBJPEG_TURBO_X64_ASM=
3908 LIBJPEG_TURBO_ARM_ASM=
3909 MOZ_PERMISSIONS=1
3910 MOZ_PLACES=1
3911 MOZ_SOCIAL=1
3912 MOZ_PREF_EXTENSIONS=1
3913 MOZ_PROFILELOCKING=1
3914 MOZ_REFLOW_PERF=
3915 MOZ_SAFE_BROWSING=
3916 MOZ_HELP_VIEWER=
3917 MOZ_SPELLCHECK=1
3918 MOZ_ANDROID_APZ=
3919 MOZ_TOOLKIT_SEARCH=1
3920 MOZ_UI_LOCALE=en-US
3921 MOZ_UNIVERSALCHARDET=1
3922 MOZ_URL_CLASSIFIER=
3923 MOZ_XUL=1
3924 MOZ_ZIPWRITER=1
3925 NS_PRINTING=1
3926 MOZ_PDF_PRINTING=
3927 MOZ_NO_SMART_CARDS=
3928 NSS_DISABLE_DBM=
3929 NECKO_COOKIES=1
3930 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
3931 if test -n "$MOZ_RTSP"; then
3932   NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
3934 USE_ARM_KUSER=
3935 BUILD_CTYPES=1
3936 MOZ_USE_NATIVE_POPUP_WINDOWS=
3937 MOZ_ANDROID_HISTORY=
3938 MOZ_WEBSMS_BACKEND=
3939 MOZ_ANDROID_BEAM=
3940 MOZ_LOCALE_SWITCHER=
3941 MOZ_ANDROID_SEARCH_ACTIVITY=
3942 MOZ_ANDROID_DOWNLOADS_INTEGRATION=
3943 MOZ_ANDROID_MLS_STUMBLER=
3944 MOZ_ANDROID_SHARE_OVERLAY=
3945 MOZ_ANDROID_NEW_TABLET_UI=
3946 ACCESSIBILITY=1
3947 MOZ_TIME_MANAGER=
3948 MOZ_PAY=
3949 MOZ_AUDIO_CHANNEL_MANAGER=
3950 NSS_NO_LIBPKIX=
3951 MOZ_CONTENT_SANDBOX=
3952 MOZ_GMP_SANDBOX=
3953 MOZ_SANDBOX=1
3955 case "$target_os" in
3956     mingw*)
3957         NS_ENABLE_TSF=1
3958         AC_DEFINE(NS_ENABLE_TSF)
3959         ;;
3960 esac
3962 case "${target}" in
3963     *-android*|*-linuxandroid*)
3964         if test "$CPU_ARCH" = "arm" ; then
3965           USE_ARM_KUSER=1
3966         fi
3968         NSS_DISABLE_DBM=1
3969         MOZ_THEME_FASTSTRIPE=1
3970         MOZ_TREE_FREETYPE=1
3971         MOZ_MEMORY=1
3972         MOZ_RAW=1
3973         ;;
3975 esac
3977 MOZ_ARG_WITH_STRING(external-source-dir,
3978 [  --with-external-source-dir=dir
3979                           External directory containing additional build files.],
3980 [ EXTERNAL_SOURCE_DIR=$withval])
3981 AC_SUBST(EXTERNAL_SOURCE_DIR)
3983 MOZ_ARG_ENABLE_STRING(application,
3984 [  --enable-application=APP
3985                           Options include:
3986                             browser (Firefox)
3987                             xulrunner
3988                             tools/update-packaging (AUS-related packaging tools)],
3989 [ MOZ_BUILD_APP=$enableval ] )
3991 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
3992 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
3993   XULRUNNER_STUB_NAME=$withval)
3995 if test -z "$XULRUNNER_STUB_NAME"; then
3996   XULRUNNER_STUB_NAME=xulrunner-stub
3998 AC_SUBST(XULRUNNER_STUB_NAME)
4000 AC_MSG_CHECKING([for application to build])
4001 if test -z "$MOZ_BUILD_APP"; then
4002   AC_MSG_RESULT([browser])
4003   MOZ_BUILD_APP=browser
4004 else
4005   # "mobile" no longer exists.
4006   if test "$MOZ_BUILD_APP" = "mobile" ; then
4007     AC_MSG_RESULT([none])
4008     AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
4009   fi
4010   # Support comm-central.
4011   if test -n "$EXTERNAL_SOURCE_DIR" ; then
4012     MOZ_BUILD_APP="$EXTERNAL_SOURCE_DIR/$MOZ_BUILD_APP"
4013     MOZ_BUILD_APP=`${PYTHON} -c "import mozpack.path as mozpath; print(mozpath.relpath(\"${MOZ_BUILD_APP}\", \"${srcdir}\"))"`
4014   fi
4015   # We have a valid application only if it has a build.mk file in its top
4016   # directory.
4017   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4018     AC_MSG_RESULT([none])
4019     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4020   else
4021     AC_MSG_RESULT([$MOZ_BUILD_APP])
4022   fi
4025 # The app update channel is 'default' when not supplied. The value is used in
4026 # the application's confvars.sh so it must be set before confvars.sh is called.
4027 MOZ_ARG_ENABLE_STRING([update-channel],
4028 [  --enable-update-channel=CHANNEL
4029                           Select application update channel (default=default)],
4030     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
4032 if test -z "$MOZ_UPDATE_CHANNEL"; then
4033     MOZ_UPDATE_CHANNEL=default
4035 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
4036 AC_SUBST(MOZ_UPDATE_CHANNEL)
4038 # Allow to specify a Mozilla API key file that contains the secret key to be
4039 # used for various Mozilla API requests.
4040 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
4041 [  --with-mozilla-api-keyfile=file   Use the secret key contained in the given keyfile for Mozilla API requests],
4042   MOZ_MOZILLA_API_KEY=`cat $withval`)
4043 if test -z "$MOZ_MOZILLA_API_KEY"; then
4044     MOZ_MOZILLA_API_KEY=no-mozilla-api-key
4046 AC_SUBST(MOZ_MOZILLA_API_KEY)
4048 # Allow to specify a Google API key file that contains the secret key to be
4049 # used for various Google API requests.
4050 MOZ_ARG_WITH_STRING(google-api-keyfile,
4051 [  --with-google-api-keyfile=file   Use the secret key contained in the given keyfile for Google API requests],
4052   MOZ_GOOGLE_API_KEY=`cat $withval`)
4053 if test -z "$MOZ_GOOGLE_API_KEY"; then
4054     MOZ_GOOGLE_API_KEY=no-google-api-key
4056 AC_SUBST(MOZ_GOOGLE_API_KEY)
4058 # Allow to specify a Google OAuth API key file that contains the client ID and
4059 # the secret key to be used for various Google OAuth API requests.
4060 MOZ_ARG_WITH_STRING(google-oauth-api-keyfile,
4061 [ --with-google-oauth-api-keyfile=file  Use the client id and secret key contained in the given keyfile for Google OAuth API requests],
4062  [MOZ_GOOGLE_OAUTH_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
4063   MOZ_GOOGLE_OAUTH_API_KEY=`cat $withval | cut -f 2 -d " "`])
4064 if test -z "$MOZ_GOOGLE_OAUTH_API_CLIENTID"; then
4065     MOZ_GOOGLE_OAUTH_API_CLIENTID=no-google-oauth-api-clientid
4066     MOZ_GOOGLE_OAUTH_API_KEY=no-google-oauth-api-key
4068 AC_SUBST(MOZ_GOOGLE_OAUTH_API_CLIENTID)
4069 AC_SUBST(MOZ_GOOGLE_OAUTH_API_KEY)
4071 # Allow specifying a Bing API key file that contains the client ID and the
4072 # secret key to be used for the Bing Translation API requests.
4073 MOZ_ARG_WITH_STRING(bing-api-keyfile,
4074 [  --with-bing-api-keyfile=file   Use the client id and secret key contained in the given keyfile for Bing API requests],
4075  [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
4076   MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
4077 if test -z "$MOZ_BING_API_CLIENTID"; then
4078     MOZ_BING_API_CLIENTID=no-bing-api-clientid
4079     MOZ_BING_API_KEY=no-bing-api-key
4081 AC_SUBST(MOZ_BING_API_CLIENTID)
4082 AC_SUBST(MOZ_BING_API_KEY)
4084 # Whether to include optional-but-large font files in the final APK.
4085 # We want this in mobile/android/confvars.sh, so it goes early.
4086 MOZ_ARG_DISABLE_BOOL(android-include-fonts,
4087 [  --disable-android-include-fonts
4088                           Disable the inclusion of fonts into the final APK],
4089     MOZ_ANDROID_EXCLUDE_FONTS=1)
4091 if test -n "$MOZ_ANDROID_EXCLUDE_FONTS"; then
4092     AC_DEFINE(MOZ_ANDROID_EXCLUDE_FONTS)
4094 AC_SUBST(MOZ_ANDROID_EXCLUDE_FONTS)
4096 # Whether this APK is destined for resource constrained devices.
4097 # We want this in mobile/android/confvars.sh, so it goes early.
4098 MOZ_ARG_ENABLE_BOOL(android-resource-constrained,
4099 [  --enable-android-resource-constrained
4100                           Exclude hi-res images and similar from the final APK],
4101     MOZ_ANDROID_RESOURCE_CONSTRAINED=1)
4103 if test -n "$MOZ_ANDROID_RESOURCE_CONSTRAINED"; then
4104     AC_DEFINE(MOZ_ANDROID_RESOURCE_CONSTRAINED)
4106 AC_SUBST(MOZ_ANDROID_RESOURCE_CONSTRAINED)
4108 # Allow the application to influence configure with a confvars.sh script.
4109 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4110 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4111   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4112   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4113 else
4114   AC_MSG_RESULT([no])
4117 # Allow influencing configure with a defines.sh script.
4118 . "${srcdir}/build/defines.sh"
4120 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4121 # set in defines.sh
4122 if test "$BUILDING_RELEASE"; then
4123   # Override value in defines.sh, if any
4124   EARLY_BETA_OR_EARLIER=
4125 elif test "$EARLY_BETA_OR_EARLIER"; then
4126   AC_DEFINE(EARLY_BETA_OR_EARLIER)
4128 AC_SUBST(EARLY_BETA_OR_EARLIER)
4130 # Allow the application to provide a subconfigure script
4131 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4132   do_output_subdirs() {
4133     if test -n "$_subconfigure_subdirs"; then
4134       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4135      fi
4136     _subconfigure_subdir="$1"
4137     _subconfigure_config_args="$ac_configure_args"
4138   }
4139   tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4140   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4141      "${srcdir}/build/autoconf/altoptions.m4" \
4142      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4143   . $tmpscript
4144   rm -f $tmpscript
4147 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4148 MOZ_ARG_WITH_STRING(app-name,
4149 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4150 WITH_APP_NAME=$withval,
4153 if test -n "$WITH_APP_NAME" ; then
4154     MOZ_APP_NAME="$WITH_APP_NAME"
4157 MOZ_ARG_WITH_STRING(app-basename,
4158 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4159 WITH_APP_BASENAME=$withval,
4162 if test -n "$WITH_APP_BASENAME" ; then
4163     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4166 # Now is a good time to test for logic errors, define mismatches, etc.
4167 case "$MOZ_BUILD_APP" in
4168 xulrunner)
4169   if test "$LIBXUL_SDK"; then
4170     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4171   fi
4172   ;;
4173 esac
4175 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4176 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4177 # MOZ_BUILD_APP.
4178 case "$MOZ_BUILD_APP" in
4179 browser)
4180   AC_DEFINE(MOZ_PHOENIX)
4181   ;;
4183 xulrunner)
4184   AC_DEFINE(MOZ_XULRUNNER)
4185   ;;
4186 b2g)
4187   AC_DEFINE(MOZ_B2G)
4188   ;;
4189 b2g/dev)
4190   AC_DEFINE(MOZ_B2G)
4191   AC_DEFINE(MOZ_MULET)
4192   ;;
4193 esac
4195 AC_SUBST(MOZ_BUILD_APP)
4196 AC_SUBST(MOZ_PHOENIX)
4197 AC_SUBST(MOZ_XULRUNNER)
4198 AC_SUBST(MOZ_B2G)
4199 AC_SUBST(MOZ_MULET)
4200 AC_SUBST(MOZ_B2G_VERSION)
4202 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4204 case "$OS_TARGET" in
4205 WINNT|Darwin|Android)
4206   MOZ_FOLD_LIBS=1
4207   ;;
4209   MOZ_FOLD_LIBS=
4210   ;;
4211 esac
4213 dnl ========================================================
4214 dnl Check Android SDK version depending on mobile target.
4215 dnl ========================================================
4217 if test -z "$gonkdir" ; then
4218     # Minimum Android SDK API Level we require.
4219     case "$MOZ_BUILD_APP" in
4220     mobile/android)
4221         android_min_api_level=17
4222         case "$target" in
4223         *-android*|*-linuxandroid*)
4224             :
4225             ;;
4226         *)
4227             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])
4228             ;;
4229         esac
4230         ;;
4231     esac
4233     MOZ_ANDROID_SDK($android_min_api_level)
4236 dnl ========================================================
4237 dnl =
4238 dnl = Toolkit Options
4239 dnl =
4240 dnl ========================================================
4241 MOZ_ARG_HEADER(Toolkit Options)
4243     dnl ========================================================
4244     dnl = Select the default toolkit
4245     dnl ========================================================
4246     MOZ_ARG_ENABLE_STRING(default-toolkit,
4247     [  --enable-default-toolkit=TK
4248                           Select default toolkit
4249                           Platform specific defaults:
4250                             Mac OS X - cairo-cocoa
4251                             Win32 - cairo-windows
4252                             * - cairo-gtk2
4253                             * - cairo-gtk3
4254                             * - cairo-qt],
4255     [ _DEFAULT_TOOLKIT=$enableval ],
4256     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4258     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4259         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4260         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4261         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4262         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4263         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4264         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4265         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4266         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4267     then
4268         dnl nglayout only supports building with one toolkit,
4269         dnl so ignore everything after the first comma (",").
4270         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4271     else
4272         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4273     fi
4275 MOZ_ARG_WITHOUT_BOOL(x,
4276 [  --without-x              Build without X11],
4277     WITHOUT_X11=1)
4279 dnl ========================================================
4280 dnl = Enable the toolkit as needed                         =
4281 dnl ========================================================
4283 MOZ_WIDGET_GTK=
4285 case "$MOZ_WIDGET_TOOLKIT" in
4287 cairo-windows)
4288     MOZ_WIDGET_TOOLKIT=windows
4289     MOZ_PDF_PRINTING=1
4290     MOZ_INSTRUMENT_EVENT_LOOP=1
4291     if test -n "$GNU_CC"; then
4292         MOZ_FOLD_LIBS=
4293     fi
4294     ;;
4296 cairo-gtk3)
4297     MOZ_WIDGET_TOOLKIT=gtk3
4298     MOZ_ENABLE_GTK=1
4299     MOZ_ENABLE_GTK3=1
4300     MOZ_ENABLE_XREMOTE=1
4301     MOZ_GL_DEFAULT_PROVIDER=GLX
4303     AC_DEFINE(MOZ_X11)
4304     MOZ_X11=1
4305     USE_FC_FREETYPE=1
4307     TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4308     MOZ_WIDGET_GTK=3
4309     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4310     MOZ_PDF_PRINTING=1
4311     MOZ_INSTRUMENT_EVENT_LOOP=1
4312     ;;
4314 cairo-gtk2|cairo-gtk2-x11)
4315     MOZ_WIDGET_TOOLKIT=gtk2
4316     MOZ_ENABLE_GTK=1
4317     MOZ_ENABLE_GTK2=1
4318     MOZ_ENABLE_XREMOTE=1
4319     MOZ_GL_DEFAULT_PROVIDER=GLX
4321     AC_DEFINE(MOZ_X11)
4322     MOZ_X11=1
4323     USE_FC_FREETYPE=1
4325     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4326     TK_LIBS='$(MOZ_GTK2_LIBS)'
4327     AC_DEFINE(MOZ_WIDGET_GTK2)
4328     MOZ_WIDGET_GTK=2
4329     AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4330     MOZ_PDF_PRINTING=1
4331     MOZ_INSTRUMENT_EVENT_LOOP=1
4332     ;;
4334 cairo-qt)
4335     MOZ_WIDGET_TOOLKIT=qt
4336     MOZ_ENABLE_QT=1
4337     if test -z "$WITHOUT_X11"; then
4338       MOZ_ENABLE_XREMOTE=1
4339       MOZ_GL_DEFAULT_PROVIDER=GLX
4340       MOZ_X11=1
4341       AC_DEFINE(MOZ_X11)
4342       XT_LIBS=
4343     fi
4345     USE_FC_FREETYPE=1
4346     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4347     TK_LIBS='$(MOZ_QT_LIBS)'
4348     AC_DEFINE(MOZ_WIDGET_QT)
4349     MOZ_PDF_PRINTING=1
4350     AC_DEFINE(QT_NO_KEYWORDS)
4351     ;;
4353 cairo-cocoa)
4354     MOZ_WIDGET_TOOLKIT=cocoa
4355     AC_DEFINE(MOZ_WIDGET_COCOA)
4356     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4357     # Use -Wl as a trick to avoid -framework and framework names from
4358     # being separated by AC_SUBST_LIST.
4359     TK_LIBS='-Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL'
4360     TK_CFLAGS="-DNO_X11"
4361     CFLAGS="$CFLAGS $TK_CFLAGS"
4362     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4363     MOZ_USER_DIR="Mozilla"
4364     MOZ_FS_LAYOUT=bundle
4365     MOZ_INSTRUMENT_EVENT_LOOP=1
4366     ;;
4368 cairo-uikit)
4369     MOZ_WIDGET_TOOLKIT=uikit
4370     AC_DEFINE(MOZ_WIDGET_UIKIT)
4371     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4372     TK_CFLAGS="-DNO_X11"
4373     TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
4374     CFLAGS="$CFLAGS $TK_CFLAGS"
4375     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4376     MOZ_USER_DIR="Mozilla"
4377     MOZ_FS_LAYOUT=bundle
4378     ;;
4380 cairo-android)
4381     AC_DEFINE(MOZ_WIDGET_ANDROID)
4382     MOZ_WIDGET_TOOLKIT=android
4383     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4384     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4385     MOZ_PDF_PRINTING=1
4386     MOZ_INSTRUMENT_EVENT_LOOP=1
4387     ;;
4389 cairo-gonk)
4390     AC_DEFINE(MOZ_WIDGET_GONK)
4391     AC_DEFINE(MOZ_TOUCH)
4392     MOZ_WIDGET_TOOLKIT=gonk
4393     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4394     TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4395     MOZ_PDF_PRINTING=1
4396     MOZ_TOUCH=1
4397     MOZ_INSTRUMENT_EVENT_LOOP=1
4398     ;;
4400 esac
4402 AC_SUBST(MOZ_PDF_PRINTING)
4403 if test "$MOZ_PDF_PRINTING"; then
4404    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4405    AC_DEFINE(MOZ_PDF_PRINTING)
4408 if test "$MOZ_ENABLE_XREMOTE"; then
4409     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4412 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4413    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4416 if test "$COMPILE_ENVIRONMENT"; then
4417   if test "$MOZ_ENABLE_GTK3"; then
4418     PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 atk-bridge-2.0 $GDK_PACKAGES)
4419     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
4420     dnl Contrary to MOZ_GTK2_LIBS, MOZ_GTK3_LIBS needs to be literally added to TK_LIBS instead
4421     dnl of a make reference because of how TK_LIBS is mangled in toolkit/library/moz.build
4422     dnl for GTK+3 builds.
4423     TK_LIBS=$MOZ_GTK3_LIBS
4424   fi
4425   if test "$MOZ_ENABLE_GTK"; then
4426     if test "$MOZ_X11"; then
4427       GDK_PACKAGES=gdk-x11-2.0
4428     fi
4430     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4431     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
4432   fi
4434 fi # COMPILE_ENVIRONMENT
4436 AC_SUBST(MOZ_FS_LAYOUT)
4438 dnl ========================================================
4439 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4440 dnl their usage and use them in spidermonkey.
4441 dnl ========================================================
4442 MOZ_ARG_WITH_BOOL(arm-kuser,
4443 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4444     USE_ARM_KUSER=1,)
4445 if test -n "$USE_ARM_KUSER"; then
4446    AC_DEFINE(USE_ARM_KUSER)
4449 dnl ========================================================
4450 dnl = startup-notification support module
4451 dnl ========================================================
4453 if test "$MOZ_ENABLE_GTK"
4454 then
4455     MOZ_ENABLE_STARTUP_NOTIFICATION=
4457     MOZ_ARG_ENABLE_BOOL(startup-notification,
4458     [  --enable-startup-notification
4459                           Enable startup-notification support (default: disabled) ],
4460         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4461         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4462     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4463     then
4464         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4465                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4466         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4467             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4468             then
4469                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4470             fi
4471             MOZ_ENABLE_STARTUP_NOTIFICATION=
4472         ])
4473     fi
4475     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4476         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4477     fi
4479     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4481 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4483 dnl ========================================================
4484 dnl Disable printing
4485 dnl ========================================================
4486 MOZ_ARG_DISABLE_BOOL(printing,
4487 [  --disable-printing      Disable printing support],
4488     NS_PRINTING=,
4489     NS_PRINTING=1)
4491 if test "$NS_PRINTING"; then
4492     AC_DEFINE(NS_PRINTING)
4493     AC_DEFINE(NS_PRINT_PREVIEW)
4496 dnl ========================================================
4497 dnl = QT support
4498 dnl ========================================================
4499 if test "$MOZ_ENABLE_QT"
4500 then
4501     MOZ_ARG_WITH_STRING(qtdir,
4502     [  --with-qtdir=\$dir       Specify Qt directory ],
4503     [ QTDIR=$withval])
4505     if test -z "$QTDIR"; then
4506         AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4507     else
4508         HOST_QMAKE="$QTDIR/bin/qmake"
4509     fi
4510     QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4512     if test -z "$QTDIR"; then
4513         case $QT_VERSION in
4514         5.*)
4515             AC_MSG_RESULT("Using qt5: $QT_VERSION")
4516             PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4517             [
4518               AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4519             ])
4520             QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4521             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4522             if test "$NS_PRINTING"; then
4523                 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4524                 [
4525                   AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4526                 ])
4527                 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4528                 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4529             fi
4530             ;;
4531         *)
4532             AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4533             ;;
4534         esac
4536         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4537         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4538     else
4539         MOZ_QT_CFLAGS="-DQT_SHARED"
4540         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4541         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4542         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4543         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4544         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4545         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4546         case $QT_VERSION in
4547         5.*)
4548             AC_MSG_RESULT("Using qt5: $QT_VERSION")
4549             MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4550             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4551             if test "$NS_PRINTING"; then
4552                 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4553                 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4554             fi
4555             ;;
4556         *)
4557             AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4558             ;;
4559         esac
4561         HOST_MOC="$QTDIR/bin/moc"
4562         HOST_RCC="$QTDIR/bin/rcc"
4563     fi
4564     if test -z "$HOST_MOC"; then
4565         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4566     fi
4567     if test -z "$HOST_RCC"; then
4568         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4569     fi
4571     MOC=$HOST_MOC
4572     RCC=$HOST_RCC
4574     MOZ_ENABLE_QMSYSTEM2=
4575     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4576                       MOZ_ENABLE_QMSYSTEM2=1,
4577                       MOZ_ENABLE_QMSYSTEM2=)
4579     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4580       MOZ_ENABLE_QMSYSTEM2=1
4581       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4582       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4583       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4584     fi
4586     MOZ_ENABLE_QTNETWORK=
4587     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4588                       MOZ_ENABLE_QTNETWORK=1,
4589                       MOZ_ENABLE_QTNETWORK=)
4591     if test "$MOZ_ENABLE_QTNETWORK"; then
4592       MOZ_ENABLE_QTNETWORK=1
4593       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4594     fi
4596     MOZ_ENABLE_QTMOBILITY=
4597     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4598                       MOZ_ENABLE_QTMOBILITY=1,
4599                       MOZ_ENABLE_QTMOBILITY=)
4600     if test "$MOZ_ENABLE_QTMOBILITY"; then
4601        MOZ_ENABLE_QTMOBILITY=1
4602        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4603        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4604        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4605        AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4606     else
4607        AC_CHECK_LIB(QtSensors, main, [
4608           MOZ_ENABLE_QTMOBILITY=1
4609           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4610           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4611           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4612           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4613           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4614        ])
4615     fi
4617     MOZ_ENABLE_QT5FEEDBACK=
4618     PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4619                       MOZ_ENABLE_QT5FEEDBACK=1,
4620                       MOZ_ENABLE_QT5FEEDBACK=)
4621     if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4622        MOZ_ENABLE_QT5FEEDBACK=1
4623        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4624        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4625        AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4626        AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4627     fi
4629     MOZ_ENABLE_QT5GEOPOSITION=
4630     PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4631                       MOZ_ENABLE_QT5GEOPOSITION=1,
4632                       MOZ_ENABLE_QT5GEOPOSITION=)
4633     if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4634        MOZ_ENABLE_QT5GEOPOSITION=1
4635        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4636        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4637        AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4638        AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4639     fi
4641     if test "$MOZ_ENABLE_CONTENTACTION"; then
4642       MOZ_ENABLE_CONTENTACTION=1
4643       AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4644     fi
4646     MOZ_ENABLE_CONTENTACTION=
4647     PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4648     if test "$MOZ_ENABLE_CONTENTACTION"; then
4649        MOZ_ENABLE_CONTENTACTION=1
4650        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4651        MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4652        AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4653        AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4654     fi
4657 AC_SUBST(GTK_CONFIG)
4658 AC_SUBST_LIST(TK_CFLAGS)
4659 AC_SUBST_LIST(TK_LIBS)
4661 AC_SUBST(MOZ_ENABLE_GTK2)
4662 AC_SUBST(MOZ_ENABLE_GTK3)
4663 AC_SUBST(MOZ_ENABLE_GTK)
4664 AC_SUBST(MOZ_ENABLE_QT)
4665 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4666 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4667 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4668 AC_SUBST(MOZ_ENABLE_XREMOTE)
4669 AC_SUBST(MOZ_WIDGET_GTK)
4670 AC_SUBST_LIST(MOZ_QT_CFLAGS)
4671 AC_SUBST_LIST(MOZ_QT_LIBS)
4673 AC_SUBST(MOC)
4674 AC_SUBST(RCC)
4676 AC_SUBST(MOZ_X11)
4678 dnl ========================================================
4679 dnl =
4680 dnl = Components & Features
4681 dnl =
4682 dnl ========================================================
4683 MOZ_ARG_HEADER(Components and Features)
4685 dnl ========================================================
4686 dnl = Localization
4687 dnl ========================================================
4688 MOZ_ARG_ENABLE_STRING(ui-locale,
4689 [  --enable-ui-locale=ab-CD
4690                           Select the user interface locale (default: en-US)],
4691     MOZ_UI_LOCALE=$enableval )
4692 AC_SUBST(MOZ_UI_LOCALE)
4694 dnl ========================================================
4695 dnl = Trademarked Branding
4696 dnl ========================================================
4697 MOZ_ARG_ENABLE_BOOL(official-branding,
4698 [  --enable-official-branding
4699                           Enable Official mozilla.org Branding
4700                           Do not distribute builds with
4701                           --enable-official-branding unless you have
4702                           permission to use trademarks per
4703                           http://www.mozilla.org/foundation/trademarks/ .],
4705   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4706     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4707   else
4708     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4709     MOZ_OFFICIAL_BRANDING=1
4710   fi
4711 ], MOZ_OFFICIAL_BRANDING=)
4713 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4714 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4715   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4718 MOZ_ARG_WITH_STRING(branding,
4719 [  --with-branding=dir     Use branding from the specified directory.],
4720     MOZ_BRANDING_DIRECTORY=$withval)
4722 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4723 if test -z "$REAL_BRANDING_DIRECTORY"; then
4724   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4727 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4728   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4729 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4730   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
4733 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4735 dnl ========================================================
4736 dnl = Distribution ID
4737 dnl ========================================================
4738 MOZ_ARG_WITH_STRING(distribution-id,
4739 [  --with-distribution-id=ID
4740                           Set distribution-specific id (default=org.mozilla)],
4741 [ val=`echo $withval`
4742     MOZ_DISTRIBUTION_ID="$val"])
4744 if test -z "$MOZ_DISTRIBUTION_ID"; then
4745    MOZ_DISTRIBUTION_ID="org.mozilla"
4748 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4749 AC_SUBST(MOZ_DISTRIBUTION_ID)
4752 dnl ========================================================
4753 dnl Google Play Services, placed here so it can depend on
4754 dnl values set by configure.sh above.
4755 dnl ========================================================
4757 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
4760 dnl ========================================================
4761 dnl = Pango
4762 dnl ========================================================
4763 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4764 then
4765     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4767     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4770 dnl ========================================================
4771 dnl = GnomeVFS, GIO and GConf support module
4772 dnl ========================================================
4774 if test "$MOZ_X11"
4775 then
4776     dnl build the GIO extension by default only when the
4777     dnl GTK2 toolkit is in use.
4778     if test "$MOZ_ENABLE_GTK"
4779     then
4780         MOZ_ENABLE_GIO=1
4781         MOZ_ENABLE_GCONF=1
4782     fi
4784     dnl ========================================================
4785     dnl = GnomeVFS support module
4786     dnl ========================================================
4787     MOZ_ARG_ENABLE_BOOL(gnomevfs,
4788     [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
4789         MOZ_ENABLE_GNOMEVFS=force,
4790         MOZ_ENABLE_GNOMEVFS=)
4792     if test "$MOZ_ENABLE_GNOMEVFS"
4793     then
4794         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4795             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4796             MOZ_ENABLE_GNOMEVFS=1
4797             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
4798         ],[
4799             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4800             then
4801                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4802             fi
4803             MOZ_ENABLE_GNOMEVFS=
4804         ])
4805     fi
4807     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
4809     dnl ========================================================
4810     dnl = GIO support module
4811     dnl ========================================================
4812     MOZ_ARG_DISABLE_BOOL(gio,
4813     [  --disable-gio           Disable GIO support],
4814         MOZ_ENABLE_GIO=,
4815         MOZ_ENABLE_GIO=force)
4817     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4818     then
4819         if test "$MOZ_ENABLE_GTK2"
4820         then
4821             PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4822                               [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4823         fi
4824         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4825             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4826             MOZ_ENABLE_GIO=1
4827             AC_DEFINE(MOZ_ENABLE_GIO)
4828         ],[
4829             if test "$MOZ_ENABLE_GIO" = "force"
4830             then
4831                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4832             fi
4833             MOZ_ENABLE_GIO=
4834         ])
4835     fi
4837     AC_SUBST(MOZ_ENABLE_GIO)
4839     dnl ========================================================
4840     dnl = GConf support module
4841     dnl ========================================================
4842     MOZ_ARG_DISABLE_BOOL(gconf,
4843     [  --disable-gconf      Disable Gconf support ],
4844         MOZ_ENABLE_GCONF=,
4845         MOZ_ENABLE_GCONF=force)
4847     if test "$MOZ_ENABLE_GCONF"
4848     then
4849         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4850             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4851             MOZ_ENABLE_GCONF=1
4852         ],[
4853             if test "$MOZ_ENABLE_GCONF" = "force"
4854             then
4855                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4856             fi
4857             MOZ_ENABLE_GCONF=
4858         ])
4859     fi
4861     if test "$MOZ_ENABLE_GCONF"; then
4862         AC_DEFINE(MOZ_ENABLE_GCONF)
4863     fi
4865     AC_SUBST(MOZ_ENABLE_GCONF)
4868 dnl ========================================================
4869 dnl = libproxy support
4870 dnl ========================================================
4872 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4873 then
4874     MOZ_ENABLE_LIBPROXY=
4876     MOZ_ARG_ENABLE_BOOL(libproxy,
4877     [  --enable-libproxy         Enable libproxy support ],
4878     MOZ_ENABLE_LIBPROXY=1,
4879     MOZ_ENABLE_LIBPROXY=)
4881     if test "$MOZ_ENABLE_LIBPROXY"
4882     then
4883         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4884         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4885     fi
4887 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4889 dnl ========================================================
4890 dnl = GNOME component (mozgnome)
4891 dnl ========================================================
4893 if test "$MOZ_ENABLE_GTK"
4894 then
4895     MOZ_ENABLE_GNOME_COMPONENT=1
4897 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4899 dnl ========================================================
4900 dnl = libgnomeui support module
4901 dnl ========================================================
4903 if test "$MOZ_ENABLE_GTK"
4904 then
4905     MOZ_ARG_ENABLE_BOOL(gnomeui,
4906     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
4907         MOZ_ENABLE_GNOMEUI=force,
4908         MOZ_ENABLE_GNOMEUI=)
4910     if test "$MOZ_ENABLE_GNOMEUI"
4911     then
4912         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4913         [
4914             MOZ_ENABLE_GNOMEUI=1
4915         ],[
4916             if test "$MOZ_ENABLE_GNOMEUI" = "force"
4917             then
4918                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4919             fi
4920             MOZ_ENABLE_GNOMEUI=
4921         ])
4922     fi
4924     if test "$MOZ_ENABLE_GNOMEUI"; then
4925         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4926     fi
4929 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4931 dnl ========================================================
4932 dnl = dbus support
4933 dnl ========================================================
4935 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4936 then
4937     MOZ_ENABLE_DBUS=1
4939     MOZ_ARG_DISABLE_BOOL(dbus,
4940     [  --disable-dbus          Disable dbus support ],
4941         MOZ_ENABLE_DBUS=,
4942         MOZ_ENABLE_DBUS=1)
4944     if test "$MOZ_ENABLE_DBUS"
4945     then
4946         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4947         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4948         AC_DEFINE(MOZ_ENABLE_DBUS)
4949     fi
4951 AC_SUBST(MOZ_ENABLE_DBUS)
4953 dnl ========================================================
4954 dnl = Enable Android History instead of Places
4955 dnl ========================================================
4956 if test -n "$MOZ_ANDROID_HISTORY"; then
4957     if test -z "$MOZ_PLACES"; then
4958         AC_DEFINE(MOZ_ANDROID_HISTORY)
4959     else
4960         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4961     fi
4964 dnl ========================================================
4965 dnl = Enable the C++ async pan/zoom code instead of the Java version
4966 dnl ========================================================
4967 MOZ_ARG_ENABLE_BOOL(android-apz,
4968 [  --enable-android-apz      Switch to C++ pan/zoom code],
4969     MOZ_ANDROID_APZ=1,
4970     MOZ_ANDROID_APZ=)
4971 if test -n "$MOZ_ANDROID_APZ"; then
4972      dnl Do this if defined in confvars.sh
4973      AC_DEFINE(MOZ_ANDROID_APZ)
4976 dnl ========================================================
4977 dnl = Disable WebSMS backend
4978 dnl ========================================================
4979 MOZ_ARG_DISABLE_BOOL(websms-backend,
4980 [  --disable-websms-backend
4981                            Disable WebSMS backend],
4982     MOZ_WEBSMS_BACKEND=,
4983     MOZ_WEBSMS_BACKEND=1)
4985 if test -n "$MOZ_WEBSMS_BACKEND"; then
4986     AC_DEFINE(MOZ_WEBSMS_BACKEND)
4989 dnl ========================================================
4990 dnl = Enable runtime locale switching on Android
4991 dnl ========================================================
4992 if test -n "$MOZ_LOCALE_SWITCHER"; then
4993     AC_DEFINE(MOZ_LOCALE_SWITCHER)
4996 dnl ========================================================
4997 dnl = Enable system download manager on Android
4998 dnl ========================================================
4999 if test -n "$MOZ_ANDROID_DOWNLOADS_INTEGRATION"; then
5000     AC_DEFINE(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
5003 dnl ========================================================
5004 dnl = Enable NFC permission on Android
5005 dnl ========================================================
5006 if test -n "$MOZ_ANDROID_BEAM"; then
5007     AC_DEFINE(MOZ_ANDROID_BEAM)
5010 dnl ========================================================
5011 dnl = Include Search Activity on Android
5012 dnl ========================================================
5013 if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
5014     AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
5017 dnl ========================================================
5018 dnl = Include Mozilla Location Service Stumbler on Android
5019 dnl ========================================================
5020 if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
5021     AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
5024 dnl ========================================================
5025 dnl = Include share overlay on Android
5026 dnl ========================================================
5027 if test -n "$MOZ_ANDROID_SHARE_OVERLAY"; then
5028     AC_DEFINE(MOZ_ANDROID_SHARE_OVERLAY)
5031 dnl ========================================================
5032 dnl = Include New Tablet UI on Android
5033 dnl = Temporary build flag to allow development in Nightly
5034 dnl ========================================================
5035 if test -n "$MOZ_ANDROID_NEW_TABLET_UI"; then
5036     AC_DEFINE(MOZ_ANDROID_NEW_TABLET_UI)
5039 dnl ========================================================
5040 dnl = Enable IPDL's "expensive" unit tests
5041 dnl ========================================================
5042 MOZ_IPDL_TESTS=
5044 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5045 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5046     MOZ_IPDL_TESTS=1,
5047     MOZ_IPDL_TESTS=)
5049 if test -n "$MOZ_IPDL_TESTS"; then
5050     AC_DEFINE(MOZ_IPDL_TESTS)
5053 AC_SUBST(MOZ_IPDL_TESTS)
5055 dnl ========================================================
5056 dnl = Disable building dbm
5057 dnl ========================================================
5058 MOZ_ARG_DISABLE_BOOL(dbm,
5059 [  --disable-dbm           Disable building dbm],
5060     NSS_DISABLE_DBM=1,
5061     NSS_DISABLE_DBM=)
5063 dnl ========================================================
5064 dnl accessibility support on by default on all platforms
5065 dnl ========================================================
5066 MOZ_ARG_DISABLE_BOOL(accessibility,
5067 [  --disable-accessibility Disable accessibility support],
5068     ACCESSIBILITY=,
5069     ACCESSIBILITY=1 )
5070 if test "$ACCESSIBILITY"; then
5071     case "$target" in
5072     *-mingw*)
5073         if test -z "$MIDL"; then
5074             if test "$GCC" != "yes"; then
5075                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5076             else
5077                 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.])
5078             fi
5079         fi
5080     esac
5081     AC_DEFINE(ACCESSIBILITY)
5084 dnl ========================================================
5085 dnl Accessibility is required for the linuxgl widget
5086 dnl backend
5087 dnl ========================================================
5088 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5089     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5092 dnl Turn off webrtc for OS's we don't handle yet, but allow
5093 dnl --enable-webrtc to override.  Can disable for everything in
5094 dnl the master list above.
5095 if test -n "$MOZ_WEBRTC"; then
5096     case "$target" in
5097     *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
5098         dnl Leave enabled
5099         ;;
5100     *)
5101         dnl default to disabled for all others
5102         MOZ_WEBRTC=
5103         ;;
5104     esac
5107 AC_TRY_COMPILE([#include <linux/ethtool.h>],
5108                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
5109                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
5111 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
5113 # target_arch is from {ia32|x64|arm|ppc}
5114 case "$CPU_ARCH" in
5115 x86_64 | arm | x86 | ppc* | ia64)
5116     :
5117     ;;
5119 # unsupported arch for webrtc
5120     MOZ_WEBRTC=
5121     ;;
5123 esac
5125 dnl ========================================================
5126 dnl = Disable WebRTC code
5127 dnl ========================================================
5128 MOZ_ARG_DISABLE_BOOL(webrtc,
5129 [  --disable-webrtc        Disable support for WebRTC],
5130     MOZ_WEBRTC=,
5131     MOZ_WEBRTC=1)
5133 if test -n "$MOZ_WEBRTC"; then
5134     AC_DEFINE(MOZ_WEBRTC)
5135     dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
5136     dnl opt/production builds (via MOZ_CRASH())
5137     AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
5138     MOZ_RAW=1
5139     MOZ_VPX=1
5140     MOZ_VPX_ERROR_CONCEALMENT=1
5142 dnl enable once Signaling lands
5143     MOZ_WEBRTC_SIGNALING=1
5144     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
5145 dnl enable once PeerConnection lands
5146     MOZ_PEERCONNECTION=1
5147     AC_DEFINE(MOZ_PEERCONNECTION)
5148     MOZ_SCTP=1
5149     MOZ_SRTP=1
5150     AC_DEFINE(MOZ_SCTP)
5151     AC_DEFINE(MOZ_SRTP)
5152     if test -n "$MOZ_X11"; then
5153       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
5154     fi
5155 else
5156     MOZ_SYNTH_PICO=
5159 dnl ========================================================
5160 dnl = Force hardware AEC, disable webrtc.org AEC
5161 dnl ========================================================
5162 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
5163 [  --enable-hardware-aec-ns   Enable support for hardware AEC and noise suppression],
5164     MOZ_WEBRTC_HARDWARE_AEC_NS=1,
5165     MOZ_WEBRTC_HARDWARE_AEC_NS=)
5167 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
5168     AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
5171 AC_SUBST(MOZ_WEBRTC)
5172 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
5173 AC_SUBST(MOZ_WEBRTC_SIGNALING)
5174 AC_SUBST(MOZ_PEERCONNECTION)
5175 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
5176 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
5177 AC_SUBST(MOZ_SCTP)
5178 AC_SUBST(MOZ_SRTP)
5179 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
5181 dnl Use integers over floats for audio on B2G and Android
5182 dnl (regarless of the CPU architecture, because audio
5183 dnl backends for those platforms don't support floats. We also
5184 dnl use integers on ARM with other OS, because it's more efficient.
5185 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
5186     MOZ_SAMPLE_TYPE_S16=1
5187     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5188     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5189 else
5190     MOZ_SAMPLE_TYPE_FLOAT32=1
5191     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5192     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5195 dnl ========================================================
5196 dnl = Disable Speech API code
5197 dnl ========================================================
5198 MOZ_ARG_DISABLE_BOOL(webspeech,
5199 [  --disable-webspeech        Disable support for HTML Speech API],
5200     MOZ_WEBSPEECH=,
5201     MOZ_WEBSPEECH=1)
5203 if test -n "$MOZ_WEBSPEECH"; then
5204     AC_DEFINE(MOZ_WEBSPEECH)
5207 AC_SUBST(MOZ_WEBSPEECH)
5209 dnl ========================================================
5210 dnl = Enable Raw Codecs
5211 dnl ========================================================
5212 MOZ_ARG_ENABLE_BOOL(raw,
5213 [  --enable-raw           Enable support for RAW media],
5214     MOZ_RAW=1,
5215     MOZ_RAW=)
5217 if test -n "$MOZ_RAW"; then
5218     AC_DEFINE(MOZ_RAW)
5221 AC_SUBST(MOZ_RAW)
5223 dnl Checks for __attribute__(aligned()) directive need by libogg
5224 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5225     [ac_cv_c_attribute_aligned],
5226     [ac_cv_c_attribute_aligned=0
5227      CFLAGS_save="${CFLAGS}"
5228      CFLAGS="${CFLAGS} -Werror"
5229      for ac_cv_c_attr_align_try in 64 32 16 8; do
5230        echo "trying $ac_cv_c_attr_align_try"
5231        AC_TRY_COMPILE([],
5232                       [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5233                       [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5234        if test "$ac_cv_c_attribute_aligned" != 0; then
5235          break;
5236        fi
5237      done
5238        CFLAGS="${CFLAGS_save}"])
5239 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5240   AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5241                      [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5244 dnl ========================================================
5245 dnl = Disable VP8 decoder support
5246 dnl ========================================================
5247 MOZ_ARG_DISABLE_BOOL(webm,
5248 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5249     MOZ_WEBM=,
5250     MOZ_WEBM=1)
5252 if test -n "$MOZ_WEBM"; then
5253     AC_DEFINE(MOZ_WEBM)
5254     MOZ_VPX=1
5257 dnl ========================================================
5258 dnl = Apple platform decoder support
5259 dnl ========================================================
5260 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5261   MOZ_APPLEMEDIA=1
5264 if test -n "$MOZ_APPLEMEDIA"; then
5265   AC_DEFINE(MOZ_APPLEMEDIA)
5266   # hack in frameworks for fmp4 - see bug 1029974
5267   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
5268   LDFLAGS="$LDFLAGS -framework AudioToolbox"
5269   dnl Verify CoreMedia is available.
5270   AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
5271     [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
5274 dnl ========================================================
5275 dnl = DirectShow support
5276 dnl ========================================================
5277 if test "$OS_ARCH" = "WINNT"; then
5278     dnl Enable DirectShow support by default.
5279     MOZ_DIRECTSHOW=1
5282 MOZ_ARG_DISABLE_BOOL(directshow,
5283 [  --disable-directshow  Disable support for DirectShow],
5284     MOZ_DIRECTSHOW=,
5285     MOZ_DIRECTSHOW=1)
5287 if test -n "$MOZ_DIRECTSHOW"; then
5288     AC_DEFINE(MOZ_DIRECTSHOW)
5291 dnl ========================================================
5292 dnl = Windows Media Foundation support
5293 dnl ========================================================
5294 if test "$OS_ARCH" = "WINNT"; then
5295     dnl Enable Windows Media Foundation support by default.
5296     dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5297     dnl guaranteed to have a recent-enough SDK to build WMF.
5298     MOZ_WMF=1
5301 MOZ_ARG_DISABLE_BOOL(wmf,
5302 [  --disable-wmf  Disable support for Windows Media Foundation],
5303     MOZ_WMF=,
5304     MOZ_WMF=1)
5306 if test -n "$MOZ_WMF"; then
5307     AC_DEFINE(MOZ_WMF)
5310 dnl ========================================================
5311 dnl FFmpeg H264/AAC Decoding Support
5312 dnl ========================================================
5313 case "$OS_TARGET" in
5314 WINNT|Darwin|Android)
5315     ;;
5317     MOZ_FFMPEG=1
5318     ;;
5319 esac
5321 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5322 [  --disable-ffmpeg         Disable FFmpeg for fragmented H264/AAC decoding],
5323     MOZ_FFMPEG=,
5324     MOZ_FFMPEG=1
5327 if test -n "$MOZ_FFMPEG"; then
5328     AC_DEFINE(MOZ_FFMPEG)
5331 dnl ========================================================
5332 dnl = Built-in fragmented MP4 support.
5333 dnl ========================================================
5335 if test "$OS_TARGET" = Android -a -z "$gonkdir"; then
5336     MOZ_FMP4=1
5339 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG" -o -n "$MOZ_APPLEMEDIA"; then
5340     dnl Enable fragmented MP4 parser on Windows by default.
5341     dnl We will also need to enable it on other platforms as we implement
5342     dnl platform decoder support there too.
5343     MOZ_FMP4=1
5346 MOZ_ARG_DISABLE_BOOL(fmp4,
5347 [  --disable-fmp4  Disable support for in built Fragmented MP4 parsing],
5348     MOZ_FMP4=,
5349     MOZ_FMP4=1)
5351 if test -n "$MOZ_FMP4"; then
5352     AC_DEFINE(MOZ_FMP4)
5353     MOZ_EME=1
5356 dnl ========================================================
5357 dnl = EME support
5358 dnl ========================================================
5360 MOZ_ARG_DISABLE_BOOL(eme,
5361 [  --disable-eme  Disable support for Encrypted Media Extensions],
5362     MOZ_EME=,
5363     MOZ_EME=1)
5365 if test -n "$MOZ_EME"; then
5366     if test -z "$MOZ_FMP4"; then
5367         AC_MSG_ERROR([Encrypted Media Extension support requires Fragmented MP4 support])
5368     fi
5369     AC_DEFINE(MOZ_EME)
5372 dnl ========================================================
5373 dnl = Enable media plugin support
5374 dnl ========================================================
5375 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5376   dnl Enable support on android by default
5377   MOZ_ANDROID_OMX=1
5380 MOZ_ARG_ENABLE_BOOL(android-omx,
5381 [  --enable-android-omx  Enable support for Android OMX media backend],
5382     MOZ_ANDROID_OMX=1,
5383     MOZ_ANDROID_OMX=)
5385 if test -n "$MOZ_ANDROID_OMX"; then
5386   AC_DEFINE(MOZ_ANDROID_OMX)
5389 dnl ========================================================
5390 dnl = Enable getUserMedia support
5391 dnl ========================================================
5392 MOZ_ARG_ENABLE_BOOL(media-navigator,
5393 [  --enable-media-navigator  Enable support for getUserMedia],
5394     MOZ_MEDIA_NAVIGATOR=1,
5395     MOZ_MEDIA_NAVIGATOR=)
5397 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5398   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5401 dnl ========================================================
5402 dnl = Enable building OMX media plugin (B2G or Android)
5403 dnl ========================================================
5404 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5405   dnl Enable support on android by default
5406   MOZ_OMX_PLUGIN=1
5409 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5410 [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
5411     MOZ_OMX_PLUGIN=1,
5412     MOZ_OMX_PLUGIN=)
5414 if test -n "$MOZ_OMX_PLUGIN"; then
5415     if test "$OS_TARGET" = "Android"; then
5416         dnl Only allow building OMX plugin on Gonk (B2G) or Android
5417         AC_DEFINE(MOZ_OMX_PLUGIN)
5418     else
5419        dnl fail if we're not building on Gonk or Android
5420        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5421     fi
5424 dnl system libvpx Support
5425 dnl ========================================================
5426 MOZ_ARG_WITH_BOOL(system-libvpx,
5427 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
5428     MOZ_NATIVE_LIBVPX=1)
5430 MOZ_LIBVPX_CFLAGS=
5431 MOZ_LIBVPX_LIBS=
5433 if test -n "$MOZ_VPX"; then
5434     AC_DEFINE(MOZ_VPX)
5435     if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5436         AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5437     fi
5439     _SAVE_CFLAGS=$CFLAGS
5440     _SAVE_LIBS=$LIBS
5441     if test -n "$MOZ_NATIVE_LIBVPX"; then
5442         dnl ============================
5443         dnl === libvpx Version check ===
5444         dnl ============================
5445         dnl Check to see if we have a system libvpx package.
5446         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
5448         CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5449         LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5451         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5452          [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.])])
5454         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5455          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5457         MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
5458          [AC_CHECK_FUNC(vpx_mem_set_functions)])
5459         if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
5460                 "$ac_cv_func_vpx_mem_set_functions" = no; then
5461             AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
5462         fi
5463     fi
5464     CFLAGS=$_SAVE_CFLAGS
5465     LIBS=$_SAVE_LIBS
5468 AC_SUBST(MOZ_NATIVE_LIBVPX)
5469 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
5470 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
5472 if test "$MOZ_WEBM"; then
5473     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5474         MOZ_VORBIS=1
5475     else
5476         MOZ_TREMOR=1
5477     fi
5480 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5482     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5483     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5484     dnl We currently require gcc on all arm platforms.
5485     VPX_AS=$YASM
5486     VPX_ASM_SUFFIX=asm
5487     VPX_NEED_OBJ_INT_EXTRACT=
5489     dnl See if we have assembly on this platform.
5490     case "$OS_ARCH:$CPU_ARCH" in
5491     Darwin:x86)
5492       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5493       VPX_X86_ASM=1
5494     ;;
5495     Darwin:x86_64)
5496       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5497       VPX_X86_ASM=1
5498     ;;
5499     WINNT:x86_64)
5500       VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5501       VPX_X86_ASM=1
5502     ;;
5503     WINNT:x86)
5504       dnl Check for yasm 1.1 or greater.
5505       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5506         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.])
5507       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5508         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.])
5509       else
5510         VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5511         VPX_X86_ASM=1
5512         dnl The encoder needs obj_int_extract to get asm offsets.
5513       fi
5514     ;;
5515     *:arm*)
5516       if test -n "$GNU_AS" ; then
5517         VPX_AS=$AS
5518         dnl These flags are a lie; they're just used to enable the requisite
5519         dnl opcodes; actual arch detection is done at runtime.
5520         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5521         VPX_DASH_C_FLAG="-c"
5522         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5523         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5524         VPX_ARM_ASM=1
5525       fi
5526     ;;
5527     *:x86)
5528       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5529         VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5530         VPX_X86_ASM=1
5531       fi
5532     ;;
5533     *:x86_64)
5534       if $CC -E -dM -</dev/null | grep -q __ELF__; then
5535         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5536         VPX_X86_ASM=1
5537       fi
5538     ;;
5539     esac
5541     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5542       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.])
5543     fi
5545     if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5546       dnl We prefer to get asm offsets using inline assembler, which the above
5547       dnl compilers can do. When we're not using one of those, we have to fall
5548       dnl back to obj_int_extract, which reads them from a compiled object
5549       dnl file. Unfortunately, that only works if we're compiling on a system
5550       dnl with the header files for the appropriate object file format.
5551       VPX_NEED_OBJ_INT_EXTRACT=1
5552     fi
5554     if test -n "$VPX_X86_ASM"; then
5555       AC_DEFINE(VPX_X86_ASM)
5556     elif test -n "$VPX_ARM_ASM"; then
5557       AC_DEFINE(VPX_ARM_ASM)
5558     else
5559       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5560     fi
5563 dnl ========================================================
5564 dnl = Disable Wave decoder support
5565 dnl ========================================================
5566 MOZ_ARG_DISABLE_BOOL(wave,
5567 [  --disable-wave          Disable Wave decoder support],
5568     MOZ_WAVE=,
5569     MOZ_WAVE=1)
5571 if test -n "$MOZ_WAVE"; then
5572     AC_DEFINE(MOZ_WAVE)
5575 dnl ========================================================
5576 dnl = Handle dependent MEDIA defines
5577 dnl ========================================================
5579 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5580     AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive!  The build system should not allow them both to be set, but they are.  Please file a bug at https://bugzilla.mozilla.org/])
5583 if test -n "$MOZ_VORBIS"; then
5584     AC_DEFINE(MOZ_VORBIS)
5587 if test -n "$MOZ_TREMOR"; then
5588     AC_DEFINE(MOZ_TREMOR)
5589     # Tremor doesn't have an encoder.
5590     MOZ_WEBM_ENCODER=
5593 if test -n "$MOZ_WEBM_ENCODER"; then
5594     AC_DEFINE(MOZ_WEBM_ENCODER)
5596 AC_SUBST(MOZ_WEBM_ENCODER)
5598 dnl ==================================
5599 dnl = Check alsa availability on Linux
5600 dnl ==================================
5602 dnl If using Linux, ensure that the alsa library is available
5603 if test "$OS_TARGET" = "Linux"; then
5604     MOZ_ALSA=1
5607 MOZ_ARG_ENABLE_BOOL(alsa,
5608 [  --enable-alsa          Enable Alsa support (default on Linux)],
5609    MOZ_ALSA=1,
5610    MOZ_ALSA=)
5612 if test -n "$MOZ_ALSA"; then
5613     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5614          [echo "$MOZ_ALSA_PKG_ERRORS"
5615           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.)])])
5618 AC_SUBST(MOZ_ALSA)
5620 dnl ========================================================
5621 dnl = Disable PulseAudio
5622 dnl ========================================================
5624 dnl If using Linux, ensure that the PA library is available
5625 case "$OS_TARGET" in
5626 WINNT|Darwin|Android|OpenBSD)
5627     ;;
5629     if test -z "$MOZ_B2G"; then
5630         MOZ_PULSEAUDIO=1
5631     fi
5632     ;;
5633 esac
5635 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5636 [  --disable-pulseaudio          Disable PulseAudio support],
5637    MOZ_PULSEAUDIO=,
5638    MOZ_PULSEAUDIO=1)
5640 if test -n "$MOZ_PULSEAUDIO"; then
5641     if test -z "$gonkdir"; then
5642         PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5643              [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5644               AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5645     else
5646         MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5647     fi
5650 AC_SUBST(MOZ_PULSEAUDIO)
5652 dnl ========================================================
5653 dnl = Enable GStreamer
5654 dnl ========================================================
5655 case "$OS_TARGET" in
5656 WINNT|Darwin|Android)
5657     ;;
5659     MOZ_GSTREAMER=1
5660     GST_API_VERSION=0.10
5661     ;;
5662 esac
5664 MOZ_ARG_ENABLE_STRING(gstreamer,
5665 [  --enable-gstreamer[=0.10]           Enable GStreamer support],
5666 [ MOZ_GSTREAMER=1
5667   # API version, eg 0.10, 1.0 etc
5668   if test -z "$enableval" -o "$enableval" = "yes"; then
5669     GST_API_VERSION=0.10
5670   elif test "$enableval" = "no"; then
5671     MOZ_GSTREAMER=
5672   else
5673     GST_API_VERSION=$enableval
5674   fi],
5677 if test -n "$MOZ_GSTREAMER"; then
5678     # core/base release number
5679     if test "$GST_API_VERSION" = "1.0"; then
5680       GST_VERSION=1.0
5681     else
5682       GST_VERSION=0.10.25
5683     fi
5685     PKG_CHECK_MODULES(GSTREAMER,
5686                       gstreamer-$GST_API_VERSION >= $GST_VERSION
5687                       gstreamer-app-$GST_API_VERSION
5688                       gstreamer-plugins-base-$GST_API_VERSION,
5689                       [_HAVE_GSTREAMER=1],
5690                       [_HAVE_GSTREAMER=])
5691     if test -z "$_HAVE_GSTREAMER"; then
5692         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])
5693     fi
5695     _SAVE_LDFLAGS=$LDFLAGS
5696     LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5697     AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5698     if test -n "$_HAVE_LIBGSTVIDEO" ; then
5699         GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5700     else
5701         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.])
5702     fi
5703     LDFLAGS=$_SAVE_LDFLAGS
5706 AC_SUBST(MOZ_GSTREAMER)
5707 AC_SUBST(GST_API_VERSION)
5709 if test -n "$MOZ_GSTREAMER"; then
5710      AC_DEFINE(MOZ_GSTREAMER)
5711      AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
5715 dnl ========================================================
5716 dnl Permissions System
5717 dnl ========================================================
5718 MOZ_ARG_DISABLE_BOOL(permissions,
5719 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5720     MOZ_PERMISSIONS=,
5721     MOZ_PERMISSIONS=1
5724 AC_SUBST(MOZ_PERMISSIONS)
5725 if test -n "$MOZ_PERMISSIONS"; then
5726     AC_DEFINE(MOZ_PERMISSIONS)
5729 dnl ========================================================
5730 dnl Child permissions, currently only used for b2g
5731 dnl ========================================================
5732 if test -n "$MOZ_B2G"; then
5733     if test -n "$MOZ_PERMISSIONS"; then
5734         MOZ_CHILD_PERMISSIONS=1
5735         AC_DEFINE(MOZ_CHILD_PERMISSIONS)
5736     else
5737         AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5738     fi
5740 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5742 dnl ========================================================
5743 dnl NegotiateAuth
5744 dnl ========================================================
5745 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5746 [  --disable-negotiateauth Disable GSS-API negotiation ],
5747     MOZ_AUTH_EXTENSION=,
5748     MOZ_AUTH_EXTENSION=1 )
5750 dnl ========================================================
5751 dnl Pref extensions (autoconfig)
5752 dnl ========================================================
5753 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5754 [  --disable-pref-extensions
5755                           Disable pref extensions such as autoconfig],
5756   MOZ_PREF_EXTENSIONS=,
5757   MOZ_PREF_EXTENSIONS=1 )
5759 dnl ========================================================
5760 dnl Searching of system directories for extensions.
5761 dnl Note: this switch is meant to be used for test builds
5762 dnl whose behavior should not depend on what happens to be
5763 dnl installed on the local machine.
5764 dnl ========================================================
5765 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5766 [  --disable-system-extension-dirs
5767                           Disable searching system- and account-global
5768                           directories for extensions of any kind; use
5769                           only profile-specific extension directories],
5770   ENABLE_SYSTEM_EXTENSION_DIRS=,
5771   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5772 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5773   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5776 dnl ========================================================
5777 dnl = Universalchardet
5778 dnl ========================================================
5779 MOZ_ARG_DISABLE_BOOL(universalchardet,
5780 [  --disable-universalchardet
5781                           Disable universal encoding detection],
5782   MOZ_UNIVERSALCHARDET=,
5783   MOZ_UNIVERSALCHARDET=1 )
5785 if test -n "${JAVA_BIN_PATH}"; then
5786   dnl Look for javac and jar in the specified path.
5787   JAVA_PATH="$JAVA_BIN_PATH"
5788 else
5789   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5790   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5793 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5794 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5795 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5796 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5797 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5798 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5800 if test -n "${JAVA_BIN_PATH}" -o \
5801   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5802   if test -z "$JAVA" -o "$JAVA" = ":"; then
5803     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}])
5804   fi
5805   if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5806     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}])
5807   fi
5808   if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5809     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}])
5810   fi
5811   if test -z "$JAR" -o "$JAR" = ":"; then
5812     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}])
5813   fi
5814   if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5815     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}])
5816   fi
5817   if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5818     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}])
5819   fi
5821   AC_MSG_CHECKING([for minimum required javac version >= 1.7])
5823   dnl Javac spits out something like `javac 1.7.0`. This line cuts off the 'javac'
5824   _javac_version=$($JAVAC -version 2>&1 | cut -d ' ' -f 2)
5826   dnl Here, we extract the major (1) and minor (7) version numbers from the
5827   dnl acquired version string.
5828   _javac_major_version=$(echo $_javac_version | cut -d '.' -f 1)
5829   _javac_minor_version=$(echo $_javac_version | cut -d '.' -f 2)
5831   AC_MSG_RESULT([$_javac_version])
5833   dnl Fail if we have a version other than 1.7.X
5834   if test "$_javac_major_version" -ne "1" -o \
5835        \( "$_javac_minor_version" -lt "7" \); then
5836       AC_MSG_ERROR([javac 1.7 or higher is required.])
5837   fi
5840 dnl ========================================================
5841 dnl = ANGLE OpenGL->D3D translator for WebGL
5842 dnl = * only applies to win32
5843 dnl ========================================================
5845 MOZ_ANGLE_RENDERER=
5846 MOZ_D3D_CPU_SUFFIX=
5847 MOZ_HAS_WINSDK_WITH_D3D=
5848 MOZ_D3DCOMPILER_VISTA_DLL=
5849 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5850 MOZ_DIRECTX_SDK_PATH=
5851 MOZ_D3DCOMPILER_XP_DLL=
5852 MOZ_D3DCOMPILER_XP_CAB=
5854 case "$target_os" in
5855 *mingw*)
5856     MOZ_ANGLE_RENDERER=1
5857     ;;
5858 esac
5860 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5861 case "${target_cpu}" in
5862 i*86)
5863   MOZ_D3D_CPU_SUFFIX=x86
5864   ;;
5865 x86_64)
5866   MOZ_D3D_CPU_SUFFIX=x64
5867   ;;
5868 esac
5870 MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
5871 [  --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
5872     MOZ_REQUIRE_ALL_D3DCS=1,
5873     MOZ_REQUIRE_ALL_D3DCS=)
5875 # This is potentially set in external mozconfig files; if it's set,
5876 # then the build exposes the "webgl" context name, which is reserved
5877 # for conformant implementations.
5878 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5879   AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5882 dnl ========================================================
5883 dnl D3D compiler DLL
5884 dnl ========================================================
5885 MOZ_FOUND_D3D_COMPILERS=
5887 if test -n "$MOZ_ANGLE_RENDERER"; then
5888   if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5889     AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5890   fi
5892   ######################################
5893   # Find _46+ for use by Vista+.
5895   # Find a D3D compiler DLL in a Windows SDK.
5896   MOZ_D3DCOMPILER_VISTA_DLL=
5897   case "$MOZ_WINSDK_MAXVER" in
5898   0x0603*)
5899     MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5900     AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5901   ;;
5902   esac
5904   if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5905     # We have a name, now track down the path.
5906     if test -n "$WINDOWSSDKDIR"; then
5907       MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5908       if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5909         AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5910         MOZ_HAS_WINSDK_WITH_D3D=1
5911       else
5912         AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5913         AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5914         MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5915       fi
5916     else
5917       AC_MSG_RESULT([Windows SDK not found.])
5918     fi
5919   fi
5921   if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5922     MOZ_D3DCOMPILER_VISTA_DLL=
5923   fi
5925   # On mingw, check if headers are provided by toolchain.
5926   if test -n "$GNU_CC"; then
5927     MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5928   fi
5930   ######################################
5931   # Find _43 for use by XP.
5933   if test "$HAVE_64BIT_BUILD"; then
5934     AC_MSG_RESULT([We are building a 64-bit binary, skip checking d3dcompiler_43.])
5935   else
5936     # Get the SDK path from the registry.
5937     # First try to get the June 2010 SDK
5938     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5939     if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5940       # Otherwise just take whatever comes first
5941       MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5942     fi
5943     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'`
5945     if test -n "$MOZ_DIRECTX_SDK_PATH" &&
5946        test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
5947       AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5948     else
5949       AC_MSG_RESULT([DirectX SDK not found.])
5950       MOZ_DIRECTX_SDK_PATH=
5951     fi
5953     # Check that our DirectX SDK is acceptable.
5954     if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5955       if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5956         AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
5957         MOZ_DIRECTX_SDK_PATH=
5958       fi
5959     fi
5961     if test -n "$MOZ_DIRECTX_SDK_PATH"; then
5962       # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
5963       # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5964       MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
5966       if test -n "$MOZ_D3DX9_VERSION" ; then
5967         MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
5969         if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
5970           MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5971         else
5972           AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
5973           AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
5974           MOZ_DIRECTX_SDK_PATH=
5975         fi
5976       else
5977         AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
5978         MOZ_DIRECTX_SDK_PATH=
5979       fi
5980     else
5981       AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
5982       AC_MSG_RESULT([  Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
5983     fi
5984   fi
5986   ######################################
5987   # Check that we found what we needed.
5988   MOZ_FOUND_A_D3D_COMPILER=
5989   MOZ_FOUND_BOTH_D3D_COMPILERS=1
5991   if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5992     MOZ_FOUND_A_D3D_COMPILER=1
5993     AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
5994   else
5995     MOZ_FOUND_BOTH_D3D_COMPILERS=
5996   fi
5998   if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
5999     MOZ_FOUND_A_D3D_COMPILER=1
6000     AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
6001   else
6002     MOZ_FOUND_BOTH_D3D_COMPILERS=
6003   fi
6005   if test -z "$CROSS_COMPILE"; then
6006     if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
6007       AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
6008       AC_MSG_ERROR([  Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
6009     fi
6011     if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
6012       AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
6013       AC_MSG_ERROR([  Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
6014     fi
6015   fi
6019 dnl ========================================================
6020 dnl Gamepad support
6021 dnl ========================================================
6022 MOZ_GAMEPAD=
6023 MOZ_GAMEPAD_BACKEND=stub
6025 # Gamepad DOM is built on supported platforms by default.
6026 case "$OS_TARGET" in
6027      Darwin|WINNT|Linux)
6028        MOZ_GAMEPAD=1
6029        ;;
6030      Android)
6031        if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
6032          MOZ_GAMEPAD=1
6033        fi
6034        ;;
6035      *)
6036        ;;
6037 esac
6039 MOZ_ARG_DISABLE_BOOL(gamepad,
6040 [  --disable-gamepad   Disable gamepad support],
6041     MOZ_GAMEPAD=,
6042     MOZ_GAMEPAD=1)
6044 if test "$MOZ_GAMEPAD"; then
6045     case "$OS_TARGET" in
6046     Darwin)
6047         MOZ_GAMEPAD_BACKEND=cocoa
6048         ;;
6049     WINNT)
6050         MOZ_GAMEPAD_BACKEND=windows
6051         ;;
6052     Linux)
6053         MOZ_CHECK_HEADER([linux/joystick.h])
6054         if test "$ac_cv_header_linux_joystick_h" != "yes"; then
6055           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.])
6056         fi
6057         MOZ_GAMEPAD_BACKEND=linux
6058         ;;
6059     Android)
6060         MOZ_GAMEPAD_BACKEND=android
6061         ;;
6062     *)
6063         ;;
6064    esac
6066   AC_DEFINE(MOZ_GAMEPAD)
6068 AC_SUBST(MOZ_GAMEPAD)
6069 AC_SUBST(MOZ_GAMEPAD_BACKEND)
6071 dnl ========================================================
6072 dnl = Breakpad crash reporting (on by default on supported platforms)
6073 dnl ========================================================
6075 case $target in
6076 i?86-*-mingw*|x86_64-*-mingw*)
6077   MOZ_CRASHREPORTER=1
6078   ;;
6079 i?86-apple-darwin*|x86_64-apple-darwin*)
6080   MOZ_CRASHREPORTER=1
6081   ;;
6082 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6083   if test "$MOZ_ENABLE_GTK"; then
6084     MOZ_CRASHREPORTER=1
6085   fi
6086   ;;
6087 *-android*|*-linuxandroid*)
6088   MOZ_CRASHREPORTER=1
6089   ;;
6090 *solaris*)
6091   MOZ_CRASHREPORTER=1
6092   ;;
6093 esac
6095 MOZ_ARG_DISABLE_BOOL(crashreporter,
6096 [  --disable-crashreporter Disable breakpad crash reporting],
6097     [MOZ_CRASHREPORTER=],
6098     [MOZ_CRASHREPORTER=F # Force enable breakpad])
6100 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
6101   if test "$MOZ_CRASHREPORTER" = F; then
6102     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
6103   fi
6104   MOZ_CRASHREPORTER=
6107 if test -n "$MOZ_CRASHREPORTER"; then
6108    AC_DEFINE(MOZ_CRASHREPORTER)
6110   if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
6111     test -z "$SKIP_LIBRARY_CHECKS"; then
6112     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6113   fi
6115   if test "$OS_ARCH" = "WINNT"; then
6116     if test -z "$HAVE_64BIT_BUILD"; then
6117       MOZ_CRASHREPORTER_INJECTOR=1
6118       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
6119     fi
6120   fi
6123 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6124 [  --with-crashreporter-enable-percent=NN
6125                           Enable sending crash reports by default on NN% of users. (default=100)],
6126 [ val=`echo $withval | sed 's/[^0-9]//g'`
6127     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6129 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6130    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6132 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6134 dnl ========================================================
6135 dnl = libjpeg-turbo configuration
6136 dnl ========================================================
6137 MOZ_LIBJPEG_TURBO=
6138 if test -z "$MOZ_NATIVE_JPEG"; then
6139     MOZ_LIBJPEG_TURBO=1
6142 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6143 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
6144     MOZ_LIBJPEG_TURBO=,
6145     MOZ_LIBJPEG_TURBO=1)
6147 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6148     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6151 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6152 dnl files.
6154 if test -n "$MOZ_LIBJPEG_TURBO"; then
6156   dnl Do we support libjpeg-turbo on this platform?
6157   case "$OS_ARCH:$OS_TEST" in
6158   Darwin:i?86)
6159     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6160     LIBJPEG_TURBO_X86_ASM=1
6161   ;;
6162   Darwin:x86_64)
6163     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6164     LIBJPEG_TURBO_X64_ASM=1
6165   ;;
6166   WINNT:x86|WINNT:i?86)
6167     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6168     LIBJPEG_TURBO_X86_ASM=1
6169   ;;
6170   WINNT:x86_64)
6171     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6172     LIBJPEG_TURBO_X64_ASM=1
6173   ;;
6174   *:arm*)
6175     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6176     LIBJPEG_TURBO_ARM_ASM=1
6177   ;;
6178   *:x86|*:i?86)
6179     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6180       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6181       LIBJPEG_TURBO_X86_ASM=1
6182     fi
6183   ;;
6184   *:x86_64)
6185     if $CC -E -dM -</dev/null | grep -q __ELF__; then
6186       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6187       LIBJPEG_TURBO_X64_ASM=1
6188     fi
6189   ;;
6190   esac
6194 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6195 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6196 dnl it doesn't exist or we have too old of a version.
6197 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6198     LIBJPEG_TURBO_AS=$YASM
6200     if test -z "$LIBJPEG_TURBO_AS" ; then
6201         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.])
6202     fi
6204     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6205     dnl on Linux and 1.1 or newer everywhere else.
6206     if test "$OS_ARCH" = "Linux" ; then
6207         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
6208             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.])
6209         fi
6210     else
6211         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6212             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.])
6213         fi
6214     fi
6217 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6218 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6219 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6220     echo "Using $AS as the assembler for ARM code."
6221     LIBJPEG_TURBO_AS=$AS
6224 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6225     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6226 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6227     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6228 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6229     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6230 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6231     dnl Warn if we're not building the optimized routines, even though the user
6232     dnl didn't specify --disable-libjpeg-turbo.
6233     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6236 dnl ========================================================
6237 dnl = Enable compilation of specific extension modules
6238 dnl ========================================================
6240 MOZ_ARG_ENABLE_STRING(extensions,
6241 [  --enable-extensions     Enable extensions],
6242 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6243     if test "$option" = "yes" -o "$option" = "all"; then
6244         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6245     elif test "$option" = "no" -o "$option" = "none"; then
6246         MOZ_EXTENSIONS=""
6247     elif test "$option" = "default"; then
6248         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6249     elif test `echo "$option" | grep -c \^-` != 0; then
6250         option=`echo $option | sed 's/^-//'`
6251         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6252     else
6253         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6254     fi
6255 done],
6256     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6258 if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6259     # Suppress warning on non-X11 platforms
6260     if test -n "$MOZ_X11"; then
6261         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
6262     fi
6263     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6266 dnl Do not build gnomevfs with libxul based apps
6267 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6268     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6271 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6272     # Suppress warning on non-X11 platforms
6273     if test -n "$MOZ_X11"; then
6274         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
6275     fi
6276     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6279 dnl Do not build gio with libxul based apps
6280 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6281     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6284 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6285     MOZ_GIO_COMPONENT=1
6286     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6288 AC_SUBST(MOZ_GIO_COMPONENT)
6290 dnl Remove dupes
6291 MOZ_EXTENSIONS=`$PYTHON ${srcdir}/build/unix/uniq.py ${MOZ_EXTENSIONS}`
6293 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6294 dnl when trying to build a nonexistent extension.
6295 for extension in $MOZ_EXTENSIONS; do
6296     if test ! -d "${srcdir}/extensions/${extension}"; then
6297         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6298     fi
6299 done
6301 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6302   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6305 dnl ========================================================
6306 dnl Build Freetype in the tree
6307 dnl ========================================================
6308 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6309 [  --enable-tree-freetype  Enable Tree FreeType],
6310     MOZ_TREE_FREETYPE=1,
6311     MOZ_TREE_FREETYPE= )
6312 if test -n "$MOZ_TREE_FREETYPE"; then
6313    if test -n "$_WIN32_MSVC"; then
6314       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6315    fi
6316    AC_DEFINE(MOZ_TREE_FREETYPE)
6317    AC_SUBST(MOZ_TREE_FREETYPE)
6318    MOZ_ENABLE_CAIRO_FT=1
6319    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6320    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6321    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6322    CAIRO_FT_OSLIBS=''
6323    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6324    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6325    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6326    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
6329 dnl ========================================================
6330 dnl Installer
6331 dnl ========================================================
6332 dnl Abort Windows build if the required major version and
6333 dnl minimum minor version of Unicode NSIS isn't in the path
6334 dnl (unless in case of cross compiling, for which Unicode
6335 dnl is not yet sufficient).
6336 if test "$OS_ARCH" = "WINNT"; then
6337     MIN_NSIS_MAJOR_VER=2
6338     MIN_NSIS_MINOR_VER=46
6339     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
6340     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6341       AC_MSG_RESULT([yes])
6342       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
6343       changequote(,)
6344       MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
6345       changequote([,])
6346       if test "$MAKENSISU_PARSED_VER" = ""; then
6347           changequote(,)
6348           MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6349           changequote([,])
6350       fi
6351       MAKENSISU_MAJOR_VER=0
6352       MAKENSISU_MINOR_VER=0
6353       if test ! "$MAKENSISU_PARSED_VER" = ""; then
6354           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6355           MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6356       fi
6357       AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6358       if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6359               "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6360          test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6361           AC_MSG_RESULT([yes])
6362       else
6363           AC_MSG_RESULT([no])
6364           if test -z "$CROSS_COMPILE"; then
6365             AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6366           else
6367             MAKENSISU=
6368           fi
6369       fi
6370     elif test -z "$CROSS_COMPILE"; then
6371       AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6372     else
6373       MAKENSISU=
6374     fi
6377 dnl ========================================================
6378 dnl Web App Runtime
6379 dnl ========================================================
6380 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6381 [  --disable-webapp-runtime  Disable Web App Runtime],
6382     MOZ_WEBAPP_RUNTIME=,
6383     MOZ_WEBAPP_RUNTIME=1)
6384 if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
6385     MOZ_WEBAPP_RUNTIME=
6387 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6388     MOZ_WEBAPP_RUNTIME=
6390 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6391 if test "$MOZ_WEBAPP_RUNTIME"; then
6392     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6395 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6396 if test -z "$TAR"; then
6397     AC_MSG_ERROR([no tar archiver found in \$PATH])
6399 AC_SUBST(TAR)
6401 AC_CHECK_PROGS(WGET, wget, "")
6402 AC_SUBST(WGET)
6404 dnl ========================================================
6405 dnl Signing
6406 dnl ========================================================
6408 if test -n "$MOZ_SIGN_CMD"; then
6409     AC_DEFINE(MOZ_SIGNING)
6412 dnl ========================================================
6413 dnl Maintenance Service
6414 dnl ========================================================
6416 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6417 [  --enable-maintenance-service       Enable building of maintenanceservice],
6418     MOZ_MAINTENANCE_SERVICE=1,
6419     MOZ_MAINTENANCE_SERVICE= )
6421 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6422   if test "$OS_ARCH" = "WINNT"; then
6423     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6424   else
6425     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6426   fi
6429 dnl ========================================================
6430 dnl Bundled fonts on desktop platforms
6431 dnl ========================================================
6433 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6434 [  --enable-bundled-fonts  Enable support for bundled fonts on desktop platforms],
6435     MOZ_BUNDLED_FONTS=1,
6436     MOZ_BUNDLED_FONTS=)
6438 if test -n "$MOZ_BUNDLED_FONTS"; then
6439   AC_DEFINE(MOZ_BUNDLED_FONTS)
6442 dnl ========================================================
6443 dnl Verify MAR signatures
6444 dnl ========================================================
6446 MOZ_ARG_ENABLE_BOOL(verify-mar,
6447 [  --enable-verify-mar     Enable verifying MAR signatures],
6448     MOZ_VERIFY_MAR_SIGNATURE=1,
6449     MOZ_VERIFY_MAR_SIGNATURE= )
6451 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6452   if test "$OS_ARCH" = "WINNT"; then
6453     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6454   else
6455     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6456   fi
6459 dnl ========================================================
6460 dnl Enable building the signmar program.
6461 dnl This option is much different than the --enable-verify-mar option.
6462 dnl --enable-verify-mar is for enabling the verification check on MAR
6463 dnl files in the updater.  The --enable-signmar option is for building
6464 dnl the signmar program.
6465 dnl ========================================================
6467 MOZ_ARG_ENABLE_BOOL(signmar,
6468 [  --enable-signmar     Enable building the signmar program],
6469     MOZ_ENABLE_SIGNMAR=1,
6470     MOZ_ENABLE_SIGNMAR= )
6472 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6473   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6476 dnl ========================================================
6477 dnl Updater
6478 dnl ========================================================
6480 MOZ_ARG_DISABLE_BOOL(updater,
6481 [  --disable-updater       Disable building of updater],
6482     MOZ_UPDATER=,
6483     MOZ_UPDATER=1 )
6485 if test -n "$MOZ_UPDATER"; then
6486     AC_DEFINE(MOZ_UPDATER)
6489 # tools/update-packaging is not checked out by default.
6490 MOZ_ARG_ENABLE_BOOL(update-packaging,
6491 [  --enable-update-packaging
6492                           Enable tools/update-packaging],
6493     MOZ_UPDATE_PACKAGING=1,
6494     MOZ_UPDATE_PACKAGING= )
6495 AC_SUBST(MOZ_UPDATE_PACKAGING)
6497 dnl ========================================================
6498 dnl build the tests by default
6499 dnl ========================================================
6500 MOZ_ARG_DISABLE_BOOL(tests,
6501 [  --disable-tests         Do not build test libraries & programs],
6502     ENABLE_TESTS=,
6503     ENABLE_TESTS=1 )
6505 if test -n "$ENABLE_TESTS"; then
6506     GTEST_HAS_RTTI=0
6507     AC_DEFINE(ENABLE_TESTS)
6508     AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6509     AC_SUBST(GTEST_HAS_RTTI)
6510     if test -n "$_WIN32_MSVC"; then
6511           AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6512     fi
6513     if test "${OS_TARGET}" = "Android"; then
6514         AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6515         AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6516         AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6517         AC_SUBST(GTEST_OS_LINUX_ANDROID)
6518         AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6519         AC_SUBST(GTEST_HAS_CLONE)
6520     fi
6523 dnl ========================================================
6524 dnl parental controls (for Windows Vista)
6525 dnl ========================================================
6526 MOZ_ARG_DISABLE_BOOL(parental-controls,
6527 [  --disable-parental-controls
6528                           Do not build parental controls],
6529    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6530    MOZ_DISABLE_PARENTAL_CONTROLS=)
6531 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6532     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6535 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6537 dnl ========================================================
6538 dnl = Disable smartcard support
6539 dnl ========================================================
6540 if test -n "$MOZ_NO_SMART_CARDS"; then
6541     AC_DEFINE(MOZ_NO_SMART_CARDS)
6543 AC_SUBST(MOZ_NO_SMART_CARDS)
6545 dnl ========================================================
6546 dnl = Disable EV certificate verification
6547 dnl ========================================================
6548 if test -n "$MOZ_NO_EV_CERTS"; then
6549     AC_DEFINE(MOZ_NO_EV_CERTS)
6551 AC_SUBST(MOZ_NO_EV_CERTS)
6553 dnl ========================================================
6554 dnl = Disable libpkix
6555 dnl ========================================================
6556 if test -n "$NSS_NO_LIBPKIX"; then
6557     AC_DEFINE(NSS_NO_LIBPKIX)
6559 AC_SUBST(NSS_NO_LIBPKIX)
6561 dnl ========================================================
6562 dnl = Sandboxing support
6563 dnl ========================================================
6564 MOZ_ARG_DISABLE_BOOL(sandbox,
6565 [  --disable-sandbox        Disable sandboxing support],
6566     MOZ_SANDBOX=,
6567     MOZ_SANDBOX=1)
6569 dnl ========================================================
6570 dnl = Content process sandboxing
6571 dnl ========================================================
6572 if test -n "$gonkdir"; then
6573     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6576 case "$OS_TARGET:$NIGHTLY_BUILD" in
6577 WINNT:*)
6578     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6579     ;;
6580 Darwin:1)
6581     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6582     ;;
6583 esac
6585 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6586 [  --enable-content-sandbox Enable sandboxing support for content-processes
6587   --disable-content-sandbox Disable sandboxing support for content-processes],
6588     MOZ_CONTENT_SANDBOX=1,
6589     MOZ_CONTENT_SANDBOX=)
6591 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
6592     AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
6595 if test -n "$MOZ_CONTENT_SANDBOX"; then
6596     AC_DEFINE(MOZ_CONTENT_SANDBOX)
6599 AC_SUBST(MOZ_CONTENT_SANDBOX)
6601 dnl ========================================================
6602 dnl = Gecko Media Plugin sandboxing
6603 dnl ========================================================
6604 case $OS_TARGET in
6605 WINNT)
6606     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6607     ;;
6608 Linux)
6609     case $CPU_ARCH in
6610     x86_64|x86)
6611         MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6612         ;;
6613     esac
6614     ;;
6615 Darwin)
6616     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6617     ;;
6618 esac
6620 if test -n "$MOZ_GMP_SANDBOX"; then
6621     AC_DEFINE(MOZ_GMP_SANDBOX)
6624 AC_SUBST(MOZ_GMP_SANDBOX)
6626 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
6627     MOZ_SANDBOX=
6630 if test -n "$MOZ_SANDBOX"; then
6631     AC_DEFINE(MOZ_SANDBOX)
6634 AC_SUBST(MOZ_SANDBOX)
6637 dnl ========================================================
6638 dnl =
6639 dnl = Module specific options
6640 dnl =
6641 dnl ========================================================
6642 MOZ_ARG_HEADER(Individual module options)
6644 dnl ========================================================
6645 dnl = Disable feed handling components
6646 dnl ========================================================
6647 MOZ_ARG_DISABLE_BOOL(feeds,
6648 [  --disable-feeds         Disable feed handling and processing components],
6649     MOZ_FEEDS=,
6650     MOZ_FEEDS=1 )
6651 if test -n "$MOZ_FEEDS"; then
6652     AC_DEFINE(MOZ_FEEDS)
6653 else
6654     if test "$MOZ_BUILD_APP" = "browser"; then
6655         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6656     fi
6659 dnl ========================================================
6660 dnl Check for sqlite
6661 dnl ========================================================
6663 MOZ_NATIVE_SQLITE=
6664 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6665 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6666 MOZ_NATIVE_SQLITE=1,
6667 MOZ_NATIVE_SQLITE= )
6669 if test -n "$MOZ_NATIVE_SQLITE"
6670 then
6671     dnl ============================
6672     dnl === SQLite Version check ===
6673     dnl ============================
6674     dnl Check to see if the system SQLite package is new enough.
6675     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6677     dnl ==================================
6678     dnl === SQLITE_SECURE_DELETE check ===
6679     dnl ==================================
6680     dnl Check to see if the system SQLite package is compiled with
6681     dnl SQLITE_SECURE_DELETE enabled.
6682     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6683     _SAVE_CFLAGS="$CFLAGS"
6684     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6685     _SAVE_LIBS="$LIBS"
6686     LIBS="$LIBS $SQLITE_LIBS"
6687     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6688         AC_TRY_RUN([
6689             #include "sqlite3.h"
6691             int main(int argc, char **argv){
6692               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6693             }],
6694             ac_cv_sqlite_secure_delete=yes,
6695             ac_cv_sqlite_secure_delete=no,
6696             ac_cv_sqlite_secure_delete=no
6697         )
6698     ])
6699     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6700     CFLAGS="$_SAVE_CFLAGS"
6701     LIBS="$_SAVE_LIBS"
6702     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6703         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6704     fi
6706     dnl ===============================
6707     dnl === SQLITE_THREADSAFE check ===
6708     dnl ===============================
6709     dnl Check to see if the system SQLite package is compiled with
6710     dnl SQLITE_THREADSAFE enabled.
6711     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6712     _SAVE_CFLAGS="$CFLAGS"
6713     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6714     _SAVE_LIBS="$LIBS"
6715     LIBS="$LIBS $SQLITE_LIBS"
6716     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6717         AC_TRY_RUN([
6718             #include "sqlite3.h"
6720             int main(int argc, char **argv){
6721               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6722             }],
6723             ac_cv_sqlite_threadsafe=yes,
6724             ac_cv_sqlite_threadsafe=no,
6725             ac_cv_sqlite_threadsafe=no
6726         )
6727     ])
6728     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6729     CFLAGS="$_SAVE_CFLAGS"
6730     LIBS="$_SAVE_LIBS"
6731     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6732         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6733     fi
6735     dnl ================================
6736     dnl === SQLITE_ENABLE_FTS3 check ===
6737     dnl ================================
6738     dnl check to see if the system SQLite package is compiled with
6739     dnl SQLITE_ENABLE_FTS3 enabled.
6740     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6741     _SAVE_CFLAGS="$CFLAGS"
6742     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6743     _SAVE_LIBS="$LIBS"
6744     LIBS="$LIBS $SQLITE_LIBS"
6745     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6746         AC_TRY_RUN([
6747             #include "sqlite3.h"
6749             int main(int argc, char **argv){
6750               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6751             }],
6752             ac_cv_sqlite_enable_fts3=yes,
6753             ac_cv_sqlite_enable_fts3=no,
6754             ac_cv_sqlite_enable_fts3=no
6755         )
6756     ])
6757     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6758     CFLAGS="$_SAVE_CFLAGS"
6759     LIBS="$_SAVE_LIBS"
6760     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6761         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6762     fi
6764     dnl =========================================
6765     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6766     dnl =========================================
6767     dnl check to see if the system SQLite package is compiled with
6768     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6769     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6770     _SAVE_CFLAGS="$CFLAGS"
6771     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6772     _SAVE_LIBS="$LIBS"
6773     LIBS="$LIBS $SQLITE_LIBS"
6774     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6775         AC_TRY_RUN([
6776             #include "sqlite3.h"
6778             int main(int argc, char **argv){
6779               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6780             }],
6781             ac_cv_sqlite_enable_unlock_notify=yes,
6782             ac_cv_sqlite_enable_unlock_notify=no,
6783             ac_cv_sqlite_enable_unlock_notify=no
6784         )
6785     ])
6786     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6787     CFLAGS="$_SAVE_CFLAGS"
6788     LIBS="$_SAVE_LIBS"
6789     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6790         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6791     fi
6794 if test -n "$MOZ_NATIVE_SQLITE"; then
6795     AC_DEFINE(MOZ_NATIVE_SQLITE)
6797 AC_SUBST(MOZ_NATIVE_SQLITE)
6799 dnl ========================================================
6800 dnl = Enable help viewer (off by default)
6801 dnl ========================================================
6802 if test -n "$MOZ_HELP_VIEWER"; then
6803      dnl Do this if defined in confvars.sh
6804      AC_DEFINE(MOZ_HELP_VIEWER)
6807 dnl ========================================================
6808 dnl = Enable safe browsing (anti-phishing)
6809 dnl ========================================================
6810 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6811 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6812     MOZ_SAFE_BROWSING=1,
6813     MOZ_SAFE_BROWSING= )
6814 if test -n "$MOZ_SAFE_BROWSING"; then
6815     AC_DEFINE(MOZ_SAFE_BROWSING)
6817 AC_SUBST(MOZ_SAFE_BROWSING)
6819 dnl ========================================================
6820 dnl = Enable url-classifier
6821 dnl ========================================================
6822 dnl Implicitly enabled by default if building with safe-browsing
6823 if test -n "$MOZ_SAFE_BROWSING"; then
6824     MOZ_URL_CLASSIFIER=1
6826 MOZ_ARG_ENABLE_BOOL(url-classifier,
6827 [  --enable-url-classifier Enable url classifier module],
6828     MOZ_URL_CLASSIFIER=1,
6829     MOZ_URL_CLASSIFIER= )
6830 if test -n "$MOZ_URL_CLASSIFIER"; then
6831     AC_DEFINE(MOZ_URL_CLASSIFIER)
6833 AC_SUBST(MOZ_URL_CLASSIFIER)
6835 dnl ========================================================
6836 dnl = Disable zipwriter
6837 dnl ========================================================
6838 MOZ_ARG_DISABLE_BOOL(zipwriter,
6839 [  --disable-zipwriter     Disable zipwriter component],
6840     MOZ_ZIPWRITER=,
6841     MOZ_ZIPWRITER=1 )
6842 AC_SUBST(MOZ_ZIPWRITER)
6844 dnl ========================================================
6845 dnl GL provider
6846 dnl ========================================================
6847 MOZ_GL_PROVIDER=
6848 MOZ_ARG_WITH_STRING(gl-provider,
6849 [  --with-gl-provider=ID
6850                           Set GL provider backend type],
6851 [ val=`echo $withval`
6852     MOZ_GL_PROVIDER="$val"])
6854 if test -n "$MOZ_GL_PROVIDER"; then
6855 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6856 AC_SUBST(MOZ_GL_PROVIDER)
6857 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6859 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6860 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6862 dnl ========================================================
6863 dnl = faststripe theme
6864 dnl ========================================================
6865 MOZ_ARG_ENABLE_BOOL(faststripe,
6866 [  --enable-faststripe     Use faststripe theme],
6867     MOZ_THEME_FASTSTRIPE=1,
6868     MOZ_THEME_FASTSTRIPE= )
6869 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6871 dnl ========================================================
6872 dnl =
6873 dnl = Feature options that require extra sources to be pulled
6874 dnl =
6875 dnl ========================================================
6876 dnl MOZ_ARG_HEADER(Features that require extra sources)
6878 dnl ========================================================
6879 dnl =
6880 dnl = Runtime debugging and Optimization Options
6881 dnl =
6882 dnl ========================================================
6883 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6885 dnl ========================================================
6886 dnl enable mobile optimizations
6887 dnl ========================================================
6888 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6889 [  --enable-mobile-optimize
6890                           Enable mobile optimizations],
6891     MOZ_GFX_OPTIMIZE_MOBILE=1)
6893 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6895 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6896     # We ignore paint will resample on mobile for performance.
6897     # We may want to revisit this later.
6898     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
6900     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6901     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
6904 dnl ========================================================
6905 dnl = Enable code optimization. ON by default.
6906 dnl ========================================================
6907 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6908     MOZ_OPTIMIZE_FLAGS="-O"
6911 MOZ_ARG_ENABLE_STRING(optimize,
6912 [  --disable-optimize      Disable compiler optimization
6913   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6914 [ if test "$enableval" != "no"; then
6915     MOZ_OPTIMIZE=1
6916     if test -n "$enableval" -a "$enableval" != "yes"; then
6917         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6918         MOZ_OPTIMIZE=2
6919     fi
6920 else
6921     MOZ_OPTIMIZE=
6922 fi ], MOZ_OPTIMIZE=1)
6924 MOZ_SET_FRAMEPTR_FLAGS
6926 if test "$COMPILE_ENVIRONMENT"; then
6927 if test -n "$MOZ_OPTIMIZE"; then
6928     AC_MSG_CHECKING([for valid optimization flags])
6929     _SAVE_CFLAGS=$CFLAGS
6930     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6931     AC_TRY_COMPILE([#include <stdio.h>],
6932         [printf("Hello World\n");],
6933         _results=yes,
6934         _results=no)
6935     AC_MSG_RESULT([$_results])
6936     if test "$_results" = "no"; then
6937         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6938     fi
6939     CFLAGS=$_SAVE_CFLAGS
6941 fi # COMPILE_ENVIRONMENT
6943 AC_SUBST(MOZ_OPTIMIZE)
6944 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6945 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6946 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6947 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6948 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6949 AC_SUBST(MOZ_PGO)
6950 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6952 dnl ========================================================
6953 dnl = Enable NS_StackWalk.
6954 dnl ========================================================
6956 # On Windows, NS_StackWalk will only work correctly if we have frame pointers
6957 # available. That will only be true for non-optimized builds, debug builds or
6958 # builds with --enable-profiling in the .mozconfig (which is turned on in
6959 # Nightly by default.)
6960 case "$OS_TARGET" in
6961 WINNT)
6962     if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
6963         MOZ_STACKWALKING=1
6964     else
6965         MOZ_STACKWALKING=
6966     fi
6967     ;;
6969     MOZ_STACKWALKING=1
6970     ;;
6971 esac
6973 if test -n "$MOZ_STACKWALKING"; then
6974     AC_DEFINE(MOZ_STACKWALKING)
6977 AC_SUBST(MOZ_STACKWALKING)
6979 dnl ========================================================
6980 dnl = Disable treating compiler warnings as errors
6981 dnl ========================================================
6982 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6983    WARNINGS_AS_ERRORS=''
6984 elif test "$GNU_CC"; then
6985     # Prevent the following GCC warnings from being treated as errors:
6986     # -Wuninitialized - too many false positives
6987     # -Wmaybe-uninitialized - too many false positives
6988     # -Wdeprecated-declarations - we don't want our builds held hostage when a
6989     #   platform-specific API becomes deprecated.
6990     MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6991     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6992     MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6993     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6994     MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6995     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6997     if test -n "$MOZ_PGO"; then
6998         MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
6999         MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
7000     fi
7003 dnl ========================================================
7004 dnl = Disable runtime logging checks
7005 dnl ========================================================
7006 MOZ_ARG_DISABLE_BOOL(logging,
7007 [  --disable-logging       Disable logging facilities],
7008     NS_DISABLE_LOGGING=1,
7009     NS_DISABLE_LOGGING= )
7010 if test "$NS_DISABLE_LOGGING"; then
7011     AC_DEFINE(NS_DISABLE_LOGGING)
7012 else
7013     AC_DEFINE(MOZ_LOGGING)
7014     AC_DEFINE(FORCE_PR_LOG)
7017 dnl ========================================================
7018 dnl = This will enable logging of addref, release, ctor, dtor.
7019 dnl ========================================================
7020 _ENABLE_LOGREFCNT=42
7021 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7022 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7023     _ENABLE_LOGREFCNT=1,
7024     _ENABLE_LOGREFCNT= )
7025 if test "$_ENABLE_LOGREFCNT" = "1"; then
7026     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7027 elif test -z "$_ENABLE_LOGREFCNT"; then
7028     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7031 dnl ========================================================
7032 dnl moz_aproximate_location
7033 dnl ========================================================
7034 MOZ_ARG_ENABLE_BOOL(approximate_location,
7035 [ --enable-approximate-location    Enable approximate location ],
7036     MOZ_APPROX_LOCATION=1,
7037     MOZ_APPROX_LOCATION= )
7038 if test -n "$MOZ_APPROX_LOCATION"; then
7039     AC_DEFINE(MOZ_APPROX_LOCATION)
7042 dnl ========================================================
7043 dnl moz_gps_debug
7044 dnl ========================================================
7045 MOZ_ARG_ENABLE_BOOL(gps_debug,
7046 [ --enable-gps-debug    Enable gps specific debug messages ],
7047     MOZ_GPS_DEBUG=1,
7048     MOZ_GPS_DEBUG= )
7049 if test -n "$MOZ_GPS_DEBUG"; then
7050     AC_DEFINE(MOZ_GPS_DEBUG)
7052 if test -n "$MOZ_DEBUG"; then
7053     AC_DEFINE(MOZ_GPS_DEBUG)
7056 dnl ========================================================
7057 dnl moz_dump_painting
7058 dnl ========================================================
7059 MOZ_ARG_ENABLE_BOOL(dump-painting,
7060 [  --enable-dump-painting          Enable paint debugging.],
7061     MOZ_DUMP_PAINTING=1,
7062     MOZ_DUMP_PAINTING= )
7063 if test -n "$MOZ_DUMP_PAINTING"; then
7064     AC_DEFINE(MOZ_DUMP_PAINTING)
7065     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7067 if test -n "$MOZ_DEBUG"; then
7068     AC_DEFINE(MOZ_DUMP_PAINTING)
7071 dnl ========================================================
7072 dnl = Enable DMD
7073 dnl ========================================================
7075 MOZ_ARG_ENABLE_BOOL(dmd,
7076 [  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc],
7077     MOZ_DMD=1,
7078     MOZ_DMD= )
7080 if test "$MOZ_DMD"; then
7081     AC_DEFINE(MOZ_DMD)
7083     if test "${CPU_ARCH}" = "arm"; then
7084         CFLAGS="$CFLAGS -funwind-tables"
7085         CXXFLAGS="$CXXFLAGS -funwind-tables"
7086     fi
7088     MOZ_MEMORY=1                        # DMD enables jemalloc
7089     MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
7091 AC_SUBST(MOZ_DMD)
7093 dnl ========================================================
7094 dnl = Enable jemalloc
7095 dnl ========================================================
7096 MOZ_ARG_ENABLE_BOOL(jemalloc,
7097 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7098     MOZ_MEMORY=1,
7099     MOZ_MEMORY=)
7101 case "${OS_TARGET}" in
7102 Android|WINNT|Darwin)
7103   MOZ_GLUE_IN_PROGRAM=
7104   ;;
7106   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
7107   MOZ_GLUE_IN_PROGRAM=1
7108   ;;
7109 esac
7111 dnl ========================================================
7112 dnl = Enable dynamic replacement of malloc implementation
7113 dnl ========================================================
7114 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
7115   # Enable on central for the debugging opportunities it adds.
7116   MOZ_REPLACE_MALLOC=1
7118 MOZ_ARG_ENABLE_BOOL(replace-malloc,
7119 [  --enable-replace-malloc   Enable ability to dynamically replace the malloc implementation],
7120     MOZ_REPLACE_MALLOC=1,
7121     MOZ_REPLACE_MALLOC= )
7123 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
7124     dnl We don't want to enable jemalloc unconditionally because it may be a
7125     dnl deliberate choice not to enable it (bug 702250, for instance)
7126     AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
7127 elif test -n "$MOZ_REPLACE_MALLOC"; then
7128     AC_DEFINE(MOZ_REPLACE_MALLOC)
7129     MOZ_NATIVE_JEMALLOC=
7131     dnl Replace-malloc Mac linkage quirks
7132     if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
7133         AC_CACHE_CHECK([how to do weak dynamic linking],
7134             ac_cv_weak_dynamic_linking,
7135             [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
7136              if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
7137                 test -s conftest${DLL_SUFFIX}; then
7138                  dnl There are several ways the linker can put link edit rules in a binary:
7139                  dnl - classic info only (for OSX < 10.6)
7140                  dnl - dyld info only
7141                  dnl - both
7142                  if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
7143                      _CLASSIC_INFO=
7144                  else
7145                      _CLASSIC_INFO=1
7146                  fi
7147                  if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
7148                      _DYLD_INFO=1
7149                  else
7150                      _DYLD_INFO=
7151                  fi
7152                  dnl With classic info, we need to build with -flat_namespace.
7153                  dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
7154                  dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
7155                  dnl forgets to set the weak flag in the dyld info.
7156                  dnl See http://glandium.org/blog/?p=2764 for more details.
7157                  dnl
7158                  dnl Values for ac_cv_weak_dynamic_linking, and subsequently
7159                  dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
7160                  dnl - "flat namespace" when -flat_namespace alone is needed
7161                  dnl - "dummy library" when a dummy library and -flat_namespace are needed
7162                  dnl - "compiler support" when nothing is needed
7163                  if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
7164                      if test -n "$_CLASSIC_INFO"; then
7165                          ac_cv_weak_dynamic_linking="flat namespace"
7166                      else
7167                          ac_cv_weak_dynamic_linking="compiler support"
7168                      fi
7169                  else
7170                      if test -n "$_DYLD_INFO"; then
7171                          ac_cv_weak_dynamic_linking="dummy library"
7172                      else
7173                          ac_cv_weak_dynamic_linking="flat namespace"
7174                      fi
7175                  fi
7176              else
7177                  AC_ERROR([couldn't compile a simple C file])
7178              fi
7179              rm -rf conftest*])
7180         MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
7181     fi
7183 AC_SUBST(MOZ_REPLACE_MALLOC)
7184 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
7186 dnl ========================================================
7187 dnl = Jemalloc build setup
7188 dnl ========================================================
7189 if test -z "$MOZ_MEMORY"; then
7190   if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
7191     MOZ_NATIVE_JEMALLOC=1
7192     AC_CHECK_FUNCS(mallctl nallocx,,
7193       [MOZ_NATIVE_JEMALLOC=
7194        break])
7195     if test -n "$MOZ_NATIVE_JEMALLOC"; then
7196       MOZ_MEMORY=1
7197       AC_DEFINE(MOZ_MEMORY)
7198       AC_DEFINE(MOZ_JEMALLOC3)
7199       AC_DEFINE(MOZ_NATIVE_JEMALLOC)
7200     fi
7201   fi
7202   case "${target}" in
7203     *-mingw*)
7204       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7205         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.])
7206       fi
7207       ;;
7208   esac
7209 else
7210   AC_DEFINE(MOZ_MEMORY)
7211   if test -n "$MOZ_JEMALLOC3"; then
7212     AC_DEFINE(MOZ_JEMALLOC3)
7213   fi
7214   if test "x$MOZ_DEBUG" = "x1"; then
7215     AC_DEFINE(MOZ_MEMORY_DEBUG)
7216   fi
7217   dnl The generic feature tests that determine how to compute ncpus are long and
7218   dnl complicated.  Therefore, simply define special cpp variables for the
7219   dnl platforms we have special knowledge of.
7220   case "${target}" in
7221   *-darwin*)
7222     AC_DEFINE(MOZ_MEMORY_DARWIN)
7223     ;;
7224   *-*freebsd*)
7225     AC_DEFINE(MOZ_MEMORY_BSD)
7226     ;;
7227   *-android*|*-linuxandroid*)
7228     AC_DEFINE(MOZ_MEMORY_LINUX)
7229     AC_DEFINE(MOZ_MEMORY_ANDROID)
7230     if test -n "$gonkdir"; then
7231       AC_DEFINE(MOZ_MEMORY_GONK)
7232     fi
7233     ;;
7234   *-*linux*)
7235     AC_DEFINE(MOZ_MEMORY_LINUX)
7236     ;;
7237   *-netbsd*)
7238     AC_DEFINE(MOZ_MEMORY_BSD)
7239     ;;
7240   *-solaris*)
7241     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7242     ;;
7243   *-mingw*)
7244     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7245     export MOZ_NO_DEBUG_RTL=1
7246     WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7247     dnl Look for a broken crtdll.obj
7248     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7249     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7250     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7251       MOZ_CRT=1
7252     fi
7253     rm crtdll.obj
7254     ;;
7255   *)
7256     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7257     ;;
7258   esac
7259 fi # MOZ_MEMORY
7260 AC_SUBST(MOZ_MEMORY)
7261 AC_SUBST(MOZ_JEMALLOC3)
7262 AC_SUBST(MOZ_NATIVE_JEMALLOC)
7263 AC_SUBST(MOZ_CRT)
7264 export MOZ_CRT
7265 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
7266 AC_SUBST_LIST(WIN32_CRT_LIBS)
7268 dnl We need to wrap dlopen and related functions on Android because we use
7269 dnl our own linker.
7270 if test "$OS_TARGET" = Android; then
7271     MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
7272     if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
7273         MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--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"
7274     fi
7275     if test "$MOZ_WIDGET_TOOLKIT" = android; then
7276         MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7277     fi
7280 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
7281 export MOZ_GLUE_WRAP_LDFLAGS
7283 dnl ========================================================
7284 dnl JS opt-mode assertions and minidump instrumentation
7285 dnl ========================================================
7286 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7287 [  --enable-js-diagnostics
7288                           Enable JS diagnostic assertions and breakpad data],
7289     JS_CRASH_DIAGNOSTICS=1,
7290     JS_CRASH_DIAGNOSTICS= )
7291 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7292     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7295 dnl ========================================================
7296 dnl = Enable static checking using gcc-dehydra
7297 dnl ========================================================
7299 MOZ_ARG_WITH_STRING(static-checking,
7300 [  --with-static-checking=path/to/gcc_dehydra.so
7301                           Enable static checking of code using GCC-dehydra],
7302     DEHYDRA_PATH=$withval,
7303     DEHYDRA_PATH= )
7305 if test -n "$DEHYDRA_PATH"; then
7306     if test ! -f "$DEHYDRA_PATH"; then
7307         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7308     fi
7309     AC_DEFINE(NS_STATIC_CHECKING)
7311 AC_SUBST(DEHYDRA_PATH)
7313 dnl ========================================================
7314 dnl = Enable using the clang plugin to build
7315 dnl ========================================================
7317 MOZ_CONFIG_CLANG_PLUGIN
7319 dnl ========================================================
7320 dnl = Enable stripping of libs & executables
7321 dnl ========================================================
7322 MOZ_ARG_ENABLE_BOOL(strip,
7323 [  --enable-strip          Enable stripping of libs & executables ],
7324     ENABLE_STRIP=1,
7325     ENABLE_STRIP= )
7327 dnl ========================================================
7328 dnl = Enable stripping of libs & executables when packaging
7329 dnl ========================================================
7330 MOZ_ARG_ENABLE_BOOL(install-strip,
7331 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7332     PKG_SKIP_STRIP= ,
7333     PKG_SKIP_STRIP=1)
7335 dnl ========================================================
7336 dnl = --disable-elf-hack
7337 dnl ========================================================
7339 USE_ELF_HACK=1
7340 MOZ_ARG_DISABLE_BOOL(elf-hack,
7341 [  --disable-elf-hack      Disable elf hacks],
7342     [USE_ELF_HACK=],
7343     [USE_ELF_HACK=1])
7345 # Only enable elfhack where supported
7346 if test "$USE_ELF_HACK" = 1; then
7347     case "${HOST_OS_ARCH},${OS_ARCH}" in
7348     Linux,Linux)
7349         case "${CPU_ARCH}" in
7350         arm | x86 | x86_64)
7351             USE_ELF_HACK=1
7352             ;;
7353         *)
7354             USE_ELF_HACK=
7355             ;;
7356         esac
7357         ;;
7358     *)
7359         USE_ELF_HACK=
7360         ;;
7361     esac
7364 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
7365     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7366     dnl memory addresses it maps to. The result is that by the time elfhack
7367     dnl kicks in, it is not possible to apply relocations because of that,
7368     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7369     dnl segment. It makes elfhack mostly useless, so considering the problems
7370     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7371     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7372     dnl the linker creates PT_GNU_RELRO segments. However, when we do want
7373     dnl elfhack enabled, disable PT_GNU_RELRO instead.
7374     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7375         LINK_WITH_PT_GNU_RELRO,
7376         [echo "int main() {return 0;}" > conftest.${ac_ext}
7377          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7378             test -s conftest${ac_exeext}; then
7379             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7380                 LINK_WITH_PT_GNU_RELRO=yes
7381             else
7382                 LINK_WITH_PT_GNU_RELRO=no
7383             fi
7384          else
7385              dnl We really don't expect to get here, but just in case
7386              AC_ERROR([couldn't compile a simple C file])
7387          fi
7388          rm -rf conftest*])
7389     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7390         if test "$USE_ELF_HACK" = F; then
7391             AC_MSG_CHECKING([for -z norelro option to ld])
7392             _SAVE_LDFLAGS=$LDFLAGS
7393             LDFLAGS="$LDFLAGS -Wl,-z,norelro"
7394             AC_TRY_LINK(,,AC_MSG_RESULT([yes])
7395                         [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
7396                         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.]))
7397             USE_ELF_HACK=1
7398         else
7399             AC_MSG_WARN([Disabling elfhack])
7400             USE_ELF_HACK=
7401         fi
7402     fi
7405 dnl ========================================================
7406 dnl = libstdc++ compatibility hacks
7407 dnl ========================================================
7409 STDCXX_COMPAT=
7410 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7411 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7412     STDCXX_COMPAT=1)
7414 if test -n "$STDCXX_COMPAT"; then
7415    eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7416    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7417    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7420 dnl ========================================================
7421 dnl =
7422 dnl = Profiling and Instrumenting
7423 dnl =
7424 dnl ========================================================
7425 MOZ_ARG_HEADER(Profiling and Instrumenting)
7427 dnl ========================================================
7428 dnl = Enable runtime visual profiling logger
7429 dnl ========================================================
7430 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7431 [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
7432     MOZ_VISUAL_EVENT_TRACER=1,
7433     MOZ_VISUAL_EVENT_TRACER=)
7434 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7435     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7438 dnl ========================================================
7439 dnl = Enable TaskTracer
7440 dnl ========================================================
7441 MOZ_ARG_ENABLE_BOOL(tasktracer,
7442 [  --enable-tasktracer       Set compile flags necessary for using TaskTracer],
7443     MOZ_TASK_TRACER=1,
7444     MOZ_TASK_TRACER= )
7445 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7446     AC_DEFINE(MOZ_TASK_TRACER)
7447     AC_SUBST(MOZ_TASK_TRACER)
7450 dnl ========================================================
7451 dnl Turn on reflow counting
7452 dnl ========================================================
7453 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7454 [  --enable-reflow-perf    Enable reflow performance tracing],
7455     MOZ_REFLOW_PERF=1,
7456     MOZ_REFLOW_PERF= )
7457 if test -n "$MOZ_REFLOW_PERF"; then
7458     AC_DEFINE(MOZ_REFLOW_PERF)
7461 dnl ========================================================
7462 dnl = Offer a way to disable the startup cache
7463 dnl ========================================================
7465 MOZ_ARG_DISABLE_BOOL(startupcache,
7466 [  --disable-startupcache          Disable startup cache ],
7467     MOZ_DISABLE_STARTUPCACHE=1,
7468     MOZ_DISABLE_STARTUPCACHE=)
7470 dnl bug 988880: disable startup cache on b2g
7471 if test -n "$MOZ_B2G"; then
7472   MOZ_DISABLE_STARTUPCACHE=1
7474 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
7475   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
7477 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7479 dnl ========================================================
7480 dnl = Enable Radio Interface for B2G (Gonk usually)
7481 dnl ========================================================
7482 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7483 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7484     MOZ_B2G_RIL=1,
7485     MOZ_B2G_RIL=,
7486     MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7487 if test -n "$MOZ_B2G_RIL"; then
7488     if test -n "$_PLATFORM_HAVE_RIL"; then
7489         AC_DEFINE(MOZ_B2G_RIL)
7490     else
7491         AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7492     fi
7494 AC_SUBST(MOZ_B2G_RIL)
7496 dnl ========================================================
7497 dnl = Enable Radio FM for B2G (Gonk usually)
7498 dnl ========================================================
7499 if test -n "$MOZ_B2G_FM"; then
7500     AC_DEFINE(MOZ_B2G_FM)
7502 AC_SUBST(MOZ_B2G_FM)
7504 dnl ========================================================
7505 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7506 dnl ========================================================
7507 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7508 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7509     MOZ_B2G_BT=1,
7510     MOZ_B2G_BT= )
7511 if test -n "$MOZ_B2G_BT"; then
7512     AC_DEFINE(MOZ_B2G_BT)
7514 AC_SUBST(MOZ_B2G_BT)
7515 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7516 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7517 AC_SUBST(MOZ_B2G_BT_DAEMON)
7519 dnl ========================================================
7520 dnl = Enable NFC Interface for B2G (Gonk usually)
7521 dnl ========================================================
7522 MOZ_ARG_ENABLE_BOOL(nfc,
7523 [  --enable-nfc         Set compile flags necessary for compiling NFC API ],
7524     MOZ_NFC=1,
7525     MOZ_NFC= )
7526 if test -n "$MOZ_NFC"; then
7527    AC_DEFINE(MOZ_NFC)
7529 AC_SUBST(MOZ_NFC)
7531 dnl ========================================================
7532 dnl = Enable Pico Speech Synthesis (Gonk usually)
7533 dnl ========================================================
7534 MOZ_ARG_ENABLE_BOOL(synth-pico,
7535 [  --enable-synth-pico  Set compile flags necessary for compiling Pico Web Speech API ],
7536     MOZ_SYNTH_PICO=1,
7537     MOZ_SYNTH_PICO= )
7538 if test -n "$MOZ_SYNTH_PICO"; then
7539     AC_DEFINE(MOZ_SYNTH_PICO)
7541 AC_SUBST(MOZ_SYNTH_PICO)
7543 dnl ========================================================
7544 dnl = Enable Support for Time Manager API
7545 dnl ========================================================
7546 if test -n "$MOZ_TIME_MANAGER"; then
7547     AC_DEFINE(MOZ_TIME_MANAGER)
7549 AC_SUBST(MOZ_TIME_MANAGER)
7551 dnl ========================================================
7552 dnl = Enable Camera Interface for B2G (Gonk usually)
7553 dnl ========================================================
7554 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7555 [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
7556     MOZ_B2G_CAMERA=1,
7557     MOZ_B2G_CAMERA= )
7558 if test -n "$MOZ_B2G_CAMERA"; then
7559    AC_DEFINE(MOZ_B2G_CAMERA)
7561 AC_SUBST(MOZ_B2G_CAMERA)
7563 dnl ========================================================
7564 dnl = Enable Support for Payment API
7565 dnl ========================================================
7566 if test -n "$MOZ_PAY"; then
7567     AC_DEFINE(MOZ_PAY)
7569 AC_SUBST(MOZ_PAY)
7571 dnl ========================================================
7572 dnl = Enable Browser Support for Activities
7573 dnl ========================================================
7574 if test -n "$MOZ_ACTIVITIES"; then
7575     AC_DEFINE(MOZ_ACTIVITIES)
7577 AC_SUBST(MOZ_ACTIVITIES)
7579 dnl ========================================================
7580 dnl = Enable Support for AudioChannelManager API
7581 dnl ========================================================
7582 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7583     AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7585 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7587 dnl ========================================================
7588 dnl = Enable Support for Secure Element API
7589 dnl ========================================================
7590    MOZ_SECUREELEMENT=1,
7591 if test -n "$MOZ_SECUREELEMENT"; then
7592    AC_DEFINE(MOZ_SECUREELEMENT)
7594  AC_SUBST(MOZ_SECUREELEMENT)
7596 dnl ========================================================
7597 dnl = Support for demangling undefined symbols
7598 dnl ========================================================
7599 if test -z "$SKIP_LIBRARY_CHECKS"; then
7600     AC_LANG_SAVE
7601     AC_LANG_CPLUSPLUS
7602     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7603     AC_LANG_RESTORE
7606 # Demangle only for debug or DMD builds
7607 MOZ_DEMANGLE_SYMBOLS=
7608 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
7609     MOZ_DEMANGLE_SYMBOLS=1
7610     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7612 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7614 dnl ========================================================
7615 dnl = Support for gcc stack unwinding (from gcc 3.3)
7616 dnl ========================================================
7617 if test -z "$SKIP_LIBRARY_CHECKS"; then
7618     AC_LANG_SAVE
7619     AC_LANG_CPLUSPLUS
7620     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7621     AC_LANG_RESTORE
7624 dnl ========================================================
7625 dnl JIT observers
7626 dnl ========================================================
7628 MOZ_ARG_WITH_STRING(jitreport-granularity,
7629 [  --jitreport-granularity=N
7630                            Default granularity at which to report JIT code
7631                            to external tools
7632                              0 - no info
7633                              1 - code ranges for whole functions only
7634                              2 - per-line information
7635                              3 - per-op information],
7636   JITREPORT_GRANULARITY=$withval,
7637   JITREPORT_GRANULARITY=3)
7639 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7641 dnl ========================================================
7642 dnl = Disable Mozilla's versions of RIL and Geolocation
7643 dnl ========================================================
7644 MOZ_ARG_DISABLE_BOOL(mozril-geoloc,
7645 [  --disable-mozril-geoloc         Disable Mozilla's RIL and geolocation],
7646     DISABLE_MOZ_RIL_GEOLOC=1,
7647     DISABLE_MOZ_RIL_GEOLOC= )
7648 if test -n "$DISABLE_MOZ_RIL_GEOLOC"; then
7649    AC_DEFINE(DISABLE_MOZ_RIL_GEOLOC)
7651 AC_SUBST(DISABLE_MOZ_RIL_GEOLOC)
7653 dnl ========================================================
7654 dnl =
7655 dnl = Misc. Options
7656 dnl =
7657 dnl ========================================================
7658 MOZ_ARG_HEADER(Misc. Options)
7660 dnl ========================================================
7661 dnl update xterm title
7662 dnl ========================================================
7663 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7664 [  --enable-xterm-updates  Update XTERM titles with current command.],
7665     MOZ_UPDATE_XTERM=1,
7666     MOZ_UPDATE_XTERM= )
7668 dnl =========================================================
7669 dnl = Chrome format
7670 dnl =========================================================
7671 MOZ_ARG_ENABLE_STRING([chrome-format],
7672 [  --enable-chrome-format=jar|flat|omni
7673                           Select FORMAT of chrome files during packaging],
7674     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7676 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7677     MOZ_CHROME_FILE_FORMAT=jar
7680 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7681     AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7684 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7685     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7686     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7687     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7690 dnl =========================================================
7691 dnl Enable support for revamped devtools Performance Tools
7692 dnl =========================================================
7694 MOZ_ARG_ENABLE_BOOL(devtools-perf,
7695 [  --enable-devtools-perf Set compile flags necessary for compiling devtools perftools],
7696 MOZ_DEVTOOLS_PERFTOOLS=1,
7697 MOZ_DEVTOOLS_PERFTOOLS= )
7698 if test -n "$MOZ_DEVTOOLS_PERFTOOLS"; then
7699   AC_DEFINE(MOZ_DEVTOOLS_PERFTOOLS)
7701 AC_SUBST(MOZ_DEVTOOLS_PERFTOOLS)
7703 dnl =========================================================
7704 dnl Omnijar packaging (bug 552121)
7705 dnl =========================================================
7706 dnl Omnijar packaging is compatible with flat packaging.
7707 dnl In unpackaged builds, omnijar looks for files as if
7708 dnl things were flat packaged. After packaging, all files
7709 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7710 dnl is set to flat since putting files into jars is only
7711 dnl done during packaging with omnijar.
7712 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7713     MOZ_OMNIJAR=1
7714     AC_DEFINE(MOZ_OMNIJAR)
7716 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7717 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7718     MOZ_CHROME_FILE_FORMAT=flat
7719 else
7720     MOZ_CHROME_FILE_FORMAT=symlink
7723 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7724     dnl Fennec's static resources live in the assets/ folder of the
7725     dnl APK.  Adding a path to the name here works because we only
7726     dnl have one omnijar file in the final package (which is not the
7727     dnl case on desktop), and necessitates some contortions during
7728     dnl packaging so that the resources in the omnijar are considered
7729     dnl as rooted at / and not as rooted at assets/ (which again is
7730     dnl not the case on desktop: there are omnijars rooted at webrtc/,
7731     dnl etc). packager.mk handles changing the rooting of the single
7732     dnl omnijar.
7733     OMNIJAR_NAME=assets/omni.ja
7734 else
7735     OMNIJAR_NAME=omni.ja
7738 AC_SUBST(OMNIJAR_NAME)
7739 AC_SUBST(MOZ_OMNIJAR)
7740 AC_SUBST(MOZ_PACKAGER_FORMAT)
7742 dnl ========================================================
7743 dnl = Define default location for MOZILLA_FIVE_HOME
7744 dnl ========================================================
7745 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7746 [  --with-default-mozilla-five-home
7747                           Set the default value for MOZILLA_FIVE_HOME],
7748 [ val=`echo $withval`
7749   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7751 dnl ========================================================
7752 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7753 dnl ========================================================
7754 MOZ_ARG_WITH_STRING(user-appdir,
7755 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7756 [ val=`echo $withval`
7757 if echo "$val" | grep "\/" >/dev/null; then
7758     AC_MSG_ERROR("Homedir must be single relative path.")
7759 else
7760     MOZ_USER_DIR="$val"
7761 fi])
7763 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7765 dnl ========================================================
7766 dnl = Doxygen configuration
7767 dnl ========================================================
7768 dnl Use commas to specify multiple dirs to this arg
7769 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7770 MOZ_ARG_WITH_STRING(doc-input-dirs,
7771 [  --with-doc-input-dirs=DIRS
7772                           Header/idl dirs to create docs from],
7773 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7774 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7776 dnl Use commas to specify multiple dirs to this arg
7777 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7778 MOZ_ARG_WITH_STRING(doc-include-dirs,
7779 [  --with-doc-include-dirs=DIRS
7780                           Include dirs to preprocess doc headers],
7781 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7782 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7784 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7785 MOZ_ARG_WITH_STRING(doc-output-dir,
7786 [  --with-doc-output-dir=DIR
7787                           Dir to generate docs into],
7788 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7789 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7791 if test -z "$SKIP_COMPILER_CHECKS"; then
7792 dnl ========================================================
7793 dnl =
7794 dnl = Compiler Options
7795 dnl =
7796 dnl ========================================================
7797 MOZ_ARG_HEADER(Compiler Options)
7799 dnl ========================================================
7800 dnl Check for gcc -pipe support
7801 dnl ========================================================
7802 AC_MSG_CHECKING([for -pipe support])
7803 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7804     dnl Any gcc that supports firefox supports -pipe.
7805     CFLAGS="$CFLAGS -pipe"
7806     CXXFLAGS="$CXXFLAGS -pipe"
7807     AC_MSG_RESULT([yes])
7808 else
7809     AC_MSG_RESULT([no])
7812 dnl ========================================================
7813 dnl Profile guided optimization (gcc checks)
7814 dnl ========================================================
7815 dnl Test for profiling options
7816 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7818 _SAVE_CFLAGS="$CFLAGS"
7819 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7821 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7822 AC_TRY_COMPILE([], [return 0;],
7823                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7824                  result="yes" ], result="no")
7825 AC_MSG_RESULT([$result])
7827 if test $result = "yes"; then
7828   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7829   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7830   PROFILE_USE_LDFLAGS="-fprofile-use"
7833 CFLAGS="$_SAVE_CFLAGS"
7835 if test -n "$INTEL_CC"; then
7836   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7837   PROFILE_GEN_LDFLAGS=
7838   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7839   PROFILE_USE_LDFLAGS=
7842 dnl Sun Studio on Solaris
7843 if test "$SOLARIS_SUNPRO_CC"; then
7844   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7845   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7846   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7847   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7850 AC_SUBST(PROFILE_GEN_CFLAGS)
7851 AC_SUBST(PROFILE_GEN_LDFLAGS)
7852 AC_SUBST(PROFILE_USE_CFLAGS)
7853 AC_SUBST(PROFILE_USE_LDFLAGS)
7855 dnl =============================================
7856 dnl Support for -fno-integrated-as (recent clang)
7857 dnl =============================================
7858 dnl Under clang 3.4+, use -fno-integrated-as to
7859 dnl build libvpx's vp8_asm_enc_offsets.c
7861 _SAVE_CFLAGS="$CFLAGS"
7862 CFLAGS="$CFLAGS -fno-integrated-as -S"
7864 AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
7865 AC_TRY_COMPILE([], [return 0;],
7866                [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
7867                  result="yes" ], result="no")
7868 AC_MSG_RESULT([$result])
7870 CFLAGS="$_SAVE_CFLAGS"
7872 AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
7874 fi # ! SKIP_COMPILER_CHECKS
7876 AC_DEFINE(CPP_THROW_NEW, [throw()])
7877 AC_LANG_C
7879 if test "$COMPILE_ENVIRONMENT"; then
7880 MOZ_EXPAND_LIBS
7881 fi # COMPILE_ENVIRONMENT
7883 dnl ========================================================
7884 dnl =
7885 dnl = Build depencency options
7886 dnl =
7887 dnl ========================================================
7888 MOZ_ARG_HEADER(Build dependencies)
7890 if test "$GNU_CC" -a "$GNU_CXX"; then
7891   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7892 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7893 elif test "$SOLARIS_SUNPRO_CC"; then
7894   _DEPEND_CFLAGS=
7895 else
7896   dnl Don't override this for MSVC
7897   if test -z "$_WIN32_MSVC"; then
7898     _USE_CPP_INCLUDE_FLAG=
7899     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7900     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7901   else
7902     echo '#include <stdio.h>' > dummy-hello.c
7903     changequote(,)
7904     dnl This output is localized, split at the first double space or colon and space.
7905     _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
7906     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7907     _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7908     changequote([,])
7909     if ! test -e "$_CL_STDIO_PATH"; then
7910         AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7911     fi
7912     if test -z "$CL_INCLUDES_PREFIX"; then
7913         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7914     fi
7915     AC_SUBST(CL_INCLUDES_PREFIX)
7916     rm -f dummy-hello.c
7918     dnl Make sure that the build system can handle non-ASCII characters
7919     dnl in environment variables to prevent it from breaking silently on
7920     dnl non-English systems.
7921     NONASCII=$'\241\241'
7922     AC_SUBST(NONASCII)
7923   fi
7926 dnl ========================================================
7927 dnl =
7928 dnl = Static Build Options
7929 dnl =
7930 dnl ========================================================
7931 MOZ_ARG_HEADER(Static build options)
7933 if test -n "$GKMEDIAS_SHARED_LIBRARY"; then
7934   AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7936 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7938 if test -z "$MOZ_NATIVE_ZLIB"; then
7939 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7940   ZLIB_IN_MOZGLUE=1
7941   AC_DEFINE(ZLIB_IN_MOZGLUE)
7945 AC_SUBST(ZLIB_IN_MOZGLUE)
7947 dnl ========================================================
7948 dnl =
7949 dnl = Standalone module options
7950 dnl =
7951 dnl ========================================================
7952 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7954 dnl Check for GLib.
7955 dnl ========================================================
7957 if test -z "$SKIP_PATH_CHECKS"; then
7958 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7959     if test "$MOZ_ENABLE_GTK" ; then
7960         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7961     fi
7965 if test -z "${GLIB_GMODULE_LIBS}" \
7966    -a -n "${GLIB_CONFIG}"\
7967     -a "${GLIB_CONFIG}" != no\
7968 ; then
7969     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7972 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
7974 dnl ========================================================
7975 dnl Graphics checks.
7976 dnl ========================================================
7978 if test "${OS_TARGET}" = "WINNT" -o \
7979         "${OS_ARCH}" = "Darwin" -o \
7980         "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7981         "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7982         "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7983         "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7984     case "${target_cpu}" in
7985     i*86*|x86_64|arm)
7986         MOZ_ENABLE_SKIA=1
7987         ;;
7988     *)
7989         MOZ_ENABLE_SKIA=
7990         ;;
7991     esac
7992 else
7993 MOZ_ENABLE_SKIA=
7996 MOZ_ARG_ENABLE_BOOL(skia,
7997 [  --enable-skia   Enable use of Skia],
7998 MOZ_ENABLE_SKIA=1,
7999 MOZ_ENABLE_SKIA=)
8001 MOZ_ARG_DISABLE_BOOL(skia-gpu,
8002 [  --disable-skia-gpu  Disable use of Skia-GPU],
8003 MOZ_DISABLE_SKIA_GPU=1,
8004 MOZ_DISABLE_SKIA_GPU=)
8006 if test "$USE_FC_FREETYPE"; then
8007     if test "$COMPILE_ENVIRONMENT"; then
8008         dnl ========================================================
8009         dnl = Check for freetype2 and its functionality
8010         dnl ========================================================
8011         PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
8013         if test "$_HAVE_FREETYPE2"; then
8014             _SAVE_LIBS="$LIBS"
8015             _SAVE_CFLAGS="$CFLAGS"
8016             LIBS="$LIBS $FT2_LIBS"
8017             CFLAGS="$CFLAGS $FT2_CFLAGS"
8019             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
8020                 ac_cv_member_FT_Bitmap_Size_y_ppem,
8021                 [AC_TRY_COMPILE([#include <ft2build.h>
8022                                  #include FT_FREETYPE_H],
8023                                 [FT_Bitmap_Size s;
8024                                  if (sizeof s.y_ppem) return 0;
8025                                  return 1],
8026                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
8027                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
8028             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
8029                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
8030             else
8031                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
8032             fi
8033             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
8034                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
8035                                [FT_Bitmap_Size structure includes y_ppem field])
8037             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
8039             LIBS="$_SAVE_LIBS"
8040             CFLAGS="$_SAVE_CFLAGS"
8041         fi
8043         _SAVE_CPPFLAGS="$CPPFLAGS"
8044         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8045         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8046             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8047         CPPFLAGS="$_SAVE_CPPFLAGS"
8048     else
8049         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8050     fi
8052     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
8053     [
8054         if test "$MOZ_PANGO"; then
8055             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
8056             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
8057         else
8058             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
8059             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
8060         fi
8061     ])
8064 dnl ========================================================
8065 dnl Check for pixman and cairo
8066 dnl ========================================================
8068 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
8069   # cairo-gtk3 can be build with system-cairo only
8070   MOZ_TREE_CAIRO=
8071 else
8072   MOZ_TREE_CAIRO=1
8075 MOZ_ARG_ENABLE_BOOL(system-cairo,
8076 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8077 MOZ_TREE_CAIRO=,
8078 MOZ_TREE_CAIRO=1 )
8080 MOZ_TREE_PIXMAN=1
8081 MOZ_ARG_ENABLE_BOOL(system-pixman,
8082 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8083 MOZ_TREE_PIXMAN=,
8084 MOZ_TREE_PIXMAN=force,
8085 MOZ_TREE_PIXMAN=1 )
8087 # System cairo depends on system pixman
8088 if test "$MOZ_TREE_PIXMAN" = "force"; then
8089     if test -z "$MOZ_TREE_CAIRO"; then
8090         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
8091     else
8092         MOZ_TREE_PIXMAN=1
8093     fi
8094 elif test -z "$MOZ_TREE_CAIRO"; then
8095     MOZ_TREE_PIXMAN=
8098 if test "$MOZ_TREE_PIXMAN"; then
8099     AC_DEFINE(MOZ_TREE_PIXMAN)
8100 else
8101     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8102     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
8103     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
8105 AC_SUBST(MOZ_PIXMAN_CFLAGS)
8106 AC_SUBST_LIST(MOZ_PIXMAN_LIBS)
8108 # Check for headers defining standard int types.
8109 if test -n "$COMPILE_ENVIRONMENT"; then
8110     MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8112     if test "${ac_cv_header_inttypes_h}" = "yes"; then
8113         HAVE_INTTYPES_H=1
8114     fi
8117 AC_SUBST(HAVE_INTTYPES_H)
8119 if test "$MOZ_TREE_CAIRO"; then
8120     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8121     AC_DEFINE(MOZ_TREE_CAIRO)
8123     if test "$OS_ARCH" = "WINNT"; then
8124         # For now we assume that we will have a uint64_t available through
8125         # one of the above headers or mozstdint.h.
8126         AC_DEFINE(HAVE_UINT64_T)
8127     fi
8129     # Define macros for cairo-features.h
8130     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8131     if test "$MOZ_X11"; then
8132         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8133         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8134         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8135     fi
8136     if test "$_HAVE_FREETYPE2"; then
8137         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8138         MOZ_ENABLE_CAIRO_FT=1
8139         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8140     fi
8142     case "$MOZ_WIDGET_TOOLKIT" in
8143       qt)
8144         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8145         ;;
8146       cocoa | uikit)
8147         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8148         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8149         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8150         ;;
8151       windows)
8152         WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8153         WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8154         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8155         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8156         MOZ_ENABLE_D2D_SURFACE=1
8157         MOZ_ENABLE_DWRITE_FONT=1
8159         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8161         dnl D3D10 Layers depend on D2D Surfaces.
8162         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8163           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8164         fi
8165         ;;
8166       gtk3)
8167         AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
8168         ;;
8169     esac
8170     if test "$USE_FC_FREETYPE"; then
8171         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8172     fi
8173     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8174     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8175     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8176     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8177     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8179     AC_SUBST(PS_SURFACE_FEATURE)
8180     AC_SUBST(PDF_SURFACE_FEATURE)
8181     AC_SUBST(SVG_SURFACE_FEATURE)
8182     AC_SUBST(XLIB_SURFACE_FEATURE)
8183     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8184     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8185     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8186     AC_SUBST(WIN32_SURFACE_FEATURE)
8187     AC_SUBST(OS2_SURFACE_FEATURE)
8188     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8189     AC_SUBST(FT_FONT_FEATURE)
8190     AC_SUBST(FC_FONT_FEATURE)
8191     AC_SUBST(WIN32_FONT_FEATURE)
8192     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8193     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8194     AC_SUBST(QUARTZ_FONT_FEATURE)
8195     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8196     AC_SUBST(QT_SURFACE_FEATURE)
8197     AC_SUBST(TEE_SURFACE_FEATURE)
8199     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8201     if test "$MOZ_X11"; then
8202         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
8203     fi
8205     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8206 else
8207     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
8208     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
8209     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
8210     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8211     if test "$MOZ_X11"; then
8212         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8213         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8214         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
8215         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8216     fi
8219 AC_SUBST(MOZ_TREE_CAIRO)
8220 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
8221 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
8222 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
8223 AC_SUBST(MOZ_TREE_PIXMAN)
8225 dnl ========================================================
8226 dnl Skia
8227 dnl ========================================================
8228 if test "$MOZ_ENABLE_SKIA"; then
8229   AC_DEFINE(MOZ_ENABLE_SKIA)
8230   AC_DEFINE(USE_SKIA)
8231   if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
8232     AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
8233   fi
8235   if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
8236     MOZ_ENABLE_SKIA_GPU=1
8237     AC_DEFINE(USE_SKIA_GPU)
8238     AC_SUBST(MOZ_ENABLE_SKIA_GPU)
8239   fi
8241 AC_SUBST(MOZ_ENABLE_SKIA)
8243 dnl ========================================================
8244 dnl disable xul
8245 dnl ========================================================
8246 MOZ_ARG_DISABLE_BOOL(xul,
8247 [  --disable-xul           Disable XUL],
8248     MOZ_XUL= )
8249 if test "$MOZ_XUL"; then
8250   AC_DEFINE(MOZ_XUL)
8251 else
8252   dnl remove extensions that require XUL
8253   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
8256 AC_SUBST(MOZ_XUL)
8258 dnl ========================================================
8259 dnl disable profile locking
8260 dnl   do no use this in applications that can have more than
8261 dnl   one process accessing the profile directory.
8262 dnl ========================================================
8263 MOZ_ARG_DISABLE_BOOL(profilelocking,
8264 [  --disable-profilelocking
8265                           Disable profile locking],
8266     MOZ_PROFILELOCKING=,
8267     MOZ_PROFILELOCKING=1 )
8268 if test "$MOZ_PROFILELOCKING"; then
8269   AC_DEFINE(MOZ_PROFILELOCKING)
8272 dnl ========================================================
8273 dnl necko configuration options
8274 dnl ========================================================
8277 dnl option to disable various necko protocols
8279 MOZ_ARG_ENABLE_STRING(necko-protocols,
8280 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8281                           Enable/disable specific protocol handlers],
8282 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8283     if test "$option" = "yes" -o "$option" = "all"; then
8284         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8285     elif test "$option" = "no" -o "$option" = "none"; then
8286         NECKO_PROTOCOLS=""
8287     elif test "$option" = "default"; then
8288         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8289     elif test `echo "$option" | grep -c \^-` != 0; then
8290         option=`echo $option | sed 's/^-//'`
8291         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8292     else
8293         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8294     fi
8295 done],
8296     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8297 dnl Remove dupes
8298 NECKO_PROTOCOLS=`$PYTHON ${srcdir}/build/unix/uniq.py ${NECKO_PROTOCOLS}`
8299 AC_SUBST_SET(NECKO_PROTOCOLS)
8300 for p in $NECKO_PROTOCOLS; do
8301     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8302     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
8303 done
8306 dnl option to disable necko's wifi scanner
8309 case "$OS_TARGET" in
8310   Android)
8311     if test -n "$gonkdir"; then
8312       NECKO_WIFI=1
8313     fi
8314     ;;
8315   Darwin|DragonFly|FreeBSD|SunOS|WINNT)
8316     NECKO_WIFI=1
8317     ;;
8318   Linux)
8319     NECKO_WIFI=1
8320     NECKO_WIFI_DBUS=1
8321     ;;
8322 esac
8324 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8325 [  --disable-necko-wifi    Disable necko wifi scanner],
8326     NECKO_WIFI=,
8327     NECKO_WIFI=1)
8329 if test "$NECKO_WIFI"; then
8330   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
8331     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
8332   fi
8333   AC_DEFINE(NECKO_WIFI)
8334   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
8336 AC_SUBST(NECKO_WIFI)
8337 AC_SUBST(NECKO_WIFI_DBUS)
8340 dnl option to disable cookies
8342 MOZ_ARG_DISABLE_BOOL(cookies,
8343 [  --disable-cookies       Disable cookie support],
8344     NECKO_COOKIES=,
8345     NECKO_COOKIES=1)
8346 AC_SUBST(NECKO_COOKIES)
8347 if test "$NECKO_COOKIES"; then
8348     AC_DEFINE(NECKO_COOKIES)
8349     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
8353 dnl Always build Marionette if not Android or B2G
8355 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
8356     AC_DEFINE(ENABLE_MARIONETTE)
8358 AC_SUBST(ENABLE_MARIONETTE)
8359 if test "$ENABLE_MARIONETTE"; then
8360     AC_DEFINE(ENABLE_MARIONETTE)
8364 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8366 MOZ_ARG_DISABLE_BOOL(ctypes,
8367 [  --disable-ctypes        Disable js-ctypes],
8368     BUILD_CTYPES=,
8369     BUILD_CTYPES=1)
8370 AC_SUBST(BUILD_CTYPES)
8371 if test "$BUILD_CTYPES"; then
8372     AC_DEFINE(BUILD_CTYPES)
8375 dnl Build Places if required
8376 if test "$MOZ_PLACES"; then
8377   AC_DEFINE(MOZ_PLACES)
8380 dnl Build SocialAPI if required
8381 if test "$MOZ_SOCIAL"; then
8382   AC_DEFINE(MOZ_SOCIAL)
8385 dnl Build Common JS modules provided by services.
8386 AC_SUBST(MOZ_SERVICES_COMMON)
8387 if test -n "$MOZ_SERVICES_COMMON"; then
8388   AC_DEFINE(MOZ_SERVICES_COMMON)
8391 dnl Build Services crypto component (used by Sync)
8392 AC_SUBST(MOZ_SERVICES_CRYPTO)
8393 if test -n "$MOZ_SERVICES_CRYPTO"; then
8394   AC_DEFINE(MOZ_SERVICES_CRYPTO)
8397 dnl Build Firefox Health Reporter Service
8398 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8399 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8400   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8403 dnl Build Services metrics component
8404 AC_SUBST(MOZ_SERVICES_METRICS)
8405 if test -n "$MOZ_SERVICES_METRICS"; then
8406   AC_DEFINE(MOZ_SERVICES_METRICS)
8409 dnl Build Notifications if required
8410 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8411 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8412   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8415 dnl Build Sync Services if required
8416 AC_SUBST(MOZ_SERVICES_SYNC)
8417 if test -n "$MOZ_SERVICES_SYNC"; then
8418   AC_DEFINE(MOZ_SERVICES_SYNC)
8421 dnl Build Services/CloudSync if required
8422 AC_SUBST(MOZ_SERVICES_CLOUDSYNC)
8423 if test -n "$MOZ_SERVICES_CLOUDSYNC"; then
8424   AC_DEFINE(MOZ_SERVICES_CLOUDSYNC)
8427 dnl Build Captive Portal Detector if required
8428 AC_SUBST(MOZ_CAPTIVEDETECT)
8429 if test -n "$MOZ_CAPTIVEDETECT"; then
8430   AC_DEFINE(MOZ_CAPTIVEDETECT)
8433 dnl Build second screen and casting features for external devices if required
8434 AC_SUBST(MOZ_DEVICES)
8435 if test -n "$MOZ_DEVICES"; then
8436   AC_DEFINE(MOZ_DEVICES)
8439 dnl ========================================================
8440 if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
8441     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8444 dnl ========================================================
8445 dnl =
8446 dnl = Maintainer debug option (no --enable equivalent)
8447 dnl =
8448 dnl ========================================================
8450 AC_SUBST(AR)
8451 AC_SUBST(AR_FLAGS)
8452 AC_SUBST(AR_LIST)
8453 AC_SUBST(AR_EXTRACT)
8454 AC_SUBST(AR_DELETE)
8455 AC_SUBST(AS)
8456 AC_SUBST(ASFLAGS)
8457 AC_SUBST(AS_DASH_C_FLAG)
8458 AC_SUBST(LD)
8459 AC_SUBST(RC)
8460 AC_SUBST(RCFLAGS)
8461 AC_SUBST(MC)
8462 AC_SUBST(WINDRES)
8463 AC_SUBST(IMPLIB)
8464 AC_SUBST(FILTER)
8465 AC_SUBST(BIN_FLAGS)
8466 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8467 AC_SUBST(MOZ_UPDATE_XTERM)
8468 AC_SUBST(MOZ_AUTH_EXTENSION)
8469 AC_SUBST(MOZ_PREF_EXTENSIONS)
8470 AC_SUBST(MOZ_DEBUG)
8471 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8472 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8473 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8474 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8475 AC_SUBST(WARNINGS_AS_ERRORS)
8476 AC_SUBST(MOZ_EXTENSIONS)
8477 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8478 AC_SUBST(MOZ_JPROF)
8479 AC_SUBST(MOZ_SHARK)
8480 AC_SUBST(MOZ_INSTRUMENTS)
8481 AC_SUBST(MOZ_CALLGRIND)
8482 AC_SUBST(MOZ_VTUNE)
8483 AC_SUBST(MOZ_PROFILING)
8484 AC_SUBST(LIBICONV)
8485 AC_SUBST(MOZ_PLACES)
8486 AC_SUBST(MOZ_SOCIAL)
8487 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8488 AC_SUBST(MOZ_FEEDS)
8489 AC_SUBST(NS_PRINTING)
8490 AC_SUBST(MOZ_HELP_VIEWER)
8491 AC_SUBST(TOOLCHAIN_PREFIX)
8493 AC_SUBST(JAVA)
8494 AC_SUBST(JAVAC)
8495 AC_SUBST(JAVAH)
8496 AC_SUBST(JAR)
8497 AC_SUBST(JARSIGNER)
8498 AC_SUBST(KEYTOOL)
8500 AC_SUBST(MOZ_PROFILELOCKING)
8502 AC_SUBST(ENABLE_TESTS)
8503 AC_SUBST(MOZ_UNIVERSALCHARDET)
8504 AC_SUBST(ACCESSIBILITY)
8505 AC_SUBST(MOZ_SPELLCHECK)
8506 AC_SUBST(MOZ_ANDROID_APZ)
8507 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8508 AC_SUBST(MOZ_CRASHREPORTER)
8509 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
8510 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
8511 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8512 AC_SUBST(MOZ_STUB_INSTALLER)
8513 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8514 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8515 AC_SUBST(MOZ_UPDATER)
8517 AC_SUBST(MOZ_ANGLE_RENDERER)
8518 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8519 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8520 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8521 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8522 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8523 AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
8524 AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
8526 AC_SUBST(MOZ_METRO)
8528 AC_SUBST(MOZ_ANDROID_HISTORY)
8529 AC_SUBST(MOZ_WEBSMS_BACKEND)
8530 AC_SUBST(MOZ_ANDROID_BEAM)
8531 AC_SUBST(MOZ_LOCALE_SWITCHER)
8532 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8533 AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
8534 AC_SUBST(MOZ_ANDROID_SHARE_OVERLAY)
8535 AC_SUBST(MOZ_ANDROID_NEW_TABLET_UI)
8536 AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
8537 AC_SUBST(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
8538 AC_SUBST(ENABLE_STRIP)
8539 AC_SUBST(PKG_SKIP_STRIP)
8540 AC_SUBST(STRIP_FLAGS)
8541 AC_SUBST(USE_ELF_HACK)
8542 AC_SUBST(INCREMENTAL_LINKER)
8543 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8544 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8546 AC_SUBST(MOZ_FIX_LINK_PATHS)
8548 AC_SUBST(USE_DEPENDENT_LIBS)
8550 AC_SUBST(MOZ_BUILD_ROOT)
8552 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8553 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8554 AC_SUBST(MOZ_LINKER_EXTRACT)
8556 AC_SUBST(MOZ_JSDOWNLOADS)
8557 if test -n "$MOZ_JSDOWNLOADS"; then
8558   AC_DEFINE(MOZ_JSDOWNLOADS)
8561 dnl ========================================================
8562 dnl = Mac bundle name prefix
8563 dnl ========================================================
8564 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8565 [  --with-macbundlename-prefix=prefix
8566                           Prefix for MOZ_MACBUNDLE_NAME],
8567 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8569 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8570 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8571   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8574 if test "$MOZ_DEBUG"; then
8575   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8576 else
8577   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8579 AC_SUBST(MOZ_MACBUNDLE_NAME)
8581 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8582 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8583 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8584 if test "$MOZ_DEBUG"; then
8585   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8588 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8589 AC_SUBST(MOZ_MACBUNDLE_ID)
8591 dnl ========================================================
8592 dnl = Child Process Name for IPC
8593 dnl ========================================================
8594 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8595   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8596 else
8597   # We want to let Android unpack the file at install time, but it only does
8598   # so if the file is named libsomething.so. The lib/ path is also required
8599   # because the unpacked file will be under the lib/ subdirectory and will
8600   # need to be executed from that path.
8601   MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8603 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8605 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8606 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8608 # The following variables are available to branding and application
8609 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8610 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8611 # impacts profile location and user-visible fields.
8612 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8613 # versions of a given application (e.g. Aurora and Firefox both use
8614 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8615 # for application.ini's "Name" field, which controls profile location in
8616 # the absence of a "Profile" field (see below), and various system
8617 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8618 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8619 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8620 # builds (e.g. Aurora for Firefox).
8621 # - MOZ_APP_VERSION: Defines the application version number.
8622 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8623 # defaults to a lowercase form of MOZ_APP_BASENAME.
8624 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
8625 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
8626 # - MOZ_APP_PROFILE: When set, used for application.ini's
8627 # "Profile" field, which controls profile location.
8628 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8629 # crash reporter server url.
8630 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8632 if test -z "$MOZ_APP_NAME"; then
8633    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8636 if test -z "$MOZ_APP_REMOTINGNAME"; then
8637    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
8640 # For extensions and langpacks, we require a max version that is compatible
8641 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8642 # 24.0a1 and 24.0a2 aren't affected
8643 # 24.0 becomes 24.*
8644 # 24.1.1 becomes 24.*
8645 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8646 if test -z "$IS_ALPHA"; then
8647   changequote(,)
8648   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8649   changequote([,])
8650 else
8651   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8654 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8655 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8656 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8658 AC_SUBST(MOZ_APP_NAME)
8659 AC_SUBST(MOZ_APP_REMOTINGNAME)
8660 AC_SUBST(MOZ_APP_DISPLAYNAME)
8661 AC_SUBST(MOZ_APP_BASENAME)
8662 AC_SUBST(MOZ_APP_VENDOR)
8663 AC_SUBST(MOZ_APP_PROFILE)
8664 AC_SUBST(MOZ_APP_ID)
8665 AC_SUBST(MAR_CHANNEL_ID)
8666 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8667 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8668 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8669 AC_SUBST(MOZ_APP_UA_NAME)
8670 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8671 AC_SUBST(MOZ_APP_VERSION)
8672 AC_SUBST(MOZ_APP_MAXVERSION)
8673 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8674 AC_SUBST(FIREFOX_VERSION)
8675 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8676 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8677   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8680 AC_SUBST(MOZ_APP_STATIC_INI)
8682 AC_SUBST(MOZ_PKG_SPECIAL)
8684 AC_SUBST(MOZILLA_OFFICIAL)
8686 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8687 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8689 if test "$MOZ_TELEMETRY_REPORTING"; then
8690     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8692     # Enable Telemetry by default for nightly and aurora channels
8693     if test -z "$RELEASE_BUILD"; then
8694       AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8695     fi
8698 dnl If we have any service that uploads data (and requires data submission
8699 dnl policy alert), set MOZ_DATA_REPORTING.
8700 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8701 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
8702   MOZ_DATA_REPORTING=1
8703   AC_DEFINE(MOZ_DATA_REPORTING)
8704   AC_SUBST(MOZ_DATA_REPORTING)
8707 dnl win32 options
8708 AC_SUBST(MOZ_BROWSE_INFO)
8709 AC_SUBST(MOZ_TOOLS_DIR)
8710 AC_SUBST(WIN32_REDIST_DIR)
8711 AC_SUBST(MAKENSISU)
8713 dnl Echo the CFLAGS to remove extra whitespace.
8714 CFLAGS=`echo \
8715     $_WARNINGS_CFLAGS \
8716     $CFLAGS`
8718 CXXFLAGS=`echo \
8719     $_WARNINGS_CXXFLAGS \
8720     $CXXFLAGS`
8722 COMPILE_CFLAGS=`echo \
8723     $_DEFINES_CFLAGS \
8724     $_DEPEND_CFLAGS \
8725     $COMPILE_CFLAGS`
8727 COMPILE_CXXFLAGS=`echo \
8728     $_DEFINES_CXXFLAGS \
8729     $_DEPEND_CFLAGS \
8730     $COMPILE_CXXFLAGS`
8732 HOST_CFLAGS=`echo \
8733     $HOST_CFLAGS \
8734     $_DEPEND_CFLAGS`
8736 HOST_CXXFLAGS=`echo \
8737     $HOST_CXXFLAGS \
8738     $_DEPEND_CFLAGS`
8740 AC_SUBST(MOZ_NATIVE_JPEG)
8741 AC_SUBST(MOZ_NATIVE_PNG)
8742 AC_SUBST(MOZ_NATIVE_BZ2)
8744 AC_SUBST(MOZ_JPEG_CFLAGS)
8745 AC_SUBST_LIST(MOZ_JPEG_LIBS)
8746 AC_SUBST(MOZ_BZ2_CFLAGS)
8747 AC_SUBST_LIST(MOZ_BZ2_LIBS)
8748 AC_SUBST(MOZ_PNG_CFLAGS)
8749 AC_SUBST_LIST(MOZ_PNG_LIBS)
8751 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8752     export MOZ_NUWA_PROCESS
8753     AC_DEFINE(MOZ_NUWA_PROCESS)
8755 AC_SUBST(MOZ_NUWA_PROCESS)
8756 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
8757     if test -z "$MOZ_NUWA_PROCESS"; then
8758        AC_MSG_ERROR([B2G loader works with Nuwa]);
8759     fi
8760     export MOZ_B2G_LOADER
8761     AC_DEFINE(MOZ_B2G_LOADER)
8763 AC_SUBST(MOZ_B2G_LOADER)
8765 AC_SUBST(NSPR_CFLAGS)
8766 AC_SUBST(MOZ_NATIVE_NSPR)
8768 AC_SUBST(NSS_CFLAGS)
8769 AC_SUBST(MOZ_NATIVE_NSS)
8770 AC_SUBST(NSS_DISABLE_DBM)
8772 OS_CFLAGS="$CFLAGS"
8773 OS_CXXFLAGS="$CXXFLAGS"
8774 OS_CPPFLAGS="$CPPFLAGS"
8775 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8776 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8777 OS_LDFLAGS="$LDFLAGS"
8778 OS_LIBS="$LIBS"
8779 AC_SUBST(OS_CFLAGS)
8780 AC_SUBST(OS_CXXFLAGS)
8781 AC_SUBST(OS_CPPFLAGS)
8782 AC_SUBST(OS_COMPILE_CFLAGS)
8783 AC_SUBST(OS_COMPILE_CXXFLAGS)
8784 AC_SUBST(OS_LDFLAGS)
8785 AC_SUBST(OS_LIBS)
8786 AC_SUBST(CROSS_COMPILE)
8787 AC_SUBST(WCHAR_CFLAGS)
8789 AC_SUBST(HOST_CC)
8790 AC_SUBST(HOST_CXX)
8791 AC_SUBST(HOST_CFLAGS)
8792 AC_SUBST(HOST_CXXFLAGS)
8793 AC_SUBST(HOST_LDFLAGS)
8794 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8795 AC_SUBST(HOST_AR)
8796 AC_SUBST(HOST_AR_FLAGS)
8797 AC_SUBST(HOST_LD)
8798 AC_SUBST(HOST_RANLIB)
8799 AC_SUBST(HOST_NSPR_MDCPUCFG)
8800 AC_SUBST(HOST_BIN_SUFFIX)
8801 AC_SUBST(HOST_OS_ARCH)
8803 AC_SUBST(TARGET_CPU)
8804 AC_SUBST(TARGET_VENDOR)
8805 AC_SUBST(TARGET_OS)
8806 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8807 AC_SUBST(TARGET_MD_ARCH)
8808 AC_SUBST(TARGET_XPCOM_ABI)
8809 AC_SUBST(OS_TARGET)
8810 AC_SUBST(OS_ARCH)
8811 AC_SUBST(OS_RELEASE)
8812 AC_SUBST(OS_TEST)
8813 AC_SUBST(CPU_ARCH)
8814 AC_SUBST(INTEL_ARCHITECTURE)
8815 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8816 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8817 AC_SUBST(HAVE_X86_AVX2)
8818 AC_SUBST(GCC_USE_GNU_LD)
8820 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8822 AC_SUBST(WRAP_LDFLAGS)
8823 AC_SUBST(MKSHLIB)
8824 AC_SUBST(MKCSHLIB)
8825 AC_SUBST(MKSHLIB_FORCE_ALL)
8826 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8827 AC_SUBST(DSO_CFLAGS)
8828 AC_SUBST(DSO_PIC_CFLAGS)
8829 AC_SUBST(DSO_LDOPTS)
8830 AC_SUBST(LIB_PREFIX)
8831 AC_SUBST(DLL_PREFIX)
8832 AC_SUBST(DLL_SUFFIX)
8833 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8834 AC_SUBST(LIB_SUFFIX)
8835 AC_SUBST(OBJ_SUFFIX)
8836 AC_SUBST(BIN_SUFFIX)
8837 AC_SUBST(ASM_SUFFIX)
8838 AC_SUBST(IMPORT_LIB_SUFFIX)
8839 AC_SUBST(USE_N32)
8840 AC_SUBST(CC_VERSION)
8841 AC_SUBST(CXX_VERSION)
8842 AC_SUBST(MSMANIFEST_TOOL)
8843 AC_SUBST(NS_ENABLE_TSF)
8844 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
8845 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
8847 AC_SUBST(MOZ_WAVE)
8848 AC_SUBST(MOZ_VORBIS)
8849 AC_SUBST(MOZ_TREMOR)
8850 AC_SUBST(MOZ_WEBM)
8851 AC_SUBST(MOZ_WMF)
8852 AC_SUBST(MOZ_FFMPEG)
8853 AC_SUBST(MOZ_FMP4)
8854 AC_SUBST(MOZ_EME)
8855 AC_SUBST(MOZ_DIRECTSHOW)
8856 AC_SUBST(MOZ_ANDROID_OMX)
8857 AC_SUBST(MOZ_APPLEMEDIA)
8858 AC_SUBST(MOZ_OMX_PLUGIN)
8859 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8860 AC_SUBST(MOZ_VPX)
8861 AC_SUBST(VPX_AS)
8862 AC_SUBST(VPX_ASFLAGS)
8863 AC_SUBST(VPX_DASH_C_FLAG)
8864 AC_SUBST(VPX_AS_CONVERSION)
8865 AC_SUBST(VPX_ASM_SUFFIX)
8866 AC_SUBST(VPX_X86_ASM)
8867 AC_SUBST(VPX_ARM_ASM)
8868 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8869 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8870 AC_SUBST(MOZ_CODE_COVERAGE)
8871 AC_SUBST(LIBJPEG_TURBO_AS)
8872 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8873 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8874 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8875 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8877 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8878 AC_SUBST(MOZ_FOLD_LIBS)
8879 AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE)
8881 AC_SUBST(MOZ_ENABLE_SZIP)
8882 AC_SUBST(MOZ_SZIP_FLAGS)
8884 dnl Host JavaScript runtime, if any, to use during cross compiles.
8885 AC_SUBST(JS_BINARY)
8887 if test "$MOZ_DEBUG"; then
8888     MOZ_EM_DEBUG=1
8890 AC_SUBST(MOZ_EM_DEBUG)
8892 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
8894 if test -n "$COMPILE_ENVIRONMENT"; then
8895 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8897 dnl Check for missing components
8898 if test "$MOZ_X11"; then
8899     if test "$WITHOUT_X11"; then
8900         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8901     fi
8902     dnl ====================================================
8903     dnl = Check if X headers exist
8904     dnl ====================================================
8905     _SAVE_CFLAGS=$CFLAGS
8906     CFLAGS="$CFLAGS $XCFLAGS"
8907     AC_TRY_COMPILE([
8908         #include <stdio.h>
8909         #include <stdlib.h>
8910         #include <X11/Xlib.h>
8911         #include <X11/Intrinsic.h>
8912         #include <X11/extensions/XShm.h>
8913     ],
8914     [
8915         Display *dpy = 0;
8916         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8917             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8918             exit(1);
8919         }
8920     ], [],
8921     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8922     CFLAGS="$_SAVE_CFLAGS"
8924     if test -n "$MISSING_X"; then
8925         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8926     fi
8928 fi # MOZ_X11
8930 fi # COMPILE_ENVIRONMENT
8932 dnl Set various defines and substitutions
8933 dnl ========================================================
8935 if test "$OS_ARCH" != "WINNT"; then
8936   AC_DEFINE(XP_UNIX)
8939 if test "$MOZ_DEBUG"; then
8940     AC_DEFINE(MOZ_REFLOW_PERF)
8941     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8944 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8945     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8946     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8947     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8948     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8949     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8950     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8951     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8952     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8955 if test -n "$MOZ_DEV_EDITION"; then
8956     AC_DEFINE(MOZ_DEV_EDITION)
8959 if test "$MOZ_DEBUG"; then
8960     A11Y_LOG=1
8962 case "$MOZ_UPDATE_CHANNEL" in
8963 aurora|beta|release|esr)
8964     ;;
8966     A11Y_LOG=1
8967     ;;
8968 esac
8969 AC_SUBST(A11Y_LOG)
8970 if test -n "$A11Y_LOG"; then
8971     AC_DEFINE(A11Y_LOG)
8974 AC_SUBST(MOZILLA_VERSION)
8976 AC_SUBST(ac_configure_args)
8978 dnl Spit out some output
8979 dnl ========================================================
8981 dnl The following defines are used by xpcom
8982 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8983 CPP_THROW_NEW
8984 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8985 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8986 HAVE_CPP_PARTIAL_SPECIALIZATION
8987 HAVE_GETPAGESIZE
8988 HAVE_ICONV
8989 HAVE_ICONV_WITH_CONST_INPUT
8990 HAVE_MBRTOWC
8991 HAVE_WCRTOMB
8992 HAVE_STATVFS64
8993 HAVE_STATVFS
8994 HAVE_STATFS64
8995 HAVE_STATFS
8996 HAVE_SYS_STATVFS_H
8997 HAVE_SYS_STATFS_H
8998 HAVE_SYS_VFS_H
8999 HAVE_SYS_MOUNT_H
9002 dnl ========================================================
9003 dnl ICU Support
9004 dnl ========================================================
9006 # Internationalization isn't built or exposed by default in non-desktop
9007 # builds.  Bugs to enable:
9009 #   Android:  bug 864843
9010 #   B2G:      bug 866301
9012 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
9013    test "$MOZ_BUILD_APP" = "b2g" ||
9014    test "$MOZ_BUILD_APP" = "b2g/dev"; then
9015     _INTL_API=no
9016 else
9017     _INTL_API=yes
9020 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
9021     USE_ICU=1
9024 if test "$OS_TARGET" = WINNT; then
9025     MOZ_SHARED_ICU=1
9028 MOZ_CONFIG_ICU()
9030 if test -z "$JS_SHARED_LIBRARY"; then
9031   AC_DEFINE(MOZ_STATIC_JS)
9033 AC_SUBST(JS_SHARED_LIBRARY)
9035 MOZ_CREATE_CONFIG_STATUS()
9037 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9038 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9039   MOZ_SUBCONFIGURE_ICU()
9040   MOZ_SUBCONFIGURE_FFI()
9043 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
9044 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
9045 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
9046 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
9047 # (apparently) only need this hack when egrep's "pattern" is particularly long
9048 # (as in the following code) and the first egrep on our $PATH is Apple's.  See
9049 # bug 655339.
9050 case "$host" in
9051 *-apple-darwin11*)
9052     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
9053     ;;
9055     FIXED_EGREP="egrep"
9056     ;;
9057 esac
9059 # Run jemalloc configure script
9061 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
9062   ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_ --disable-valgrind"
9063   if test -n "$MOZ_REPLACE_MALLOC"; then
9064     # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
9065     ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
9066     ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
9067   fi
9068   if test -n "$MOZ_JEMALLOC3"; then
9069     case "${OS_ARCH}" in
9070       WINNT|Darwin)
9071         # We want jemalloc functions to be kept hidden on both Mac and Windows
9072         # See memory/build/mozmemory_wrap.h for details.
9073         ac_configure_args="$ac_configure_args --without-export"
9074         ;;
9075     esac
9076   elif test "${OS_ARCH}" = Darwin; then
9077     # When building as a replace-malloc lib, disabling the zone allocator
9078     # forces to use pthread_atfork.
9079     ac_configure_args="$ac_configure_args --disable-zone-allocator"
9080   fi
9081   _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
9082   JEMALLOC_WRAPPER=
9083   if test -z "$MOZ_REPLACE_MALLOC"; then
9084     case "$OS_ARCH" in
9085       Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
9086         MANGLE=$_MANGLE
9087         ;;
9088     esac
9089   elif test -z "$MOZ_JEMALLOC3"; then
9090     MANGLE=$_MANGLE
9091     JEMALLOC_WRAPPER=replace_
9092   fi
9093   if test -n "$MANGLE"; then
9094     MANGLED=
9095     for mangle in ${MANGLE}; do
9096       if test -n "$MANGLED"; then
9097         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
9098       else
9099         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
9100       fi
9101     done
9102     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
9103   fi
9104   unset CONFIG_FILES
9105   if test -z "$MOZ_TLS"; then
9106     ac_configure_args="$ac_configure_args --disable-tls"
9107   fi
9108   EXTRA_CFLAGS="$CFLAGS"
9109   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
9110     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
9111   done
9112   if test "$CROSS_COMPILE"; then
9113     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
9114   fi
9116   if ! test -e memory/jemalloc; then
9117     mkdir -p memory/jemalloc
9118   fi
9120   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
9121   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9124 # Run freetype configure script
9126 if test "$MOZ_TREE_FREETYPE"; then
9127    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
9128    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
9129    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
9130    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
9131    # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
9132    # to force freetype to use our settings rather than autodetecting
9133    if test -n "$MOZ_NATIVE_PNG"; then
9134      export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
9135    else
9136      export LIBPNG_CFLAGS="-I$_objdir/dist/include"
9137    fi
9138    export LIBPNG_LIBS="$MOZ_PNG_LIBS "
9139    export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
9140    export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
9141    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9142    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
9144    if ! test -e modules; then
9145      mkdir modules
9146    fi
9147    # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
9148    # that further down the road.
9149    (export CC CXX RANLIB;
9150     AC_OUTPUT_SUBDIRS(modules/freetype2)
9151    ) || exit 1
9154 if test -z "$direct_nspr_config"; then
9155     dnl ========================================================
9156     dnl = Setup a nice relatively clean build environment for
9157     dnl = sub-configures.
9158     dnl ========================================================
9159     CC="$_SUBDIR_CC"
9160     CXX="$_SUBDIR_CXX"
9161     CFLAGS="$_SUBDIR_CFLAGS"
9162     CPPFLAGS="$_SUBDIR_CPPFLAGS"
9163     CXXFLAGS="$_SUBDIR_CXXFLAGS"
9164     LDFLAGS="$_SUBDIR_LDFLAGS"
9165     HOST_CC="$_SUBDIR_HOST_CC"
9166     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9167     HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9168     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9169     RC=
9172 unset MAKEFILES
9173 unset CONFIG_FILES
9175 # Run all configure scripts specified by a subconfigure
9176 if test -n "$_subconfigure_subdir"; then
9177   _save_srcdir="$srcdir"
9178   srcdir="$srcdir/.."
9179   _save_ac_configure_args="$ac_configure_args"
9180   ac_configure_args="$_subconfigure_config_args"
9181   AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
9182   ac_configure_args="$_save_ac_configure_args"
9183   srcdir="$_save_srcdir"
9186 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9187 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9189 export WRAP_LDFLAGS
9191 MOZ_SUBCONFIGURE_NSPR()
9193 dnl ========================================================
9194 dnl = Setup a nice relatively clean build environment for
9195 dnl = sub-configures.
9196 dnl ========================================================
9197 CC="$_SUBDIR_CC"
9198 CXX="$_SUBDIR_CXX"
9199 CFLAGS="$_SUBDIR_CFLAGS"
9200 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9201 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9202 LDFLAGS="$_SUBDIR_LDFLAGS"
9203 HOST_CC="$_SUBDIR_HOST_CC"
9204 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9205 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
9206 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9209 # Run the SpiderMonkey 'configure' script.
9210 dist=$MOZ_BUILD_ROOT/dist
9211 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9213 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
9214 # and $NSPR_LIBS.
9215 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
9217 ac_configure_args="$ac_configure_args --enable-threadsafe"
9219 if test "$_INTL_API" = no; then
9220     ac_configure_args="$ac_configure_args --without-intl-api"
9223 if test "$BUILD_CTYPES"; then
9224     # Build js-ctypes on the platforms we can.
9225     ac_configure_args="$ac_configure_args --enable-ctypes"
9227 if test -z "$JS_SHARED_LIBRARY" ; then
9228     ac_configure_args="$ac_configure_args --disable-shared-js"
9229     if test -n "$MOZ_DISABLE_EXPORT_JS"; then
9230         ac_configure_args="$ac_configure_args --disable-export-js"
9231     fi
9233 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
9234     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9235     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9237 ac_configure_args="$ac_configure_args --prefix=$dist"
9238 if test "$MOZ_MEMORY"; then
9239    ac_configure_args="$ac_configure_args --enable-jemalloc"
9241 if test -n "$MOZ_GLUE_IN_PROGRAM"; then
9242    export MOZ_GLUE_IN_PROGRAM
9244 if test -n "$ZLIB_IN_MOZGLUE"; then
9245    MOZ_ZLIB_LIBS=
9247 export MOZ_NATIVE_ZLIB
9248 export MOZ_ZLIB_CFLAGS
9249 export MOZ_ZLIB_LIBS
9250 export MOZ_APP_NAME
9251 export MOZ_APP_REMOTINGNAME
9252 export DONT_POPULATE_VIRTUALENV=1
9253 export PYTHON
9254 export MOZILLA_CENTRAL_PATH=$_topsrcdir
9255 export STLPORT_CPPFLAGS
9256 export STLPORT_LIBS
9257 export JS_STANDALONE=no
9258 export MOZ_LINKER
9259 export ZLIB_IN_MOZGLUE
9261 if ! test -e js; then
9262     mkdir js
9265 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
9266 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9268 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9270 export WRITE_MOZINFO=1
9271 dnl we need to run config.status after js/src subconfigure because we're
9272 dnl traversing its moz.build and we need its config.status for that.
9273 dnl However, writing our own config.status needs to happen before
9274 dnl subconfigures because the setup surrounding subconfigures alters
9275 dnl many AC_SUBSTed variables.
9276 MOZ_RUN_CONFIG_STATUS()
9277 unset WRITE_MOZINFO