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