Bug 732976 - SingleSourceFactory should generate checksums file. r=ted
[gecko.git] / configure.in
blob3aced513209972fa7f3074a6fb4286c543b8ba97
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 dnl
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
10 dnl
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
14 dnl License.
15 dnl
16 dnl The Original Code is this file as it was released upon August 6, 1998.
17 dnl
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
22 dnl
23 dnl Contributor(s):
24 dnl   Jamie Zawinski <jwz@jwz.org>
25 dnl   gettimeofday args check
26 dnl   Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl   gnomefe update & enable-pthreads
28 dnl   Ramiro Estrugo <ramiro@netscape.com>
29 dnl   X11 makedepend support
30 dnl   Insure support.
31 dnl   Henry Sobotka <sobotka@axess.com>
32 dnl   OS/2 support
33 dnl   Dan Mosedale <dmose@mozilla.org>
34 dnl   LDAP support
35 dnl   Seth Spitzer <sspitzer@netscape.com>
36 dnl   xpctools support
37 dnl   Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl   Howard Chu <hyc@symas.com>
39 dnl   MSYS support
40 dnl   Mark Mentovai <mark@moxienet.com>:
41 dnl   Mac OS X 10.4 support
42 dnl   Giorgio Maone <g.maone@informaction.com>
43 dnl   MSVC l10n compatible version check
44 dnl   Ben Turner <mozilla@songbirdnest.com>
45 dnl   Windows x64 support
46 dnl   Makoto Kato <m_kato@ga2.so-net.ne.jp>
47 dnl
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
59 dnl
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
65 AC_PREREQ(2.13)
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
68 AC_CANONICAL_SYSTEM
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
73 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1`
74 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
77 dnl =
78 dnl = Don't change the following two lines.  Doing so breaks:
79 dnl =
80 dnl = CFLAGS="-foo" ./configure
81 dnl =
82 dnl ========================================================
83 CFLAGS="${CFLAGS=}"
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
86 LDFLAGS="${LDFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
96 _SUBDIR_CC="$CC"
97 _SUBDIR_CXX="$CXX"
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
110 MOZJPEG=62
111 MOZPNG=10509
112 MOZZLIB=0x1230
113 NSPR_VERSION=4
114 NSS_VERSION=3
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
118 GLIB_VERSION=1.2.0
119 PERL_VERSION=5.006
120 PYTHON_VERSION=2.5
121 CAIRO_VERSION=1.10
122 PANGO_VERSION=1.14.0
123 GTK2_VERSION=2.10.0
124 WINDRES_VERSION=2.14.90
125 W32API_VERSION=3.14
126 GNOMEVFS_VERSION=2.0
127 GNOMEUI_VERSION=2.2.0
128 GCONF_VERSION=1.2.1
129 GIO_VERSION=2.18
130 STARTUP_NOTIFICATION_VERSION=0.8
131 DBUS_VERSION=0.60
132 SQLITE_VERSION=3.7.11
133 LIBNOTIFY_VERSION=0.4
135 MSMANIFEST_TOOL=
137 dnl Set various checks
138 dnl ========================================================
139 MISSING_X=
140 AC_PROG_AWK
142 dnl Initialize the Pthread test variables early so they can be
143 dnl  overridden by each platform.
144 dnl ========================================================
145 USE_PTHREADS=
146 _PTHREAD_LDFLAGS=""
148 dnl Do not allow a separate objdir build if a srcdir build exists.
149 dnl ==============================================================
150 _topsrcdir=`cd \`dirname $0\`; pwd`
151 _objdir=`pwd`
153 if test "$_topsrcdir" != "$_objdir"
154 then
155   # Check for a couple representative files in the source tree
156   _conflict_files=
157   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
158     if test -f $file; then
159       _conflict_files="$_conflict_files $file"
160     fi
161   done
162   if test "$_conflict_files"; then
163     echo "***"
164     echo "*   Your source tree contains these files:"
165     for file in $_conflict_files; do
166       echo "*         $file"
167     done
168     cat 1>&2 <<-EOF
169         *   This indicates that you previously built in the source tree.
170         *   A source tree build can confuse the separate objdir build.
171         *
172         *   To clean up the source tree:
173         *     1. cd $_topsrcdir
174         *     2. gmake distclean
175         ***
176         EOF
177     exit 1
178     break
179   fi
181 MOZ_BUILD_ROOT=`pwd`
183 dnl Default to MSVC for win32 and gcc for darwin
184 dnl ==============================================================
185 if test -z "$CROSS_COMPILE"; then
186 case "$target" in
187 *-mingw*)
188     if test -z "$CC"; then CC=cl; fi
189     if test -z "$CXX"; then CXX=cl; fi
190     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
191     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
192     if test -z "$LD"; then LD=link; fi
193     if test -z "$AS"; then
194         case "${target_cpu}" in
195         i*86)
196             AS=ml;
197             ;;
198         x86_64)
199             AS=ml64;
200             ;;
201         esac
202     fi
203     if test -z "$MIDL"; then MIDL=midl; fi
205     # need override this flag since we don't use $(LDFLAGS) for this.
206     if test -z "$HOST_LDFLAGS" ; then
207         HOST_LDFLAGS=" "
208     fi
209     ;;
210 *-darwin*)
211     # we prefer gcc-4.2 over gcc on older darwin, so
212     # use that specific version if it's available.
213     MOZ_PATH_PROGS(CC, $CC gcc-4.2 gcc)
214     MOZ_PATH_PROGS(CXX, $CXX g++-4.2 g++)
215     ;;
216 esac
219 COMPILE_ENVIRONMENT=1
220 MOZ_ARG_DISABLE_BOOL(compile-environment,
221 [  --disable-compile-environment
222                           Disable compiler/library checks.],
223     COMPILE_ENVIRONMENT= )
224 AC_SUBST(COMPILE_ENVIRONMENT)
226 MOZ_ARG_WITH_STRING(l10n-base,
227 [  --with-l10n-base=DIR    path to l10n repositories],
228     L10NBASEDIR=$withval)
229 if test -n "$L10NBASEDIR"; then
230     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
231         AC_MSG_ERROR([--with-l10n-base must specify a path])
232     elif test -d "$L10NBASEDIR"; then
233         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
234     else
235         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
236     fi
238 AC_SUBST(L10NBASEDIR)
240 dnl Check for Perl first -- needed for win32 SDK checks
241 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
242 if test -z "$PERL" -o "$PERL" = ":"; then
243     AC_MSG_ERROR([perl not found in \$PATH])
246 dnl ========================================================
247 dnl = Android uses a very custom (hacky) toolchain; we need to do this
248 dnl = here, so that the compiler checks can succeed
249 dnl ========================================================
251 MOZ_ARG_WITH_STRING(android-ndk,
252 [  --with-android-ndk=DIR
253                           location where the Android NDK can be found],
254     android_ndk=$withval)
256 MOZ_ARG_WITH_STRING(android-toolchain,
257 [  --with-android-toolchain=DIR
258                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
259     android_toolchain=$withval)
262 MOZ_ARG_WITH_STRING(android-version,
263 [  --with-android-version=VER
264                           android platform version, default 5],
265     android_version=$withval,
266     android_version=5)
268 MOZ_ARG_WITH_STRING(android-sdk,
269 [  --with-android-sdk=DIR
270                           location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
271     android_sdk=$withval)
273 MOZ_ARG_WITH_STRING(android-platform,
274 [  --with-android-platform=DIR
275                            location of platform dir, default NDK/build/platforms/android-5/arch-arm],
276     android_platform=$withval)
278 MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
279 [  --enable-android-libstdcxx
280                           use GNU libstdc++ instead of STLPort for NDK >= 5],
281     MOZ_ANDROID_LIBSTDCXX=1,
282     MOZ_ANDROID_LIBSTDCXX= )
284 case "$target" in
285 arm-linux*-android*|*-linuxandroid*)
286     android_tool_prefix="arm-linux-androideabi"
287     ;;
288 i?86-*android*)
289     android_tool_prefix="i686-android-linux"
290     ;;
291 arm-android-eabi)
292     android_tool_prefix="arm-eabi"
293     ;;
295     android_tool_prefix="$target_os"
296     ;;
297 esac
299 MOZ_ARG_WITH_STRING(gonk,
300 [  --with-gonk=DIR
301                location of gonk dir],
302     gonkdir=$withval)
304 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
305 [  --with-gonk-toolchain-prefix=DIR
306                           prefix to gonk toolchain commands],
307     gonk_toolchain_prefix=$withval)
309 if test -n "$gonkdir" ; then
310     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
311     android_source="$gonkdir"
312     ANDROID_SOURCE="$android_source"
314     dnl set up compilers
315     AS="$gonk_toolchain_prefix"as
316     CC="$gonk_toolchain_prefix"gcc
317     CXX="$gonk_toolchain_prefix"g++
318     CPP="$gonk_toolchain_prefix"cpp
319     LD="$gonk_toolchain_prefix"ld
320     AR="$gonk_toolchain_prefix"ar
321     RANLIB="$gonk_toolchain_prefix"ranlib
322     STRIP="$gonk_toolchain_prefix"strip
324     STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
325     STLPORT_LIBS="-lstlport"
327     CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/arch-arm/include -isystem $gonkdir/bionic/libc/kernel/arch-arm -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/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice"
328     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
329     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS"
330     LIBS="$LIBS $STLPORT_LIBS"
332     dnl Add -llog by default, since we use it all over the place.
333     LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ -llog $LDFLAGS"
335     dnl prevent cross compile section from using these flags as host flags
336     if test -z "$HOST_CPPFLAGS" ; then
337         HOST_CPPFLAGS=" "
338     fi
339     if test -z "$HOST_CFLAGS" ; then
340         HOST_CFLAGS=" "
341     fi
342     if test -z "$HOST_CXXFLAGS" ; then
343         HOST_CXXFLAGS=" "
344     fi
345     if test -z "$HOST_LDFLAGS" ; then
346         HOST_LDFLAGS=" "
347     fi
349     AC_DEFINE(ANDROID)
350     AC_DEFINE(HAVE_SYS_UIO_H)
351     AC_DEFINE(HAVE_PTHREADS)
352     CROSS_COMPILE=1
353     MOZ_CHROME_FILE_FORMAT=omni
354     ZLIB_DIR=yes
355     direct_nspr_config=1
356 else
357 case "$target" in
358 *-android*|*-linuxandroid*)
359     if test -z "$android_ndk" ; then
360         AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
361     fi
363     if test -z "$android_sdk" ; then
364         AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
365     else
366         if ! test -e "$android_sdk"/source.properties ; then
367             AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
368         fi
370         # Minimum Android SDK API Level we require.
371         android_min_api_level=13
373         # Get the api level from "$android_sdk"/source.properties.
374         android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties`
376         if test -z "$android_api_level" ; then
377             AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
378         fi
380         if ! test "$android_api_level" -eq "$android_api_level" ; then
381             AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
382         fi
384         if test $android_api_level -lt $android_min_api_level ; then
385             AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).])
386         fi
387     fi
389     android_platform_tools="$android_sdk"/../../platform-tools
390     if test ! -d "$android_platform_tools" ; then
391         android_platform_tools="$android_sdk"/tools # SDK Tools < r8
392     fi
394     if test -z "$android_toolchain" ; then
395         AC_MSG_CHECKING([for android toolchain directory])
397         kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
399         android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
401         # With newer NDK, the toolchain path has changed.
402         if ! test -d "$android_toolchain" ; then
403             android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
404         fi
406         if test -d "$android_toolchain" ; then
407             AC_MSG_RESULT([$android_toolchain])
408         else
409             AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
410         fi
411     fi
413     if test -z "$android_platform" ; then
414         AC_MSG_CHECKING([for android platform directory])
416         android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
418         # With newer NDK, the platform path has changed.
419         if ! test -d "$android_platform" ; then
420             android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
421         fi
423         if test -d "$android_platform" ; then
424             AC_MSG_RESULT([$android_platform])
425         else
426             AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
427         fi
428     fi
430     dnl set up compilers
431     AS="$android_toolchain"/bin/"$android_tool_prefix"-as
432     CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
433     CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
434     CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
435     LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
436     AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
437     RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
438     STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
439     OBJCOPY="$android_toolchain"/bin/"$android_tool_prefix"-objcopy
441     CPPFLAGS="-isystem $android_platform/usr/include $CPPFLAGS"
442     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
443     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
445     dnl Add -llog by default, since we use it all over the place.
446     dnl Add --allow-shlib-undefined, because libGLESv2 links to an
447     dnl undefined symbol (present on the hardware, just not in the
448     dnl NDK.)
449     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
451     dnl prevent cross compile section from using these flags as host flags
452     if test -z "$HOST_CPPFLAGS" ; then
453         HOST_CPPFLAGS=" "
454     fi
455     if test -z "$HOST_CFLAGS" ; then
456         HOST_CFLAGS=" "
457     fi
458     if test -z "$HOST_CXXFLAGS" ; then
459         HOST_CXXFLAGS=" "
460     fi
461     if test -z "$HOST_LDFLAGS" ; then
462         HOST_LDFLAGS=" "
463     fi
465     ANDROID_NDK="${android_ndk}"
466     ANDROID_TOOLCHAIN="${android_toolchain}"
467     ANDROID_PLATFORM="${android_platform}"
468     ANDROID_SDK="${android_sdk}"
469     ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
470     ANDROID_VERSION="${android_version}"
471     if test -z "$ANDROID_PACKAGE_NAME" ; then
472         ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
473     fi
474     if test -z "$MOZ_MOBILE_COMPAT" ; then
475         MOZ_MOBILE_COMPAT='All'
476     fi
478     AC_DEFINE(ANDROID)
479     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
480     AC_SUBST(ANDROID_VERSION)
481     CROSS_COMPILE=1
482     MOZ_CHROME_FILE_FORMAT=omni
483     ZLIB_DIR=yes
484     ;;
485 *-linux*)
486     AC_PATH_PROG(OBJCOPY,objcopy)
487     ;;
488 esac
492 AC_SUBST(ANDROID_NDK)
493 AC_SUBST(ANDROID_TOOLCHAIN)
494 AC_SUBST(ANDROID_PLATFORM)
495 AC_SUBST(ANDROID_SDK)
496 AC_SUBST(ANDROID_PLATFORM_TOOLS)
497 AC_SUBST(ANDROID_PACKAGE_NAME)
498 AC_SUBST(MOZ_MOBILE_COMPAT)
499 AC_SUBST(OBJCOPY)
501 dnl ========================================================
502 dnl Checks for compilers.
503 dnl ========================================================
504 dnl Set CROSS_COMPILE in the environment when running configure
505 dnl to use the cross-compile setup for now
506 dnl ========================================================
508 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
509 AR_FLAGS='cr $@'
511 if test "$COMPILE_ENVIRONMENT"; then
513 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
514     echo "cross compiling from $host to $target"
515     cross_compiling=yes
517     _SAVE_CC="$CC"
518     _SAVE_CFLAGS="$CFLAGS"
519     _SAVE_LDFLAGS="$LDFLAGS"
521     AC_MSG_CHECKING([for host c compiler])
522     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
523     if test -z "$HOST_CC"; then
524         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
525     fi
526     AC_MSG_RESULT([$HOST_CC])
527     AC_MSG_CHECKING([for host c++ compiler])
528     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
529     if test -z "$HOST_CXX"; then
530         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
531     fi
532     AC_MSG_RESULT([$HOST_CXX])
534     if test -z "$HOST_CFLAGS"; then
535         HOST_CFLAGS="$CFLAGS"
536     fi
537     if test -z "$HOST_CXXFLAGS"; then
538         HOST_CXXFLAGS="$CXXFLAGS"
539     fi
540     if test -z "$HOST_LDFLAGS"; then
541         HOST_LDFLAGS="$LDFLAGS"
542     fi
543     if test -z "$HOST_AR_FLAGS"; then
544         HOST_AR_FLAGS="$AR_FLAGS"
545     fi
546     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
547     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
548     CC="$HOST_CC"
549     CFLAGS="$HOST_CFLAGS"
550     LDFLAGS="$HOST_LDFLAGS"
552     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
553     AC_TRY_COMPILE([], [return(0);],
554         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
555         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
557     CC="$HOST_CXX"
558     CFLAGS="$HOST_CXXFLAGS"
560     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
561     AC_TRY_COMPILE([], [return(0);],
562         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
563         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
565     CC=$_SAVE_CC
566     CFLAGS=$_SAVE_CFLAGS
567     LDFLAGS=$_SAVE_LDFLAGS
569     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
570     unset ac_cv_prog_CC
571     AC_PROG_CC
572     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
573     unset ac_cv_prog_CXX
574     AC_PROG_CXX
576     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
577     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
578     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
579     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
580     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
581     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
582     AC_DEFINE(CROSS_COMPILE)
583 else
584     AC_PROG_CC
585     case "$target" in
586     *-mingw*)
587       # Work around the conftest.exe access problem on Windows
588       sleep 1
589     esac
590     AC_PROG_CXX
591     AC_PROG_RANLIB
592     MOZ_PATH_PROGS(AS, $AS as, $CC)
593     AC_CHECK_PROGS(AR, ar, :)
594     AC_CHECK_PROGS(LD, ld, :)
595     AC_CHECK_PROGS(STRIP, strip, :)
596     AC_CHECK_PROGS(WINDRES, windres, :)
597     if test -z "$HOST_CC"; then
598         HOST_CC='$(CC)'
599     fi
600     if test -z "$HOST_CFLAGS"; then
601         HOST_CFLAGS='$(CFLAGS)'
602     fi
603     if test -z "$HOST_CXX"; then
604         HOST_CXX='$(CXX)'
605     fi
606     if test -z "$HOST_CXXFLAGS"; then
607         HOST_CXXFLAGS='$(CXXFLAGS)'
608     fi
609     if test -z "$HOST_LDFLAGS"; then
610         HOST_LDFLAGS='$(LDFLAGS)'
611     fi
612     if test -z "$HOST_RANLIB"; then
613         HOST_RANLIB='$(RANLIB)'
614     fi
615     if test -z "$HOST_AR"; then
616         HOST_AR='$(AR)'
617     fi
618     if test -z "$HOST_AR_FLAGS"; then
619         HOST_AR_FLAGS='$(AR_FLAGS)'
620     fi
623 GNU_AS=
624 GNU_LD=
625 GNU_CC=
626 GNU_CXX=
627 CC_VERSION='N/A'
628 CXX_VERSION='N/A'
629 if test "$GCC" = "yes"; then
630     GNU_CC=1
631     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
633 if test "$GXX" = "yes"; then
634     GNU_CXX=1
635     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
637 if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
638     GNU_AS=1
640 rm -f conftest.out
641 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
642     GNU_LD=1
644 if test "$GNU_CC"; then
645     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
646         GCC_USE_GNU_LD=1
647     fi
650 INTEL_CC=
651 INTEL_CXX=
652 if test "$GCC" = yes; then
653    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
654      INTEL_CC=1
655    fi
658 if test "$GXX" = yes; then
659    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
660      INTEL_CXX=1
661    fi
664 CLANG_CC=
665 CLANG_CXX=
666 if test "$GCC" = yes; then
667    if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
668      CLANG_CC=1
669    fi
672 if test "$GXX" = yes; then
673    if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
674      CLANG_CXX=1
675    fi
678 dnl ========================================================
679 dnl Special win32 checks
680 dnl ========================================================
681 WINVER=502
682 dnl Target the Windows 7 SDK by default
683 WINSDK_TARGETVER=601
685 MOZ_ARG_WITH_STRING(windows-version,
686 [  --with-windows-version=WINSDK_TARGETVER
687                           Highest Windows version to target using this SDK
688                               601: Windows 7],
689   WINSDK_TARGETVER=$withval)
691 case "$WINSDK_TARGETVER" in
692 601)
693     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
694     ;;
697     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 601]);
698     ;;
700 esac
702 case "$target" in
703 *-mingw*)
704     if test "$GCC" != "yes"; then
705         # Check to see if we are really running in a msvc environemnt
706         _WIN32_MSVC=1
707         AC_CHECK_PROGS(MIDL, midl)
709         # Make sure compilers are valid
710         CFLAGS="$CFLAGS -TC -nologo"
711         CXXFLAGS="$CXXFLAGS -TP -nologo"
712         AC_LANG_SAVE
713         AC_LANG_C
714         AC_TRY_COMPILE([#include <stdio.h>],
715             [ printf("Hello World\n"); ],,
716             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
718         AC_LANG_CPLUSPLUS
719         AC_TRY_COMPILE([#include <new.h>],
720             [ unsigned *test = new unsigned(42); ],,
721             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
722         AC_LANG_RESTORE
724         changequote(,)
725         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
726         changequote([,])
728         # Determine compiler version
729         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
730         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
731         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
732         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
733         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
734         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
736         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
737         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
739         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
740             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
741         fi
743         if test "$_CC_MAJOR_VERSION" = "14"; then
744             dnl Require VC8SP1 or newer.
745             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
746             if test "$_CC_RELEASE" -lt 50727 -o \
747                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
748               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.])
749             fi
751             _CC_SUITE=8
752             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
753             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
754         elif test "$_CC_MAJOR_VERSION" = "15"; then
755             _CC_SUITE=9
756             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
757             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
758         elif test "$_CC_MAJOR_VERSION" = "16"; then
759             _CC_SUITE=10
760             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
761             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
762         elif test "$_CC_MAJOR_VERSION" = "17"; then
763             _CC_SUITE=11
764             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
765             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
766         else
767             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
768         fi
770         _MOZ_RTTI_FLAGS_ON='-GR'
771         _MOZ_RTTI_FLAGS_OFF='-GR-'
772         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
774         if test -n "$WIN32_REDIST_DIR"; then
775           if test ! -d "$WIN32_REDIST_DIR"; then
776             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
777           fi
778           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
779         fi
781         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
782         dnl not something else like "magnetic tape manipulation utility".
783         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
784         if test -z "$MSMT_TOOL"; then
785           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
786         fi
788         changequote(,)
789         _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
790         changequote([,])
791         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
792         if test -z "$MSMANIFEST_TOOL_VERSION"; then
793           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
794         fi
796         MSMANIFEST_TOOL=1
797         unset MSMT_TOOL
799         # Check linker version
800         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
801         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
802         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
803             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
804         fi
806         INCREMENTAL_LINKER=1
808         # Check midl version
809         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
810         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
811         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
812         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
813         # Add flags if necessary
814         AC_MSG_CHECKING([for midl flags])
815         case "$target" in
816         i*86-*)
817             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
818                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
819                 # MIDL version 7.00.0500 or later has no problem.
820                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
821                 AC_MSG_RESULT([need -env win32])
822             else
823                 AC_MSG_RESULT([none needed])
824             fi
825             ;;
826         x86_64-*)
827             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
828             ;;
829         *)
830             AC_MSG_RESULT([none needed])
831             ;;
832         esac
834         # Identify which version of the SDK we're building with
835         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
836         # from there
837         MOZ_CHECK_HEADERS([winsdkver.h])
838         if test "$ac_cv_header_winsdkver_h" = "yes"; then
839             # Get the highest _WIN32_WINNT and NTDDI versions supported
840             # Take the higher of the two
841             # This is done because the Windows 7 beta SDK reports its
842             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
843             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
844                            ac_cv_winsdk_maxver,
845                            [cat > conftest.h <<EOF
846 #include <winsdkver.h>
847 #include <sdkddkver.h>
849 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
850 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
851 #else
852 #define WINSDK_MAXVER NTDDI_MAXVER
853 #endif
855 WINSDK_MAXVER
857                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
858                             rm -f conftest.h
859                            ])
860             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
861         else
862             # Any SDK which doesn't have WinSDKVer.h is too old.
863             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.])
864         fi
866         unset _MSVC_VER_FILTER
868         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
869             [
870                 AC_LANG_SAVE
871                 AC_LANG_CPLUSPLUS
872                 _SAVE_CXXFLAGS="$CXXFLAGS"
873                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
874                 AC_TRY_COMPILE([#include <exception>],
875                             [std::_Throw(std::exception()); return 0;],
876                             ac_cv_have_std__Throw="yes",
877                             ac_cv_have_std__Throw="no")
878                 CXXFLAGS="$_SAVE_CXXFLAGS"
879                 AC_LANG_RESTORE
880             ])
882         if test "$ac_cv_have_std__Throw" = "yes"; then
883             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
884                            ac_cv_have_dllimport_exception_bug,
885                 [
886                     AC_LANG_SAVE
887                     AC_LANG_CPLUSPLUS
888                     _SAVE_CXXFLAGS="$CXXFLAGS"
889                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
890                     AC_TRY_LINK([#include <vector>],
891                                 [std::vector<int> v; return v.at(1);],
892                                 ac_cv_have_dllimport_exception_bug="no",
893                                 ac_cv_have_dllimport_exception_bug="yes")
894                     CXXFLAGS="$_SAVE_CXXFLAGS"
895                     AC_LANG_RESTORE
896                 ])
897             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
898                 WRAP_STL_INCLUDES=1
899                 MOZ_MSVC_STL_WRAP__Throw=1
900                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
901             fi
902         else
903             AC_CACHE_CHECK(for overridable _RAISE,
904                            ac_cv_have__RAISE,
905                 [
906                     AC_LANG_SAVE
907                     AC_LANG_CPLUSPLUS
908                     _SAVE_CXXFLAGS="$CXXFLAGS"
909                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
910                     AC_TRY_COMPILE([#include <xstddef>
911                                     #undef _RAISE
912                                     #define _RAISE(x) externallyDefinedFunction((x).what())
913                                     #include <vector>
914                                    ],
915                                    [std::vector<int> v; return v.at(1);],
916                                    ac_cv_have__RAISE="no",
917                                    ac_cv_have__RAISE="yes")
918                     CXXFLAGS="$_SAVE_CXXFLAGS"
919                     AC_LANG_RESTORE
920                 ])
921             if test "$ac_cv_have__RAISE" = "yes"; then
922                 WRAP_STL_INCLUDES=1
923                 MOZ_MSVC_STL_WRAP__RAISE=1
924                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
925             else
926                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
927             fi
928         fi
930         if test "$WRAP_STL_INCLUDES" = "1"; then
931             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
932         fi
933     else
934         # Check w32api version
935         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
936         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
937         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
938         AC_TRY_COMPILE([#include <w32api.h>],
939             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
940                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
941                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
942                 #error "test failed."
943             #endif
944             , [ res=yes ], [ res=no ])
945         AC_MSG_RESULT([$res])
946         if test "$res" != "yes"; then
947             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
948         fi
949         # Check windres version
950         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
951         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
952         AC_MSG_RESULT([$_WINDRES_VERSION])
953         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
954         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
955         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
956         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
957         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
958         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
959         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
960                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
961                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
962                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
963                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
964                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
965         then
966             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
967         fi
969         MOZ_WINSDK_MAXVER=0x06010000
970     fi # !GNU_CC
972     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
973     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
974     # Require OS features provided by IE 6.0 SP2 (XP SP2)
975     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
977     # If the maximum version supported by this SDK is lower than the target
978     # version, error out
979     AC_MSG_CHECKING([for Windows SDK being recent enough])
980     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
981         AC_MSG_RESULT("yes")
982     else
983         AC_MSG_RESULT("no")
984         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.])
985     fi
987     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
988     # Definitions matching sdkddkver.h
989     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
990     ;;
991 esac
993 AC_PROG_CPP
994 AC_PROG_CXXCPP
996 if test -n "$_WIN32_MSVC"; then
997     SKIP_PATH_CHECKS=1
998     SKIP_COMPILER_CHECKS=1
999     SKIP_LIBRARY_CHECKS=1
1001     # Since we're skipping compiler and library checks, hard-code
1002     # some facts here.
1003     AC_DEFINE(HAVE_IO_H)
1004     AC_DEFINE(HAVE_SETBUF)
1005     AC_DEFINE(HAVE_ISATTY)
1008 fi # COMPILE_ENVIRONMENT
1010 AC_SUBST(MIDL_FLAGS)
1011 AC_SUBST(_MSC_VER)
1013 AC_SUBST(GNU_AS)
1014 AC_SUBST(GNU_LD)
1015 AC_SUBST(GNU_CC)
1016 AC_SUBST(GNU_CXX)
1017 AC_SUBST(INTEL_CC)
1018 AC_SUBST(INTEL_CXX)
1019 AC_SUBST(CLANG_CC)
1020 AC_SUBST(CLANG_CXX)
1022 AC_SUBST(STL_FLAGS)
1023 AC_SUBST(WRAP_STL_INCLUDES)
1024 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
1025 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
1027 dnl ========================================================
1028 dnl Checks for programs.
1029 dnl ========================================================
1030 AC_PROG_INSTALL
1031 AC_PROG_LN_S
1033 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
1034 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
1035 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
1036 _perl_res=$?
1037 AC_MSG_RESULT([$_perl_version])
1039 if test "$_perl_res" != 0; then
1040     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
1044 AC_MSG_CHECKING([for full perl installation])
1045 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
1046 _perl_res=$?
1047 if test "$_perl_res" != 0; then
1048     AC_MSG_RESULT([no])
1049     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
1050 else
1051     AC_MSG_RESULT([yes])
1054 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
1055 if test -z "$PYTHON"; then
1056     AC_MSG_ERROR([python was not found in \$PATH])
1059 MOZ_ARG_WITH_BOOL(system-ply,
1060 [  --with-system-ply       Use system installed python ply library],
1061     [if $PYTHON -c 'import ply' 2>&5; then
1062          MOZ_SYSTEM_PLY=1
1063      else
1064          AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
1065      fi])
1067 AC_SUBST(MOZ_SYSTEM_PLY)
1069 if test -z "$COMPILE_ENVIRONMENT"; then
1070     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1072 AC_SUBST(NSINSTALL_BIN)
1074 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1075 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1076 MOZ_PATH_PROGS(UNZIP, unzip)
1077 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
1078     AC_MSG_ERROR([unzip not found in \$PATH])
1080 MOZ_PATH_PROGS(ZIP, zip)
1081 if test -z "$ZIP" -o "$ZIP" = ":"; then
1082     AC_MSG_ERROR([zip not found in \$PATH])
1084 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1085 MOZ_PATH_PROG(XARGS, xargs)
1086 if test -z "$XARGS" -o "$XARGS" = ":"; then
1087     AC_MSG_ERROR([xargs not found in \$PATH .])
1090 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
1091 AC_SUBST(RPMBUILD)
1093 if test "$COMPILE_ENVIRONMENT"; then
1095 dnl ========================================================
1096 dnl = Mac OS X toolchain support
1097 dnl ========================================================
1099 case "$target_os" in
1100 darwin*)
1101     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1102     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1103     dnl the environment and includedir purposes (when using an SDK, below),
1104     dnl but remember the full version number for the libdir (SDK).
1105     changequote(,)
1106     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1107     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1108     changequote([,])
1109     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1110         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1111         dnl 4.0.0/4061 is the default compiler in Tiger.
1112         changequote(,)
1113         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1114         changequote([,])
1115         if test "$GCC_BUILD" = "4061" ; then
1116             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1117 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1118 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1119         fi
1120     fi
1122     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1123     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1124     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1125     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1127     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1128     dnl it has moved into /usr/bin.
1129     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1130     ;;
1131 esac
1133 AC_SUBST(GCC_VERSION)
1135 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1136 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
1137 dnl when we can run target binaries.
1138 AC_SUBST(UNIVERSAL_BINARY)
1139 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
1141 dnl ========================================================
1142 dnl Check for MacOS deployment target version
1143 dnl ========================================================
1145 MOZ_ARG_ENABLE_STRING(macos-target,
1146                       [  --enable-macos-target=VER (default=10.5)
1147                           Set the minimum MacOS version needed at runtime],
1148                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1150 case "$target" in
1151 *-darwin*)
1152     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1153         dnl Use the specified value
1154         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1155     else
1156         dnl No value specified on the command line or in the environment,
1157         dnl use architecture minimum.
1158         case "${target_cpu}" in
1159           i*86)
1160             export MACOSX_DEPLOYMENT_TARGET=10.5
1161             ;;
1162           x86_64)
1163             export MACOSX_DEPLOYMENT_TARGET=10.6
1164             ;;
1165         esac
1166     fi
1167     ;;
1168 esac
1170 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1172 dnl ========================================================
1173 dnl = Mac OS X SDK support
1174 dnl ========================================================
1175 MACOS_SDK_DIR=
1176 NEXT_ROOT=
1177 MOZ_ARG_WITH_STRING(macos-sdk,
1178 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1179     MACOS_SDK_DIR=$withval)
1181 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1182 dnl NEXT_ROOT will be set and exported only if it's needed.
1183 AC_SUBST(MACOS_SDK_DIR)
1184 AC_SUBST(NEXT_ROOT)
1186 if test "$MACOS_SDK_DIR"; then
1187   dnl Sync this section with the ones in NSPR and NSS.
1188   dnl Changes to the cross environment here need to be accounted for in
1189   dnl the libIDL checks (below) and xpidl build.
1191   if test ! -d "$MACOS_SDK_DIR"; then
1192     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1193 specify a valid SDK.  SDKs are installed when the optional cross-development
1194 tools are selected during the Xcode/Developer Tools installation.])
1195   fi
1197   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1198   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1199     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1200   else
1201     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1202     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1204     dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1205     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1206     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1208     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1209       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1210       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1211       dnl be ignored and cause warnings when -syslibroot is specified.
1212       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1213       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1214       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1215     fi
1216   fi
1218   AC_LANG_SAVE
1219   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1220   AC_LANG_CPLUSPLUS
1221   AC_TRY_COMPILE([#include <new>],[],
1222    result=yes,
1223    result=no)
1224   AC_LANG_RESTORE
1225   AC_MSG_RESULT($result)
1227   if test "$result" = "no" ; then
1228     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1229   fi
1232 fi # COMPILE_ENVIRONMENT
1234 dnl clang prior to 2.9 (including Xcode 4) does not support all the
1235 dnl constructs required by the libtheora inline asm. This is used to
1236 dnl detect and disable it
1237 AC_MSG_CHECKING([whether the C compiler is clang older than version 2.9])
1238 AC_LANG_SAVE
1239 AC_LANG_C
1240 AC_TRY_COMPILE([
1241 #if defined(__clang__)
1242 # if __clang_major__<2 || (__clang_major__==2 && __clang_minor__<9)
1243 #  error "clang older than 2.9 detected"
1244 # endif
1245 #endif
1246                ],
1247                [],
1248                result="no",
1249                result="yes")
1250 AC_LANG_RESTORE
1251 AC_MSG_RESULT([$result])
1252 if test "$result" = "yes"; then
1253   MOZ_NO_THEORA_ASM=1
1255 dnl XCode 4.2 also shipped an llvm-gcc which couldn't compile
1256 dnl the libtheora inline asm.
1257 AC_MSG_CHECKING([bad gcc versions])
1258 if `$CC --version | grep -q "Apple Inc. build 5658"`; then
1259   AC_MSG_RESULT([Apple build 5658])
1260   MOZ_NO_THEORA_ASM=1
1261 else
1262   AC_MSG_RESULT([we're ok])
1265 AC_SUBST(MOZ_NO_THEORA_ASM)
1267 if test "x$MOZ_NO_THEORA_ASM" = x1; then
1268   AC_MSG_WARN([Disabling libtheora inline assembly])
1271 if test -n "$MAKE"; then
1272   if test `echo $MAKE | grep -c make.py` != 1; then
1273      NOT_PYMAKE=$MAKE
1274   fi
1277 case "$host_os" in
1278 mingw*)
1279     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1280     ;;
1282     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1283     ;;
1284 esac
1285 if test "$GMAKE" = ":"; then
1286    AC_MSG_ERROR([GNU make not found])
1288 AC_SUBST(GMAKE)
1290 if test "$COMPILE_ENVIRONMENT"; then
1292 AC_PATH_XTRA
1294 XCFLAGS="$X_CFLAGS"
1296 fi # COMPILE_ENVIRONMENT
1298 dnl ========================================================
1299 dnl set the defaults first
1300 dnl ========================================================
1301 AS_BIN=$AS
1302 AR_LIST='$(AR) t'
1303 AR_EXTRACT='$(AR) x'
1304 AR_DELETE='$(AR) d'
1305 AS='$(CC)'
1306 AS_DASH_C_FLAG='-c'
1307 DLL_PREFIX=lib
1308 LIB_PREFIX=lib
1309 DLL_SUFFIX=.so
1310 OBJ_SUFFIX=o
1311 LIB_SUFFIX=a
1312 ASM_SUFFIX=s
1313 IMPORT_LIB_SUFFIX=
1314 TARGET_MD_ARCH=unix
1315 DIRENT_INO=d_ino
1316 WIN_TOP_SRC=
1317 MOZ_USER_DIR=".mozilla"
1319 MOZ_JPEG_CFLAGS=
1320 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1321 MOZ_ZLIB_CFLAGS=
1322 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1323 MOZ_BZ2_CFLAGS=
1324 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1325 MOZ_PNG_CFLAGS=
1326 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1328 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1329 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1330 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1331 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1332 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1333 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1334 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1335 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1337 MOZ_FS_LAYOUT=unix
1339 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1341 USE_DEPENDENT_LIBS=1
1343 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1345 if test -n "$CROSS_COMPILE"; then
1346     OS_TARGET="${target_os}"
1347     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1348     OS_RELEASE=
1349     case "${target_os}" in
1350         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1351         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1352         gnu*)         OS_ARCH=GNU ;;
1353         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1354         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
1355         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1356     esac
1357     case "${target}" in
1358         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1359     esac
1360 else
1361     OS_TARGET=`uname -s`
1362     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1363     OS_RELEASE=`uname -r`
1366 # Before this used `uname -m` when not cross compiling
1367 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1368 OS_TEST="${target_cpu}"
1370 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1372 #######################################################################
1373 # Master "Core Components" macros for getting the OS target           #
1374 #######################################################################
1377 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1378 # cross-compilation.
1382 # Define and override various archtecture-specific variables, including
1383 # HOST_OS_ARCH
1384 # OS_ARCH
1385 # OS_TEST
1386 # OS_TARGET
1387 # OS_RELEASE
1388 # OS_MINOR_RELEASE
1391 case "$HOST_OS_ARCH" in
1392 mingw*)
1393     HOST_OS_ARCH=WINNT
1394     ;;
1395 darwin*)
1396     HOST_OS_ARCH=Darwin
1397     ;;
1398 linux*)
1399     HOST_OS_ARCH=Linux
1400     ;;
1401 solaris*)
1402     HOST_OS_ARCH=SunOS
1403     SOLARIS_SUNPRO_CC=
1404     SOLARIS_SUNPRO_CXX=
1405     if test -z "$GNU_CC"; then
1406         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1407             SOLARIS_SUNPRO_CC=1
1408        fi
1409     fi
1411     if test -z "$GNU_CXX"; then
1412        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1413            SOLARIS_SUNPRO_CXX=1
1414        fi
1415     fi
1416     AC_SUBST(SOLARIS_SUNPRO_CC)
1417     AC_SUBST(SOLARIS_SUNPRO_CXX)
1418     ;;
1419 BSD_386)
1420     HOST_OS_ARCH=BSD
1421     ;;
1422 OS_2)
1423     HOST_OS_ARCH=OS2
1424     ;;
1425 esac
1427 case "$OS_ARCH" in
1428 WINNT)
1429     if test -z "$CROSS_COMPILE" ; then
1430         OS_TEST=`uname -p`
1431     fi
1432     ;;
1433 Windows_NT)
1435 # If uname -s returns "Windows_NT", we assume that we are using
1436 # the uname.exe in MKS toolkit.
1438 # The -r option of MKS uname only returns the major version number.
1439 # So we need to use its -v option to get the minor version number.
1440 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1442     OS_ARCH=WINNT
1443     OS_TARGET=WINNT
1444     OS_MINOR_RELEASE=`uname -v`
1445     if test "$OS_MINOR_RELEASE" = "00"; then
1446         OS_MINOR_RELEASE=0
1447     fi
1448     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1449     ;;
1450 MINGW*_NT*)
1452 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1453 # the uname.exe in the MSYS tools.
1455     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1456     OS_ARCH=WINNT
1457     OS_TARGET=WINNT
1458     ;;
1459 AIX)
1460     OS_RELEASE=`uname -v`.`uname -r`
1461     OS_TEST=${target_cpu}
1462     ;;
1463 BSD_386)
1464     OS_ARCH=BSD
1465     ;;
1466 OS_2)
1467     OS_ARCH=OS2
1468     OS_TARGET=OS2
1469     OS_RELEASE=`uname -v`
1470     ;;
1471 Darwin)
1472     case "${target_cpu}" in
1473     powerpc*)
1474         OS_TEST=ppc
1475         ;;
1476     i*86*)
1477         OS_TEST=i386
1478         ;;
1479     x86_64)
1480         OS_TEST=x86_64
1481         ;;
1482     *)
1483         if test -z "$CROSS_COMPILE" ; then
1484             OS_TEST=`uname -p`
1485         fi
1486         ;;
1487     esac
1488     ;;
1489 esac
1491 # Only set CPU_ARCH if we recognize the value of OS_TEST
1493 case "$OS_TEST" in
1494 *86 | i86pc)
1495     CPU_ARCH=x86
1496     ;;
1498 powerpc64 | ppc64)
1499     CPU_ARCH=ppc64
1500     ;;
1502 powerpc | ppc | rs6000)
1503     CPU_ARCH=ppc
1504     ;;
1506 Alpha | alpha | ALPHA)
1507     CPU_ARCH=Alpha
1508     ;;
1510 s390)
1511     CPU_ARCH=s390
1512     ;;
1514 s390x)
1515     CPU_ARCH=s390x
1516     ;;
1518 hppa* | parisc)
1519     CPU_ARCH=hppa
1520     ;;
1522 sun4u | sparc*)
1523     CPU_ARCH=sparc
1524     ;;
1526 x86_64 | ia64)
1527     CPU_ARCH="$OS_TEST"
1528     ;;
1530 arm*)
1531     CPU_ARCH=arm
1532     ;;
1534 mips|mipsel)
1535     CPU_ARCH="mips"
1536     ;;
1537 esac
1539 if test -z "$OS_TARGET"; then
1540     OS_TARGET=$OS_ARCH
1542 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1544 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1545 dnl ===============================================================
1546 INTEL_ARCHITECTURE=
1547 case "$OS_TEST" in
1548     x86_64|i?86)
1549       INTEL_ARCHITECTURE=1
1550 esac
1552 dnl Configure platform-specific CPU architecture compiler options.
1553 dnl ==============================================================
1554 MOZ_ARCH_OPTS
1556 dnl =================================================================
1557 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1558 dnl which is bad when cross compiling.
1559 dnl =================================================================
1560 if test "$COMPILE_ENVIRONMENT"; then
1561 configure_static_assert_macros='
1562 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1563 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1564 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1567 dnl test that the macros actually work:
1568 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1569 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1570  [AC_LANG_SAVE
1571   AC_LANG_C
1572   ac_cv_static_assertion_macros_work="yes"
1573   AC_TRY_COMPILE([$configure_static_assert_macros],
1574                  [CONFIGURE_STATIC_ASSERT(1)],
1575                  ,
1576                  ac_cv_static_assertion_macros_work="no")
1577   AC_TRY_COMPILE([$configure_static_assert_macros],
1578                  [CONFIGURE_STATIC_ASSERT(0)],
1579                  ac_cv_static_assertion_macros_work="no",
1580                  )
1581   AC_LANG_CPLUSPLUS
1582   AC_TRY_COMPILE([$configure_static_assert_macros],
1583                  [CONFIGURE_STATIC_ASSERT(1)],
1584                  ,
1585                  ac_cv_static_assertion_macros_work="no")
1586   AC_TRY_COMPILE([$configure_static_assert_macros],
1587                  [CONFIGURE_STATIC_ASSERT(0)],
1588                  ac_cv_static_assertion_macros_work="no",
1589                  )
1590   AC_LANG_RESTORE
1591  ])
1592 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1593 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1594     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1596 fi # COMPILE_ENVIRONMENT
1598 dnl ========================================================
1599 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1600 dnl computed above.
1601 dnl ========================================================
1603 if test "$OS_TARGET" = "Android"; then
1604     case "${CPU_ARCH}-${MOZ_ARCH}" in
1605     arm-armv7*)
1606       ANDROID_CPU_ARCH=armeabi-v7a
1607       ;;
1608     arm-*)
1609       ANDROID_CPU_ARCH=armeabi
1610       ;;
1611     x86-*)
1612       ANDROID_CPU_ARCH=x86
1613       ;;
1614     esac
1617 if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
1618     if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
1619        if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a" ; then
1620           AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
1621        fi
1622        STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
1623        STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH"
1624        STLPORT_LIBS="-lstdc++"
1625     elif test -e "$android_ndk/sources/cxx-stl/stlport/src/iostream.cpp" ; then
1626        if test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
1627           STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
1628        elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
1629           STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
1630        else
1631           AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
1632        fi
1633        STLPORT_SOURCES="$android_ndk/sources/cxx-stl/stlport"
1634        STLPORT_CPPFLAGS="-I$_objdir/build/stlport -I$android_ndk/sources/cxx-stl/stlport/stlport"
1635        STLPORT_LIBS="-lstlport_static"
1636     elif test "$target" != "arm-android-eabi"; then
1637        dnl fail if we're not building with NDKr4
1638        AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
1639     fi
1640     CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
1641     LDFLAGS="$LDFLAGS $STLPORT_LDFLAGS"
1642     LIBS="$LIBS $STLPORT_LIBS"
1645 AC_SUBST([STLPORT_SOURCES])
1647 dnl ========================================================
1648 dnl Suppress Clang Argument Warnings
1649 dnl ========================================================
1650 if test -n "$CLANG_CC"; then
1651     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1652     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1654 if test -n "$CLANG_CXX"; then
1655     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1658 dnl ========================================================
1659 dnl = Use Address Sanitizer
1660 dnl ========================================================
1661 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1662 [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
1663     MOZ_ASAN=1,
1664     MOZ_ASAN= )
1665 if test -n "$MOZ_ASAN"; then
1666     MOZ_LLVM_HACKS=1
1667     AC_DEFINE(MOZ_ASAN)
1669 AC_SUBST(MOZ_ASAN)
1671 dnl ========================================================
1672 dnl = Enable hacks required for LLVM instrumentations
1673 dnl ========================================================
1674 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1675 [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
1676     MOZ_LLVM_HACKS=1,
1677     MOZ_LLVM_HACKS= )
1678 if test -n "$MOZ_LLVM_HACKS"; then
1679     MOZ_NO_WLZDEFS=1
1680     MOZ_CFLAGS_NSS=1
1682 AC_SUBST(MOZ_NO_WLZDEFS)
1683 AC_SUBST(MOZ_CFLAGS_NSS)
1685 dnl ========================================================
1686 dnl GNU specific defaults
1687 dnl ========================================================
1688 if test "$GNU_CC"; then
1689     # FIXME: Let us build with strict aliasing. bug 414641.
1690     CFLAGS="$CFLAGS -fno-strict-aliasing"
1691     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1692     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1693     DSO_LDOPTS='-shared'
1694     if test "$GCC_USE_GNU_LD"; then
1695         # Some tools like ASan use a runtime library that is only
1696         # linked against executables, so we must allow undefined
1697         # symbols for shared objects in some cases.
1698         if test -z "$MOZ_NO_WLZDEFS"; then
1699             # Don't allow undefined symbols in libraries
1700             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1701         fi
1702     fi
1703     WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1704     DSO_CFLAGS=''
1705     DSO_PIC_CFLAGS='-fPIC'
1706     ASFLAGS="$ASFLAGS -fPIC"
1707     _MOZ_RTTI_FLAGS_ON=-frtti
1708     _MOZ_RTTI_FLAGS_OFF=-fno-rtti
1710     # Turn on GNU-specific warnings:
1711     # -Wall - turn on a lot of warnings
1712     # -pedantic - this is turned on below
1713     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1714     # -Wdeclaration-after-statement - MSVC doesn't like these
1715     # -Werror=return-type - catches missing returns, zero false positives
1716     # -Wtype-limits - catches overflow bugs, few false positives
1717     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1718     #
1719     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1720     MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1721     MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1722     MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1723     
1724     # Turn off the following warnings that -Wall/-pedantic turn on:
1725     # -Wno-unused - lots of violations in third-party code
1726     # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1727     #
1728     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1729     MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1731     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1732        # Don't use -Wcast-align with ICC or clang
1733        case "$CPU_ARCH" in
1734            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1735            hppa | ia64 | sparc | arm)
1736            ;;
1737            *)
1738         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1739            ;;
1740        esac
1741     fi
1743     dnl Turn pedantic on but disable the warnings for long long
1744     _PEDANTIC=1
1746     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1747     _USE_CPP_INCLUDE_FLAG=1
1749 elif test "$SOLARIS_SUNPRO_CC"; then
1750     DSO_CFLAGS=''
1751     if test "$CPU_ARCH" = "sparc"; then
1752         # for Sun Studio on Solaris/SPARC
1753         DSO_PIC_CFLAGS='-xcode=pic32'
1754     else
1755         DSO_PIC_CFLAGS='-KPIC'
1756     fi
1757     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1758 else
1759     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1760     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1762     DSO_LDOPTS='-shared'
1763     if test "$GNU_LD"; then
1764         # Don't allow undefined symbols in libraries
1765         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1766     fi
1768     DSO_CFLAGS=''
1769     DSO_PIC_CFLAGS='-KPIC'
1770     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1773 if test "$GNU_CXX"; then
1774     # FIXME: Let us build with strict aliasing. bug 414641.
1775     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1777     # Turn on GNU-specific warnings:
1778     # -Wall - turn on a lot of warnings
1779     # -pedantic - this is turned on below
1780     # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1781     # -Woverloaded-virtual - ???
1782     # -Werror=return-type - catches missing returns, zero false positives
1783     # -Wtype-limits - catches overflow bugs, few false positives
1784     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1785     #
1786     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1787     MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1788     MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1789     MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1791     # Turn off the following warnings that -Wall/-pedantic turn on:
1792     # -Wno-ctor-dtor-privacy - ???
1793     # -Wno-overlength-strings - we exceed the minimum maximum length frequently 
1794     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1795     # -Wno-variadic-macros - ???
1796     #
1797     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1798     MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1799     MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1800     MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1802     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1803        # Don't use -Wcast-align with ICC or clang
1804        case "$CPU_ARCH" in
1805            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1806            hppa | ia64 | sparc | arm)
1807            ;;
1808            *)
1809         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1810            ;;
1811        esac
1812     fi
1814     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1815     _USE_CPP_INCLUDE_FLAG=1
1817     # Recent clang and gcc support C++11 deleted functions without warnings if
1818     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1819     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
1820     # unused.  But clang's warning can be disabled, so when compiling with clang
1821     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1822     # deleted function syntax.
1823     if test "$CLANG_CXX"; then
1824         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1825         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1826     fi
1828 else
1829     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1832 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1833 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1834 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1835 dnl normal behavior.
1836 dnl ========================================================
1837 MKSHLIB_FORCE_ALL=
1838 MKSHLIB_UNFORCE_ALL=
1840 if test "$COMPILE_ENVIRONMENT"; then
1841 if test "$GNU_CC"; then
1842   AC_MSG_CHECKING(whether ld has archive extraction flags)
1843   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1844    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1845     ac_cv_mkshlib_force_and_unforce="no"
1846     exec 3<&0 <<LOOP_INPUT
1847         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1848         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1849         force="-Wl,-all";              unforce="-Wl,-none"
1850 LOOP_INPUT
1851     while read line
1852     do
1853       eval $line
1854       LDFLAGS=$force
1855       LIBS=$unforce
1856       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1857     done
1858     exec 0<&3 3<&-
1859     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1860    ])
1861   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1862     AC_MSG_RESULT(no)
1863   else
1864     AC_MSG_RESULT(yes)
1865     eval $ac_cv_mkshlib_force_and_unforce
1866     MKSHLIB_FORCE_ALL=$force
1867     MKSHLIB_UNFORCE_ALL=$unforce
1868   fi
1869 fi # GNU_CC
1870 fi # COMPILE_ENVIRONMENT
1872 dnl ========================================================
1873 dnl Checking for 64-bit OS
1874 dnl ========================================================
1875 if test "$COMPILE_ENVIRONMENT"; then
1876 AC_LANG_SAVE
1877 AC_LANG_C
1878 AC_MSG_CHECKING(for 64-bit OS)
1879 AC_TRY_COMPILE([$configure_static_assert_macros],
1880                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1881                result="yes", result="no")
1882 AC_MSG_RESULT("$result")
1883 if test "$result" = "yes"; then
1884     AC_DEFINE(HAVE_64BIT_OS)
1885     HAVE_64BIT_OS=1
1887 AC_SUBST(HAVE_64BIT_OS)
1888 AC_LANG_RESTORE
1889 fi # COMPILE_ENVIRONMENT
1891 dnl ========================================================
1892 dnl Enable high-memory support on OS/2 by default.
1893 dnl ========================================================
1894 MOZ_OS2_HIGH_MEMORY=1
1895 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1896 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1897     MOZ_OS2_HIGH_MEMORY=,
1898     MOZ_OS2_HIGH_MEMORY=1 )
1899 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1901 dnl ========================================================
1902 dnl = Use profiling compile flags
1903 dnl ========================================================
1904 MOZ_ARG_ENABLE_BOOL(profiling,
1905 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1906     MOZ_PROFILING=1,
1907     MOZ_PROFILING= )
1909 dnl ========================================================
1910 dnl = Use Valgrind
1911 dnl ========================================================
1912 MOZ_ARG_ENABLE_BOOL(valgrind,
1913 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1914     MOZ_VALGRIND=1,
1915     MOZ_VALGRIND= )
1916 if test -n "$MOZ_VALGRIND"; then
1917     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1918         AC_MSG_ERROR(
1919             [--enable-valgrind specified but Valgrind is not installed]))
1920     AC_DEFINE(MOZ_VALGRIND)
1922 AC_SUBST(MOZ_VALGRIND)
1924 dnl ========================================================
1925 dnl = Use DMD
1926 dnl ========================================================
1927 MOZ_ARG_ENABLE_BOOL(dmd,
1928 [  --enable-dmd            Enable DMD; also disables jemalloc (default=no)],
1929     MOZ_DMD=1,
1930     MOZ_DMD= )
1931 if test -n "$MOZ_DMD"; then
1932     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1933         AC_MSG_ERROR(
1934             [--enable-dmd specified but Valgrind is not installed]))
1935     AC_DEFINE(MOZ_DMD)
1937 AC_SUBST(MOZ_DMD)
1939 dnl ========================================================
1940 dnl jprof
1941 dnl ========================================================
1942 MOZ_ARG_ENABLE_BOOL(jprof,
1943 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1944     MOZ_JPROF=1,
1945     MOZ_JPROF= )
1946 if test -n "$MOZ_JPROF"; then
1947     MOZ_PROFILING=1
1948     AC_DEFINE(MOZ_JPROF)
1951 dnl ========================================================
1952 dnl SPS Profiler
1953 dnl ========================================================
1954 MOZ_ENABLE_PROFILER_SPS=1
1956 case "${OS_TARGET}" in
1957 Android)
1958     case "${CPU_ARCH}" in
1959     x86 | arm) ;;
1960     *)
1961         MOZ_ENABLE_PROFILER_SPS=
1962     esac
1963     ;;
1964 Linux)
1965     case "${CPU_ARCH}" in
1966     x86 | x86_64) ;;
1967     *)
1968         MOZ_ENABLE_PROFILER_SPS=
1969     esac
1970     ;;
1971 WINNT|Darwin) ;;
1973     MOZ_ENABLE_PROFILER_SPS=
1974     ;;
1975 esac
1977 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
1978     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
1981 dnl ========================================================
1982 dnl shark
1983 dnl ========================================================
1984 MOZ_ARG_ENABLE_BOOL(shark,
1985 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1986     MOZ_SHARK=1,
1987     MOZ_SHARK= )
1988 if test -n "$MOZ_SHARK"; then
1989     MOZ_PROFILING=1
1990     AC_DEFINE(MOZ_SHARK)
1993 dnl ========================================================
1994 dnl callgrind
1995 dnl ========================================================
1996 MOZ_ARG_ENABLE_BOOL(callgrind,
1997 [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
1998     MOZ_CALLGRIND=1,
1999     MOZ_CALLGRIND= )
2000 if test -n "$MOZ_CALLGRIND"; then
2001     MOZ_PROFILING=1
2002     AC_DEFINE(MOZ_CALLGRIND)
2005 dnl ========================================================
2006 dnl vtune
2007 dnl ========================================================
2008 MOZ_ARG_ENABLE_BOOL(vtune,
2009 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
2010     MOZ_VTUNE=1,
2011     MOZ_VTUNE= )
2012 if test -n "$MOZ_VTUNE"; then
2013     MOZ_PROFILING=1
2014     AC_DEFINE(MOZ_VTUNE)
2017 dnl ========================================================
2018 dnl Profiling
2019 dnl ========================================================
2020 if test -n "$MOZ_PROFILING"; then
2021     AC_DEFINE(MOZ_PROFILING)
2024 dnl ========================================================
2025 dnl System overrides of the defaults for host
2026 dnl ========================================================
2027 case "$host" in
2028 *mingw*)
2029     if test -n "$_WIN32_MSVC"; then
2030         HOST_AR=lib
2031         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
2032         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
2033         HOST_RANLIB='echo ranlib'
2034     else
2035         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
2036     fi
2037     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
2038     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
2039     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2040     HOST_BIN_SUFFIX=.exe
2041     case "$host" in
2042     *mingw*)
2043         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
2044         ;;
2045     esac
2047     case "${host_cpu}" in
2048     i*86)
2049         if test -n "$_WIN32_MSVC"; then
2050             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
2051         fi
2052         ;;
2053     x86_64)
2054         if test -n "$_WIN32_MSVC"; then
2055             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
2056         fi
2057         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
2058         ;;
2059     esac
2060     ;;
2062 *-darwin*)
2063     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
2064     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2065     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
2066     ;;
2068 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2069     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
2070     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2071     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
2072     ;;
2074 *os2*)
2075     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
2076     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2077     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2078     HOST_BIN_SUFFIX=.exe
2079     MOZ_FIX_LINK_PATHS=
2080     ;;
2083     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
2084     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2085     ;;
2086 esac
2088 dnl We require version 2.5 or newer of Python to build.
2089 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
2090 changequote(,)
2091 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
2092 _python_res=$?
2093 changequote([,])
2094 if test "$_python_res" != 0; then
2095     AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
2097 AC_MSG_RESULT([yes])
2099 dnl Check for using a custom <stdint.h> implementation
2100 dnl ========================================================
2101 AC_MSG_CHECKING(for custom <stdint.h> implementation)
2102 if test "$MOZ_CUSTOM_STDINT_H"; then
2103   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
2104   AC_SUBST(MOZ_CUSTOM_STDINT_H)
2105   AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
2106 else
2107   AC_MSG_RESULT(none specified)
2110 dnl Get mozilla version from central milestone file
2111 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
2112 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
2114 dnl Get version of various core apps from the version files.
2115 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
2117 if test -z "$FIREFOX_VERSION"; then
2118     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
2121 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
2122 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
2123 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
2125 MOZ_DOING_LTO(lto_is_enabled)
2127 dnl ========================================================
2128 dnl System overrides of the defaults for target
2129 dnl ========================================================
2131 case "$target" in
2132 *-aix*)
2133     AC_DEFINE(AIX)
2134     if test ! "$GNU_CC"; then
2135         if test ! "$HAVE_64BIT_OS"; then
2136             # Compiling with Visual Age C++ object model compat is the
2137             # default. To compile with object model ibm, add
2138             # AIX_OBJMODEL=ibm to .mozconfig.
2139             if test "$AIX_OBJMODEL" = "ibm"; then
2140                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
2141             else
2142                 AIX_OBJMODEL=compat
2143             fi
2144         else
2145             AIX_OBJMODEL=compat
2146         fi
2147         AC_SUBST(AIX_OBJMODEL)
2148         DSO_LDOPTS='-qmkshrobj=1'
2149         DSO_CFLAGS='-qflag=w:w'
2150         DSO_PIC_CFLAGS=
2151         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
2152         MOZ_FIX_LINK_PATHS=
2153         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2154         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2155         if test "$COMPILE_ENVIRONMENT"; then
2156             AC_LANG_SAVE
2157             AC_LANG_CPLUSPLUS
2158             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
2159             AC_TRY_COMPILE([],
2160                 [#if (__IBMCPP__ < 900)
2161                  #error "Bad compiler"
2162                  #endif],
2163                 _BAD_COMPILER=,_BAD_COMPILER=1)
2164             if test -n "$_BAD_COMPILER"; then
2165                 AC_MSG_RESULT([no])
2166                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
2167             else
2168                 AC_MSG_RESULT([yes])
2169             fi
2170             AC_LANG_RESTORE
2171             TARGET_COMPILER_ABI="ibmc"
2172             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
2173             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
2174         fi
2175     fi
2176     case "${target_os}" in
2177     aix4.1*)
2178         DLL_SUFFIX='_shr.a'
2179         ;;
2180     esac
2181     if test "$COMPILE_ENVIRONMENT"; then
2182         MOZ_CHECK_HEADERS(sys/inttypes.h)
2183     fi
2184     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2185     ;;
2187 *-bsdi*)
2188     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2189     _PEDANTIC=
2190     case $OS_RELEASE in
2191         4.*|5.*)
2192             STRIP="$STRIP -d"
2193             ;;
2194         *)
2195             DSO_CFLAGS=''
2196             DSO_LDOPTS='-r'
2197             _WARNINGS_CFLAGS="-Wall"
2198             _WARNINGS_CXXFLAGS="-Wall"
2199             # The test above doesn't work properly, at least on 3.1.
2200             MKSHLIB_FORCE_ALL=''
2201             MKSHLIB_UNFORCE_ALL=''
2202         ;;
2203     esac
2204     ;;
2206 *-darwin*)
2207     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2208     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2209     MOZ_OPTIMIZE_FLAGS="-O3"
2210     _PEDANTIC=
2211     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
2212     if test "$HAVE_64BIT_OS"; then
2213         MOZ_MEMORY=1
2214     fi
2215     CFLAGS="$CFLAGS -fno-common"
2216     CXXFLAGS="$CXXFLAGS -fno-common"
2217     DLL_SUFFIX=".dylib"
2218     DSO_LDOPTS=''
2219     STRIP="$STRIP -x -S"
2220     # Check whether we're targeting OS X or iOS
2221     AC_CACHE_CHECK(for iOS target,
2222                    ac_cv_ios_target,
2223                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
2224 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
2225 #error not iOS
2226 #endif],
2227                                    [],
2228                                    ac_cv_ios_target="yes",
2229                                    ac_cv_ios_target="no")])
2230     if test "$ac_cv_ios_target" = "yes"; then
2231         AC_DEFINE(XP_IOS)
2232         AC_DEFINE(XP_DARWIN)
2233         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
2234     else
2235         AC_DEFINE(XP_MACOSX)
2236         AC_DEFINE(XP_DARWIN)
2237         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2238         # The ExceptionHandling framework is needed for Objective-C exception
2239         # logging code in nsObjCExceptions.h. Currently we only use that in debug
2240         # builds.
2241         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2242     fi
2243     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2246     if test "x$lto_is_enabled" = "xyes"; then
2247         echo "Skipping -dead_strip because lto is enabled."
2248     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2249     dnl ===================================================================
2250     elif test "x$enable_dtrace" = "xyes"; then
2251         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2252     else
2253         dnl check for the presence of the -dead_strip linker flag
2254         AC_MSG_CHECKING([for -dead_strip option to ld])
2255         _SAVE_LDFLAGS=$LDFLAGS
2256         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2257         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2258         if test -n "$_HAVE_DEAD_STRIP" ; then
2259             AC_MSG_RESULT([yes])
2260             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2261         else
2262             AC_MSG_RESULT([no])
2263         fi
2265         LDFLAGS=$_SAVE_LDFLAGS
2266     fi
2267     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2268     ;;
2270 *-freebsd*)
2271     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2272         DLL_SUFFIX=".so.1.0"
2273         DSO_LDOPTS="-shared"
2274     fi
2275     if test ! "$GNU_CC"; then
2276         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2277     fi
2278     ;;
2280 ia64*-hpux*)
2281     DLL_SUFFIX=".so"
2282     if test ! "$GNU_CC"; then
2283        DSO_LDOPTS='-b'
2284        DSO_CFLAGS=""
2285        DSO_PIC_CFLAGS=
2286        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2287        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2288        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2289     else
2290        DSO_LDOPTS='-b -E'
2291        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2292        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2293     fi
2294     MOZ_FIX_LINK_PATHS=
2295     SYSTEM_MAKEDEPEND=
2296     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2297     AC_DEFINE(_LARGEFILE64_SOURCE)
2298     ;;
2300 *-hpux*)
2301     DLL_SUFFIX=".sl"
2302     if test ! "$GNU_CC"; then
2303         DSO_LDOPTS='-b -Wl,+s'
2304         DSO_CFLAGS=""
2305         DSO_PIC_CFLAGS="+Z"
2306         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2307         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2308         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2309     else
2310         DSO_LDOPTS='-b -E +s'
2311         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2312         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2313     fi
2314     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2315     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2316     ;;
2318 *-android*|*-linuxandroid*)
2319     AC_DEFINE(NO_PW_GECOS)
2320     no_x=yes
2321     if test -n "$gonkdir"; then
2322         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2323         MOZ_B2G_RIL=1
2324         MOZ_B2G_BT=1
2325     else
2326         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2327         MOZ_LINKER=1
2328     fi
2329     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2331     MOZ_GFX_OPTIMIZE_MOBILE=1
2332     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2333     ;;
2335 *-*linux*)
2336     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2337     # Similarly for GNU_CXX and INTEL_CXX.
2338     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2339         # -Os has been broken on Intel's C/C++ compilers for quite a
2340         # while; Intel recommends against using it.
2341         MOZ_OPTIMIZE_FLAGS="-O2"
2342         MOZ_DEBUG_FLAGS="-g"
2343     elif test "$GNU_CC" -o "$GNU_CXX"; then
2344         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2345         case $GCC_VERSION in
2346         4.1.*|4.2.*|4.5.*)
2347             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2348             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2349         esac
2350         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2351         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2352         MOZ_DEBUG_FLAGS="-g"
2353     fi
2355     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2357     MOZ_MEMORY=1
2359     case "${target_cpu}" in
2360     alpha*)
2361         CFLAGS="$CFLAGS -mieee"
2362         CXXFLAGS="$CXXFLAGS -mieee"
2363     ;;
2364     i*86)
2365         USE_ELF_DYNSTR_GC=1
2366     ;;
2367     mips*)
2368         MOZ_DEBUG_FLAGS="-g" # We want inlining
2369     ;;
2370     esac
2372     if test -z "$MC"; then
2373         MC=mc.exe
2374     fi
2375     ;;
2376 *-mingw*)
2377     DSO_CFLAGS=
2378     DSO_PIC_CFLAGS=
2379     DLL_SUFFIX=.dll
2380     RC=rc.exe
2381     MC=mc.exe
2382     # certain versions of cygwin's makedepend barf on the
2383     # #include <string> vs -I./dist/include/string issue so don't use it
2384     SYSTEM_MAKEDEPEND=
2385     if test -n "$GNU_CC"; then
2386         CC="$CC -mwindows"
2387         CXX="$CXX -mwindows"
2388         CPP="$CPP -mwindows"
2389         CFLAGS="$CFLAGS -mms-bitfields"
2390         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2391         DSO_LDOPTS='-shared'
2392         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2393         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2394         RC='$(WINDRES)'
2395         # Use temp file for windres (bug 213281)
2396         RCFLAGS='-O coff --use-temp-file'
2397         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2398         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2399         MOZ_FIX_LINK_PATHS=
2400         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2401         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2402         DLL_PREFIX=
2403         IMPORT_LIB_SUFFIX=dll.a
2404         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2405     else
2406         TARGET_COMPILER_ABI=msvc
2407         HOST_CC='$(CC)'
2408         HOST_CXX='$(CXX)'
2409         HOST_LD='$(LD)'
2410         if test "$AS_BIN"; then
2411             AS="$(basename "$AS_BIN")"
2412         fi
2413         AR='lib'
2414         AR_FLAGS='-NOLOGO -OUT:"$@"'
2415         AR_EXTRACT=
2416         RANLIB='echo not_ranlib'
2417         STRIP='echo not_strip'
2418         PKG_SKIP_STRIP=1
2419         XARGS=xargs
2420         ZIP=zip
2421         UNZIP=unzip
2422         DOXYGEN=:
2423         ASM_SUFFIX=asm
2424         OBJ_SUFFIX=obj
2425         LIB_SUFFIX=lib
2426         DLL_PREFIX=
2427         LIB_PREFIX=
2428         IMPORT_LIB_SUFFIX=lib
2429         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2430         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2431         MKSHLIB_FORCE_ALL=
2432         MKSHLIB_UNFORCE_ALL=
2433         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2434         _USE_CPP_INCLUDE_FLAG=1
2435         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2436         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2437         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2438         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2439         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2440         # make 'foo == bar;' error out
2441         CFLAGS="$CFLAGS -we4553"
2442         CXXFLAGS="$CXXFLAGS -we4553"
2443         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2444         MOZ_DEBUG_FLAGS='-Zi'
2445         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2446         WARNINGS_AS_ERRORS='-WX'
2447         MOZ_OPTIMIZE_FLAGS='-O1'
2448         MOZ_FIX_LINK_PATHS=
2449         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2450         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2451         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2452         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2453         if test $_MSC_VER -ge 1400; then
2454             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2455             dnl For profile-guided optimization
2456             PROFILE_GEN_CFLAGS="-GL"
2457             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2458             dnl XXX: PGO builds can fail with warnings treated as errors,
2459             dnl specifically "no profile data available" appears to be
2460             dnl treated as an error sometimes. This might be a consequence
2461             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2462             dnl with the linker doing most of the work in the whole-program
2463             dnl optimization/PGO case. I think it's probably a compiler bug,
2464             dnl but we work around it here.
2465             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2466             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2467             dnl Probably also a compiler bug, but what can you do?
2468             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2469             LDFLAGS="$LDFLAGS -DYNAMICBASE"
2470         fi
2471     fi
2472     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/media/libjpeg)'
2473     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/media/libpng)'
2474     AC_DEFINE(HAVE_SNPRINTF)
2475     AC_DEFINE(_WINDOWS)
2476     AC_DEFINE(WIN32)
2477     AC_DEFINE(XP_WIN)
2478     AC_DEFINE(XP_WIN32)
2479     AC_DEFINE(HW_THREADS)
2480     AC_DEFINE(STDC_HEADERS)
2481     AC_DEFINE(NEW_H, <new>)
2482     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2483     TARGET_MD_ARCH=win32
2484     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2485     BIN_SUFFIX='.exe'
2486     MOZ_USER_DIR="Mozilla"
2488     dnl Hardcode to win95 for now - cls
2489     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2491     dnl set NO_X11 defines here as the general check is skipped on win32
2492     no_x=yes
2493     AC_DEFINE(NO_X11)
2495     case "$host" in
2496     *-mingw*)
2497         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2498         L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2499         ;;
2500     esac
2502     case "$host" in
2503     *-mingw*)
2504         if test -z "$MOZ_TOOLS"; then
2505             AC_MSG_ERROR([MOZ_TOOLS is not set])
2506         fi
2507         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2508         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2509             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2510         fi
2511         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2512         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2513             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2514         fi
2515         ;;
2516     esac
2518     case "$host_os" in
2519     cygwin*|msvc*|mks*)
2520         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.])
2521         ;;
2522     esac
2524     case "$target" in
2525     i*86-*)
2526         if test "$HAVE_64BIT_OS"; then
2527             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2528         fi
2530         if test $_MSC_VER -ge 1400; then
2531             LDFLAGS="$LDFLAGS -SAFESEH"
2532         fi
2534         if test -n "$GNU_CC"; then
2535             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2536             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2537         else
2538             AC_DEFINE(HAVE_STDCALL)
2539             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2540         fi
2542         MOZ_CHECK_HEADERS(mmintrin.h)
2543         AC_DEFINE(_X86_)
2544         ;;
2545     x86_64-*)
2546         if test -n "$_WIN32_MSVC"; then
2547             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2548         fi
2549         AC_DEFINE(_AMD64_)
2550         ;;
2551     *)
2552         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2553         ;;
2554     esac
2556     if test "$HAVE_64BIT_OS"; then
2557         AC_DEFINE(_WIN64)
2558     fi
2559     ;;
2561 *-netbsd*)
2562     DSO_CFLAGS=''
2563     CFLAGS="$CFLAGS -Dunix"
2564     CXXFLAGS="$CXXFLAGS -Dunix"
2565     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2566         DLL_SUFFIX=".so"
2567         DSO_PIC_CFLAGS='-fPIC -DPIC'
2568         DSO_LDOPTS='-shared'
2569         BIN_FLAGS='-Wl,--export-dynamic'
2570     else
2571         DSO_PIC_CFLAGS='-fPIC -DPIC'
2572         DLL_SUFFIX=".so.1.0"
2573         DSO_LDOPTS='-shared'
2574     fi
2575     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2576     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2577     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2578     if test "$LIBRUNPATH"; then
2579         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2580     fi
2581     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2582     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2583     ;;
2585 *-openbsd*)
2586     if test "$SO_VERSION"; then
2587         DLL_SUFFIX=".so.$SO_VERSION"
2588     else
2589         DLL_SUFFIX=".so.1.0"
2590     fi
2591     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2592     DSO_CFLAGS=''
2593     DSO_PIC_CFLAGS='-fPIC'
2594     DSO_LDOPTS='-shared -fPIC'
2595     if test "$LIBRUNPATH"; then
2596         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2597     fi
2598     ;;
2600 *-os2*)
2601     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2602     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2603     AC_DEFINE(OS2)
2604     AC_DEFINE(XP_OS2)
2605     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2606     AC_DEFINE(TCPV40HDRS)
2607     DLL_PREFIX=
2608     LIB_PREFIX=
2609     LIB_SUFFIX=lib
2610     BIN_SUFFIX=".exe"
2611     DLL_SUFFIX=".dll"
2612     IMPORT_LIB_SUFFIX=lib
2613     DSO_PIC_CFLAGS=
2614     AR=emxomfar
2615     AR_FLAGS='r $@'
2616     CFLAGS="$CFLAGS -Zomf"
2617     CXXFLAGS="$CXXFLAGS -Zomf"
2618     DSO_LDOPTS='-Zdll'
2619     BIN_FLAGS='-Zlinker /ST:0x100000'
2620     IMPLIB='emximp -o'
2621     FILTER='true'
2622     LDFLAGS='-Zmap'
2623     WARNINGS_AS_ERRORS='-Werror'
2624     MOZ_DEBUG_FLAGS="-g -fno-inline"
2625     MOZ_OPTIMIZE_FLAGS="-O2"
2626     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2627     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2628     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2629     TARGET_MD_ARCH=os2
2630     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2631     RC=rc.exe
2632     MC=mc.exe
2633     RCFLAGS='-n'
2634     MOZ_USER_DIR="Mozilla"
2635     ZIP="$ZIP -X"
2637     if test "$MOZTOOLS"; then
2638         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2639     else
2640         AC_MSG_ERROR([MOZTOOLS is not set])
2641     fi
2642     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2643         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2644         LDFLAGS="$LDFLAGS -Zhigh-mem"
2645         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2646         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2647     fi
2649     # GCC for OS/2 currently predefines these, but we don't want them
2650     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2651     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2653     AC_CACHE_CHECK(for __declspec(dllexport),
2654         ac_os2_declspec,
2655         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2656                         [return 0;],
2657                         ac_os2_declspec="yes",
2658                         ac_os2_declspec="no")])
2659     if test "$ac_os2_declspec" != "yes"; then
2660         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2661     fi
2662     ;;
2664 *-solaris*)
2665     AC_DEFINE(SOLARIS)
2666     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2667     SYSTEM_MAKEDEPEND=
2668     MOZ_FIX_LINK_PATHS=
2669     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2670     # libraries one level up (e.g. libnspr4.so)
2671     if test "$SOLARIS_SUNPRO_CC"; then
2672        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2673        LIBS="-lCrun -lCstd -lc $LIBS"
2674        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2675        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2676        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2677        LDFLAGS="-xildoff $LDFLAGS"
2678        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2679            _SAVE_LDFLAGS=$LDFLAGS
2680            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2681            AC_TRY_LINK([#include <stdio.h>],
2682                        [printf("Hello World\n");],
2683                        ,
2684                        [LDFLAGS=$_SAVE_LDFLAGS])
2685        fi
2686        MOZ_OPTIMIZE_FLAGS="-xO4"
2687        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2688        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2689        MKSHLIB_FORCE_ALL='-z allextract'
2690        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2691        DSO_LDOPTS='-G'
2692        AR_LIST="$AR t"
2693        AR_EXTRACT="$AR x"
2694        AR_DELETE="$AR d"
2695        AR='$(CXX) -xar'
2696        AR_FLAGS='-o $@'
2697        AS='/usr/ccs/bin/as'
2698        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2699        AS_DASH_C_FLAG=''
2700        TARGET_COMPILER_ABI="sunc"
2701        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2702        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2703        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2704        AC_LANG_SAVE
2705        AC_LANG_CPLUSPLUS
2706        AC_TRY_COMPILE([],
2707            [#if (__SUNPRO_CC < 0x590)
2708            #error "Denied"
2709            #endif],
2710            _BAD_COMPILER=,_BAD_COMPILER=1)
2711        if test -n "$_BAD_COMPILER"; then
2712            _res="no"
2713            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2714        else
2715            _res="yes"
2716        fi
2717        AC_TRY_COMPILE([],
2718            [#if (__SUNPRO_CC >= 0x5100)
2719            #error "Sun C++ 5.10 or above"
2720            #endif],
2721            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2722        if test "$_ABOVE_SS12U1"; then
2723            # disable xannotate
2724            CXXFLAGS="$CXXFLAGS -xannotate=no"
2725        fi
2726        AC_MSG_RESULT([$_res])
2727        AC_LANG_RESTORE
2728     else
2729        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2730        LIBS="-lc $LIBS"
2731        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2732        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2733        ASFLAGS="$ASFLAGS -fPIC"
2734        DSO_LDOPTS='-shared'
2735        WARNINGS_AS_ERRORS='-Werror'
2736        _WARNINGS_CFLAGS=''
2737        _WARNINGS_CXXFLAGS=''
2738        if test "$OS_RELEASE" = "5.3"; then
2739            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2740        fi
2741     fi
2742     if test "$OS_RELEASE" = "5.5.1"; then
2743         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2744     fi
2745     ;;
2747 *-sunos*)
2748     DSO_LDOPTS='-Bdynamic'
2749     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2750     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2751     AC_DEFINE(SUNOS4)
2752     AC_DEFINE(SPRINTF_RETURNS_STRING)
2753     case "$(target_os)" in
2754     sunos4.1*)
2755         DLL_SUFFIX='.so.1.0'
2756         ;;
2757     esac
2758     ;;
2760 *-os2*)
2761     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2762     ;;
2764 esac
2766 AC_SUBST(MOZ_LINKER)
2767 if test -n "$MOZ_LINKER"; then
2768   AC_DEFINE(MOZ_LINKER)
2770 AC_SUBST(MOZ_ENABLE_SZIP)
2772 dnl Only one oddball right now (QNX), but this gives us flexibility
2773 dnl if any other platforms need to override this in the future.
2774 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2776 dnl ========================================================
2777 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2778 dnl by now will not have any way to link most binaries (tests
2779 dnl as well as viewer, apprunner, etc.), because some symbols
2780 dnl will be left out of the "composite" .so's by ld as unneeded.
2781 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2782 dnl they can link in the static libs that provide the missing
2783 dnl symbols.
2784 dnl ========================================================
2785 NO_LD_ARCHIVE_FLAGS=
2786 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2787     NO_LD_ARCHIVE_FLAGS=1
2789 case "$target" in
2790 *-os2*)
2791     NO_LD_ARCHIVE_FLAGS=
2792     ;;
2793 *-aix4.3*|*-aix5*)
2794     NO_LD_ARCHIVE_FLAGS=
2795     ;;
2796 *-mingw*)
2797     if test -z "$GNU_CC"; then
2798         NO_LD_ARCHIVE_FLAGS=
2799     fi
2800     ;;
2801 esac
2802 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2804 dnl ========================================================
2805 dnl = Flags to strip unused symbols from .so components and
2806 dnl = to export jemalloc symbols when linking a program
2807 dnl ========================================================
2808 case "$target" in
2809     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2810         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2811         ;;
2812     *-solaris*)
2813         if test -z "$GNU_CC"; then
2814          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2815         else
2816          if test -z "$GCC_USE_GNU_LD"; then
2817           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2818          else
2819           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2820          fi
2821         fi
2822         ;;
2823     *-darwin*)
2824         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2825         ;;
2826     *-mingw*)
2827         if test -n "$GNU_CC"; then
2828            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2829         fi
2830         ;;
2831 esac
2833 if test -z "$COMPILE_ENVIRONMENT"; then
2834     SKIP_COMPILER_CHECKS=1
2835     SKIP_LIBRARY_CHECKS=1
2838 if test -z "$SKIP_COMPILER_CHECKS"; then
2839 dnl Checks for typedefs, structures, and compiler characteristics.
2840 dnl ========================================================
2841 AC_HEADER_STDC
2842 AC_C_CONST
2843 AC_TYPE_MODE_T
2844 AC_TYPE_OFF_T
2845 AC_TYPE_PID_T
2846 AC_TYPE_SIZE_T
2847 AC_LANG_CPLUSPLUS
2848 AC_MSG_CHECKING(for __stdcall)
2849 AC_CACHE_VAL(ac_cv___stdcall,
2850  [AC_TRY_COMPILE([template <typename Method> struct foo;
2851                   template <> struct foo<void (*)()> {};
2852                   template <> struct foo<void (__stdcall*)()> {};],
2853                  [],
2854                  [ac_cv___stdcall=true],
2855                  [ac_cv___stdcall=false])])
2856 if test "$ac_cv___stdcall" = true ; then
2857   AC_DEFINE(HAVE_STDCALL)
2858   AC_MSG_RESULT(yes)
2859 else
2860   AC_MSG_RESULT(no)
2862 AC_LANG_C
2863 AC_MSG_CHECKING(for ssize_t)
2864 AC_CACHE_VAL(ac_cv_type_ssize_t,
2865  [AC_TRY_COMPILE([#include <stdio.h>
2866                   #include <sys/types.h>],
2867                  [ssize_t foo = 0;],
2868                  [ac_cv_type_ssize_t=true],
2869                  [ac_cv_type_ssize_t=false])])
2870 if test "$ac_cv_type_ssize_t" = true ; then
2871   AC_DEFINE(HAVE_SSIZE_T)
2872   AC_MSG_RESULT(yes)
2873 else
2874   AC_MSG_RESULT(no)
2876 AC_STRUCT_ST_BLKSIZE
2877 AC_MSG_CHECKING(for siginfo_t)
2878 AC_CACHE_VAL(ac_cv_siginfo_t,
2879  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2880                   #include <signal.h>],
2881                  [siginfo_t* info;],
2882                  [ac_cv_siginfo_t=true],
2883                  [ac_cv_siginfo_t=false])])
2884 if test "$ac_cv_siginfo_t" = true ; then
2885   AC_DEFINE(HAVE_SIGINFO_T)
2886   AC_MSG_RESULT(yes)
2887 else
2888   AC_MSG_RESULT(no)
2891 dnl Check for int64, uint, and uint_t.
2892 dnl ========================================================
2893 AC_MSG_CHECKING(for int64)
2894 AC_CACHE_VAL(ac_cv_int64,
2895  [AC_TRY_COMPILE([#include <stdio.h>
2896                   #include <sys/types.h>],
2897                  [int64 foo = 0;],
2898                  [ac_cv_int64=true],
2899                  [ac_cv_int64=false])])
2900 if test "$ac_cv_int64" = true ; then
2901   AC_DEFINE(HAVE_INT64)
2902   AC_MSG_RESULT(yes)
2903 else
2904   AC_MSG_RESULT(no)
2906 AC_MSG_CHECKING(for uint)
2907 AC_CACHE_VAL(ac_cv_uint,
2908  [AC_TRY_COMPILE([#include <stdio.h>
2909                   #include <sys/types.h>],
2910                  [uint foo = 0;],
2911                  [ac_cv_uint=true],
2912                  [ac_cv_uint=false])])
2913 if test "$ac_cv_uint" = true ; then
2914   AC_DEFINE(HAVE_UINT)
2915   AC_MSG_RESULT(yes)
2916 else
2917   AC_MSG_RESULT(no)
2919 AC_MSG_CHECKING(for uint_t)
2920 AC_CACHE_VAL(ac_cv_uint_t,
2921  [AC_TRY_COMPILE([#include <stdio.h>
2922                   #include <sys/types.h>],
2923                  [uint_t foo = 0;],
2924                  [ac_cv_uint_t=true],
2925                  [ac_cv_uint_t=false])])
2926 if test "$ac_cv_uint_t" = true ; then
2927   AC_DEFINE(HAVE_UINT_T)
2928   AC_MSG_RESULT(yes)
2929 else
2930   AC_MSG_RESULT(no)
2933 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2934 dnl are defined when compiling C++ but not C.  Since the result of this
2935 dnl test is used only in C++, do it in C++.
2936 AC_LANG_CPLUSPLUS
2938 AC_MSG_CHECKING(for uname.domainname)
2939 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2940     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2941         [ struct utsname *res; char *domain;
2942             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2943         [ac_cv_have_uname_domainname_field=true],
2944         [ac_cv_have_uname_domainname_field=false])])
2946 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2947     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2948     AC_MSG_RESULT(yes)
2949 else
2950     AC_MSG_RESULT(no)
2953 AC_MSG_CHECKING(for uname.__domainname)
2954 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2955     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2956         [ struct utsname *res; char *domain;
2957             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2958         [ac_cv_have_uname_us_domainname_field=true],
2959         [ac_cv_have_uname_us_domainname_field=false])])
2961 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2962     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2963     AC_MSG_RESULT(yes)
2964 else
2965     AC_MSG_RESULT(no)
2968 dnl ========================================================
2969 dnl C++ rtti
2970 dnl Should be smarter and check that the compiler does indeed have rtti
2971 dnl ========================================================
2973 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
2974 [  --enable-cpp-rtti       Enable C++ RTTI ],
2975 [ _MOZ_USE_RTTI=1 ],
2976 [ _MOZ_USE_RTTI= ])
2978 if test "$_MOZ_USE_RTTI"; then
2979    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
2980 else
2981    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
2984 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
2986 dnl Check whether we can use gcc's c++0x mode
2987 AC_LANG_CPLUSPLUS
2989 if test "$GNU_CXX"; then
2990     _SAVE_CXXFLAGS=$CXXFLAGS
2991     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
2993     if test -z "$_MOZ_USE_RTTI"; then
2994         CXXFLAGS="$CXXFLAGS $_MOZ_RTTI_FLAGS"
2995         AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
2996             ac_cv_cxx0x_headers_bug,
2997             [AC_TRY_COMPILE([#include <memory>], [],
2998                             ac_cv_cxx0x_headers_bug="no",
2999                             ac_cv_cxx0x_headers_bug="yes")])
3000         CXXFLAGS="$_SAVE_CXXFLAGS"
3001         if test "$ac_cv_cxx0x_headers_bug" = "no"; then
3002             CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3003         fi
3004     fi
3007 dnl Check for usable char16_t (2 bytes, unsigned)
3008 dnl (we might not need the unsignedness check anymore)
3009 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3010     ac_cv_have_usable_char16_t,
3011     [AC_TRY_COMPILE([$configure_static_assert_macros],
3012                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3013                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3014                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3015                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3016                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3017                     ac_cv_have_usable_char16_t="yes",
3018                     ac_cv_have_usable_char16_t="no")])
3019 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3020     AC_DEFINE(HAVE_CPP_CHAR16_T)
3021     HAVE_CPP_CHAR16_T=1
3022 elif test "$GNU_CXX"; then
3023     CXXFLAGS="$_SAVE_CXXFLAGS"
3026 dnl Check for usable wchar_t (2 bytes, unsigned)
3027 dnl (we really don't need the unsignedness check anymore)
3028 dnl ========================================================
3030 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3031     ac_cv_have_usable_wchar_v2,
3032     [AC_TRY_COMPILE([#include <stddef.h>
3033                      $configure_static_assert_macros],
3034                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3035                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3036                     ac_cv_have_usable_wchar_v2="yes",
3037                     ac_cv_have_usable_wchar_v2="no")])
3038 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3039     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3040     HAVE_CPP_2BYTE_WCHAR_T=1
3041 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3042 dnl This is really gcc-only
3043 dnl Do this test using CXX only since some versions of gcc
3044 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3045 dnl only have short-wchar support for c++.
3046 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3048     _SAVE_CXXFLAGS=$CXXFLAGS
3049     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3051     AC_CACHE_CHECK(for compiler -fshort-wchar option,
3052         ac_cv_have_usable_wchar_option_v2,
3053         [AC_TRY_LINK([#include <stddef.h>
3054                       $configure_static_assert_macros],
3055                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3056                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3057                      ac_cv_have_usable_wchar_option_v2="yes",
3058                      ac_cv_have_usable_wchar_option_v2="no")])
3060     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3061         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3062         HAVE_CPP_2BYTE_WCHAR_T=1
3063         if test "$OS_TARGET" = Android; then
3064             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3065             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3066             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3067             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3068         else
3069             WCHAR_CFLAGS="-fshort-wchar"
3070         fi
3071     else
3072         CXXFLAGS=$_SAVE_CXXFLAGS
3073     fi
3076 AC_LANG_C
3078 dnl Check for .hidden assembler directive and visibility attribute.
3079 dnl Borrowed from glibc configure.in
3080 dnl ===============================================================
3081 if test "$GNU_CC"; then
3082   AC_CACHE_CHECK(for visibility(hidden) attribute,
3083                  ac_cv_visibility_hidden,
3084                  [cat > conftest.c <<EOF
3085                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3087                   ac_cv_visibility_hidden=no
3088                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3089                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3090                       ac_cv_visibility_hidden=yes
3091                     fi
3092                   fi
3093                   rm -f conftest.[cs]
3094                  ])
3095   if test "$ac_cv_visibility_hidden" = "yes"; then
3096     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3098     AC_CACHE_CHECK(for visibility(default) attribute,
3099                    ac_cv_visibility_default,
3100                    [cat > conftest.c <<EOF
3101                     int foo __attribute__ ((visibility ("default"))) = 1;
3103                     ac_cv_visibility_default=no
3104                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3105                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3106                         ac_cv_visibility_default=yes
3107                       fi
3108                     fi
3109                     rm -f conftest.[cs]
3110                    ])
3111     if test "$ac_cv_visibility_default" = "yes"; then
3112       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3114       AC_CACHE_CHECK(for visibility pragma support,
3115                      ac_cv_visibility_pragma,
3116                      [cat > conftest.c <<EOF
3117 #pragma GCC visibility push(hidden)
3118                       int foo_hidden = 1;
3119 #pragma GCC visibility push(default)
3120                       int foo_default = 1;
3122                       ac_cv_visibility_pragma=no
3123                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3124                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3125                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3126                             ac_cv_visibility_pragma=yes
3127                           fi
3128                         fi
3129                       fi
3130                       rm -f conftest.[cs]
3131                     ])
3132       if test "$ac_cv_visibility_pragma" = "yes"; then
3133         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3134                        ac_cv_have_visibility_class_bug,
3135                        [cat > conftest.c <<EOF
3136 #pragma GCC visibility push(hidden)
3137 struct __attribute__ ((visibility ("default"))) TestStruct {
3138   static void Init();
3140 __attribute__ ((visibility ("default"))) void TestFunc() {
3141   TestStruct::Init();
3144                        ac_cv_have_visibility_class_bug=no
3145                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3146                          ac_cv_have_visibility_class_bug=yes
3147                        else
3148                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3149                            ac_cv_have_visibility_class_bug=yes
3150                          fi
3151                        fi
3152                        rm -rf conftest.{c,S}
3153                        ])
3155         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3156                        ac_cv_have_visibility_builtin_bug,
3157                        [cat > conftest.c <<EOF
3158 #pragma GCC visibility push(hidden)
3159 #pragma GCC visibility push(default)
3160 #include <string.h>
3161 #pragma GCC visibility pop
3163 __attribute__ ((visibility ("default"))) void Func() {
3164   char c[[100]];
3165   memset(c, 0, sizeof(c));
3168                        ac_cv_have_visibility_builtin_bug=no
3169                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3170                          ac_cv_have_visibility_builtin_bug=yes
3171                        else
3172                          if test `grep -c "@PLT" conftest.S` = 0; then
3173                            ac_cv_visibility_builtin_bug=yes
3174                          fi
3175                        fi
3176                        rm -f conftest.{c,S}
3177                        ])
3178         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3179                 "$ac_cv_have_visibility_class_bug" = "no"; then
3180           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3181           WRAP_SYSTEM_INCLUDES=1
3182           STL_FLAGS='-I$(DIST)/stl_wrappers'
3183           WRAP_STL_INCLUDES=1
3184         else
3185           VISIBILITY_FLAGS='-fvisibility=hidden'
3186         fi # have visibility pragma bug
3187       fi   # have visibility pragma
3188     fi     # have visibility(default) attribute
3189   fi       # have visibility(hidden) attribute
3190 fi         # GNU_CC
3192 # visibility hidden flag for Sun Studio on Solaris
3193 if test "$SOLARIS_SUNPRO_CC"; then
3194 VISIBILITY_FLAGS='-xldscope=hidden'
3195 fi         # Sun Studio on Solaris
3197 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3198 AC_SUBST(VISIBILITY_FLAGS)
3200 MOZ_GCC_PR49911
3201 MOZ_COMPILER_OPTS
3203 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3204 dnl ========================================================
3205 if test "$GNU_CC"; then
3206   CFLAGS_save="${CFLAGS}"
3207   CFLAGS="${CFLAGS} -Werror"
3208   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3209                  ac_cv_force_align_arg_pointer,
3210                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3211                                  [],
3212                                  ac_cv_force_align_arg_pointer="yes",
3213                                  ac_cv_force_align_arg_pointer="no")])
3214   CFLAGS="${CFLAGS_save}"
3215   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3216     HAVE_GCC_ALIGN_ARG_POINTER=1
3217   else
3218     HAVE_GCC_ALIGN_ARG_POINTER=
3219   fi
3221 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3223 dnl Checks for header files.
3224 dnl ========================================================
3225 AC_HEADER_DIRENT
3226 case "$target_os" in
3227 freebsd*|openbsd*)
3228 # for stuff like -lXshm
3229     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3230     ;;
3231 esac
3232 MOZ_CHECK_COMMON_HEADERS
3234 dnl These are all the places some variant of statfs can be hiding.
3235 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3237 dnl Quota support
3238 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
3239 MOZ_CHECK_HEADERS(linux/quota.h)
3241 dnl Try for MMX support
3242 dnl NB - later gcc versions require -mmmx for this header to be successfully
3243 dnl included (or another option which implies it, such as -march=pentium-mmx)
3244 MOZ_CHECK_HEADERS(mmintrin.h)
3246 dnl Check whether the compiler supports the new-style C++ standard
3247 dnl library headers (i.e. <new>) or needs the old "new.h"
3248 AC_LANG_CPLUSPLUS
3249 NEW_H=new.h
3250 MOZ_CHECK_HEADER(new, [NEW_H=new])
3251 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3252 AC_LANG_C
3254 AC_ARG_ENABLE(dtrace,
3255               [  --enable-dtrace         build with dtrace support if available (default=no)],
3256               [enable_dtrace="yes"],)
3257 if test "x$enable_dtrace" = "xyes"; then
3258   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3259   if test -n "$HAVE_DTRACE"; then
3260       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3261   else
3262       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3263   fi
3265 AC_SUBST(HAVE_DTRACE)
3267 case $target in
3268 *-aix4.3*|*-aix5*)
3269         ;;
3271         MOZ_CHECK_HEADERS(sys/cdefs.h)
3272         ;;
3273 esac
3275 dnl Checks for libraries.
3276 dnl ========================================================
3277 case $target in
3278 *-hpux11.*)
3279         ;;
3281         AC_CHECK_LIB(c_r, gethostbyname_r)
3282         ;;
3283 esac
3285 dnl We don't want to link with libdl even if it's present on OS X, since
3286 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3287 dnl in libc.
3288 dnl We don't want to link against libm or libpthread on Darwin since
3289 dnl they both are just symlinks to libSystem and explicitly linking
3290 dnl against libSystem causes issues when debugging (see bug 299601).
3291 case $target in
3292 *-darwin*)
3293     ;;
3294 *-os2*)
3295     ;;
3297     AC_SEARCH_LIBS(dlopen, dl,
3298         MOZ_CHECK_HEADER(dlfcn.h,
3299         AC_DEFINE(HAVE_DLOPEN)))
3300     ;;
3301 esac
3303 _SAVE_CFLAGS="$CFLAGS"
3304 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3305 AC_CHECK_FUNCS(dladdr memmem)
3306 CFLAGS="$_SAVE_CFLAGS"
3308 if test ! "$GNU_CXX"; then
3310     case $target in
3311     *-aix*)
3312         AC_CHECK_LIB(C_r, demangle)
3313         ;;
3314      *)
3315         AC_CHECK_LIB(C, demangle)
3316         ;;
3317      esac
3320 dnl OS/2 has socket in libc.
3321 case $target in
3322 *-os2*)
3323     ;;
3325     AC_CHECK_LIB(socket, socket)
3326 esac
3328 XLDFLAGS="$X_LIBS"
3329 XLIBS="$X_EXTRA_LIBS"
3331 dnl ========================================================
3332 dnl Checks for X libraries.
3333 dnl Ordering is important.
3334 dnl Xt is dependent upon SM as of X11R6
3335 dnl ========================================================
3336 if test "$no_x" = "yes"; then
3337     AC_DEFINE(NO_X11)
3338 else
3339     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3340         XLIBS="-lX11 $XLIBS"
3341         _SAVE_LDFLAGS="$LDFLAGS"
3342         LDFLAGS="$XLDFLAGS $LDFLAGS"
3343         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3344                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3345         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3346                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3348         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3349         unset ac_cv_lib_Xt_XtFree
3350             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3351             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3352         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3353                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3354         ])
3356     # AIX needs the motif library linked before libXt to prevent
3357     # crashes in plugins linked against Motif - Bug #98892
3358     case "${target_os}" in
3359     aix*)
3360         XT_LIBS="-lXm $XT_LIBS"
3361         ;;
3362     esac
3364     dnl ========================================================
3365     dnl = Check for XShm
3366     dnl ========================================================
3367     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3368         $XLIBS $XEXT_LIBS)
3370     dnl ========================================================
3371     dnl = Check for Xss
3372     dnl ========================================================
3373     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3374         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3375             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3376              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3378         LDFLAGS="$_SAVE_LDFLAGS"
3380     dnl ========================================================
3381     dnl = Check for freetype2 and its functionality
3382     dnl ========================================================
3383     PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
3385     if test "$_HAVE_FREETYPE2"; then
3386         _SAVE_LIBS="$LIBS"
3387         _SAVE_CFLAGS="$CFLAGS"
3388         LIBS="$LIBS $FT2_LIBS"
3389         CFLAGS="$CFLAGS $FT2_CFLAGS"
3391         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3392             ac_cv_member_FT_Bitmap_Size_y_ppem,
3393             [AC_TRY_COMPILE([#include <ft2build.h>
3394                              #include FT_FREETYPE_H],
3395                             [FT_Bitmap_Size s;
3396                              if (sizeof s.y_ppem) return 0;
3397                              return 1],
3398                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3399                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3400         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3401             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3402         else
3403             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3404         fi
3405         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3406                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3407                            [FT_Bitmap_Size structure includes y_ppem field])
3409         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3411         LIBS="$_SAVE_LIBS"
3412         CFLAGS="$_SAVE_CFLAGS"
3413     fi
3415 fi # $no_x
3417 AC_SUBST(XCFLAGS)
3418 AC_SUBST(XLDFLAGS)
3419 AC_SUBST(XLIBS)
3420 AC_SUBST(XEXT_LIBS)
3421 AC_SUBST(XT_LIBS)
3422 AC_SUBST(XSS_LIBS)
3424 dnl ========================================================
3425 dnl = pthread support
3426 dnl = Start by checking whether the system support pthreads
3427 dnl ========================================================
3428 case "$target_os" in
3429 darwin*)
3430     USE_PTHREADS=1
3431     ;;
3433     MOZ_CHECK_PTHREADS(pthreads,
3434         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3435         MOZ_CHECK_PTHREADS(pthread,
3436             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3437             MOZ_CHECK_PTHREADS(c_r,
3438                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3439                 MOZ_CHECK_PTHREADS(c,
3440                     USE_PTHREADS=1
3441                 )
3442             )
3443         )
3444     )
3445     ;;
3446 esac
3448 dnl ========================================================
3449 dnl Check the command line for --with-pthreads
3450 dnl ========================================================
3451 MOZ_ARG_WITH_BOOL(pthreads,
3452 [  --with-pthreads         Force use of system pthread library with NSPR ],
3453 [ if test "$USE_PTHREADS"x = x; then
3454     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3455 fi],
3456     USE_PTHREADS=
3457     _PTHREAD_LDFLAGS=
3460 dnl ========================================================
3461 dnl Do the platform specific pthread hackery
3462 dnl ========================================================
3463 if test "$USE_PTHREADS"x != x
3464 then
3465         dnl
3466         dnl See if -pthread is supported.
3467         dnl
3468         rm -f conftest*
3469         ac_cv_have_dash_pthread=no
3470         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3471         echo 'int main() { return 0; }' | cat > conftest.c
3472         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3473         if test $? -eq 0; then
3474                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3475                         ac_cv_have_dash_pthread=yes
3476                 case "$target_os" in
3477                 freebsd*)
3478 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3479                 ;;
3480                 *)
3481                             CFLAGS="$CFLAGS -pthread"
3482                             CXXFLAGS="$CXXFLAGS -pthread"
3483                 ;;
3484                 esac
3485                 fi
3486         fi
3487         rm -f conftest*
3488     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3490         dnl
3491         dnl See if -pthreads is supported.
3492         dnl
3493     ac_cv_have_dash_pthreads=no
3494     if test "$ac_cv_have_dash_pthread" = "no"; then
3495             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3496         echo 'int main() { return 0; }' | cat > conftest.c
3497             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3498         if test $? -eq 0; then
3499                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3500                             ac_cv_have_dash_pthreads=yes
3501                             CFLAGS="$CFLAGS -pthreads"
3502                             CXXFLAGS="$CXXFLAGS -pthreads"
3503                     fi
3504             fi
3505             rm -f conftest*
3506         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3507     fi
3509         case "$target" in
3510             *-*-freebsd*)
3511                         AC_DEFINE(_REENTRANT)
3512                         AC_DEFINE(_THREAD_SAFE)
3513                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3514                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3515                                 _PTHREAD_LDFLAGS="-pthread"
3516                         else
3517                                 _PTHREAD_LDFLAGS="-lc_r"
3518                         fi
3519                         ;;
3521             *-*-openbsd*|*-*-bsdi*)
3522                         AC_DEFINE(_REENTRANT)
3523                         AC_DEFINE(_THREAD_SAFE)
3524                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3525                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3526                 _PTHREAD_LDFLAGS="-pthread"
3527                         fi
3528                         ;;
3530             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3531                         AC_DEFINE(_REENTRANT)
3532                         ;;
3534             *-aix4.3*|*-aix5*)
3535                         AC_DEFINE(_REENTRANT)
3536                         ;;
3538             *-hpux11.*)
3539                         AC_DEFINE(_REENTRANT)
3540                         ;;
3542             *-*-solaris*)
3543                         AC_DEFINE(_REENTRANT)
3544                         if test "$SOLARIS_SUNPRO_CC"; then
3545                                 CFLAGS="$CFLAGS -mt"
3546                                 CXXFLAGS="$CXXFLAGS -mt"
3547                         fi
3548                         ;;
3549         esac
3550     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3554 dnl Checks for library functions.
3555 dnl ========================================================
3556 AC_PROG_GCC_TRADITIONAL
3557 AC_FUNC_MEMCMP
3558 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3559 AC_CHECK_FUNCS(flockfile getpagesize)
3560 AC_CHECK_FUNCS(localtime_r strtok_r)
3562 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3563 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3564                ac_cv_clock_monotonic,
3565                [for libs in "" -lrt; do
3566                     _SAVE_LDFLAGS="$LDFLAGS"
3567                     LDFLAGS="$LDFLAGS $libs"
3568                     AC_TRY_LINK([#include <time.h>],
3569                                  [ struct timespec ts;
3570                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
3571                                  ac_cv_clock_monotonic=$libs
3572                                  break,
3573                                  ac_cv_clock_monotonic=no)
3574                     LDFLAGS="$_SAVE_LDFLAGS"
3575                 done])
3576 if test "$ac_cv_clock_monotonic" != "no"; then
3577     HAVE_CLOCK_MONOTONIC=1
3578     REALTIME_LIBS=$ac_cv_clock_monotonic
3579     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3580     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3581     AC_SUBST(REALTIME_LIBS)
3584 dnl check for wcrtomb/mbrtowc
3585 dnl =======================================================================
3586 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3587 AC_LANG_SAVE
3588 AC_LANG_CPLUSPLUS
3589 AC_CACHE_CHECK(for wcrtomb,
3590     ac_cv_have_wcrtomb,
3591     [AC_TRY_LINK([#include <wchar.h>],
3592                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3593                  ac_cv_have_wcrtomb="yes",
3594                  ac_cv_have_wcrtomb="no")])
3595 if test "$ac_cv_have_wcrtomb" = "yes"; then
3596     AC_DEFINE(HAVE_WCRTOMB)
3598 AC_CACHE_CHECK(for mbrtowc,
3599     ac_cv_have_mbrtowc,
3600     [AC_TRY_LINK([#include <wchar.h>],
3601                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3602                  ac_cv_have_mbrtowc="yes",
3603                  ac_cv_have_mbrtowc="no")])
3604 if test "$ac_cv_have_mbrtowc" = "yes"; then
3605     AC_DEFINE(HAVE_MBRTOWC)
3607 AC_LANG_RESTORE
3610 AC_CACHE_CHECK(
3611     [for res_ninit()],
3612     ac_cv_func_res_ninit,
3613     [AC_TRY_LINK([
3614         #ifdef linux
3615         #define _BSD_SOURCE 1
3616         #endif
3617         #include <resolv.h>
3618         ],
3619         [int foo = res_ninit(&_res);],
3620         [ac_cv_func_res_ninit=yes],
3621         [ac_cv_func_res_ninit=no])
3622     ])
3624 if test "$ac_cv_func_res_ninit" = "yes"; then
3625     AC_DEFINE(HAVE_RES_NINIT)
3626 dnl must add the link line we do something as foolish as this... dougt
3627 dnl else
3628 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3629 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3632 AC_LANG_CPLUSPLUS
3633 AC_CACHE_CHECK(
3634     [for gnu_get_libc_version()],
3635     ac_cv_func_gnu_get_libc_version,
3636     [AC_TRY_LINK([
3637         #ifdef HAVE_GNU_LIBC_VERSION_H
3638         #include <gnu/libc-version.h>
3639         #endif
3640         ],
3641         [const char *glibc_version = gnu_get_libc_version();],
3642         [ac_cv_func_gnu_get_libc_version=yes],
3643         [ac_cv_func_gnu_get_libc_version=no]
3644         )]
3645     )
3647 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3648     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3651 case $target_os in
3652     darwin*|mingw*|os2*)
3653         ;;
3654     *)
3656 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3657     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3658         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3659 _SAVE_LIBS=$LIBS
3660 LIBS="$LIBS $_ICONV_LIBS"
3661 AC_CACHE_CHECK(
3662     [for iconv()],
3663     ac_cv_func_iconv,
3664     [AC_TRY_LINK([
3665         #include <stdlib.h>
3666         #include <iconv.h>
3667         ],
3668         [
3669             iconv_t h = iconv_open("", "");
3670             iconv(h, NULL, NULL, NULL, NULL);
3671             iconv_close(h);
3672         ],
3673         [ac_cv_func_iconv=yes],
3674         [ac_cv_func_iconv=no]
3675         )]
3676     )
3677 if test "$ac_cv_func_iconv" = "yes"; then
3678     AC_DEFINE(HAVE_ICONV)
3679     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3680     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3681     LIBICONV="$_ICONV_LIBS"
3682     AC_CACHE_CHECK(
3683         [for iconv() with const input],
3684         ac_cv_func_const_iconv,
3685         [AC_TRY_COMPILE([
3686             #include <stdlib.h>
3687             #include <iconv.h>
3688             ],
3689             [
3690                 const char *input = "testing";
3691                 iconv_t h = iconv_open("", "");
3692                 iconv(h, &input, NULL, NULL, NULL);
3693                 iconv_close(h);
3694             ],
3695             [ac_cv_func_const_iconv=yes],
3696             [ac_cv_func_const_iconv=no]
3697             )]
3698         )
3699     if test "$ac_cv_func_const_iconv" = "yes"; then
3700         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3701     fi
3703 LIBS=$_SAVE_LIBS
3705     ;;
3706 esac
3708 AM_LANGINFO_CODESET
3710 AC_LANG_C
3712 dnl **********************
3713 dnl *** va_copy checks ***
3714 dnl **********************
3715 dnl we currently check for all three va_copy possibilities, so we get
3716 dnl all results in config.log for bug reports.
3717 AC_MSG_CHECKING(for an implementation of va_copy())
3718 AC_CACHE_VAL(ac_cv_va_copy,[
3719     AC_TRY_RUN([
3720         #include <stdarg.h>
3721         void f (int i, ...) {
3722             va_list args1, args2;
3723             va_start (args1, i);
3724             va_copy (args2, args1);
3725             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3726                 exit (1);
3727             va_end (args1); va_end (args2);
3728         }
3729         int main() { f (0, 42); return 0; }],
3730         ac_cv_va_copy=yes,
3731         ac_cv_va_copy=no,
3732         ac_cv_va_copy=no
3733     )
3735 AC_MSG_RESULT($ac_cv_va_copy)
3736 AC_MSG_CHECKING(for an implementation of __va_copy())
3737 AC_CACHE_VAL(ac_cv___va_copy,[
3738     AC_TRY_RUN([
3739         #include <stdarg.h>
3740         void f (int i, ...) {
3741             va_list args1, args2;
3742             va_start (args1, i);
3743             __va_copy (args2, args1);
3744             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3745                 exit (1);
3746             va_end (args1); va_end (args2);
3747         }
3748         int main() { f (0, 42); return 0; }],
3749         ac_cv___va_copy=yes,
3750         ac_cv___va_copy=no,
3751         ac_cv___va_copy=no
3752     )
3754 AC_MSG_RESULT($ac_cv___va_copy)
3755 AC_MSG_CHECKING(whether va_lists can be copied by value)
3756 AC_CACHE_VAL(ac_cv_va_val_copy,[
3757     AC_TRY_RUN([
3758         #include <stdarg.h>
3759         void f (int i, ...) {
3760             va_list args1, args2;
3761             va_start (args1, i);
3762             args2 = args1;
3763             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3764                 exit (1);
3765             va_end (args1); va_end (args2);
3766         }
3767         int main() { f (0, 42); return 0; }],
3768         ac_cv_va_val_copy=yes,
3769         ac_cv_va_val_copy=no,
3770         ac_cv_va_val_copy=yes
3771     )
3773 if test "x$ac_cv_va_copy" = "xyes"; then
3774     AC_DEFINE(VA_COPY, va_copy)
3775     AC_DEFINE(HAVE_VA_COPY)
3776 elif test "x$ac_cv___va_copy" = "xyes"; then
3777     AC_DEFINE(VA_COPY, __va_copy)
3778     AC_DEFINE(HAVE_VA_COPY)
3781 if test "x$ac_cv_va_val_copy" = "xno"; then
3782    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3784 AC_MSG_RESULT($ac_cv_va_val_copy)
3786 dnl ===================================================================
3787 dnl ========================================================
3788 dnl Put your C++ language/feature checks below
3789 dnl ========================================================
3790 AC_LANG_CPLUSPLUS
3792 ARM_ABI_PREFIX=
3793 if test "$GNU_CC"; then
3794   if test "$CPU_ARCH" = "arm" ; then
3795     AC_CACHE_CHECK(for ARM EABI,
3796         ac_cv_gcc_arm_eabi,
3797         [AC_TRY_COMPILE([],
3798                         [
3799 #if defined(__ARM_EABI__)
3800   return 0;
3801 #else
3802 #error Not ARM EABI.
3803 #endif
3804                         ],
3805                         ac_cv_gcc_arm_eabi="yes",
3806                         ac_cv_gcc_arm_eabi="no")])
3807     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3808         HAVE_ARM_EABI=1
3809         ARM_ABI_PREFIX=eabi-
3810     else
3811         ARM_ABI_PREFIX=oabi-
3812     fi
3813   fi
3815   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3818 dnl Check for support of modern template specialization syntax
3819 dnl Test code and requirement from scc@netscape.com.
3820 dnl Autoconf cut-and-paste job by waterson@netscape.com
3821 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3822                ac_cv_cpp_modern_specialize_template_syntax,
3823                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3824                                class Y {};
3825                                template <> struct X<Y> { double a; };,
3826                                X<int> int_x;
3827                                X<Y> y_x;,
3828                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3829                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3830 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3831   AC_MSG_ERROR([The C++ compiler does not support template specialization])
3834 dnl Some compilers support only full specialization, and some don't.
3835 AC_CACHE_CHECK(whether partial template specialization works,
3836                ac_cv_cpp_partial_specialization,
3837                [AC_TRY_COMPILE(template <class T> class Foo {};
3838                                template <class T> class Foo<T*> {};,
3839                                return 0;,
3840                                ac_cv_cpp_partial_specialization=yes,
3841                                ac_cv_cpp_partial_specialization=no)])
3842 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3843   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3846 dnl Check to see if we can resolve ambiguity with |using|.
3847 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3848                ac_cv_cpp_ambiguity_resolving_using,
3849                [AC_TRY_COMPILE(class X {
3850                                  public: int go(const X&) {return 3;}
3851                                          int jo(const X&) {return 3;}
3852                                };
3853                                class Y : public X {
3854                                  public:  int go(int) {return 2;}
3855                                           int jo(int) {return 2;}
3856                                           using X::jo;
3857                                  private: using X::go;
3858                                };,
3859                                X x; Y y; y.jo(x);,
3860                                ac_cv_cpp_ambiguity_resolving_using=yes,
3861                                ac_cv_cpp_ambiguity_resolving_using=no)])
3862 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3863    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3866 dnl See if a dynamic_cast to void* gives the most derived object.
3867 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3868                ac_cv_cpp_dynamic_cast_void_ptr,
3869                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3870                             class Y { int j; public: virtual ~Y() { } };
3871                             class Z : public X, public Y { int k; };
3873                             int main() {
3874                                  Z mdo;
3875                                  X *subx = (X*)&mdo;
3876                                  Y *suby = (Y*)&mdo;
3877                                  return !((((void*)&mdo != (void*)subx) &&
3878                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3879                                           (((void*)&mdo != (void*)suby) &&
3880                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3881                             }],
3882                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3883                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3884                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3885 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3886    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3890 dnl note that this one is reversed - if the test fails, then
3891 dnl we require implementations of unused virtual methods. Which
3892 dnl really blows because it means we'll have useless vtable
3893 dnl bloat.
3894 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3895                ac_cv_cpp_unused_required,
3896                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3897                                X x;,
3898                                ac_cv_cpp_unused_required=no,
3899                                ac_cv_cpp_unused_required=yes)])
3900 if test "$ac_cv_cpp_unused_required" = yes ; then
3901    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3905 dnl Some compilers have trouble comparing a constant reference to a templatized
3906 dnl class to zero, and require an explicit operator==() to be defined that takes
3907 dnl an int. This test separates the strong from the weak.
3909 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3910                ac_cv_trouble_comparing_to_zero,
3911                [AC_TRY_COMPILE([#include <algorithm>
3912                                 template <class T> class Foo {};
3913                                 class T2;
3914                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3915                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3916                                [Foo<int> f; return (0 != f);],
3917                                ac_cv_trouble_comparing_to_zero=no,
3918                                ac_cv_trouble_comparing_to_zero=yes)])
3919 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3920   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3923 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3924 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3925 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3926 # linking XUL.
3927 _SAVE_LDFLAGS=$LDFLAGS
3928 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3929 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3930                ac_cv_thread_keyword,
3931                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3932                             [return tlsIsMainThread;],
3933                             ac_cv_thread_keyword=yes,
3934                             ac_cv_thread_keyword=no)])
3935 LDFLAGS=$_SAVE_LDFLAGS
3936 # The custom dynamic linker doesn't support TLS variables
3937 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3938   # mips builds fail with TLS variables because of a binutils bug.
3939   # See bug 528687
3940   case "${target}" in
3941     mips*-*)
3942       :
3943       ;;
3944     *-android*|*-linuxandroid*)
3945       :
3946       ;;
3947     *)
3948       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3949       ;;
3950   esac
3953 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3954 if test -n "$MOZ_LINKER"; then
3955   if test "$CPU_ARCH" = arm; then
3956     dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
3957     ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
3958     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3959     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3960       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
3961       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
3962     fi
3963   fi
3966 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3967 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3968 dnl We however want to avoid these text relocations, and this can be done
3969 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3970 dnl doesn't contain anything at all, beside placeholders for some sections,
3971 dnl and crtbegin only contains a finalizer function that calls
3972 dnl __cxa_finalize. The custom linker actually takes care of calling
3973 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3974 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3975 dnl link crtbegin and crtend at all.
3976 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
3977   AC_CACHE_CHECK([whether the CRT objects have text relocations],
3978     ac_cv_crt_has_text_relocations,
3979     [echo 'int foo() { return 0; }' > conftest.cpp
3980      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3981         test -s conftest${DLL_SUFFIX}; then
3982        if readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3983          ac_cv_crt_has_text_relocations=yes
3984        else
3985          ac_cv_crt_has_text_relocations=no
3986        fi
3987      else
3988        AC_ERROR([couldn't compile a simple C file])
3989      fi
3990      rm -rf conftest*])
3991   if test "$ac_cv_crt_has_text_relocations" = yes; then
3992     dnl While we want libraries to skip the CRT files, we don't want
3993     dnl executables to be treated the same way. We thus set the flag
3994     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3995     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3996     dnl Using LDFLAGS in nspr is safe, since we only really build
3997     dnl libraries there.
3998     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3999     NSPR_LDFLAGS=-nostartfiles
4000   fi
4003 dnl Check for the existence of various allocation headers/functions
4005 MALLOC_H=
4006 MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4007 if test "$MALLOC_H" = ""; then
4008   MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4009   if test "$MALLOC_H" = ""; then
4010     MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4011   fi
4013 if test "$MALLOC_H" != ""; then
4014    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4017 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4018 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4020 dnl See if compiler supports some gcc-style attributes
4022 AC_CACHE_CHECK(for __attribute__((always_inline)),
4023                ac_cv_attribute_always_inline,
4024                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
4025                                [],
4026                                ac_cv_attribute_always_inline=yes,
4027                                ac_cv_attribute_always_inline=no)])
4029 AC_CACHE_CHECK(for __attribute__((malloc)),
4030                ac_cv_attribute_malloc,
4031                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
4032                                [],
4033                                ac_cv_attribute_malloc=yes,
4034                                ac_cv_attribute_malloc=no)])
4036 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4037                ac_cv_attribute_warn_unused,
4038                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
4039                                [],
4040                                ac_cv_attribute_warn_unused=yes,
4041                                ac_cv_attribute_warn_unused=no)])
4043 dnl End of C++ language/feature checks
4044 AC_LANG_C
4046 dnl ========================================================
4047 dnl =  Internationalization checks
4048 dnl ========================================================
4050 dnl Internationalization and Locale support is different
4051 dnl on various UNIX platforms.  Checks for specific i18n
4052 dnl features go here.
4054 dnl check for LC_MESSAGES
4055 AC_CACHE_CHECK(for LC_MESSAGES,
4056                 ac_cv_i18n_lc_messages,
4057                 [AC_TRY_COMPILE([#include <locale.h>],
4058                                 [int category = LC_MESSAGES;],
4059                                 ac_cv_i18n_lc_messages=yes,
4060                                 ac_cv_i18n_lc_messages=no)])
4061 if test "$ac_cv_i18n_lc_messages" = yes; then
4062    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4065 AC_HAVE_FUNCS(localeconv)
4066 fi # ! SKIP_COMPILER_CHECKS
4068 TARGET_XPCOM_ABI=
4069 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4070     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4073 dnl Mozilla specific options
4074 dnl ========================================================
4075 dnl The macros used for command line options
4076 dnl are defined in build/autoconf/altoptions.m4.
4078 dnl If the compiler supports these attributes, define them as
4079 dnl convenience macros.
4080 if test "$ac_cv_attribute_always_inline" = yes ; then
4081   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4082 else
4083   AC_DEFINE(NS_ALWAYS_INLINE,)
4086 if test "$ac_cv_attribute_malloc" = yes ; then
4087   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4088 else
4089   AC_DEFINE(NS_ATTR_MALLOC,)
4092 if test "$ac_cv_attribute_warn_unused" = yes ; then
4093   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4094 else
4095   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4098 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4099 dnl features that Windows actually does support.
4101 if test -n "$SKIP_COMPILER_CHECKS"; then
4102    dnl Windows has malloc.h
4103    AC_DEFINE(MALLOC_H, [<malloc.h>])
4104    AC_DEFINE(HAVE_FORCEINLINE)
4105    AC_DEFINE(HAVE_LOCALECONV)
4106 fi # SKIP_COMPILER_CHECKS
4108 dnl ========================================================
4109 dnl =
4110 dnl = Check for external package dependencies
4111 dnl =
4112 dnl ========================================================
4113 MOZ_ARG_HEADER(External Packages)
4115 MOZ_ARG_WITH_STRING(libxul-sdk,
4116 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4117   LIBXUL_SDK_DIR=$withval)
4119 if test "$LIBXUL_SDK_DIR" = "yes"; then
4120     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4121 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4122     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4124     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4125         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4126     fi
4129 AC_SUBST(LIBXUL_SDK)
4131 if test -n "$LIBXUL_SDK"; then
4132     LIBXUL_DIST="$LIBXUL_SDK"
4133 else
4134     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4136 AC_SUBST(LIBXUL_DIST)
4138 SYSTEM_LIBXUL=
4140 MOZ_ARG_WITH_BOOL(system-libxul,
4141 [  --with-system-libxul    Use system installed libxul SDK],
4142     SYSTEM_LIBXUL=1)
4144 dnl ========================================================
4145 dnl = If NSPR was not detected in the system,
4146 dnl = use the one in the source tree (mozilla/nsprpub)
4147 dnl ========================================================
4148 MOZ_ARG_WITH_BOOL(system-nspr,
4149 [  --with-system-nspr      Use system installed NSPR],
4150     _USE_SYSTEM_NSPR=1 )
4152 if test -n "$_USE_SYSTEM_NSPR"; then
4153     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])])
4156 if test -n "$MOZ_NATIVE_NSPR"; then
4157     _SAVE_CFLAGS=$CFLAGS
4158     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4159     AC_TRY_COMPILE([#include "prtypes.h"],
4160                 [#ifndef PR_STATIC_ASSERT
4161                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
4162                  #endif],
4163                 [MOZ_NATIVE_NSPR=1],
4164                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4165     AC_TRY_COMPILE([#include "prtypes.h"],
4166                 [#ifndef PR_UINT64
4167                  #error PR_UINT64 not defined or requires including prtypes.h
4168                  #endif],
4169                 [MOZ_NATIVE_NSPR=1],
4170                 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
4171     CFLAGS=$_SAVE_CFLAGS
4172 else
4173     if test "$OS_ARCH" = "WINNT"; then
4174         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4175         if test -n "$GNU_CC"; then
4176             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4177         else
4178             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4179         fi
4180     else
4181         NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4182         NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4183     fi
4186 dnl system libevent Support
4187 dnl ========================================================
4188 MOZ_ARG_WITH_STRING(system-libevent,
4189 [  --with-system-libevent=[PFX]
4190                           Use system libevent [installed at prefix PFX]],
4191     LIBEVENT_DIR=$withval)
4193 _SAVE_CFLAGS=$CFLAGS
4194 _SAVE_LDFLAGS=$LDFLAGS
4195 _SAVE_LIBS=$LIBS
4196 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4197     MOZ_NATIVE_LIBEVENT=
4198 else
4199     if test "${LIBEVENT_DIR}" = "yes"; then
4200         LIBEVENT_DIR=/usr
4201     fi
4202     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4203     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4204     MOZ_CHECK_HEADER(event.h,
4205         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4206              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4207          fi],
4208         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4209     AC_CHECK_LIB(event, event_init,
4210                  [MOZ_NATIVE_LIBEVENT=1
4211                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4212                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4213                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4215 CFLAGS=$_SAVE_CFLAGS
4216 LDFLAGS=$_SAVE_LDFLAGS
4217 LIBS=$_SAVE_LIBS
4219 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4220 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4221 AC_SUBST(MOZ_LIBEVENT_LIBS)
4223 dnl ========================================================
4224 dnl = If NSS was not detected in the system,
4225 dnl = use the one in the source tree (mozilla/security/nss)
4226 dnl ========================================================
4228 MOZ_ARG_WITH_BOOL(system-nss,
4229 [  --with-system-nss       Use system installed NSS],
4230     _USE_SYSTEM_NSS=1 )
4232 if test -n "$_USE_SYSTEM_NSS"; then
4233     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])])
4236 if test -n "$MOZ_NATIVE_NSS"; then
4237    NSS_LIBS="$NSS_LIBS -lcrmf"
4238 else
4239    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4240    NSS_DEP_LIBS="\
4241         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4242         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4243         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4244         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4245         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4247    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4248        NSS_LIBS="\
4249         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4250         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4251         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4252         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4253         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4254    else
4255        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4256    fi
4259 dnl ======================
4260 dnl Detect yasm
4261 dnl ======================
4263 AC_MSG_CHECKING([for YASM assembler])
4264 AC_CHECK_PROGS(YASM, yasm, "")
4266 if test -n "$YASM"; then
4267   dnl Pull out yasm's version string
4268   changequote(,)
4269   _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
4270   changequote([,])
4272   YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4273   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4274   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4275   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4276   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4279 if test -z "$SKIP_LIBRARY_CHECKS"; then
4280 dnl system JPEG support
4281 dnl ========================================================
4282 MOZ_ARG_WITH_STRING(system-jpeg,
4283 [  --with-system-jpeg[=PFX]
4284                           Use system libjpeg [installed at prefix PFX]],
4285     JPEG_DIR=$withval)
4287 _SAVE_CFLAGS=$CFLAGS
4288 _SAVE_LDFLAGS=$LDFLAGS
4289 _SAVE_LIBS=$LIBS
4290 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4291     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4292     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4294 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4295     SYSTEM_JPEG=
4296 else
4297     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4300 if test "$SYSTEM_JPEG" = 1; then
4301     LIBS="$JPEG_LIBS $LIBS"
4302     AC_TRY_COMPILE([ #include <stdio.h>
4303                      #include <sys/types.h>
4304                      #include <jpeglib.h> ],
4305                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4306                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4307                      #endif ],
4308                    SYSTEM_JPEG=1,
4309                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4311 CFLAGS=$_SAVE_CFLAGS
4312 LDFLAGS=$_SAVE_LDFLAGS
4313 LIBS=$_SAVE_LIBS
4315 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4316     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4317     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4320 dnl system ZLIB support
4321 dnl ========================================================
4322 MOZ_ARG_WITH_STRING(system-zlib,
4323 [  --with-system-zlib[=PFX]
4324                           Use system libz [installed at prefix PFX]],
4325     ZLIB_DIR=$withval)
4327 _SAVE_CFLAGS=$CFLAGS
4328 _SAVE_LDFLAGS=$LDFLAGS
4329 _SAVE_LIBS=$LIBS
4330 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4331     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4332     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4334 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4335     SYSTEM_ZLIB=
4336 else
4337     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4338         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4340 if test "$SYSTEM_ZLIB" = 1; then
4341     LIBS="$ZLIB_LIBS $LIBS"
4342     AC_TRY_COMPILE([ #include <stdio.h>
4343                      #include <string.h>
4344                      #include <zlib.h> ],
4345                    [ #if ZLIB_VERNUM < $MOZZLIB
4346                      #error "Insufficient zlib version ($MOZZLIB required)."
4347                      #endif ],
4348                    SYSTEM_ZLIB=1,
4349                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4351 CFLAGS=$_SAVE_CFLAGS
4352 LDFLAGS=$_SAVE_LDFLAGS
4353 LIBS=$_SAVE_LIBS
4355 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4356     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4357     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4360 if test "$MOZ_LINKER" = 1 -a "$SYSTEM_ZLIB" != 1; then
4361     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4364 dnl system BZIP2 Support
4365 dnl ========================================================
4366 MOZ_ARG_WITH_STRING(system-bz2,
4367 [  --with-system-bz2[=PFX]
4368                           Use system libbz2 [installed at prefix PFX]],
4369     BZ2_DIR=$withval)
4371 _SAVE_CFLAGS=$CFLAGS
4372 _SAVE_LDFLAGS=$LDFLAGS
4373 _SAVE_LIBS=$LIBS
4374 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4375     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4376     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4378 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4379     SYSTEM_BZ2=
4380 else
4381     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4382         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4384 CFLAGS=$_SAVE_CFLAGS
4385 LDFLAGS=$_SAVE_LDFLAGS
4386 LIBS=$_SAVE_LIBS
4388 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4389     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4390     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4393 dnl system PNG Support
4394 dnl ========================================================
4395 MOZ_ARG_WITH_STRING(system-png,
4396 [  --with-system-png[=PFX]
4397                           Use system libpng [installed at prefix PFX]],
4398     PNG_DIR=$withval)
4400 _SAVE_CFLAGS=$CFLAGS
4401 _SAVE_LDFLAGS=$LDFLAGS
4402 _SAVE_LIBS=$LIBS
4403 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4404 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4405 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4406     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4407     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4409 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4410     SYSTEM_PNG=
4411 else
4412     _SAVE_PNG_LIBS=$PNG_LIBS
4413     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4414                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4415                  $PNG_LIBS)
4416     AC_CHECK_LIB(png, png_get_acTL, ,
4417                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4418                  $_SAVE_PNG_LIBS)
4420 if test "$SYSTEM_PNG" = 1; then
4421     LIBS="$PNG_LIBS $LIBS"
4422     AC_TRY_COMPILE([ #include <stdio.h>
4423                      #include <sys/types.h>
4424                      #include <png.h> ],
4425                    [ #if PNG_LIBPNG_VER < $MOZPNG
4426                      #error "Insufficient libpng version ($MOZPNG required)."
4427                      #endif
4428                      #ifndef PNG_UINT_31_MAX
4429                      #error "Insufficient libpng version."
4430                      #endif ],
4431                    SYSTEM_PNG=1,
4432                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4434 CFLAGS=$_SAVE_CFLAGS
4435 LDFLAGS=$_SAVE_LDFLAGS
4436 LIBS=$_SAVE_LIBS
4438 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4439     PNG_CFLAGS="-I${PNG_DIR}/include"
4440     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4443 fi # SKIP_LIBRARY_CHECKS
4445 dnl system HunSpell Support
4446 dnl ========================================================
4447 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4448 [  --enable-system-hunspell
4449                           Use system hunspell (located with pkgconfig)],
4450     SYSTEM_HUNSPELL=1 )
4452 if test -n "$SYSTEM_HUNSPELL"; then
4453     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4456 AC_SUBST(SYSTEM_HUNSPELL)
4458 dnl ========================================================
4459 dnl system libffi Support
4460 dnl ========================================================
4461 MOZ_ARG_ENABLE_BOOL(system-ffi,
4462 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
4463     MOZ_NATIVE_FFI=1 )
4465 if test -n "$MOZ_NATIVE_FFI"; then
4466     # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4467     # for non-GCC compilers.
4468     if test -z "$GNU_CC"; then
4469         PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4470     else
4471         PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4472     fi
4473     MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4476 dnl ========================================================
4477 dnl Java SDK support
4478 dnl ========================================================
4480 JAVA_BIN_PATH=
4481 MOZ_ARG_WITH_STRING(java-bin-path,
4482 [  --with-java-bin-path=dir
4483                           Location of Java binaries (java, javac, jar)],
4484     JAVA_BIN_PATH=$withval)
4486 dnl ========================================================
4487 dnl =
4488 dnl = Application
4489 dnl =
4490 dnl ========================================================
4492 MOZ_ARG_HEADER(Application)
4494 ENABLE_TESTS=1
4495 ENABLE_SYSTEM_EXTENSION_DIRS=1
4496 MOZ_BRANDING_DIRECTORY=
4497 MOZ_OFFICIAL_BRANDING=
4498 MOZ_FEEDS=1
4499 MOZ_FLEXBOX=
4500 MOZ_JSDEBUGGER=1
4501 MOZ_AUTH_EXTENSION=1
4502 MOZ_OGG=1
4503 MOZ_RAW=
4504 MOZ_SYDNEYAUDIO=
4505 MOZ_CUBEB=
4506 MOZ_VORBIS=
4507 MOZ_TREMOR=
4508 MOZ_WAVE=1
4509 MOZ_MEDIA=
4510 MOZ_WEBM=1
4511 MOZ_VP8_ERROR_CONCEALMENT=
4512 MOZ_VP8_ENCODER=
4513 VPX_AS=
4514 VPX_ASFLAGS=
4515 VPX_AS_DASH_C_FLAG=
4516 VPX_AS_CONVERSION=
4517 VPX_ASM_SUFFIX=
4518 VPX_X86_ASM=
4519 VPX_ARM_ASM=
4520 LIBJPEG_TURBO_AS=
4521 LIBJPEG_TURBO_ASFLAGS=
4522 LIBJPEG_TURBO_X86_ASM=
4523 LIBJPEG_TURBO_X64_ASM=
4524 LIBJPEG_TURBO_ARM_ASM=
4525 MOZ_PANGO=1
4526 MOZ_PERMISSIONS=1
4527 MOZ_PLACES=1
4528 MOZ_PREF_EXTENSIONS=1
4529 MOZ_PROFILELOCKING=1
4530 MOZ_PSM=1
4531 MOZ_REFLOW_PERF=
4532 MOZ_SAFE_BROWSING=
4533 MOZ_HELP_VIEWER=
4534 MOZ_SPELLCHECK=1
4535 MOZ_JAVA_COMPOSITOR=
4536 MOZ_ONLY_TOUCH_EVENTS=
4537 MOZ_SVG_DLISTS=
4538 MOZ_TOOLKIT_SEARCH=1
4539 MOZ_UI_LOCALE=en-US
4540 MOZ_UNIVERSALCHARDET=1
4541 MOZ_URL_CLASSIFIER=
4542 MOZ_XTF=1
4543 MOZ_XUL=1
4544 MOZ_ZIPWRITER=1
4545 NS_PRINTING=1
4546 MOZ_PDF_PRINTING=
4547 MOZ_DISABLE_DOMCRYPTO=
4548 NSS_DISABLE_DBM=
4549 NECKO_WIFI=1
4550 NECKO_COOKIES=1
4551 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4552 USE_ARM_KUSER=
4553 BUILD_CTYPES=1
4554 MOZ_USE_NATIVE_POPUP_WINDOWS=
4555 MOZ_ANDROID_HISTORY=
4556 MOZ_WEBSMS_BACKEND=
4557 MOZ_GRAPHITE=1
4559 case "${target}" in
4560 *darwin*)
4561     ACCESSIBILITY=
4562     ;;
4564     ACCESSIBILITY=1
4565     ;;
4566 esac
4568 case "$target_os" in
4569     mingw*)
4570         NS_ENABLE_TSF=1
4571         AC_DEFINE(NS_ENABLE_TSF)
4572         ;;
4573 esac
4575 case "${target}" in
4576     *-android*|*-linuxandroid*)
4577         if test "$CPU_ARCH" = "arm" ; then
4578           USE_ARM_KUSER=1
4579         fi
4581         NSS_DISABLE_DBM=1
4582         NECKO_WIFI=
4583         MOZ_THEME_FASTSTRIPE=1
4584         MOZ_TREE_FREETYPE=1
4585         MOZ_MEMORY=1
4586         MOZ_RAW=1
4587         ;;
4588 esac
4590 MOZ_ARG_ENABLE_STRING(application,
4591 [  --enable-application=APP
4592                           Options include:
4593                             browser (Firefox)
4594                             xulrunner
4595                             tools/update-packaging (AUS-related packaging tools)],
4596 [ MOZ_BUILD_APP=$enableval ] )
4598 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4599 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4600   XULRUNNER_STUB_NAME=$withval)
4602 if test -z "$XULRUNNER_STUB_NAME"; then
4603   case "$target_os" in
4604   darwin*)
4605     XULRUNNER_STUB_NAME=xulrunner
4606     ;;
4607   *)
4608     XULRUNNER_STUB_NAME=xulrunner-stub
4609   esac
4611 AC_SUBST(XULRUNNER_STUB_NAME)
4613 AC_MSG_CHECKING([for application to build])
4614 if test -z "$MOZ_BUILD_APP"; then
4615   AC_MSG_RESULT([browser])
4616   MOZ_BUILD_APP=browser
4617 else
4618   # default mobile to be mobile/xul
4619   if test "$MOZ_BUILD_APP" = "mobile" ; then
4620     MOZ_BUILD_APP=mobile/xul
4621   fi
4622   # We have a valid application only if it has a build.mk file in its top
4623   # directory.
4624   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4625     AC_MSG_RESULT([none])
4626     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4627   else
4628     AC_MSG_RESULT([$MOZ_BUILD_APP])
4629   fi
4632 # Allow the application to influence configure with a confvars.sh script.
4634 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4635 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4636   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4637   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4638 else
4639   AC_MSG_RESULT([no])
4642 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4643 MOZ_ARG_WITH_STRING(app-name,
4644 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4645 WITH_APP_NAME=$withval,
4648 if test -n "$WITH_APP_NAME" ; then
4649     MOZ_APP_NAME="$WITH_APP_NAME"
4652 MOZ_ARG_WITH_STRING(app-basename,
4653 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4654 WITH_APP_BASENAME=$withval,
4657 if test -n "$WITH_APP_BASENAME" ; then
4658     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4661 # Now is a good time to test for logic errors, define mismatches, etc.
4662 case "$MOZ_BUILD_APP" in
4663 xulrunner)
4664   if test "$LIBXUL_SDK"; then
4665     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4666   fi
4667   ;;
4668 esac
4670 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4671 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4672 # MOZ_BUILD_APP.
4673 case "$MOZ_BUILD_APP" in
4674 browser)
4675   AC_DEFINE(MOZ_PHOENIX)
4676   ;;
4678 xulrunner)
4679   AC_DEFINE(MOZ_XULRUNNER)
4680   ;;
4681 esac
4683 AC_SUBST(MOZ_BUILD_APP)
4684 AC_SUBST(MOZ_PHOENIX)
4685 AC_SUBST(MOZ_XULRUNNER)
4687 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4689 dnl ========================================================
4690 dnl =
4691 dnl = Toolkit Options
4692 dnl =
4693 dnl ========================================================
4694 MOZ_ARG_HEADER(Toolkit Options)
4696     dnl ========================================================
4697     dnl = Select the default toolkit
4698     dnl ========================================================
4699         MOZ_ARG_ENABLE_STRING(default-toolkit,
4700         [  --enable-default-toolkit=TK
4701                           Select default toolkit
4702                           Platform specific defaults:
4703                             Mac OS X - cairo-cocoa
4704                             OS/2 - cairo-os2
4705                             Win32 - cairo-windows
4706                             * - cairo-gtk2
4707                             * - cairo-qt],
4708     [ _DEFAULT_TOOLKIT=$enableval ],
4709     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4711     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4712         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4713         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4714         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4715         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4716         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4717         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4718         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4719         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4720     then
4721         dnl nglayout only supports building with one toolkit,
4722         dnl so ignore everything after the first comma (",").
4723         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4724     else
4725         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4726     fi
4728 MOZ_ARG_WITHOUT_BOOL(x,
4729 [  --without-x              Build without X11],
4730     WITHOUT_X11=1)
4732 dnl ========================================================
4733 dnl = Enable the toolkit as needed                         =
4734 dnl ========================================================
4736 case "$MOZ_WIDGET_TOOLKIT" in
4738 cairo-windows)
4739     MOZ_WIDGET_TOOLKIT=windows
4740     MOZ_WEBGL=1
4741     MOZ_PDF_PRINTING=1
4742     MOZ_INSTRUMENT_EVENT_LOOP=1
4743     ;;
4745 cairo-gtk2|cairo-gtk2-x11)
4746     MOZ_WIDGET_TOOLKIT=gtk2
4747     MOZ_ENABLE_GTK2=1
4748     MOZ_ENABLE_XREMOTE=1
4749     MOZ_WEBGL=1
4750     MOZ_GL_DEFAULT_PROVIDER=GLX
4752     AC_DEFINE(MOZ_X11)
4753     MOZ_X11=1
4754     USE_FC_FREETYPE=1
4756     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4757     TK_LIBS='$(MOZ_GTK2_LIBS)'
4758     AC_DEFINE(MOZ_WIDGET_GTK2)
4759     MOZ_PDF_PRINTING=1
4760     MOZ_INSTRUMENT_EVENT_LOOP=1
4761     ;;
4763 cairo-qt)
4764     MOZ_WIDGET_TOOLKIT=qt
4765     MOZ_ENABLE_QT=1
4766     if test -z "$WITHOUT_X11"; then
4767       MOZ_ENABLE_XREMOTE=1
4768       MOZ_GL_DEFAULT_PROVIDER=GLX
4769       MOZ_X11=1
4770       AC_DEFINE(MOZ_X11)
4771       XT_LIBS=
4772     fi
4774     MOZ_WEBGL=1
4775     USE_ELF_DYNSTR_GC=
4776     USE_FC_FREETYPE=1
4777     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4778     TK_LIBS='$(MOZ_QT_LIBS)'
4779     AC_DEFINE(MOZ_WIDGET_QT)
4780     MOZ_PDF_PRINTING=1
4781     ;;
4783 cairo-os2)
4784     MOZ_WIDGET_TOOLKIT=os2
4785     USE_FC_FREETYPE=1
4786     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4787     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4788     MOZ_PDF_PRINTING=1
4789     ;;
4791 cairo-cocoa)
4792     MOZ_WIDGET_TOOLKIT=cocoa
4793     AC_DEFINE(MOZ_WIDGET_COCOA)
4794     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4795     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4796     TK_CFLAGS="-DNO_X11"
4797     CFLAGS="$CFLAGS $TK_CFLAGS"
4798     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4799     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4800     MOZ_USER_DIR="Mozilla"
4801     MOZ_FS_LAYOUT=bundle
4802     MOZ_WEBGL=1
4803     MOZ_INSTRUMENT_EVENT_LOOP=1
4804     ;;
4806 cairo-uikit)
4807     MOZ_WIDGET_TOOLKIT=uikit
4808     AC_DEFINE(MOZ_WIDGET_UIKIT)
4809     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4810     TK_CFLAGS="-DNO_X11"
4811     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4812     CFLAGS="$CFLAGS $TK_CFLAGS"
4813     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4814     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4815     MOZ_USER_DIR="Mozilla"
4816     MOZ_FS_LAYOUT=bundle
4817     ;;
4819 cairo-android)
4820     AC_DEFINE(MOZ_WIDGET_ANDROID)
4821     MOZ_WIDGET_TOOLKIT=android
4822     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4823     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4824     MOZ_WEBGL=1
4825     MOZ_PDF_PRINTING=1
4826     MOZ_INSTRUMENT_EVENT_LOOP=1
4827     if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4828         MOZ_OLD_LINKER=1
4829     fi
4830     ;;
4832 cairo-gonk)
4833     AC_DEFINE(MOZ_WIDGET_GONK)
4834     AC_DEFINE(MOZ_TOUCH)
4835     MOZ_WIDGET_TOOLKIT=gonk
4836     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4837     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4838     MOZ_WEBGL=1
4839     MOZ_PDF_PRINTING=1
4840     MOZ_TOUCH=1
4841     ;;
4843 esac
4845 AC_SUBST(MOZ_OLD_LINKER)
4846 AC_SUBST(MOZ_PDF_PRINTING)
4847 if test "$MOZ_PDF_PRINTING"; then
4848    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4849    AC_DEFINE(MOZ_PDF_PRINTING)
4852 if test "$MOZ_ENABLE_XREMOTE"; then
4853     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4856 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4857    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4860 if test "$COMPILE_ENVIRONMENT"; then
4861   if test "$MOZ_ENABLE_GTK2"; then
4862     if test "$MOZ_X11"; then
4863       GDK_PACKAGES=gdk-x11-2.0
4864     fi
4866     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4867   fi
4869 fi # COMPILE_ENVIRONMENT
4871 AC_SUBST(MOZ_FS_LAYOUT)
4873 dnl ========================================================
4874 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4875 dnl their usage and use them in spidermonkey.
4876 dnl ========================================================
4877 MOZ_ARG_WITH_BOOL(arm-kuser,
4878 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4879     USE_ARM_KUSER=1,)
4880 if test -n "$USE_ARM_KUSER"; then
4881    AC_DEFINE(USE_ARM_KUSER)
4884 dnl ========================================================
4885 dnl = startup-notification support module
4886 dnl ========================================================
4888 if test "$MOZ_ENABLE_GTK2"
4889 then
4890     MOZ_ENABLE_STARTUP_NOTIFICATION=
4892     MOZ_ARG_ENABLE_BOOL(startup-notification,
4893     [  --enable-startup-notification
4894                           Enable startup-notification support (default: disabled) ],
4895         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4896         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4897     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4898     then
4899         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4900                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4901         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4902             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4903             then
4904                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4905             fi
4906             MOZ_ENABLE_STARTUP_NOTIFICATION=
4907         ])
4908     fi
4910     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4911         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4912     fi
4914     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4916 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4917 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4918 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4920 dnl ========================================================
4921 dnl = QT support
4922 dnl ========================================================
4923 if test "$MOZ_ENABLE_QT"
4924 then
4925     MOZ_ARG_WITH_STRING(qtdir,
4926     [  --with-qtdir=\$dir       Specify Qt directory ],
4927     [ QTDIR=$withval])
4929     if test -z "$QTDIR"; then
4930         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4931         PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport QtQuick1,
4932                       MOZ_ENABLE_QT5=1,
4933                       MOZ_ENABLE_QT5=)
4934         if test "$MOZ_ENABLE_QT5"; then
4935             echo "Using qt5"
4936             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4937             MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4938         fi
4940         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4941         AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4942     else
4943         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4945         MOZ_QT_CFLAGS="-DQT_SHARED"
4946         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4947         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4948         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4949         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4950         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4951         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4952         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4953         HOST_MOC="$QTDIR/bin/moc"
4954         HOST_RCC="$QTDIR/bin/rcc"
4956         # QtWidgets was introduced only in Qt5
4957         if test -d $QTDIR/include/QtWidgets; then
4958             echo "Using qt5"
4959             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
4960             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMultimedia"
4961             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4962             MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtQuick1"
4963             MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtMultimedia -lQtPrintSupport -lQtQuick1"
4964         fi
4965     fi
4966     if test -z "$HOST_MOC"; then
4967         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
4968 incorrect])
4969     fi
4970     if test -z "$HOST_RCC"; then
4971         AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
4972 incorrect])
4973     fi
4975     MOC=$HOST_MOC
4976     RCC=$HOST_RCC
4978     MOZ_ENABLE_QMSYSTEM2=
4979     PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4980                       MOZ_ENABLE_QMSYSTEM2=1,
4981                       MOZ_ENABLE_QMSYSTEM2=)
4983     if test "$MOZ_ENABLE_QMSYSTEM2"; then
4984       MOZ_ENABLE_QMSYSTEM2=1
4985       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4986       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4987       AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4988     fi
4990     MOZ_ENABLE_QTNETWORK=
4991     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4992                       MOZ_ENABLE_QTNETWORK=1,
4993                       MOZ_ENABLE_QTNETWORK=)
4995     if test "$MOZ_ENABLE_QTNETWORK"; then
4996       MOZ_ENABLE_QTNETWORK=1
4997       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4998     fi
5000     MOZ_ENABLE_QTMOBILITY=
5001     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
5002                       MOZ_ENABLE_QTMOBILITY=1,
5003                       MOZ_ENABLE_QTMOBILITY=)
5004     if test "$MOZ_ENABLE_QTMOBILITY"; then
5005        MOZ_ENABLE_QTMOBILITY=1
5006        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
5007        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
5008     else
5009        AC_CHECK_LIB(QtSensors, main, [
5010           MOZ_ENABLE_QTMOBILITY=1
5011           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
5012           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
5013           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
5014           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
5015           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
5016        ])
5017     fi
5018     if test "$MOZ_ENABLE_QTMOBILITY"; then
5019        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
5020     fi
5023 AC_SUBST(GTK_CONFIG)
5024 AC_SUBST(TK_CFLAGS)
5025 AC_SUBST(TK_LIBS)
5027 AC_SUBST(MOZ_ENABLE_GTK2)
5028 AC_SUBST(MOZ_ENABLE_QT)
5029 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5030 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
5031 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
5032 AC_SUBST(MOZ_ENABLE_XREMOTE)
5033 AC_SUBST(MOZ_GTK2_CFLAGS)
5034 AC_SUBST(MOZ_GTK2_LIBS)
5035 AC_SUBST(MOZ_QT_CFLAGS)
5036 AC_SUBST(MOZ_QT_LIBS)
5038 AC_SUBST(MOC)
5039 AC_SUBST(RCC)
5041 AC_SUBST(MOZ_X11)
5043 dnl ========================================================
5044 dnl =
5045 dnl = Components & Features
5046 dnl =
5047 dnl ========================================================
5048 MOZ_ARG_HEADER(Components and Features)
5050 dnl ========================================================
5051 dnl = Localization
5052 dnl ========================================================
5053 MOZ_ARG_ENABLE_STRING(ui-locale,
5054 [  --enable-ui-locale=ab-CD
5055                           Select the user interface locale (default: en-US)],
5056     MOZ_UI_LOCALE=$enableval )
5057 AC_SUBST(MOZ_UI_LOCALE)
5059 dnl ========================================================
5060 dnl = Trademarked Branding
5061 dnl ========================================================
5062 MOZ_ARG_ENABLE_BOOL(official-branding,
5063 [  --enable-official-branding
5064                           Enable Official mozilla.org Branding
5065                           Do not distribute builds with
5066                           --enable-official-branding unless you have
5067                           permission to use trademarks per
5068                           http://www.mozilla.org/foundation/trademarks/ .],
5070   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5071     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5072   else
5073     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5074     MOZ_OFFICIAL_BRANDING=1
5075   fi
5076 ], MOZ_OFFICIAL_BRANDING=)
5078 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5079 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5080   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5083 MOZ_ARG_WITH_STRING(branding,
5084 [  --with-branding=dir     Use branding from the specified directory.],
5085     MOZ_BRANDING_DIRECTORY=$withval)
5087 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5088 if test -z "$REAL_BRANDING_DIRECTORY"; then
5089   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5092 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5093   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5096 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5098 dnl ========================================================
5099 dnl = Distribution ID
5100 dnl ========================================================
5101 MOZ_ARG_WITH_STRING(distribution-id,
5102 [  --with-distribution-id=ID
5103                           Set distribution-specific id (default=org.mozilla)],
5104 [ val=`echo $withval`
5105     MOZ_DISTRIBUTION_ID="$val"])
5107 if test -z "$MOZ_DISTRIBUTION_ID"; then
5108    MOZ_DISTRIBUTION_ID="org.mozilla"
5111 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5112 AC_SUBST(MOZ_DISTRIBUTION_ID)
5115 dnl ========================================================
5116 dnl complex text support off by default
5117 dnl ========================================================
5118 MOZ_ARG_DISABLE_BOOL(pango,
5119 [  --disable-pango         Disable usage of Pango ],
5120     MOZ_PANGO=,
5121     MOZ_PANGO=1)
5123 dnl ========================================================
5124 dnl = Pango
5125 dnl ========================================================
5126 if test "$MOZ_ENABLE_GTK2"
5127 then
5128     AC_SUBST(MOZ_PANGO)
5130     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5132     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5133     AC_SUBST(MOZ_PANGO_CFLAGS)
5134     AC_SUBST(MOZ_PANGO_LIBS)
5135     if test "$MOZ_PANGO"
5136     then
5137         AC_DEFINE(MOZ_PANGO)
5138     else
5139         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5140         AC_SUBST(FT2_CFLAGS)
5141         AC_SUBST(FT2_LIBS)
5142     fi
5145 if test "$MOZ_ENABLE_QT"
5146 then
5147     if test "$MOZ_PANGO"
5148     then
5149         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5150         [
5151             AC_SUBST(MOZ_PANGO_CFLAGS)
5152             AC_SUBST(MOZ_PANGO_LIBS)
5153             AC_DEFINE(MOZ_PANGO)
5154         ],
5155         [
5156             echo "Pango library not found, will use FT2 font engine"
5157             MOZ_PANGO=
5158         ])
5159     fi
5160     AC_SUBST(MOZ_PANGO)
5163 dnl ========================================================
5164 dnl = GnomeVFS, GIO and GConf support module
5165 dnl ========================================================
5167 if test "$MOZ_X11"
5168 then
5169     dnl build the gnomevfs extension by default only when the
5170     dnl GTK2 toolkit is in use.
5171     if test "$MOZ_ENABLE_GTK2"
5172     then
5173         MOZ_ENABLE_GNOMEVFS=1
5174         MOZ_ENABLE_GCONF=1
5175     fi
5177     dnl ========================================================
5178     dnl = GnomeVFS support module
5179     dnl ========================================================
5180     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5181     [  --disable-gnomevfs      Disable GnomeVFS support ],
5182         MOZ_ENABLE_GNOMEVFS=,
5183         MOZ_ENABLE_GNOMEVFS=force)
5185     if test "$MOZ_ENABLE_GNOMEVFS"
5186     then
5187         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5188             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5189             MOZ_ENABLE_GNOMEVFS=1
5190             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5191         ],[
5192             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5193             then
5194                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5195             fi
5196             MOZ_ENABLE_GNOMEVFS=
5197         ])
5198     else
5199         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5200             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5201               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5202             ])
5203         fi
5204     fi
5206     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5207     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5208     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5210     dnl ========================================================
5211     dnl = GIO support module
5212     dnl ========================================================
5213     MOZ_ARG_ENABLE_BOOL(gio,
5214     [  --enable-gio            Enable GIO support (default: disabled)],
5215         MOZ_ENABLE_GIO=force,
5216         MOZ_ENABLE_GIO=)
5218     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5219     then
5220         PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
5221                           [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
5222         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5223             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5224             MOZ_ENABLE_GIO=1
5225             AC_DEFINE(MOZ_ENABLE_GIO)
5226         ],[
5227             if test "$MOZ_ENABLE_GIO" = "force"
5228             then
5229                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5230             fi
5231             MOZ_ENABLE_GIO=
5232         ])
5233     fi
5235     AC_SUBST(MOZ_ENABLE_GIO)
5236     AC_SUBST(MOZ_GIO_CFLAGS)
5237     AC_SUBST(MOZ_GIO_LIBS)
5239     dnl ========================================================
5240     dnl = GConf support module
5241     dnl ========================================================
5242     MOZ_ARG_DISABLE_BOOL(gconf,
5243     [  --disable-gconf      Disable Gconf support ],
5244         MOZ_ENABLE_GCONF=,
5245         MOZ_ENABLE_GCONF=force)
5247     if test "$MOZ_ENABLE_GCONF"
5248     then
5249         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5250             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5251             MOZ_ENABLE_GCONF=1
5252         ],[
5253             if test "$MOZ_ENABLE_GCONF" = "force"
5254             then
5255                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5256             fi
5257             MOZ_ENABLE_GCONF=
5258         ])
5259     fi
5261     if test "$MOZ_ENABLE_GCONF"; then
5262         AC_DEFINE(MOZ_ENABLE_GCONF)
5263     fi
5265     AC_SUBST(MOZ_ENABLE_GCONF)
5266     AC_SUBST(MOZ_GCONF_CFLAGS)
5267     AC_SUBST(MOZ_GCONF_LIBS)
5270 dnl ========================================================
5271 dnl = libproxy support
5272 dnl ========================================================
5274 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5275 then
5276     MOZ_ENABLE_LIBPROXY=
5278     MOZ_ARG_ENABLE_BOOL(libproxy,
5279     [  --enable-libproxy         Enable libproxy support ],
5280     MOZ_ENABLE_LIBPROXY=1,
5281     MOZ_ENABLE_LIBPROXY=)
5283     if test "$MOZ_ENABLE_LIBPROXY"
5284     then
5285         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5286         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5287     fi
5289 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5290 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5291 AC_SUBST(MOZ_LIBPROXY_LIBS)
5293 dnl ========================================================
5294 dnl = libnotify support
5295 dnl ========================================================
5297 if test "$MOZ_ENABLE_GTK2"
5298 then
5299     MOZ_ENABLE_LIBNOTIFY=1
5301     MOZ_ARG_DISABLE_BOOL(libnotify,
5302     [  --disable-libnotify     Disable libnotify support ],
5303     MOZ_ENABLE_LIBNOTIFY=,
5304     MOZ_ENABLE_LIBNOTIFY=1)
5306     if test "$MOZ_ENABLE_LIBNOTIFY"
5307     then
5308         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5309     fi
5312 if test -z "$SKIP_LIBRARY_CHECKS"
5313 then
5314     if test "$MOZ_ENABLE_GTK2"
5315     then
5316         if test "$MOZ_ENABLE_LIBNOTIFY"
5317         then
5318             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5319         fi
5320     fi
5322 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5323 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5324 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5326 dnl ========================================================
5327 dnl = GNOME component (mozgnome)
5328 dnl ========================================================
5330 # The GNOME component is built if one of
5331 # gnome-vfs, gio, gconf or libnotify is available.
5332 if test "$MOZ_ENABLE_GCONF" -o \
5333    "$MOZ_ENABLE_GNOMEVFS" -o \
5334    "$MOZ_ENABLE_GIO" -o \
5335    "$MOZ_ENABLE_LIBNOTIFY"; then
5336     MOZ_ENABLE_GNOME_COMPONENT=1
5337 else
5338     MOZ_ENABLE_GNOME_COMPONENT=
5340 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5342 dnl ========================================================
5343 dnl = libgnomeui support module
5344 dnl ========================================================
5346 if test "$MOZ_ENABLE_GTK2"
5347 then
5348     MOZ_ENABLE_GNOMEUI=1
5350     MOZ_ARG_DISABLE_BOOL(gnomeui,
5351     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5352         MOZ_ENABLE_GNOMEUI=,
5353         MOZ_ENABLE_GNOMEUI=force)
5355     if test "$MOZ_ENABLE_GNOMEUI"
5356     then
5357         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5358         [
5359             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5360             MOZ_ENABLE_GNOMEUI=1
5361         ],[
5362             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5363             then
5364                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5365             fi
5366             MOZ_ENABLE_GNOMEUI=
5367         ])
5368     fi
5370     if test "$MOZ_ENABLE_GNOMEUI"; then
5371         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5372     fi
5375 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5376 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5377 AC_SUBST(MOZ_GNOMEUI_LIBS)
5379 dnl ========================================================
5380 dnl = dbus support
5381 dnl ========================================================
5383 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5384 then
5385     MOZ_ENABLE_DBUS=1
5387     MOZ_ARG_DISABLE_BOOL(dbus,
5388     [  --disable-dbus          Disable dbus support ],
5389         MOZ_ENABLE_DBUS=,
5390         MOZ_ENABLE_DBUS=1)
5392     if test "$MOZ_ENABLE_DBUS"
5393     then
5394         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5395         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5396         AC_DEFINE(MOZ_ENABLE_DBUS)
5397     fi
5399 AC_SUBST(MOZ_ENABLE_DBUS)
5400 AC_SUBST(MOZ_DBUS_CFLAGS)
5401 AC_SUBST(MOZ_DBUS_LIBS)
5402 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5403 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5405 dnl ========================================================
5406 dnl = Enable Android History instead of Places
5407 dnl ========================================================
5408 if test -n "$MOZ_ANDROID_HISTORY"; then
5409      dnl Do this if defined in confvars.sh
5410      AC_DEFINE(MOZ_ANDROID_HISTORY)
5414 dnl ========================================================
5415 dnl = Build with the Android Java compositor
5416 dnl ========================================================
5417 if test -n "$MOZ_JAVA_COMPOSITOR"; then
5418      dnl Do this if defined in confvars.sh
5419      AC_DEFINE(MOZ_JAVA_COMPOSITOR)
5422 dnl ========================================================
5423 dnl = Disable WebSMS backend
5424 dnl ========================================================
5425 MOZ_ARG_DISABLE_BOOL(websms-backend,
5426 [  --disable-websms-backend
5427                            Disable WebSMS backend],
5428     MOZ_WEBSMS_BACKEND=,
5429     MOZ_WEBSMS_BACKEND=1)
5431 if test -n "$MOZ_WEBSMS_BACKEND"; then
5432     AC_DEFINE(MOZ_WEBSMS_BACKEND)
5435 dnl ========================================================
5436 dnl = Build Personal Security Manager
5437 dnl ========================================================
5438 MOZ_ARG_DISABLE_BOOL(crypto,
5439 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5440     MOZ_PSM=,
5441     MOZ_PSM=1 )
5443 dnl ========================================================
5444 dnl = JS Debugger XPCOM component (js/jsd)
5445 dnl ========================================================
5446 MOZ_ARG_DISABLE_BOOL(jsd,
5447 [  --disable-jsd           Disable JavaScript debug library],
5448     MOZ_JSDEBUGGER=,
5449     MOZ_JSDEBUGGER=1)
5452 dnl ========================================================
5453 dnl = Enable IPDL's "expensive" unit tests
5454 dnl ========================================================
5455 MOZ_IPDL_TESTS=
5457 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5458 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5459     MOZ_IPDL_TESTS=1,
5460     MOZ_IPDL_TESTS=)
5462 if test -n "$MOZ_IPDL_TESTS"; then
5463     AC_DEFINE(MOZ_IPDL_TESTS)
5466 AC_SUBST(MOZ_IPDL_TESTS)
5468 dnl ========================================================
5469 dnl = Turns off code necessary for e10s compatibility
5470 dnl ========================================================
5471 dnl This is a temporary flag to be removed in bug 662601 when
5472 dnl it's no longer needed
5474 MOZ_E10S_COMPAT=
5476 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5477 [  --enable-e10s-compat     Turns off code for e10s compat],
5478     MOZ_E10S_COMPAT=1,
5479     MOZ_E10S_COMPAT=)
5481 if test -n "$MOZ_E10S_COMPAT"; then
5482     AC_DEFINE(MOZ_E10S_COMPAT)
5485 dnl ========================================================
5486 dnl = Disable building dbm
5487 dnl ========================================================
5488 MOZ_ARG_DISABLE_BOOL(dbm,
5489 [  --disable-dbm           Disable building dbm],
5490     NSS_DISABLE_DBM=1,
5491     NSS_DISABLE_DBM=)
5493 dnl bi-directional support always on
5494 IBMBIDI=1
5495 AC_DEFINE(IBMBIDI)
5497 dnl ========================================================
5498 dnl accessibility support on by default on all platforms
5499 dnl except OS X.
5500 dnl ========================================================
5501 MOZ_ARG_DISABLE_BOOL(accessibility,
5502 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5503     ACCESSIBILITY=,
5504     ACCESSIBILITY=1 )
5505 if test "$ACCESSIBILITY"; then
5506     AC_DEFINE(ACCESSIBILITY)
5509 dnl ========================================================
5510 dnl Disable printing
5511 dnl ========================================================
5512 MOZ_ARG_DISABLE_BOOL(printing,
5513 [  --disable-printing      Disable printing support],
5514     NS_PRINTING=,
5515     NS_PRINTING=1)
5517 if test "$NS_PRINTING"; then
5518     AC_DEFINE(NS_PRINTING)
5519     AC_DEFINE(NS_PRINT_PREVIEW)
5522 dnl ========================================================
5523 dnl = Enable Raw Codecs
5524 dnl ========================================================
5525 MOZ_ARG_ENABLE_BOOL(raw,
5526 [  --enable-raw           Enable support for RAW media],
5527     MOZ_RAW=1,
5528     MOZ_RAW=)
5530 if test -n "$MOZ_RAW"; then
5531     AC_DEFINE(MOZ_RAW)
5532     MOZ_MEDIA=1
5535 AC_SUBST(MOZ_RAW)
5537 dnl ========================================================
5538 dnl = Disable Ogg Codecs
5539 dnl ========================================================
5540 MOZ_ARG_DISABLE_BOOL(ogg,
5541 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5542     MOZ_OGG=,
5543     MOZ_OGG=1)
5545 if test -n "$MOZ_OGG"; then
5546     AC_DEFINE(MOZ_OGG)
5547     MOZ_SYDNEYAUDIO=1
5548     MOZ_CUBEB=1
5549     MOZ_MEDIA=1
5550     case "$target_cpu" in
5551     arm*)
5552         MOZ_TREMOR=1
5553     ;;
5554     *)
5555         MOZ_VORBIS=1
5556     ;;
5557     esac
5559     dnl Checks for __attribute__(aligned()) directive
5560     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5561         [ac_cv_c_attribute_aligned],
5562         [ac_cv_c_attribute_aligned=0
5563          CFLAGS_save="${CFLAGS}"
5564          CFLAGS="${CFLAGS} -Werror"
5565          for ac_cv_c_attr_align_try in 64 32 16 8; do
5566            echo "trying $ac_cv_c_attr_align_try"
5567            AC_TRY_COMPILE([],
5568                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5569                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5570            if test "$ac_cv_c_attribute_aligned" != 0; then
5571              break;
5572            fi
5573          done
5574            CFLAGS="${CFLAGS_save}"])
5575     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5576       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5577                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5578     fi
5581 dnl ========================================================
5582 dnl = Disable VP8 decoder support
5583 dnl ========================================================
5584 MOZ_ARG_DISABLE_BOOL(webm,
5585 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
5586     MOZ_WEBM=,
5587     MOZ_WEBM=1)
5589 dnl system libvpx Support
5590 dnl ========================================================
5591 MOZ_ARG_WITH_STRING(system-libvpx,
5592 [  --with-system-libvpx=[PFX]
5593                           Use system libvpx [installed at prefix PFX]],
5594     LIBVPX_DIR=$withval)
5596 MOZ_NATIVE_LIBVPX=
5597 MOZ_LIBVPX_INCLUDES=
5598 MOZ_LIBVPX_LIBS=
5600 if test -n "$MOZ_WEBM"; then
5601     AC_DEFINE(MOZ_WEBM)
5602     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5603         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5604     fi
5605     if test -n "$MOZ_VP8_ENCODER" ; then
5606         AC_DEFINE(MOZ_VP8_ENCODER)
5607     fi
5609     if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
5610         _SAVE_CFLAGS=$CFLAGS
5611         _SAVE_LDFLAGS=$LDFLAGS
5612         _SAVE_LIBS=$LIBS
5613         if test "${LIBVPX_DIR}" = "yes"; then
5614             LIBVPX_DIR=/usr
5615         fi
5616         CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
5617         LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
5618         MOZ_NATIVE_LIBVPX_DEC_TEST=
5619         MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
5620             [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
5621              AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
5622             fi],
5623             AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
5624         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
5625                      [MOZ_NATIVE_LIBVPX_DEC_TEST=1],
5626                      ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
5627         if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then
5628             AC_MSG_CHECKING([for libvpx version >= v1.0.0])
5629             dnl We need at least v1.0.0 to fix several crash bugs (for which we
5630             dnl had local patches prior to v1.0.0).
5631             dnl
5632             dnl This is a terrible test for the library version, but we don't
5633             dnl have a good one. There is no version number in a public header,
5634             dnl and testing the headers still doesn't guarantee we link against
5635             dnl the right version. While we could call vpx_codec_version() at
5636             dnl run-time, that would break cross-compiling. There are no
5637             dnl additional exported decoder symbols between the v1.0.0 release
5638             dnl and the v0.9.7 one to check for.
5639             AC_TRY_COMPILE([
5640                 #include <vpx/vpx_decoder.h>
5641                 #if !defined(VPX_CODEC_USE_INPUT_FRAGMENTS)
5642                     #error "test failed."
5643                 #endif
5644                 ],
5645                 [return 0;],
5646                 [AC_MSG_RESULT([yes])
5647                  MOZ_NATIVE_LIBVPX=1
5648                  AC_DEFINE(MOZ_NATIVE_LIBVPX)
5649                  MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
5650                  MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
5651                 [AC_MSG_RESULT([no])
5652                  AC_MSG_ERROR([--with-system-libvpx requested but it is not v1.0.0 or later])])
5653         fi
5654         CFLAGS=$_SAVE_CFLAGS
5655         LDFLAGS=$_SAVE_LDFLAGS
5656         LIBS=$_SAVE_LIBS
5657     fi
5660 AC_SUBST(MOZ_NATIVE_LIBVPX)
5661 AC_SUBST(MOZ_LIBVPX_INCLUDES)
5662 AC_SUBST(MOZ_LIBVPX_LIBS)
5664 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
5665     MOZ_SYDNEYAUDIO=1
5666     MOZ_CUBEB=1
5667     MOZ_MEDIA=1
5668     case "$target_cpu" in
5669     arm*)
5670         MOZ_TREMOR=1
5671     ;;
5672     *)
5673         MOZ_VORBIS=1
5674     ;;
5675     esac
5678     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5679     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5680     dnl We currently require gcc on all arm platforms.
5681     VPX_AS=$YASM
5682     VPX_ASM_SUFFIX=asm
5683     VPX_NEED_OBJ_INT_EXTRACT=
5685     dnl See if we have assembly on this platform.
5686     case "$OS_ARCH:$CPU_ARCH" in
5687     Linux:x86)
5688       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5689       VPX_X86_ASM=1
5690     ;;
5691     Linux:x86_64)
5692       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5693       VPX_X86_ASM=1
5694     ;;
5695     SunOS:x86)
5696       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5697       VPX_X86_ASM=1
5698     ;;
5699     SunOS:x86_64)
5700       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5701       VPX_X86_ASM=1
5702     ;;
5703     Darwin:x86)
5704       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5705       VPX_X86_ASM=1
5706     ;;
5707     Darwin:x86_64)
5708       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5709       VPX_X86_ASM=1
5710     ;;
5711     WINNT:x86_64)
5712       if test -z "$GNU_CC"; then
5713         VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5714         VPX_X86_ASM=1
5715       fi
5716     ;;
5717     WINNT:x86)
5718       if test -z "$GNU_CC"; then
5719         dnl Check for yasm 1.1 or greater.
5720         if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5721           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.])
5722         elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5723           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.])
5724         else
5725           VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5726           VPX_X86_ASM=1
5727           dnl The encoder needs obj_int_extract to get asm offsets.
5728         fi
5729       fi
5730     ;;
5731     *:arm*)
5732       if test -n "$GNU_AS" ; then
5733         VPX_AS=$AS
5734         dnl These flags are a lie; they're just used to enable the requisite
5735         dnl opcodes; actual arch detection is done at runtime.
5736         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5737         VPX_DASH_C_FLAG="-c"
5738         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5739         VPX_ASM_SUFFIX="$ASM_SUFFIX"
5740         VPX_ARM_ASM=1
5741       fi
5742     esac
5744     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5745       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.])
5746     fi
5748     if test -n "$MOZ_VP8_ENCODER" -a \
5749             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5750       dnl We prefer to get asm offsets using inline assembler, which the above
5751       dnl compilers can do. When we're not using one of those, we have to fall
5752       dnl back to obj_int_extract, which reads them from a compiled object
5753       dnl file. Unfortunately, that only works if we're compiling on a system
5754       dnl with the header files for the appropriate object file format.
5755       VPX_NEED_OBJ_INT_EXTRACT=1
5756     fi
5758     if test -n "$VPX_X86_ASM"; then
5759       AC_DEFINE(VPX_X86_ASM)
5760     elif test -n "$VPX_ARM_ASM"; then
5761       AC_DEFINE(VPX_ARM_ASM)
5762     else
5763       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5764     fi
5767 dnl ========================================================
5768 dnl = Disable Wave decoder support
5769 dnl ========================================================
5770 MOZ_ARG_DISABLE_BOOL(wave,
5771 [  --disable-wave          Disable Wave decoder support],
5772     MOZ_WAVE=,
5773     MOZ_WAVE=1)
5775 if test -n "$MOZ_WAVE"; then
5776     AC_DEFINE(MOZ_WAVE)
5777     MOZ_SYDNEYAUDIO=1
5778     MOZ_CUBEB=1
5779     MOZ_MEDIA=1
5782 dnl ========================================================
5783 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5784 dnl ========================================================
5786 if test -n "$MOZ_SYDNEYAUDIO"; then
5787     AC_DEFINE(MOZ_SYDNEYAUDIO)
5790 if test -n "$MOZ_CUBEB"; then
5791     case "$target" in
5792     *-mingw*)
5793         AC_DEFINE(MOZ_CUBEB)
5794         ;;
5795     *)
5796         dnl Other targets will be enabled soon.
5797         ;;
5798     esac
5801 if test -n "$MOZ_MEDIA"; then
5802     AC_DEFINE(MOZ_MEDIA)
5805 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5806     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/])
5809 if test -n "$MOZ_VORBIS"; then
5810     AC_DEFINE(MOZ_VORBIS)
5813 if test -n "$MOZ_TREMOR"; then
5814     AC_DEFINE(MOZ_TREMOR)
5817 dnl ========================================================
5818 dnl = Check alsa availability on Linux if using sydneyaudio
5819 dnl ========================================================
5821 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5822 if test -n "$MOZ_SYDNEYAUDIO"; then
5823    case "$target_os" in
5824 linux*)
5825       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5826          [echo "$MOZ_ALSA_PKG_ERRORS"
5827           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.)])])
5828       ;;
5829    esac
5832 dnl ========================================================
5833 dnl Permissions System
5834 dnl ========================================================
5835 MOZ_ARG_DISABLE_BOOL(permissions,
5836 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5837     MOZ_PERMISSIONS=,
5838     MOZ_PERMISSIONS=1
5841 dnl ========================================================
5842 dnl NegotiateAuth
5843 dnl ========================================================
5844 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5845 [  --disable-negotiateauth Disable GSS-API negotiation ],
5846     MOZ_AUTH_EXTENSION=,
5847     MOZ_AUTH_EXTENSION=1 )
5849 dnl ========================================================
5850 dnl XTF
5851 dnl ========================================================
5852 MOZ_ARG_DISABLE_BOOL(xtf,
5853 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5854     MOZ_XTF=,
5855     MOZ_XTF=1 )
5856 if test "$MOZ_XTF"; then
5857   AC_DEFINE(MOZ_XTF)
5860 dnl ========================================================
5861 dnl Pref extensions (autoconfig)
5862 dnl ========================================================
5863 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5864 [  --disable-pref-extensions
5865                           Disable pref extensions such as autoconfig],
5866   MOZ_PREF_EXTENSIONS=,
5867   MOZ_PREF_EXTENSIONS=1 )
5869 dnl ========================================================
5870 dnl Searching of system directories for extensions.
5871 dnl Note: this switch is meant to be used for test builds
5872 dnl whose behavior should not depend on what happens to be
5873 dnl installed on the local machine.
5874 dnl ========================================================
5875 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5876 [  --disable-system-extension-dirs
5877                           Disable searching system- and account-global
5878                           directories for extensions of any kind; use
5879                           only profile-specific extension directories],
5880   ENABLE_SYSTEM_EXTENSION_DIRS=,
5881   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5882 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5883   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5886 dnl ========================================================
5887 dnl = Universalchardet
5888 dnl ========================================================
5889 MOZ_ARG_DISABLE_BOOL(universalchardet,
5890 [  --disable-universalchardet
5891                           Disable universal encoding detection],
5892   MOZ_UNIVERSALCHARDET=,
5893   MOZ_UNIVERSALCHARDET=1 )
5895 if test -n "${JAVA_BIN_PATH}"; then
5896   dnl Look for javac and jar in the specified path.
5897   JAVA_PATH="$JAVA_BIN_PATH"
5898 else
5899   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5900   JAVA_PATH="$JAVA_HOME/bin:$PATH"
5903 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5904 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5905 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5907 if test -n "${JAVA_BIN_PATH}" -o \
5908   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5909   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5910     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}])
5911   fi
5914 dnl ========================================================
5915 dnl = ANGLE OpenGL->D3D translator for WebGL
5916 dnl = * only applies to win32
5917 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5918 dnl ========================================================
5919 MOZ_ANGLE=
5920 MOZ_DIRECTX_SDK_PATH=
5921 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5922 MOZ_D3DX9_VERSION=
5923 MOZ_D3DX9_CAB=
5924 MOZ_D3DCOMPILER_CAB=
5925 MOZ_D3DX9_DLL=
5926 MOZ_D3DCOMPILER_DLL=
5927 case "$target_os" in
5928 *mingw*)
5929     MOZ_ANGLE=1
5930     ;;
5931 esac
5933 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5934 case "${target_cpu}" in
5935 i*86)
5936   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5937   ;;
5938 x86_64)
5939   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5940   ;;
5941 esac
5943 if test -n "$MOZ_ANGLE"; then
5944 MOZ_ARG_DISABLE_BOOL(angle,
5945 [  --disable-angle     Disable building of ANGLE for WebGL->D3D translation],
5946     MOZ_ANGLE=,
5947     MOZ_ANGLE=1)
5949 if test -n "$MOZ_ANGLE"; then
5950   if test -z "$_WIN32_MSVC"; then
5951     AC_MSG_ERROR([Building ANGLE requires MSVC.  To build without ANGLE, reconfigure with --disable-angle.])
5952   fi
5954   # Get the SDK path from the registry.
5955   # First try to get the June 2010 SDK
5956   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5957   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5958     # Otherwise just take whatever comes first
5959     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5960   fi
5962   if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5963     AC_MSG_ERROR([Found the February 2010 DirectX SDK. This is too old. We now require the June 2010 DirectX SDK, or newer.  Upgrade your SDK or to explicitly build without ANGLE, reconfigure with --disable-angle.])
5964   else
5965     MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
5966   fi
5968   MOZ_ANGLE=
5970   if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5971     if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5972       AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5973       MOZ_ANGLE=1
5974     fi
5975   fi
5977   if test -z "$MOZ_ANGLE" ; then
5978     AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for ANGLE. Please install it (June 2010 or newer). To explicitly build without ANGLE, reconfigure with --disable-angle.])
5979   fi
5981   if test -n "$MOZ_ANGLE" ; then
5982     # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
5983     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'`
5985     if test -z "$MOZ_D3DX9_VERSION" ; then
5986       AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for ANGLE. To explicitly build without ANGLE, reconfigure with --disable-angle.])
5987     fi
5989     if test -n "$MOZ_ANGLE" ; then
5990       MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5991       MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
5993       MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
5994       MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
5995     fi
5996   fi
6000 dnl ========================================================
6001 dnl = Breakpad crash reporting (on by default on supported platforms)
6002 dnl ========================================================
6004 case $target in
6005 i?86-*-mingw*|x86_64-*-mingw*)
6006   MOZ_CRASHREPORTER=1
6007   ;;
6008 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6009   MOZ_CRASHREPORTER=1
6010   ;;
6011 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6012   if test "$MOZ_ENABLE_GTK2"; then
6013     MOZ_CRASHREPORTER=1
6014   fi
6015   ;;
6016 *-android*|*-linuxandroid*)
6017   MOZ_CRASHREPORTER=1
6018   ;;
6019 *solaris*)
6020   MOZ_CRASHREPORTER=1
6021   ;;
6022 esac
6024 MOZ_ARG_DISABLE_BOOL(crashreporter,
6025 [  --disable-crashreporter Disable breakpad crash reporting],
6026     MOZ_CRASHREPORTER=,
6027     MOZ_CRASHREPORTER=1)
6029 if test -n "$MOZ_CRASHREPORTER"; then
6030    AC_DEFINE(MOZ_CRASHREPORTER)
6032   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6033     test -z "$SKIP_LIBRARY_CHECKS"; then
6034     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6035     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6036     AC_SUBST(MOZ_GTHREAD_LIBS)
6038     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.])])
6039   fi
6041   if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
6042     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
6043   fi
6046 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6047 [  --with-crashreporter-enable-percent=NN
6048                           Enable sending crash reports by default on NN% of users. (default=100)],
6049 [ val=`echo $withval | sed 's/[^0-9]//g'`
6050     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6052 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6053    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6055 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6057 dnl ========================================================
6058 dnl = libjpeg-turbo configuration
6059 dnl ========================================================
6060 MOZ_LIBJPEG_TURBO=
6061 if test -z "$SYSTEM_JPEG"; then
6062     MOZ_LIBJPEG_TURBO=1
6065 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6066 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
6067     MOZ_LIBJPEG_TURBO=,
6068     MOZ_LIBJPEG_TURBO=1)
6070 if test "$SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6071     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6074 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6075 dnl files.
6077 if test -n "$MOZ_LIBJPEG_TURBO"; then
6079   dnl Do we support libjpeg-turbo on this platform?
6080   case "$OS_ARCH:$OS_TEST" in
6081   Linux:x86|Linux:i?86)
6082     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6083     LIBJPEG_TURBO_X86_ASM=1
6084   ;;
6085   Linux:x86_64)
6086     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6087     LIBJPEG_TURBO_X64_ASM=1
6088   ;;
6089   SunOS:i?86)
6090     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6091     LIBJPEG_TURBO_X86_ASM=1
6092   ;;
6093   SunOS:x86_64)
6094     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6095     LIBJPEG_TURBO_X64_ASM=1
6096   ;;
6097   Darwin:i?86)
6098     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6099     LIBJPEG_TURBO_X86_ASM=1
6100   ;;
6101   Darwin:x86_64)
6102     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6103     LIBJPEG_TURBO_X64_ASM=1
6104   ;;
6105   WINNT:x86|WINNT:i?86)
6106     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6107     LIBJPEG_TURBO_X86_ASM=1
6108   ;;
6109   WINNT:x86_64)
6110     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6111     LIBJPEG_TURBO_X64_ASM=1
6112   ;;
6113   *:arm*)
6114     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6115     LIBJPEG_TURBO_ARM_ASM=1
6116   ;;
6117   esac
6121 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6122 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6123 dnl it doesn't exist or we have too old of a version.
6124 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6125     AC_MSG_CHECKING([for Yasm assembler])
6126     AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6128     if test -z "$LIBJPEG_TURBO_AS" ; then
6129         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.])
6130     fi
6132     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
6133     dnl on Linux and 1.1 or newer everywhere else.
6134     if test "$OS_ARCH" = "Linux" ; then
6135         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
6136             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.])
6137         fi
6138     else
6139         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6140             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.])
6141         fi
6142     fi
6145 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6146 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6147 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6148     echo "Using $AS as the assembler for ARM code."
6149     LIBJPEG_TURBO_AS=$AS
6152 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6153     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6154 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6155     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6156 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6157     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6158 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6159     dnl Warn if we're not building the optimized routines, even though the user
6160     dnl didn't specify --disable-libjpeg-turbo.
6161     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6164 dnl ========================================================
6165 dnl = Enable compilation of specific extension modules
6166 dnl ========================================================
6168 MOZ_ARG_ENABLE_STRING(extensions,
6169 [  --enable-extensions     Enable extensions],
6170 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6171     if test "$option" = "yes" -o "$option" = "all"; then
6172         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6173     elif test "$option" = "no" -o "$option" = "none"; then
6174         MOZ_EXTENSIONS=""
6175     elif test "$option" = "default"; then
6176         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6177     elif test `echo "$option" | grep -c \^-` != 0; then
6178         option=`echo $option | sed 's/^-//'`
6179         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6180     else
6181         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6182     fi
6183 done],
6184     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6186 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6187     # Suppress warning on non-X11 platforms
6188     if test -n "$MOZ_X11"; then
6189         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6190     fi
6191     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6194 dnl Do not build gnomevfs with libxul based apps
6195 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6196     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6199 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6200     # Suppress warning on non-X11 platforms
6201     if test -n "$MOZ_X11"; then
6202         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6203     fi
6204     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6207 dnl Do not build gio with libxul based apps
6208 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6209     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6212 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6213     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6214     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6217 dnl xforms requires xtf
6218 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6219     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6220     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6223 dnl Remove dupes
6224 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6226 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6227 dnl when trying to build a nonexistent extension.
6228 for extension in $MOZ_EXTENSIONS; do
6229     if test ! -d "${srcdir}/extensions/${extension}"; then
6230         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6231     fi
6232 done
6234 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6235   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6238 dnl ========================================================
6239 dnl CSS3 Flexbox Support
6240 dnl ========================================================
6241 if test -n "$MOZ_FLEXBOX"; then
6242   AC_DEFINE(MOZ_FLEXBOX)
6245 dnl ========================================================
6246 dnl SVG Display Lists
6247 dnl ========================================================
6248 if test -n "$MOZ_SVG_DLISTS"; then
6249   AC_DEFINE(MOZ_SVG_DLISTS)
6252 dnl ========================================================
6253 dnl Build Freetype in the tree
6254 dnl ========================================================
6255 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6256 [  --enable-tree-freetype  Enable Tree FreeType],
6257     MOZ_TREE_FREETYPE=1,
6258     MOZ_TREE_FREETYPE= )
6259 if test -n "$MOZ_TREE_FREETYPE"; then
6260    if test -n "$_WIN32_MSVC"; then
6261       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6262    fi
6263    AC_DEFINE(MOZ_TREE_FREETYPE)
6264    AC_SUBST(MOZ_TREE_FREETYPE)
6265    MOZ_ENABLE_CAIRO_FT=1
6266    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6267    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6268    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6269    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6270    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6271    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6272    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6273    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6274    AC_SUBST(CAIRO_FT_CFLAGS)
6277 dnl ========================================================
6278 dnl Installer
6279 dnl ========================================================
6280 dnl Abort Windows build if the required major version and
6281 dnl minimum minor version of Unicode NSIS isn't in the path
6282 dnl (unless in case of cross compiling, for which Unicode
6283 dnl is not yet sufficient).
6284 if test "$OS_ARCH" = "WINNT"; then
6285     REQ_NSIS_MAJOR_VER=2
6286     MIN_NSIS_MINOR_VER=33
6287     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6288     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6289       AC_MSG_RESULT([yes])
6290       changequote(,)
6291       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6292       changequote([,])
6293       if test ! "$MAKENSISU_VER" = ""; then
6294           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6295           MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6296       fi
6297       AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6298       if test "$MAKENSISU_VER" = "" || \
6299          test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6300               ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6301           AC_MSG_RESULT([no])
6302           if test -z "$CROSS_COMPILE"; then
6303             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.])
6304           else
6305             MAKENSISU=
6306           fi
6307       fi
6308     elif test -z "$CROSS_COMPILE"; then
6309       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.])
6310     else
6311       MAKENSISU=
6312     fi
6315 AC_MSG_CHECKING([for tar archiver])
6316 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6317 if test -z "$TAR"; then
6318     AC_MSG_ERROR([no tar archiver found in \$PATH])
6320 AC_MSG_RESULT([$TAR])
6321 AC_SUBST(TAR)
6323 AC_MSG_CHECKING([for wget])
6324 AC_CHECK_PROGS(WGET, wget, "")
6325 AC_MSG_RESULT([$WGET])
6326 AC_SUBST(WGET)
6328 dnl ========================================================
6329 dnl Maintenance Service
6330 dnl ========================================================
6332 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6333 [  --enable-maintenance-service       Enable building of maintenanceservice],
6334     MOZ_MAINTENANCE_SERVICE=1,
6335     MOZ_MAINTENANCE_SERVICE= )
6337 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6338   if test "$OS_ARCH" = "WINNT"; then
6339     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6340   else
6341     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6342   fi
6345 dnl ========================================================
6346 dnl Verify MAR signatures
6347 dnl ========================================================
6349 MOZ_ARG_ENABLE_BOOL(verify-mar,
6350 [  --enable-verify-mar     Enable verifying MAR signatures],
6351     MOZ_VERIFY_MAR_SIGNATURE=1,
6352     MOZ_VERIFY_MAR_SIGNATURE= )
6354 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6355   if test "$OS_ARCH" = "WINNT"; then
6356     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6357   else
6358     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6359   fi
6362 dnl ========================================================
6363 dnl Enable building the signmar program.
6364 dnl This option is much different than the --enable-verify-mar option.
6365 dnl --enable-verify-mar is for enabling the verification check on MAR
6366 dnl files in the updater.  The --enable-signmar option is for building
6367 dnl the signmar program.
6368 dnl ========================================================
6370 MOZ_ARG_ENABLE_BOOL(sign-mar,
6371 [  --enable-signmar     Enable building the signmar program],
6372     MOZ_ENABLE_SIGNMAR=1,
6373     MOZ_ENABLE_SIGNMAR= )
6375 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6376   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6379 dnl ========================================================
6380 dnl Updater
6381 dnl ========================================================
6383 MOZ_ARG_DISABLE_BOOL(updater,
6384 [  --disable-updater       Disable building of updater],
6385     MOZ_UPDATER=,
6386     MOZ_UPDATER=1 )
6388 if test -n "$MOZ_UPDATER"; then
6389     AC_DEFINE(MOZ_UPDATER)
6392 # app update channel is 'default' when not supplied.
6393 MOZ_ARG_ENABLE_STRING([update-channel],
6394 [  --enable-update-channel=CHANNEL
6395                           Select application update channel (default=default)],
6396     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6398 if test -z "$MOZ_UPDATE_CHANNEL"; then
6399     MOZ_UPDATE_CHANNEL=default
6401 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6402 AC_SUBST(MOZ_UPDATE_CHANNEL)
6404 # tools/update-packaging is not checked out by default.
6405 MOZ_ARG_ENABLE_BOOL(update-packaging,
6406 [  --enable-update-packaging
6407                           Enable tools/update-packaging],
6408     MOZ_UPDATE_PACKAGING=1,
6409     MOZ_UPDATE_PACKAGING= )
6410 AC_SUBST(MOZ_UPDATE_PACKAGING)
6412 dnl ========================================================
6413 dnl leaky
6414 dnl ========================================================
6415 MOZ_ARG_ENABLE_BOOL(leaky,
6416 [  --enable-leaky          Build leaky memory tool],
6417     MOZ_LEAKY=1,
6418     MOZ_LEAKY=)
6421 dnl ========================================================
6422 dnl build the tests by default
6423 dnl ========================================================
6424 MOZ_ARG_DISABLE_BOOL(tests,
6425 [  --disable-tests         Do not build test libraries & programs],
6426     ENABLE_TESTS=,
6427     ENABLE_TESTS=1 )
6429 dnl ========================================================
6430 dnl parental controls (for Windows Vista)
6431 dnl ========================================================
6432 MOZ_ARG_DISABLE_BOOL(parental-controls,
6433 [  --disable-parental-controls
6434                           Do not build parental controls],
6435    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6436    MOZ_DISABLE_PARENTAL_CONTROLS=)
6437 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6438     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6441 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6443 dnl ========================================================
6444 dnl = Disable DOMCrypto
6445 dnl ========================================================
6446 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6447     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6450 dnl ========================================================
6451 dnl =
6452 dnl = Module specific options
6453 dnl =
6454 dnl ========================================================
6455 MOZ_ARG_HEADER(Individual module options)
6457 dnl ========================================================
6458 dnl = Disable feed handling components
6459 dnl ========================================================
6460 MOZ_ARG_DISABLE_BOOL(feeds,
6461 [  --disable-feeds         Disable feed handling and processing components],
6462     MOZ_FEEDS=,
6463     MOZ_FEEDS=1 )
6464 if test -n "$MOZ_FEEDS"; then
6465     AC_DEFINE(MOZ_FEEDS)
6466 else
6467     if test "$MOZ_BUILD_APP" = "browser"; then
6468         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6469     fi
6472 dnl ========================================================
6473 dnl Check for sqlite
6474 dnl ========================================================
6476 MOZ_NATIVE_SQLITE=
6477 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6478 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6479 MOZ_NATIVE_SQLITE=1,
6480 MOZ_NATIVE_SQLITE= )
6482 if test -z "$MOZ_NATIVE_SQLITE"
6483 then
6484     SQLITE_CFLAGS=
6485     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6486 else
6487     dnl ============================
6488     dnl === SQLite Version check ===
6489     dnl ============================
6490     dnl Check to see if the system SQLite package is new enough.
6491     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6493     dnl ==================================
6494     dnl === SQLITE_SECURE_DELETE check ===
6495     dnl ==================================
6496     dnl Check to see if the system SQLite package is compiled with
6497     dnl SQLITE_SECURE_DELETE enabled.
6498     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6499     _SAVE_CFLAGS="$CFLAGS"
6500     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6501     _SAVE_LIBS="$LIBS"
6502     LIBS="$LIBS $SQLITE_LIBS"
6503     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6504         AC_TRY_RUN([
6505             #include "sqlite3.h"
6507             int main(int argc, char **argv){
6508               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6509             }],
6510             ac_cv_sqlite_secure_delete=yes,
6511             ac_cv_sqlite_secure_delete=no,
6512             ac_cv_sqlite_secure_delete=no
6513         )
6514     ])
6515     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6516     CFLAGS="$_SAVE_CFLAGS"
6517     LIBS="$_SAVE_LIBS"
6518     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6519         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6520     fi
6522     dnl ===============================
6523     dnl === SQLITE_THREADSAFE check ===
6524     dnl ===============================
6525     dnl Check to see if the system SQLite package is compiled with
6526     dnl SQLITE_THREADSAFE enabled.
6527     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6528     _SAVE_CFLAGS="$CFLAGS"
6529     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6530     _SAVE_LIBS="$LIBS"
6531     LIBS="$LIBS $SQLITE_LIBS"
6532     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6533         AC_TRY_RUN([
6534             #include "sqlite3.h"
6536             int main(int argc, char **argv){
6537               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6538             }],
6539             ac_cv_sqlite_threadsafe=yes,
6540             ac_cv_sqlite_threadsafe=no,
6541             ac_cv_sqlite_threadsafe=no
6542         )
6543     ])
6544     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6545     CFLAGS="$_SAVE_CFLAGS"
6546     LIBS="$_SAVE_LIBS"
6547     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6548         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6549     fi
6551     dnl ================================
6552     dnl === SQLITE_ENABLE_FTS3 check ===
6553     dnl ================================
6554     dnl check to see if the system SQLite package is compiled with
6555     dnl SQLITE_ENABLE_FTS3 enabled.
6556     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6557     _SAVE_CFLAGS="$CFLAGS"
6558     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6559     _SAVE_LIBS="$LIBS"
6560     LIBS="$LIBS $SQLITE_LIBS"
6561     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6562         AC_TRY_RUN([
6563             #include "sqlite3.h"
6565             int main(int argc, char **argv){
6566               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6567             }],
6568             ac_cv_sqlite_enable_fts3=yes,
6569             ac_cv_sqlite_enable_fts3=no,
6570             ac_cv_sqlite_enable_fts3=no
6571         )
6572     ])
6573     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6574     CFLAGS="$_SAVE_CFLAGS"
6575     LIBS="$_SAVE_LIBS"
6576     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6577         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6578     fi
6580     dnl =========================================
6581     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6582     dnl =========================================
6583     dnl check to see if the system SQLite package is compiled with
6584     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6585     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6586     _SAVE_CFLAGS="$CFLAGS"
6587     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6588     _SAVE_LIBS="$LIBS"
6589     LIBS="$LIBS $SQLITE_LIBS"
6590     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6591         AC_TRY_RUN([
6592             #include "sqlite3.h"
6594             int main(int argc, char **argv){
6595               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6596             }],
6597             ac_cv_sqlite_enable_unlock_notify=yes,
6598             ac_cv_sqlite_enable_unlock_notify=no,
6599             ac_cv_sqlite_enable_unlock_notify=no
6600         )
6601     ])
6602     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6603     CFLAGS="$_SAVE_CFLAGS"
6604     LIBS="$_SAVE_LIBS"
6605     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6606         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6607     fi
6610 if test -n "$MOZ_NATIVE_SQLITE"; then
6611     AC_DEFINE(MOZ_NATIVE_SQLITE)
6613 AC_SUBST(MOZ_NATIVE_SQLITE)
6615 dnl ========================================================
6616 dnl = Enable help viewer (off by default)
6617 dnl ========================================================
6618 if test -n "$MOZ_HELP_VIEWER"; then
6619      dnl Do this if defined in confvars.sh
6620      AC_DEFINE(MOZ_HELP_VIEWER)
6623 dnl ========================================================
6624 dnl = Enable safe browsing (anti-phishing)
6625 dnl ========================================================
6626 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6627 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6628     MOZ_SAFE_BROWSING=1,
6629     MOZ_SAFE_BROWSING= )
6630 if test -n "$MOZ_SAFE_BROWSING"; then
6631     AC_DEFINE(MOZ_SAFE_BROWSING)
6633 AC_SUBST(MOZ_SAFE_BROWSING)
6635 dnl ========================================================
6636 dnl = Enable url-classifier
6637 dnl ========================================================
6638 dnl Implicitly enabled by default if building with safe-browsing
6639 if test -n "$MOZ_SAFE_BROWSING"; then
6640     MOZ_URL_CLASSIFIER=1
6642 MOZ_ARG_ENABLE_BOOL(url-classifier,
6643 [  --enable-url-classifier Enable url classifier module],
6644     MOZ_URL_CLASSIFIER=1,
6645     MOZ_URL_CLASSIFIER= )
6646 if test -n "$MOZ_URL_CLASSIFIER"; then
6647     AC_DEFINE(MOZ_URL_CLASSIFIER)
6649 AC_SUBST(MOZ_URL_CLASSIFIER)
6651 dnl ========================================================
6652 dnl = Disable zipwriter
6653 dnl ========================================================
6654 MOZ_ARG_DISABLE_BOOL(zipwriter,
6655 [  --disable-zipwriter     Disable zipwriter component],
6656     MOZ_ZIPWRITER=,
6657     MOZ_ZIPWRITER=1 )
6658 AC_SUBST(MOZ_ZIPWRITER)
6660 dnl ========================================================
6661 dnl = libconic
6662 dnl ========================================================
6663 dnl superseded by QtNetwork starting from 4.7
6664 MOZ_ENABLE_LIBCONIC=1
6666 if test -n "$MOZ_ENABLE_QT"; then
6667   if test "$MOZ_ENABLE_QTNETWORK"; then
6668     MOZ_ENABLE_LIBCONIC=
6669   fi
6672 MOZ_ARG_DISABLE_BOOL(libconic,
6673 [  --disable-libconic      Disable libconic],
6674     MOZ_ENABLE_LIBCONIC=,
6675     MOZ_ENABLE_LIBCONIC=1 )
6677 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6678     PKG_CHECK_MODULES(LIBCONIC, conic,
6679                       MOZ_ENABLE_LIBCONIC=1,
6680                       MOZ_ENABLE_LIBCONIC=)
6682 if test "$MOZ_ENABLE_LIBCONIC"; then
6683     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6686 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6687 AC_SUBST(LIBCONIC_CFLAGS)
6688 AC_SUBST(LIBCONIC_LIBS)
6690 dnl ========================================================
6691 dnl = Maemo checks
6692 dnl ========================================================
6694 MAEMO_SDK_TARGET_VER=-1
6696 MOZ_ARG_WITH_STRING(maemo-version,
6697 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6698                           Maemo SDK Version],
6699   MAEMO_SDK_TARGET_VER=$withval)
6701 case "$MAEMO_SDK_TARGET_VER" in
6703     MOZ_PLATFORM_MAEMO=5
6704     ;;
6707     MOZ_PLATFORM_MAEMO=6
6708     ;;
6711     dnl We aren't compiling for Maemo, move on.
6712     ;;
6714     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6715     ;;
6716 esac
6718 if test $MOZ_PLATFORM_MAEMO; then
6719    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6721    if test -z "$MOZ_ENABLE_DBUS"; then
6722        AC_MSG_ERROR([DBus is required when building for Maemo])
6723    fi
6725    MOZ_GFX_OPTIMIZE_MOBILE=1
6726    MOZ_GL_DEFAULT_PROVIDER=EGL
6727    MOZ_MAEMO_LIBLOCATION=
6729    if test $MOZ_PLATFORM_MAEMO = 5; then
6730       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6731       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6732           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6733       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6734                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6736       AC_SUBST(XCOMPOSITE_LIBS)
6738       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6739       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6740       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6741       if test -z "$_LIB_FOUND"; then
6742          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6743       fi
6746       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6747       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6748       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6749       if test -z "$_LIB_FOUND"; then
6750          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6751       fi
6753       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6754       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6755       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6756       if test -z "$_LIB_FOUND"; then
6757          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6758       fi
6760    fi
6761    if test $MOZ_PLATFORM_MAEMO = 6; then
6763       PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6764                         _LIB_FOUND=1,
6765                         _LIB_FOUND=)
6766       if test "$_LIB_FOUND"; then
6767          MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6768          MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6769          MOZ_ENABLE_CONTENTMANAGER=1
6770          AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6771       else
6772          AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6773       fi
6774       AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6776       dnl ========================================================
6777       dnl = Enable meego libcontentaction
6778       dnl ========================================================
6779       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6780       [  --enable-meegocontentaction           Enable meegocontentaction support],
6781          MOZ_MEEGOCONTENTACTION=1,
6782          MOZ_MEEGOCONTENTACTION=)
6784       if test -n "$MOZ_MEEGOCONTENTACTION"; then
6786          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6787          if test "$_LIB_FOUND"; then
6788             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6789             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6790             MOZ_ENABLE_CONTENTACTION=1
6791             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6792             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6793          fi
6794       fi
6796       MOZ_ARG_ENABLE_BOOL(meegotouch,
6797       [  --enable-meegotouch  Enable meegotouch support],
6798          MOZ_MEEGOTOUCHENABLED=1,
6799          MOZ_MEEGOTOUCHENABLED=)
6801       if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6802           PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6803           if test "$_LIB_FOUND"; then
6804               MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6805               MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6806               AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6807           else
6808               AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6809           fi
6810       fi
6811    fi
6813    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6814    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6815    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6816    if test "$_LIB_FOUND"; then
6817       MOZ_MAEMO_LIBLOCATION=1
6818       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6819    else
6820       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6821    fi
6822    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6824    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6825    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6826    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6827    if test "$_LIB_FOUND"; then
6828       MOZ_ENABLE_MEEGOTOUCHSHARE=1
6829       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6830    else
6831       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6832    fi
6833    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6835    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6836    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6839 dnl ========================================================
6840 dnl = XRender Composite
6841 dnl ========================================================
6842 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6843 [  --enable-egl-xrender-composite
6844                           Enable EGL xrender composite optimizations],
6845     MOZ_EGL_XRENDER_COMPOSITE=1)
6847 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6848     AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6851 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6853 dnl ========================================================
6854 dnl GL provider
6855 dnl ========================================================
6856 MOZ_GL_PROVIDER=
6857 MOZ_ARG_WITH_STRING(gl-provider,
6858 [  --with-gl-provider=ID
6859                           Set GL provider backend type],
6860 [ val=`echo $withval`
6861     MOZ_GL_PROVIDER="$val"])
6863 if test -n "$MOZ_GL_PROVIDER"; then
6864 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6865 AC_SUBST(MOZ_GL_PROVIDER)
6866 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6869 dnl ========================================================
6870 dnl = faststripe theme
6871 dnl ========================================================
6872 MOZ_ARG_ENABLE_BOOL(faststripe,
6873 [  --enable-faststripe     Use faststripe theme],
6874     MOZ_THEME_FASTSTRIPE=1,
6875     MOZ_THEME_FASTSTRIPE= )
6876 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6878 dnl ========================================================
6879 dnl =
6880 dnl = Feature options that require extra sources to be pulled
6881 dnl =
6882 dnl ========================================================
6883 dnl MOZ_ARG_HEADER(Features that require extra sources)
6885 dnl ========================================================
6886 dnl =
6887 dnl = Debugging Options
6888 dnl =
6889 dnl ========================================================
6890 MOZ_ARG_HEADER(Debugging and Optimizations)
6892 dnl ========================================================
6893 dnl = Disable building with debug info.
6894 dnl = Debugging is OFF by default
6895 dnl ========================================================
6896 if test -z "$MOZ_DEBUG_FLAGS"; then
6897   MOZ_DEBUG_FLAGS="-g"
6900 MOZ_ARG_ENABLE_STRING(debug,
6901 [  --enable-debug[=DBG]    Enable building with developer debug info
6902                            (using compiler flags DBG)],
6903 [ if test "$enableval" != "no"; then
6904     MOZ_DEBUG=1
6905     if test -n "$enableval" -a "$enableval" != "yes"; then
6906         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6907         _MOZ_DEBUG_FLAGS_SET=1
6908     fi
6909   else
6910     MOZ_DEBUG=
6911   fi ],
6912   MOZ_DEBUG=)
6914 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6915 MOZ_ARG_WITH_STRING(debug-label,
6916 [  --with-debug-label=LABELS
6917                           Define DEBUG_<value> for each comma-separated
6918                           value given.],
6919 [ for option in `echo $withval | sed 's/,/ /g'`; do
6920     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6921 done])
6923 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6925 if test -n "$MOZ_DEBUG"; then
6926     AC_MSG_CHECKING([for valid debug flags])
6927     _SAVE_CFLAGS=$CFLAGS
6928     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6929     AC_TRY_COMPILE([#include <stdio.h>],
6930         [printf("Hello World\n");],
6931         _results=yes,
6932         _results=no)
6933     AC_MSG_RESULT([$_results])
6934     if test "$_results" = "no"; then
6935         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6936     fi
6937     CFLAGS=$_SAVE_CFLAGS
6940 dnl ========================================================
6941 dnl enable mobile optimizations
6942 dnl ========================================================
6943 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6944 [  --enable-mobile-optimize
6945                           Enable mobile optimizations],
6946     MOZ_GFX_OPTIMIZE_MOBILE=1)
6948 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6950 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6951     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6954 dnl ========================================================
6955 dnl = Enable code optimization. ON by default.
6956 dnl ========================================================
6957 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6958         MOZ_OPTIMIZE_FLAGS="-O"
6961 MOZ_ARG_ENABLE_STRING(optimize,
6962 [  --disable-optimize      Disable compiler optimization
6963   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6964 [ if test "$enableval" != "no"; then
6965     MOZ_OPTIMIZE=1
6966     if test -n "$enableval" -a "$enableval" != "yes"; then
6967         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6968         MOZ_OPTIMIZE=2
6969     fi
6970 else
6971     MOZ_OPTIMIZE=
6972 fi ], MOZ_OPTIMIZE=1)
6974 MOZ_SET_FRAMEPTR_FLAGS
6976 if test "$COMPILE_ENVIRONMENT"; then
6977 if test -n "$MOZ_OPTIMIZE"; then
6978     AC_MSG_CHECKING([for valid optimization flags])
6979     _SAVE_CFLAGS=$CFLAGS
6980     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6981     AC_TRY_COMPILE([#include <stdio.h>],
6982         [printf("Hello World\n");],
6983         _results=yes,
6984         _results=no)
6985     AC_MSG_RESULT([$_results])
6986     if test "$_results" = "no"; then
6987         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6988     fi
6989     CFLAGS=$_SAVE_CFLAGS
6991 fi # COMPILE_ENVIRONMENT
6993 AC_SUBST(MOZ_OPTIMIZE)
6994 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6995 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6996 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6997 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6998 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7000 dnl ========================================================
7001 dnl = Enable generation of debug symbols
7002 dnl ========================================================
7003 MOZ_ARG_ENABLE_STRING(debug-symbols,
7004 [  --enable-debug-symbols[=DBG]
7005                           Enable debugging symbols (using compiler flags DBG)],
7006 [ if test "$enableval" != "no"; then
7007       MOZ_DEBUG_SYMBOLS=1
7008       if test -n "$enableval" -a "$enableval" != "yes"; then
7009           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7010               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7011           else
7012               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7013           fi
7014       fi
7015   else
7016       MOZ_DEBUG_SYMBOLS=
7017   fi ],
7018   MOZ_DEBUG_SYMBOLS=1)
7020 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7021     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7022     export MOZ_DEBUG_SYMBOLS
7025 dnl ========================================================
7026 dnl = Enable any treating of compile warnings as errors
7027 dnl ========================================================
7028 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7029 [  --enable-warnings-as-errors
7030                           Enable treating of warnings as errors],
7031     MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7032     MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7033 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7034    WARNINGS_AS_ERRORS=''
7037 dnl ========================================================
7038 dnl = Disable runtime logging checks
7039 dnl ========================================================
7040 MOZ_ARG_DISABLE_BOOL(logging,
7041 [  --disable-logging       Disable logging facilities],
7042     NS_DISABLE_LOGGING=1,
7043     NS_DISABLE_LOGGING= )
7044 if test "$NS_DISABLE_LOGGING"; then
7045     AC_DEFINE(NS_DISABLE_LOGGING)
7046 else
7047     AC_DEFINE(MOZ_LOGGING)
7050 dnl ========================================================
7051 dnl = This will enable logging of addref, release, ctor, dtor.
7052 dnl ========================================================
7053 _ENABLE_LOGREFCNT=42
7054 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7055 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7056     _ENABLE_LOGREFCNT=1,
7057     _ENABLE_LOGREFCNT= )
7058 if test "$_ENABLE_LOGREFCNT" = "1"; then
7059     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7060 elif test -z "$_ENABLE_LOGREFCNT"; then
7061     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7064 dnl ========================================================
7065 dnl moz_dump_painting
7066 dnl ========================================================
7067 MOZ_ARG_ENABLE_BOOL(dump-painting,
7068 [  --enable-dump-painting          Enable paint debugging.],
7069     MOZ_DUMP_PAINTING=1,
7070     MOZ_DUMP_PAINTING= )
7071 if test -n "$MOZ_DUMP_PAINTING"; then
7072     AC_DEFINE(MOZ_DUMP_PAINTING)
7073     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7075 if test -n "$MOZ_DEBUG"; then
7076     AC_DEFINE(MOZ_DUMP_PAINTING)
7079 dnl ========================================================
7080 dnl = Enable trace malloc
7081 dnl ========================================================
7082 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7083 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7084 [  --enable-trace-malloc   Enable malloc tracing; also disables jemalloc],
7085     NS_TRACE_MALLOC=1,
7086     NS_TRACE_MALLOC= )
7087 if test "$NS_TRACE_MALLOC"; then
7088   # Please, Mr. Linker Man, don't take away our symbol names
7089   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7090   USE_ELF_DYNSTR_GC=
7091   AC_DEFINE(NS_TRACE_MALLOC)
7093 AC_SUBST(NS_TRACE_MALLOC)
7095 dnl ========================================================
7096 dnl = Enable jemalloc
7097 dnl ========================================================
7098 MOZ_ARG_ENABLE_BOOL(jemalloc,
7099 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7100     MOZ_MEMORY=1,
7101     MOZ_MEMORY=)
7103 if test "$NS_TRACE_MALLOC"; then
7104     MOZ_MEMORY=
7106 if test "$MOZ_DMD"; then
7107     MOZ_MEMORY=
7110 if test "${OS_TARGET}" = "Android"; then
7111   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7112   :
7113 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7114   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7115   if test -z "$GNU_CC"; then
7116     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7117   else
7118     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7119   fi
7120 else
7121   dnl On other Unix systems, we only want to link executables against mozglue
7122   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib) $(MKSHLIB_UNFORCE_ALL)'
7123   if test -n "$GNU_CC"; then
7124     dnl And we need mozglue symbols to be exported.
7125     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7126   fi
7127   if test "$MOZ_LINKER" = 1; then
7128     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
7129   fi
7132 if test -z "$MOZ_MEMORY"; then
7133   case "${target}" in
7134     *-mingw*)
7135       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7136         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.])
7137       fi
7138       ;;
7139   esac
7140 else
7141   dnl Don't try to run compiler tests on Windows
7142   if test "$OS_ARCH" = "WINNT"; then
7143     if test -z "$HAVE_64BIT_OS"; then
7144       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7145     else
7146       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7147     fi
7148   else
7149     AC_CHECK_SIZEOF([int *], [4])
7150     case "${ac_cv_sizeof_int_p}" in
7151     4)
7152       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7153       ;;
7154     8)
7155       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7156       ;;
7157     *)
7158       AC_MSG_ERROR([Unexpected pointer size])
7159       ;;
7160     esac
7161   fi
7163   AC_DEFINE(MOZ_MEMORY)
7164   if test "x$MOZ_DEBUG" = "x1"; then
7165     AC_DEFINE(MOZ_MEMORY_DEBUG)
7166   fi
7167   dnl The generic feature tests that determine how to compute ncpus are long and
7168   dnl complicated.  Therefore, simply define special cpp variables for the
7169   dnl platforms we have special knowledge of.
7170   case "${target}" in
7171   *-darwin*)
7172     AC_DEFINE(MOZ_MEMORY_DARWIN)
7173     ;;
7174   *-*freebsd*)
7175     AC_DEFINE(MOZ_MEMORY_BSD)
7176     ;;
7177   *-android*|*-linuxandroid*)
7178     AC_DEFINE(MOZ_MEMORY_LINUX)
7179     AC_DEFINE(MOZ_MEMORY_ANDROID)
7180     _WRAP_MALLOC=1
7181     MOZ_GLUE_LDFLAGS=
7182     ;;
7183   *-*linux*)
7184     AC_DEFINE(MOZ_MEMORY_LINUX)
7185     ;;
7186   *-netbsd*)
7187     AC_DEFINE(MOZ_MEMORY_BSD)
7188     ;;
7189   *-solaris*)
7190     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7191     ;;
7192   *-mingw*)
7193     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7194     if test -z "$MOZ_DEBUG"; then
7195       WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7196     else
7197       WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7198     fi
7199     dnl Look for a broken crtdll.obj
7200     WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7201     lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7202     if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7203       MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7204       dnl Also pass this to NSPR/NSS
7205       DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7206     else
7207       DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7208     fi
7209     rm crtdll.obj
7211     export DLLFLAGS
7212     ;;
7213   *)
7214     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7215     ;;
7216   esac
7217 fi # MOZ_MEMORY
7218 AC_SUBST(MOZ_MEMORY)
7219 AC_SUBST(MOZ_GLUE_LDFLAGS)
7220 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7221 AC_SUBST(WIN32_CRT_LIBS)
7222 dnl Need to set this for make because NSS doesn't have configure
7223 AC_SUBST(DLLFLAGS)
7225 dnl We need to wrap dlopen and related functions on Android because we use
7226 dnl our own linker.
7227 if test "$OS_TARGET" = Android; then
7228     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7229     if test -n "$MOZ_OLD_LINKER"; then
7230         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7231     fi
7232     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7233     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7236 dnl ========================================================
7237 dnl = Use malloc wrapper lib
7238 dnl ========================================================
7239 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7240 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7241     _WRAP_MALLOC=1,
7242     _WRAP_MALLOC= )
7244 if test -n "$_WRAP_MALLOC"; then
7245     if test -n "$GNU_CC"; then
7246         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7247         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7248         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7249         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7250     else
7251         AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7252     fi
7255 dnl ========================================================
7256 dnl = Location of malloc wrapper lib
7257 dnl ========================================================
7258 MOZ_ARG_WITH_STRING(wrap-malloc,
7259 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7260     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7262 dnl ========================================================
7263 dnl = Use JS Call tracing
7264 dnl ========================================================
7265 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7266 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7267     MOZ_TRACE_JSCALLS=1,
7268     MOZ_TRACE_JSCALLS= )
7269 if test -n "$MOZ_TRACE_JSCALLS"; then
7270     AC_DEFINE(MOZ_TRACE_JSCALLS)
7273 dnl ========================================================
7274 dnl = Use incremental GC
7275 dnl ========================================================
7276 JSGC_INCREMENTAL=1
7277 MOZ_ARG_DISABLE_BOOL(gcincremental,
7278 [  --disable-gcincremental Disable incremental GC],
7279     JSGC_INCREMENTAL= )
7280 if test -n "$JSGC_INCREMENTAL"; then
7281     AC_DEFINE(JSGC_INCREMENTAL)
7284 dnl ========================================================
7285 dnl ETW - Event Tracing for Windows
7286 dnl ========================================================
7287 MOZ_ARG_ENABLE_BOOL(ETW,
7288 [  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting],
7289     MOZ_ETW=1,
7290     MOZ_ETW= )
7291 if test -n "$MOZ_ETW"; then
7292     AC_DEFINE(MOZ_ETW)
7295 if test -n "$MOZ_ETW"; then
7296     if test -z "$MOZ_WINSDK_TARGETVER"; then
7297         AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7298     fi
7301 dnl ========================================================
7302 dnl Zealous JavaScript GC
7303 dnl ========================================================
7304 MOZ_ARG_ENABLE_BOOL(gczeal,
7305 [  --enable-gczeal         Enable zealous JavaScript GCing],
7306     JS_GC_ZEAL=1,
7307     JS_GC_ZEAL= )
7308 if test -n "$JS_GC_ZEAL"; then
7309     AC_DEFINE(JS_GC_ZEAL)
7312 dnl ========================================================
7313 dnl JS opt-mode assertions and minidump instrumentation
7314 dnl ========================================================
7315 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7316 [  --enable-js-diagnostics
7317                           Enable JS diagnostic assertions and breakpad data],
7318     JS_CRASH_DIAGNOSTICS=1,
7319     JS_CRASH_DIAGNOSTICS= )
7320 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7321     AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7324 dnl ======================================================
7325 dnl = Enable compiling with ccache
7326 dnl ======================================================
7327 MOZ_ARG_WITH_STRING(ccache,
7328 [  --with-ccache[=path/to/ccache]
7329                           Enable compiling with ccache],
7330     CCACHE=$withval, CCACHE="no")
7332 if test "$CCACHE" != "no"; then
7333     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7334         CCACHE=
7335     else
7336         if test ! -e "$CCACHE"; then
7337             AC_MSG_ERROR([$CCACHE not found])
7338         fi
7339     fi
7340     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7341     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7342         AC_MSG_ERROR([ccache not found])
7343     elif test -x "$CCACHE"; then
7344         CC="$CCACHE $CC"
7345         CXX="$CCACHE $CXX"
7346     else
7347         AC_MSG_ERROR([$CCACHE is not executable])
7348     fi
7351 dnl ========================================================
7352 dnl = Enable static checking using gcc-dehydra
7353 dnl ========================================================
7355 MOZ_ARG_WITH_STRING(static-checking,
7356 [  --with-static-checking=path/to/gcc_dehydra.so
7357                           Enable static checking of code using GCC-dehydra],
7358     DEHYDRA_PATH=$withval,
7359     DEHYDRA_PATH= )
7361 if test -n "$DEHYDRA_PATH"; then
7362     if test ! -f "$DEHYDRA_PATH"; then
7363         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7364     fi
7365     AC_DEFINE(NS_STATIC_CHECKING)
7367 AC_SUBST(DEHYDRA_PATH)
7369 dnl ========================================================
7370 dnl = Enable stripping of libs & executables
7371 dnl ========================================================
7372 MOZ_ARG_ENABLE_BOOL(strip,
7373 [  --enable-strip          Enable stripping of libs & executables ],
7374     ENABLE_STRIP=1,
7375     ENABLE_STRIP= )
7377 dnl ========================================================
7378 dnl = Enable stripping of libs & executables when packaging
7379 dnl ========================================================
7380 MOZ_ARG_ENABLE_BOOL(install-strip,
7381 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7382     PKG_SKIP_STRIP= ,
7383     PKG_SKIP_STRIP=1)
7385 dnl ========================================================
7386 dnl = --enable-elf-dynstr-gc
7387 dnl ========================================================
7388 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7389 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7390     USE_ELF_DYNSTR_GC=1,
7391     USE_ELF_DYNSTR_GC= )
7393 dnl ========================================================
7394 dnl = --disable-elf-hack
7395 dnl ========================================================
7397 USE_ELF_HACK=1
7398 MOZ_ARG_DISABLE_BOOL(elf-hack,
7399 [  --disable-elf-hack      Disable elf hacks],
7400     USE_ELF_HACK=,
7401     USE_ELF_HACK=1)
7403 # Only enable elfhack where supported
7404 if test "$USE_ELF_HACK" = 1; then
7405     case "${HOST_OS_ARCH},${OS_ARCH}" in
7406     Linux,Linux)
7407         case "${CPU_ARCH}" in
7408         arm | x86 | x86_64)
7409             USE_ELF_HACK=1
7410             ;;
7411         *)
7412             USE_ELF_HACK=
7413             ;;
7414         esac
7415         ;;
7416     *)
7417         USE_ELF_HACK=
7418         ;;
7419     esac
7422 if test "$USE_ELF_HACK" = 1; then
7423     dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7424     dnl memory addresses it maps to. The result is that by the time elfhack
7425     dnl kicks in, it is not possible to apply relocations because of that,
7426     dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7427     dnl segment. It makes elfhack mostly useless, so considering the problems
7428     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7429     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7430     dnl the linker creates PT_GNU_RELRO segments.
7431     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7432         LINK_WITH_PT_GNU_RELRO,
7433         [echo "int main() {return 0;}" > conftest.${ac_ext}
7434          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7435             test -s conftest${ac_exeext}; then
7436             if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7437                 LINK_WITH_PT_GNU_RELRO=yes
7438             else
7439                 LINK_WITH_PT_GNU_RELRO=no
7440             fi
7441          else
7442              dnl We really don't expect to get here, but just in case
7443              AC_ERROR([couldn't compile a simple C file])
7444          fi
7445          rm -rf conftest*])
7446     if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7447         AC_MSG_WARN([Disabling elfhack])
7448         USE_ELF_HACK=
7449     fi
7452 dnl ========================================================
7453 dnl = libstdc++ compatibility hacks
7454 dnl ========================================================
7456 STDCXX_COMPAT=
7457 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7458 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
7459     STDCXX_COMPAT=stdc++compat.cpp)
7461 AC_SUBST(STDCXX_COMPAT)
7463 if test -n "$STDCXX_COMPAT"; then
7464    eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7465    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7466    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7469 dnl ========================================================
7470 dnl =
7471 dnl = Profiling and Instrumenting
7472 dnl =
7473 dnl ========================================================
7474 MOZ_ARG_HEADER(Profiling and Instrumenting)
7476 dnl ========================================================
7477 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7478 dnl = timing for identifying code bottlenecks
7479 dnl = NS_FUNCTION_TIMER is off by default.
7480 dnl ========================================================
7481 MOZ_ARG_ENABLE_BOOL(functiontimer,
7482 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7483     NS_FUNCTION_TIMER=1,
7484     NS_FUNCTION_TIMER= )
7485 if test -n "$NS_FUNCTION_TIMER"; then
7486     AC_DEFINE(NS_FUNCTION_TIMER)
7489 dnl ========================================================
7490 dnl Turn on reflow counting
7491 dnl ========================================================
7492 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7493 [  --enable-reflow-perf    Enable reflow performance tracing],
7494     MOZ_REFLOW_PERF=1,
7495     MOZ_REFLOW_PERF= )
7496 if test -n "$MOZ_REFLOW_PERF"; then
7497     AC_DEFINE(MOZ_REFLOW_PERF)
7500 dnl ========================================================
7501 dnl Enable code size metrics.
7502 dnl ========================================================
7503 MOZ_ARG_ENABLE_BOOL(codesighs,
7504 [  --enable-codesighs      Enable code size analysis tools],
7505     _ENABLE_CODESIGHS=1,
7506     _ENABLE_CODESIGHS= )
7507 if test -n "$_ENABLE_CODESIGHS"; then
7508     if test -d $srcdir/tools/codesighs; then
7509         MOZ_MAPINFO=1
7510     else
7511         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7512     fi
7515 dnl ========================================================
7516 dnl = Support for Quantify (Windows)
7517 dnl ========================================================
7518 MOZ_ARG_ENABLE_BOOL(quantify,
7519 [  --enable-quantify       Enable Quantify support (Windows only) ],
7520     MOZ_QUANTIFY=1,
7521     MOZ_QUANTIFY= )
7523 dnl ========================================================
7524 dnl = Enable Radio Interface for B2G (Gonk usually)
7525 dnl ========================================================
7526 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7527 [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7528     MOZ_B2G_RIL=1,
7529     MOZ_B2G_RIL= )
7530 if test -n "$MOZ_B2G_RIL"; then
7531    AC_DEFINE(MOZ_B2G_RIL)
7533 AC_SUBST(MOZ_B2G_RIL)
7535 dnl ========================================================
7536 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7537 dnl ========================================================
7538 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7539 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
7540     MOZ_B2G_BT=1,
7541     MOZ_B2G_BT= )
7542 if test -n "$MOZ_B2G_BT"; then
7543    AC_DEFINE(MOZ_B2G_BT)
7545 AC_SUBST(MOZ_B2G_BT)
7547 dnl ========================================================
7548 dnl = Support for demangling undefined symbols
7549 dnl ========================================================
7550 if test -z "$SKIP_LIBRARY_CHECKS"; then
7551     AC_LANG_SAVE
7552     AC_LANG_CPLUSPLUS
7553     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7554     AC_LANG_RESTORE
7557 # Demangle only for debug or trace-malloc builds
7558 MOZ_DEMANGLE_SYMBOLS=
7559 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7560     MOZ_DEMANGLE_SYMBOLS=1
7561     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7563 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7565 dnl ========================================================
7566 dnl = Support for gcc stack unwinding (from gcc 3.3)
7567 dnl ========================================================
7568 if test -z "$SKIP_LIBRARY_CHECKS"; then
7569     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7572 dnl ========================================================
7573 dnl JIT observers
7574 dnl ========================================================
7576 MOZ_ARG_WITH_STRING(jitreport-granularity,
7577 [  --jitreport-granularity=N
7578                            Default granularity at which to report JIT code
7579                            to external tools
7580                              0 - no info
7581                              1 - code ranges for whole functions only
7582                              2 - per-line information
7583                              3 - per-op information],
7584   JITREPORT_GRANULARITY=$withval,
7585   JITREPORT_GRANULARITY=3)
7587 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7589 dnl ========================================================
7590 dnl =
7591 dnl = Misc. Options
7592 dnl =
7593 dnl ========================================================
7594 MOZ_ARG_HEADER(Misc. Options)
7596 dnl ========================================================
7597 dnl update xterm title
7598 dnl ========================================================
7599 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7600 [  --enable-xterm-updates  Update XTERM titles with current command.],
7601     MOZ_UPDATE_XTERM=1,
7602     MOZ_UPDATE_XTERM= )
7604 dnl =========================================================
7605 dnl = Chrome format
7606 dnl =========================================================
7607 MOZ_ARG_ENABLE_STRING([chrome-format],
7608 [  --enable-chrome-format=jar|flat|both|symlink|omni
7609                           Select FORMAT of chrome files (default=jar)],
7610     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7612 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7613     MOZ_CHROME_FILE_FORMAT=jar
7616 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7617     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7618     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7619     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7620     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7621     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7624 dnl =========================================================
7625 dnl Omnijar packaging (bug 552121)
7626 dnl =========================================================
7627 dnl Omnijar packaging is compatible with flat packaging.
7628 dnl In unpackaged builds, omnijar looks for files as if
7629 dnl things were flat packaged. After packaging, all files
7630 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7631 dnl is set to flat since putting files into jars is only
7632 dnl done during packaging with omnijar.
7633 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7634     MOZ_OMNIJAR=1
7635     AC_DEFINE(MOZ_OMNIJAR)
7636     if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7637         MOZ_CHROME_FILE_FORMAT=flat
7638     else
7639         MOZ_CHROME_FILE_FORMAT=symlink
7640     fi
7641 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7642     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7645 OMNIJAR_NAME=omni.ja
7646 AC_SUBST(OMNIJAR_NAME)
7647 AC_SUBST(MOZ_OMNIJAR)
7649 dnl ========================================================
7650 dnl = Define default location for MOZILLA_FIVE_HOME
7651 dnl ========================================================
7652 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7653 [  --with-default-mozilla-five-home
7654                           Set the default value for MOZILLA_FIVE_HOME],
7655 [ val=`echo $withval`
7656   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7658 dnl ========================================================
7659 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7660 dnl ========================================================
7661 MOZ_ARG_WITH_STRING(user-appdir,
7662 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7663 [ val=`echo $withval`
7664 if echo "$val" | grep "\/" >/dev/null; then
7665     AC_MSG_ERROR("Homedir must be single relative path.")
7666 else
7667     MOZ_USER_DIR="$val"
7668 fi])
7670 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7672 dnl ========================================================
7673 dnl = Doxygen configuration
7674 dnl ========================================================
7675 dnl Use commas to specify multiple dirs to this arg
7676 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7677 MOZ_ARG_WITH_STRING(doc-input-dirs,
7678 [  --with-doc-input-dirs=DIRS
7679                           Header/idl dirs to create docs from],
7680 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7681 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7683 dnl Use commas to specify multiple dirs to this arg
7684 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7685 MOZ_ARG_WITH_STRING(doc-include-dirs,
7686 [  --with-doc-include-dirs=DIRS
7687                           Include dirs to preprocess doc headers],
7688 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7689 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7691 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7692 MOZ_ARG_WITH_STRING(doc-output-dir,
7693 [  --with-doc-output-dir=DIR
7694                           Dir to generate docs into],
7695 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7696 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7698 if test -z "$SKIP_COMPILER_CHECKS"; then
7699 dnl ========================================================
7700 dnl =
7701 dnl = Compiler Options
7702 dnl =
7703 dnl ========================================================
7704 MOZ_ARG_HEADER(Compiler Options)
7706 dnl ========================================================
7707 dnl Check for gcc -pipe support
7708 dnl ========================================================
7709 AC_MSG_CHECKING([for -pipe support])
7710 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7711     dnl Any gcc that supports firefox supports -pipe.
7712     CFLAGS="$CFLAGS -pipe"
7713     CXXFLAGS="$CXXFLAGS -pipe"
7714     AC_MSG_RESULT([yes])
7715 else
7716     AC_MSG_RESULT([no])
7719 dnl ========================================================
7720 dnl Profile guided optimization (gcc checks)
7721 dnl ========================================================
7722 dnl Test for profiling options
7723 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7725 _SAVE_CFLAGS="$CFLAGS"
7726 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7728 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7729 AC_TRY_COMPILE([], [return 0;],
7730                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7731                  result="yes" ], result="no")
7732 AC_MSG_RESULT([$result])
7734 if test $result = "yes"; then
7735   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7736   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7737   PROFILE_USE_LDFLAGS="-fprofile-use"
7740 CFLAGS="$_SAVE_CFLAGS"
7742 if test -n "$INTEL_CC"; then
7743   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7744   PROFILE_GEN_LDFLAGS=
7745   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7746   PROFILE_USE_LDFLAGS=
7749 dnl Sun Studio on Solaris
7750 if test "$SOLARIS_SUNPRO_CC"; then
7751   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7752   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7753   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7754   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7757 AC_SUBST(PROFILE_GEN_CFLAGS)
7758 AC_SUBST(PROFILE_GEN_LDFLAGS)
7759 AC_SUBST(PROFILE_USE_CFLAGS)
7760 AC_SUBST(PROFILE_USE_LDFLAGS)
7762 AC_LANG_CPLUSPLUS
7764 dnl ========================================================
7765 dnl Test for -pedantic bustage
7766 dnl ========================================================
7767 MOZ_ARG_DISABLE_BOOL(pedantic,
7768 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7769 _PEDANTIC= )
7770 if test "$_PEDANTIC"; then
7771     _SAVE_CXXFLAGS=$CXXFLAGS
7772     CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7773     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7774     AC_TRY_COMPILE([$configure_static_assert_macros],
7775                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7776                    result="no", result="yes" )
7777     AC_MSG_RESULT([$result])
7778     CXXFLAGS="$_SAVE_CXXFLAGS"
7780     case "$result" in
7781     no)
7782         _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7783         _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7784         ;;
7785     yes)
7786         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7787         ;;
7788     esac
7791 dnl ========================================================
7792 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7793 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7794 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7795 dnl ========================================================
7796 _SAVE_CXXFLAGS=$CXXFLAGS
7797 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7798 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7799     ac_nscap_nonconst_opeq_bug,
7800     [AC_TRY_COMPILE([
7801                       template <class T>
7802                       class Pointer
7803                         {
7804                         public:
7805                           T* myPtr;
7806                         };
7808                       template <class T, class U>
7809                       int operator==(const Pointer<T>& rhs, U* lhs)
7810                         {
7811                           return rhs.myPtr == lhs;
7812                         }
7814                       template <class T, class U>
7815                       int operator==(const Pointer<T>& rhs, const U* lhs)
7816                         {
7817                           return rhs.myPtr == lhs;
7818                         }
7819                     ],
7820                     [
7821                       Pointer<int> foo;
7822                       const int* bar;
7823                       return foo == bar;
7824                     ],
7825                     ac_nscap_nonconst_opeq_bug="no",
7826                     ac_nscap_nonconst_opeq_bug="yes")])
7827 CXXFLAGS="$_SAVE_CXXFLAGS"
7829 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7830     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7832 fi # ! SKIP_COMPILER_CHECKS
7834 AC_DEFINE(CPP_THROW_NEW, [throw()])
7835 AC_LANG_C
7837 MOZ_EXPAND_LIBS
7839 dnl ========================================================
7840 dnl =
7841 dnl = Build depencency options
7842 dnl =
7843 dnl ========================================================
7844 MOZ_ARG_HEADER(Build dependencies)
7846 dnl ========================================================
7847 dnl = Do not auto generate dependency info
7848 dnl ========================================================
7849 MOZ_AUTO_DEPS=1
7850 MOZ_ARG_DISABLE_BOOL(auto-deps,
7851 [  --disable-auto-deps     Do not automatically generate dependency info],
7852     MOZ_AUTO_DEPS=,
7853     MOZ_AUTO_DEPS=1)
7855 if test -n "$MOZ_AUTO_DEPS"; then
7856 dnl ========================================================
7857 dnl = Use mkdepend instead of $CC -MD for dependency generation
7858 dnl ========================================================
7859 _cpp_md_flag=
7860 MOZ_ARG_DISABLE_BOOL(md,
7861 [  --disable-md            Do not use compiler-based dependencies ],
7862   [_cpp_md_flag=],
7863   [_cpp_md_flag=1],
7864   [dnl Default is to turn on -MD if using GNU-compatible compilers
7865    if test "$GNU_CC" -a "$GNU_CXX"; then
7866      _cpp_md_flag=1
7867    fi
7868   dnl Default is to use -xM if using Sun Studio on Solaris
7869    if test "$SOLARIS_SUNPRO_CC"; then
7870      _cpp_md_flag=1
7871    fi])
7872 if test "$_cpp_md_flag"; then
7873   COMPILER_DEPEND=1
7874   _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
7875   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7876   if test "$SOLARIS_SUNPRO_CC"; then
7877     _DEPEND_CFLAGS=
7878   fi
7879 else
7880   COMPILER_DEPEND=
7881   dnl Don't override this for MSVC
7882   if test -z "$_WIN32_MSVC"; then
7883     _USE_CPP_INCLUDE_FLAG=
7884     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7885     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7886   else
7887     echo '#include <stdio.h>' > dummy-hello.c
7888     changequote(,)
7889     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7890     changequote([,])
7891     if test -z "$CL_INCLUDES_PREFIX"; then
7892         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7893     fi
7894     AC_SUBST(CL_INCLUDES_PREFIX)
7895     rm -f dummy-hello.c
7896     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
7897     dnl cl.py provides dependency generation for MSVC
7898     CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
7899     CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
7900     COMPILER_DEPEND=1
7901   fi
7903 fi # MOZ_AUTO_DEPS
7904 MDDEPDIR='.deps'
7905 AC_SUBST(MOZ_AUTO_DEPS)
7906 AC_SUBST(COMPILER_DEPEND)
7907 AC_SUBST(MDDEPDIR)
7908 AC_SUBST(CC_WRAPPER)
7909 AC_SUBST(CXX_WRAPPER)
7912 dnl ========================================================
7913 dnl =
7914 dnl = Static Build Options
7915 dnl =
7916 dnl ========================================================
7917 MOZ_ARG_HEADER(Static build options)
7919 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7920 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7921   ENABLE_SHARED_JS=1
7924 MOZ_ARG_ENABLE_BOOL(shared-js,
7925 [  --enable-shared-js
7926                           Create a shared JavaScript library.],
7927     ENABLE_SHARED_JS=1,
7928     ENABLE_SHARED_JS=)
7930 if test -n "$ENABLE_SHARED_JS"; then
7931   JS_SHARED_LIBRARY=1
7932   MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7933 else
7934   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7935   AC_DEFINE(MOZ_STATIC_JS)
7937 AC_SUBST(JS_SHARED_LIBRARY)
7939 AC_SUBST(LIBXUL_LIBS)
7940 XPCOM_LIBS="$LIBXUL_LIBS"
7942 dnl ========================================================
7943 dnl =
7944 dnl = Standalone module options
7945 dnl =
7946 dnl ========================================================
7947 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7949 dnl Check for GLib.
7950 dnl ========================================================
7952 if test -z "$SKIP_PATH_CHECKS"; then
7953 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7954     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7955         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7956     else
7957         AM_PATH_GLIB(${GLIB_VERSION})
7958     fi
7962 if test -z "${GLIB_GMODULE_LIBS}" \
7963    -a -n "${GLIB_CONFIG}"\
7964     -a "${GLIB_CONFIG}" != no\
7965 ; then
7966     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7969 AC_SUBST(GLIB_CFLAGS)
7970 AC_SUBST(GLIB_LIBS)
7971 AC_SUBST(GLIB_GMODULE_LIBS)
7973 dnl ========================================================
7974 dnl Graphics checks.
7975 dnl ========================================================
7977 if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
7978 MOZ_ENABLE_SKIA=1
7979 else
7980 MOZ_ENABLE_SKIA=
7983 MOZ_ARG_ENABLE_BOOL(skia,
7984 [  --enable-skia   Enable use of Skia],
7985 MOZ_ENABLE_SKIA=1,
7986 MOZ_ENABLE_SKIA=)
7988 dnl ========================================================
7989 dnl Check for cairo
7990 dnl ========================================================
7991 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7993 MOZ_TREE_CAIRO=1
7994 MOZ_ARG_ENABLE_BOOL(system-cairo,
7995 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
7996 MOZ_TREE_CAIRO=,
7997 MOZ_TREE_CAIRO=1 )
7999 MOZ_TREE_PIXMAN=1
8000 MOZ_ARG_ENABLE_BOOL(system-pixman,
8001 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8002 MOZ_TREE_PIXMAN=,
8003 MOZ_TREE_PIXMAN=1 )
8005 # Check for headers defining standard int types.
8006 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8008 if test "$MOZ_TREE_CAIRO"; then
8009     AC_DEFINE(MOZ_TREE_CAIRO)
8011     # For now we assume that we will have a uint64_t available through
8012     # one of the above headers or mozstdint.h.
8013     AC_DEFINE(HAVE_UINT64_T)
8015     # Define macros for cairo-features.h
8016     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8017     if test "$MOZ_X11"; then
8018         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8019         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8020         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8021         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8022         MOZ_ENABLE_CAIRO_FT=1
8023         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8024     fi
8025     case "$MOZ_WIDGET_TOOLKIT" in
8026       qt)
8027         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8028         ;;
8029       cocoa | uikit)
8030         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8031         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8032         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8033         ;;
8034       windows)
8035         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8036         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8037         if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8038             WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8039             WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8040             MOZ_ENABLE_D2D_SURFACE=1
8041             MOZ_ENABLE_DWRITE_FONT=1
8042         else
8043             WIN32_DWRITE_FONT_FEATURE=
8044             WIN32_D2D_SURFACE_FEATURE=
8045         fi
8047         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8049         dnl D3D10 Layers depend on D2D Surfaces.
8050         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8051           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8052         fi
8053         ;;
8054       os2)
8055         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8056         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8057         MOZ_ENABLE_CAIRO_FT=1
8058         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8059         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8060         ;;
8061     esac
8062     if test "$USE_FC_FREETYPE"; then
8063         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8064     fi
8065     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8066     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8067     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8068     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8069     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8070     AC_SUBST(CAIRO_FT_CFLAGS)
8072     AC_SUBST(PS_SURFACE_FEATURE)
8073     AC_SUBST(PDF_SURFACE_FEATURE)
8074     AC_SUBST(SVG_SURFACE_FEATURE)
8075     AC_SUBST(XLIB_SURFACE_FEATURE)
8076     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8077     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8078     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8079     AC_SUBST(WIN32_SURFACE_FEATURE)
8080     AC_SUBST(OS2_SURFACE_FEATURE)
8081     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8082     AC_SUBST(FT_FONT_FEATURE)
8083     AC_SUBST(FC_FONT_FEATURE)
8084     AC_SUBST(WIN32_FONT_FEATURE)
8085     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8086     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8087     AC_SUBST(QUARTZ_FONT_FEATURE)
8088     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8089     AC_SUBST(QT_SURFACE_FEATURE)
8090     AC_SUBST(TEE_SURFACE_FEATURE)
8092     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8094     if test "$MOZ_TREE_PIXMAN"; then
8095         AC_DEFINE(MOZ_TREE_PIXMAN)
8096         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8097     else
8098         PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8099         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8100         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8101     fi
8103     if test "$MOZ_X11"; then
8104         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8105     fi
8107     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8108     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8110 else
8111    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8112    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8113    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8114    PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8115    if test "$MOZ_X11"; then
8116         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8117         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8118         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8119    fi
8122 AC_SUBST(MOZ_TREE_CAIRO)
8123 AC_SUBST(MOZ_CAIRO_CFLAGS)
8124 AC_SUBST(MOZ_CAIRO_LIBS)
8125 AC_SUBST(MOZ_TREE_PIXMAN)
8127 dnl ========================================================
8128 dnl qcms
8129 dnl ========================================================
8131 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8132 AC_SUBST(QCMS_LIBS)
8134 dnl ========================================================
8135 dnl HarfBuzz
8136 dnl ========================================================
8137 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8138 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8140 dnl ========================================================
8141 dnl SIL Graphite
8142 dnl ========================================================
8143 if test "$MOZ_GRAPHITE"; then
8144   MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8145   AC_DEFINE(MOZ_GRAPHITE)
8146 else
8147   MOZ_GRAPHITE_LIBS=
8149 AC_SUBST(MOZ_GRAPHITE)
8150 AC_SUBST(MOZ_GRAPHITE_LIBS)
8152 dnl ========================================================
8153 dnl OTS
8154 dnl ========================================================
8155 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8156 AC_SUBST(MOZ_OTS_LIBS)
8158 dnl ========================================================
8159 dnl Skia 
8160 dnl ========================================================
8161 if test "$MOZ_ENABLE_SKIA"; then
8162   MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8163   AC_DEFINE(MOZ_ENABLE_SKIA)
8164 else
8165   MOZ_SKIA_LIBS=
8167 AC_SUBST(MOZ_ENABLE_SKIA)
8168 AC_SUBST(MOZ_SKIA_LIBS)
8170 dnl ========================================================
8171 dnl disable xul
8172 dnl ========================================================
8173 MOZ_ARG_DISABLE_BOOL(xul,
8174 [  --disable-xul           Disable XUL],
8175     MOZ_XUL= )
8176 if test "$MOZ_XUL"; then
8177   AC_DEFINE(MOZ_XUL)
8178 else
8179   dnl remove extensions that require XUL
8180   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8183 AC_SUBST(MOZ_XUL)
8185 dnl ========================================================
8186 dnl disable profile locking
8187 dnl   do no use this in applications that can have more than
8188 dnl   one process accessing the profile directory.
8189 dnl ========================================================
8190 MOZ_ARG_DISABLE_BOOL(profilelocking,
8191 [  --disable-profilelocking
8192                           Disable profile locking],
8193     MOZ_PROFILELOCKING=,
8194     MOZ_PROFILELOCKING=1 )
8195 if test "$MOZ_PROFILELOCKING"; then
8196   AC_DEFINE(MOZ_PROFILELOCKING)
8199 dnl ========================================================
8200 dnl necko configuration options
8201 dnl ========================================================
8204 dnl option to disable various necko protocols
8206 MOZ_ARG_ENABLE_STRING(necko-protocols,
8207 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8208                           Enable/disable specific protocol handlers],
8209 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8210     if test "$option" = "yes" -o "$option" = "all"; then
8211         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8212     elif test "$option" = "no" -o "$option" = "none"; then
8213         NECKO_PROTOCOLS=""
8214     elif test "$option" = "default"; then
8215         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8216     elif test `echo "$option" | grep -c \^-` != 0; then
8217         option=`echo $option | sed 's/^-//'`
8218         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8219     else
8220         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8221     fi
8222 done],
8223     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8224 dnl Remove dupes
8225 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8226 AC_SUBST(NECKO_PROTOCOLS)
8227 for p in $NECKO_PROTOCOLS; do
8228     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8229 done
8232 dnl option to disable necko's wifi scanner
8234 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8235 [  --disable-necko-wifi    Disable necko wifi scanner],
8236     NECKO_WIFI=,
8237     NECKO_WIFI=1)
8239 if test "$OS_ARCH" = "OS2"; then
8240   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8241   NECKO_WIFI=
8243 if test "$NECKO_WIFI" -a \
8244         "$OS_ARCH" != "Linux" -a \
8245         "$OS_ARCH" != "Darwin" -a \
8246         "$OS_ARCH" != "SunOS" -a \
8247         "$OS_ARCH" != "WINNT"; then
8248   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8251 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8252 then
8253   MOZ_CHECK_HEADER([iwlib.h])
8254   if test "$ac_cv_header_iwlib_h" != "yes"; then
8255     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])
8256   fi
8259 if test "$NECKO_WIFI"; then
8260   AC_DEFINE(NECKO_WIFI)
8262 AC_SUBST(NECKO_WIFI)
8265 dnl option to disable cookies
8267 MOZ_ARG_DISABLE_BOOL(cookies,
8268 [  --disable-cookies       Disable cookie support],
8269     NECKO_COOKIES=,
8270     NECKO_COOKIES=1)
8271 AC_SUBST(NECKO_COOKIES)
8272 if test "$NECKO_COOKIES"; then
8273     AC_DEFINE(NECKO_COOKIES)
8277 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8279 MOZ_ARG_DISABLE_BOOL(ctypes,
8280 [  --disable-ctypes        Disable js-ctypes],
8281     BUILD_CTYPES=,
8282     BUILD_CTYPES=1)
8283 AC_SUBST(BUILD_CTYPES)
8284 if test "$BUILD_CTYPES"; then
8285     AC_DEFINE(BUILD_CTYPES)
8288 dnl NECKO_ configuration options are not global
8289 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8291 dnl Build Places if required
8292 if test "$MOZ_PLACES"; then
8293   AC_DEFINE(MOZ_PLACES)
8296 dnl Build Sync Services if required
8297 AC_SUBST(MOZ_SERVICES_SYNC)
8298 if test -n "$MOZ_SERVICES_SYNC"; then
8299   AC_DEFINE(MOZ_SERVICES_SYNC)
8302 dnl ========================================================
8303 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8304     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8307 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8308   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8311 if test "$MOZ_APP_COMPONENT_MODULES"; then
8312   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8315 dnl ========================================================
8316 dnl =
8317 dnl = Maintainer debug option (no --enable equivalent)
8318 dnl =
8319 dnl ========================================================
8321 AC_SUBST(AR)
8322 AC_SUBST(AR_FLAGS)
8323 AC_SUBST(AR_LIST)
8324 AC_SUBST(AR_EXTRACT)
8325 AC_SUBST(AR_DELETE)
8326 AC_SUBST(AS)
8327 AC_SUBST(ASFLAGS)
8328 AC_SUBST(AS_DASH_C_FLAG)
8329 AC_SUBST(LD)
8330 AC_SUBST(RC)
8331 AC_SUBST(RCFLAGS)
8332 AC_SUBST(MC)
8333 AC_SUBST(WINDRES)
8334 AC_SUBST(IMPLIB)
8335 AC_SUBST(FILTER)
8336 AC_SUBST(BIN_FLAGS)
8337 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8338 AC_SUBST(MOZ_UPDATE_XTERM)
8339 AC_SUBST(MOZ_PLATFORM_MAEMO)
8340 AC_SUBST(MOZ_AUTH_EXTENSION)
8341 AC_SUBST(MOZ_PERMISSIONS)
8342 AC_SUBST(MOZ_XTF)
8343 AC_SUBST(MOZ_PREF_EXTENSIONS)
8344 AC_SUBST(MOZ_JS_LIBS)
8345 AC_SUBST(MOZ_PSM)
8346 AC_SUBST(MOZ_DEBUG)
8347 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8348 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8349 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8350 AC_SUBST(MOZ_DEBUG_FLAGS)
8351 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8352 AC_SUBST(WARNINGS_AS_ERRORS)
8353 AC_SUBST(MOZ_EXTENSIONS)
8354 AC_SUBST(MOZ_JSDEBUGGER)
8355 AC_SUBST(MOZ_LOG_REFCNT)
8356 AC_SUBST(MOZ_LEAKY)
8357 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8358 AC_SUBST(MOZ_JPROF)
8359 AC_SUBST(MOZ_SHARK)
8360 AC_SUBST(MOZ_CALLGRIND)
8361 AC_SUBST(MOZ_VTUNE)
8362 AC_SUBST(MOZ_ETW)
8363 AC_SUBST(MOZ_PROFILING)
8364 AC_SUBST(MOZ_QUANTIFY)
8365 AC_SUBST(LIBICONV)
8366 AC_SUBST(MOZ_PLACES)
8367 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8368 AC_SUBST(MOZ_FEEDS)
8369 AC_SUBST(NS_PRINTING)
8370 AC_SUBST(MOZ_WEBGL)
8371 AC_SUBST(MOZ_HELP_VIEWER)
8373 AC_SUBST(JAVA)
8374 AC_SUBST(JAVAC)
8375 AC_SUBST(JAR)
8377 AC_SUBST(MOZ_PROFILELOCKING)
8379 AC_SUBST(ENABLE_TESTS)
8380 AC_SUBST(ENABLE_MARIONETTE)
8381 AC_SUBST(IBMBIDI)
8382 AC_SUBST(MOZ_UNIVERSALCHARDET)
8383 AC_SUBST(ACCESSIBILITY)
8384 AC_SUBST(MOZ_SPELLCHECK)
8385 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8386 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8387 AC_SUBST(MOZ_USER_DIR)
8388 AC_SUBST(MOZ_CRASHREPORTER)
8389 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8390 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8391 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8392 AC_SUBST(MOZ_UPDATER)
8393 AC_SUBST(MOZ_ANGLE)
8394 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8395 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8396 AC_SUBST(MOZ_D3DX9_VERSION)
8397 AC_SUBST(MOZ_D3DX9_CAB)
8398 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8399 AC_SUBST(MOZ_D3DX9_DLL)
8400 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8402 AC_SUBST(MOZ_ANDROID_HISTORY)
8403 AC_SUBST(MOZ_WEBSMS_BACKEND)
8404 AC_SUBST(ENABLE_STRIP)
8405 AC_SUBST(PKG_SKIP_STRIP)
8406 AC_SUBST(STRIP_FLAGS)
8407 AC_SUBST(USE_ELF_DYNSTR_GC)
8408 AC_SUBST(USE_ELF_HACK)
8409 AC_SUBST(INCREMENTAL_LINKER)
8410 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8411 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8413 AC_SUBST(MOZ_FIX_LINK_PATHS)
8414 AC_SUBST(XPCOM_LIBS)
8415 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8416 AC_SUBST(XPCOM_GLUE_LDOPTS)
8417 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8419 AC_SUBST(USE_DEPENDENT_LIBS)
8421 AC_SUBST(MOZ_BUILD_ROOT)
8422 AC_SUBST(MOZ_OS2_TOOLS)
8424 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8425 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8427 dnl ========================================================
8428 dnl = Mac bundle name prefix
8429 dnl ========================================================
8430 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8431 [  --with-macbundlename-prefix=prefix
8432                           Prefix for MOZ_MACBUNDLE_NAME],
8433 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8435 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8436 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8437   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8440 if test "$MOZ_DEBUG"; then
8441   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8442 else
8443   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8445 AC_SUBST(MOZ_MACBUNDLE_NAME)
8447 # The following variables are available to branding and application
8448 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8449 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8450 # impacts profile location and user-visible fields.
8451 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8452 # versions of a given application (e.g. Aurora and Firefox both use
8453 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8454 # for application.ini's "Name" field, which controls profile location in
8455 # the absence of a "Profile" field (see below), and various system
8456 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8457 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8458 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8459 # builds (e.g. Aurora for Firefox).
8460 # - MOZ_APP_VERSION: Defines the application version number.
8461 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8462 # defaults to a lowercase form of MOZ_APP_BASENAME.
8463 # - MOZ_APP_PROFILE: When set, used for application.ini's
8464 # "Profile" field, which controls profile location.
8465 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8466 # crash reporter server url.
8467 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8468 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8470 if test -z "$MOZ_APP_NAME"; then
8471    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8474 AC_SUBST(MOZ_APP_NAME)
8475 AC_SUBST(MOZ_APP_DISPLAYNAME)
8476 AC_SUBST(MOZ_APP_BASENAME)
8477 AC_SUBST(MOZ_APP_VENDOR)
8478 AC_SUBST(MOZ_APP_PROFILE)
8479 AC_SUBST(MOZ_APP_ID)
8480 AC_SUBST(MAR_CHANNEL_ID)
8481 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8482 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8483 AC_SUBST(MOZ_EXTENSION_MANAGER)
8484 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8485 AC_SUBST(MOZ_APP_UA_NAME)
8486 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8487 AC_SUBST(MOZ_APP_VERSION)
8488 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
8489 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8490 AC_SUBST(FIREFOX_VERSION)
8491 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8492 AC_SUBST(MOZ_UA_BUILDID)
8494 # We can't use the static application.ini data when building against
8495 # a libxul SDK.
8496 if test -n "$LIBXUL_SDK"; then
8497     MOZ_APP_STATIC_INI=
8499 AC_SUBST(MOZ_APP_STATIC_INI)
8501 AC_SUBST(MOZ_PKG_SPECIAL)
8503 AC_SUBST(MOZILLA_OFFICIAL)
8505 if test "$MOZ_TELEMETRY_REPORTING"; then
8506     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8509 dnl win32 options
8510 AC_SUBST(MOZ_MAPINFO)
8511 AC_SUBST(MOZ_BROWSE_INFO)
8512 AC_SUBST(MOZ_TOOLS_DIR)
8513 AC_SUBST(WIN32_REDIST_DIR)
8514 AC_SUBST(PYTHON)
8515 AC_SUBST(MAKENSISU)
8517 dnl Echo the CFLAGS to remove extra whitespace.
8518 CFLAGS=`echo \
8519         $_WARNINGS_CFLAGS \
8520         $CFLAGS`
8522 CXXFLAGS=`echo \
8523         $_MOZ_RTTI_FLAGS \
8524         $_WARNINGS_CXXFLAGS \
8525         $CXXFLAGS`
8527 COMPILE_CFLAGS=`echo \
8528     $_DEFINES_CFLAGS \
8529         $_DEPEND_CFLAGS \
8530     $COMPILE_CFLAGS`
8532 COMPILE_CXXFLAGS=`echo \
8533     $_DEFINES_CXXFLAGS \
8534         $_DEPEND_CFLAGS \
8535     $COMPILE_CXXFLAGS`
8537 AC_SUBST(SYSTEM_MAKEDEPEND)
8538 AC_SUBST(SYSTEM_LIBXUL)
8539 AC_SUBST(SYSTEM_JPEG)
8540 AC_SUBST(SYSTEM_PNG)
8541 AC_SUBST(SYSTEM_ZLIB)
8542 AC_SUBST(SYSTEM_BZ2)
8544 AC_SUBST(JPEG_CFLAGS)
8545 AC_SUBST(JPEG_LIBS)
8546 AC_SUBST(ZLIB_CFLAGS)
8547 AC_SUBST(ZLIB_LIBS)
8548 AC_SUBST(BZ2_CFLAGS)
8549 AC_SUBST(BZ2_LIBS)
8550 AC_SUBST(PNG_CFLAGS)
8551 AC_SUBST(PNG_LIBS)
8553 AC_SUBST(MOZ_FLEXBOX)
8554 AC_SUBST(MOZ_JPEG_CFLAGS)
8555 AC_SUBST(MOZ_JPEG_LIBS)
8556 AC_SUBST(MOZ_ZLIB_CFLAGS)
8557 AC_SUBST(MOZ_ZLIB_LIBS)
8558 AC_SUBST(MOZ_BZ2_CFLAGS)
8559 AC_SUBST(MOZ_BZ2_LIBS)
8560 AC_SUBST(MOZ_PNG_CFLAGS)
8561 AC_SUBST(MOZ_PNG_LIBS)
8563 AC_SUBST(NSPR_CFLAGS)
8564 AC_SUBST(NSPR_LIBS)
8565 AC_SUBST(MOZ_NATIVE_NSPR)
8567 AC_SUBST(NSS_CFLAGS)
8568 AC_SUBST(NSS_LIBS)
8569 AC_SUBST(NSS_DEP_LIBS)
8570 AC_SUBST(MOZ_NATIVE_NSS)
8571 AC_SUBST(NSS_DISABLE_DBM)
8573 AC_SUBST(CFLAGS)
8574 AC_SUBST(CXXFLAGS)
8575 AC_SUBST(CPPFLAGS)
8576 AC_SUBST(COMPILE_CFLAGS)
8577 AC_SUBST(COMPILE_CXXFLAGS)
8578 AC_SUBST(LDFLAGS)
8579 AC_SUBST(LIBS)
8580 AC_SUBST(CROSS_COMPILE)
8581 AC_SUBST(WCHAR_CFLAGS)
8583 AC_SUBST(HOST_CC)
8584 AC_SUBST(HOST_CXX)
8585 AC_SUBST(HOST_CFLAGS)
8586 AC_SUBST(HOST_CXXFLAGS)
8587 AC_SUBST(HOST_LDFLAGS)
8588 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8589 AC_SUBST(HOST_AR)
8590 AC_SUBST(HOST_AR_FLAGS)
8591 AC_SUBST(HOST_LD)
8592 AC_SUBST(HOST_RANLIB)
8593 AC_SUBST(HOST_NSPR_MDCPUCFG)
8594 AC_SUBST(HOST_BIN_SUFFIX)
8595 AC_SUBST(HOST_OS_ARCH)
8597 AC_SUBST(TARGET_CPU)
8598 AC_SUBST(TARGET_VENDOR)
8599 AC_SUBST(TARGET_OS)
8600 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8601 AC_SUBST(TARGET_MD_ARCH)
8602 AC_SUBST(TARGET_XPCOM_ABI)
8603 AC_SUBST(OS_TARGET)
8604 AC_SUBST(OS_ARCH)
8605 AC_SUBST(OS_RELEASE)
8606 AC_SUBST(OS_TEST)
8607 AC_SUBST(CPU_ARCH)
8608 AC_SUBST(INTEL_ARCHITECTURE)
8610 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8611 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8613 AC_SUBST(WRAP_LDFLAGS)
8614 AC_SUBST(MKSHLIB)
8615 AC_SUBST(MKCSHLIB)
8616 AC_SUBST(MKSHLIB_FORCE_ALL)
8617 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8618 AC_SUBST(DSO_CFLAGS)
8619 AC_SUBST(DSO_PIC_CFLAGS)
8620 AC_SUBST(DSO_LDOPTS)
8621 AC_SUBST(LIB_PREFIX)
8622 AC_SUBST(DLL_PREFIX)
8623 AC_SUBST(DLL_SUFFIX)
8624 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8625 AC_SUBST(LIB_SUFFIX)
8626 AC_SUBST(OBJ_SUFFIX)
8627 AC_SUBST(BIN_SUFFIX)
8628 AC_SUBST(ASM_SUFFIX)
8629 AC_SUBST(IMPORT_LIB_SUFFIX)
8630 AC_SUBST(USE_N32)
8631 AC_SUBST(CC_VERSION)
8632 AC_SUBST(CXX_VERSION)
8633 AC_SUBST(MSMANIFEST_TOOL)
8634 AC_SUBST(NS_ENABLE_TSF)
8635 AC_SUBST(MOZ_NSS_PATCH)
8636 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8637 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8639 AC_SUBST(MOZ_MEDIA)
8640 AC_SUBST(MOZ_SYDNEYAUDIO)
8641 AC_SUBST(MOZ_CUBEB)
8642 AC_SUBST(MOZ_WAVE)
8643 AC_SUBST(MOZ_VORBIS)
8644 AC_SUBST(MOZ_TREMOR)
8645 AC_SUBST(MOZ_WEBM)
8646 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8647 AC_SUBST(MOZ_VP8_ENCODER)
8648 AC_SUBST(MOZ_OGG)
8649 AC_SUBST(MOZ_ALSA_LIBS)
8650 AC_SUBST(VPX_AS)
8651 AC_SUBST(VPX_ASFLAGS)
8652 AC_SUBST(VPX_DASH_C_FLAG)
8653 AC_SUBST(VPX_AS_CONVERSION)
8654 AC_SUBST(VPX_ASM_SUFFIX)
8655 AC_SUBST(VPX_X86_ASM)
8656 AC_SUBST(VPX_ARM_ASM)
8657 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8658 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8659 AC_SUBST(LIBJPEG_TURBO_AS)
8660 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8661 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8662 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8663 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8665 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8667 AC_MSG_CHECKING([for posix_fallocate])
8668 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8669   #include <fcntl.h>],
8670                  [posix_fallocate(0, 0, 0);],
8671                  [ac_cv___posix_fallocate=true],
8672                  [ac_cv___posix_fallocate=false])
8674 if test "$ac_cv___posix_fallocate" = true ; then
8675   AC_DEFINE(HAVE_POSIX_FALLOCATE)
8676   AC_MSG_RESULT(yes)
8677 else
8678   AC_MSG_RESULT(no)
8681 dnl Check for missing components
8682 if test "$COMPILE_ENVIRONMENT"; then
8683 if test "$MOZ_X11"; then
8684     if test "$WITHOUT_X11"; then
8685         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8686     fi
8687     dnl ====================================================
8688     dnl = Check if X headers exist
8689     dnl ====================================================
8690     _SAVE_CFLAGS=$CFLAGS
8691     CFLAGS="$CFLAGS $XCFLAGS"
8692     AC_TRY_COMPILE([
8693         #include <stdio.h>
8694         #include <stdlib.h>
8695         #include <X11/Xlib.h>
8696         #include <X11/Intrinsic.h>
8697         #include <X11/extensions/XShm.h>
8698     ],
8699     [
8700         Display *dpy = 0;
8701         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8702             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8703             exit(1);
8704         }
8705     ], [],
8706     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8707     CFLAGS="$_SAVE_CFLAGS"
8709     if test -n "$MISSING_X"; then
8710         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8711     fi
8713 fi # MOZ_X11
8715 dnl Check for headers, etc. needed by WebGL.
8716 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8717     MOZ_CHECK_HEADER(GL/glx.h)
8718     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8719         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))])
8720     fi
8721 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8722 fi # COMPILE_ENVIRONMENT
8724 if test "$USE_FC_FREETYPE"; then
8725     if test "$COMPILE_ENVIRONMENT"; then
8726         _SAVE_CPPFLAGS="$CPPFLAGS"
8727         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8728         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8729             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8730         CPPFLAGS="$_SAVE_CPPFLAGS"
8731     else
8732         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8733     fi
8736 dnl Set various defines and substitutions
8737 dnl ========================================================
8739 if test "$OS_ARCH" = "Darwin"; then
8740   AC_DEFINE(XP_UNIX)
8741   AC_DEFINE(UNIX_ASYNC_DNS)
8742 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8743   AC_DEFINE(XP_UNIX)
8744   AC_DEFINE(UNIX_ASYNC_DNS)
8747 if test "$MOZ_DEBUG"; then
8748     AC_DEFINE(MOZ_REFLOW_PERF)
8749     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8752 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8753     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8754     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8755     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8756     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8757     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8758     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8759     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8760     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8763 case "$host_os" in
8764 mingw*)
8765     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8766     ;;
8767 esac
8769 AC_SUBST(WIN_TOP_SRC)
8771 AC_SUBST(MOZILLA_VERSION)
8773 AC_SUBST(ac_configure_args)
8775 dnl Spit out some output
8776 dnl ========================================================
8778 dnl The following defines are used by xpcom
8779 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8780 CPP_THROW_NEW
8781 HAVE_CPP_2BYTE_WCHAR_T
8782 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8783 HAVE_CPP_CHAR16_T
8784 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8785 HAVE_CPP_PARTIAL_SPECIALIZATION
8786 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8787 HAVE_STATVFS
8788 NEED_CPP_UNUSED_IMPLEMENTATIONS
8789 NEW_H
8790 HAVE_GETPAGESIZE
8791 HAVE_ICONV
8792 HAVE_ICONV_WITH_CONST_INPUT
8793 HAVE_MBRTOWC
8794 HAVE_SYS_MOUNT_H
8795 HAVE_SYS_VFS_H
8796 HAVE_WCRTOMB
8799 AC_CONFIG_HEADER(
8800 netwerk/necko-config.h
8801 xpcom/xpcom-config.h
8802 xpcom/xpcom-private.h
8805 # Hack around an Apple bug that effects the egrep that comes with OS X 10.7.
8806 # "arch -arch i386 egrep" always uses the 32-bit Intel part of the egrep fat
8807 # binary, even on 64-bit systems.  It should work on OS X 10.4.5 and up.  We
8808 # (apparently) only need this hack when egrep's "pattern" is particularly
8809 # long (as in the following code).  See bug 655339.
8810 case "$host" in
8811 *-apple-darwin*)
8812     FIXED_EGREP="arch -arch i386 egrep"
8813     ;;
8815     FIXED_EGREP="egrep"
8816     ;;
8817 esac
8819 # Save the defines header file before autoconf removes it.
8820 # (Do not add AC_DEFINE calls after this line.)
8821   _CONFIG_TMP=confdefs-tmp.h
8822   _CONFIG_DEFS_H=mozilla-config.h
8824   cat > $_CONFIG_TMP <<\EOF
8825 /* List of defines generated by configure. Included with preprocessor flag,
8826  * -include, to avoid long list of -D defines on the compile command-line.
8827  * Do not edit.
8828  */
8830 #ifndef _MOZILLA_CONFIG_H_
8831 #define _MOZILLA_CONFIG_H_
8834 _EGREP_PATTERN='^#define ('
8835 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8836     for f in $_NON_GLOBAL_ACDEFINES; do
8837         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8838     done
8840 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8842   sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8844   if test "$?" != 0; then
8845     AC_MSG_ERROR([Error outputting config definitions])
8846   fi
8848   cat >> $_CONFIG_TMP <<\EOF
8850 /* The c99 defining the limit macros (UINT32_MAX for example), says:
8851  * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
8852  * is defined before <stdint.h> is included. */
8853 #define __STDC_LIMIT_MACROS
8855 /* Force-include hunspell_alloc_hooks.h for hunspell, so that we don't need to
8856  * modify it directly.
8858  * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/Makefile.in,
8859  * unless --enable-system-hunspell is defined.
8860  */
8861 #if defined(HUNSPELL_STATIC)
8862 #include "hunspell_alloc_hooks.h"
8863 #endif
8865 #endif /* _MOZILLA_CONFIG_H_ */
8869   # Only write mozilla-config.h when something changes (or it doesn't exist)
8870   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8871     rm $_CONFIG_TMP
8872   else
8873     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8874     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8876     echo ==== $_CONFIG_DEFS_H =================================
8877     cat $_CONFIG_DEFS_H
8878   fi
8880 dnl Probably shouldn't call this manually but we always want the output of DEFS
8881 rm -f confdefs.h.save
8882 mv confdefs.h confdefs.h.save
8883 $FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8884 if test "$?" != 0; then
8885   AC_MSG_ERROR([Error outputting confdefs.h])
8887 AC_OUTPUT_MAKE_DEFS()
8888 MOZ_DEFINES=$DEFS
8889 AC_SUBST(MOZ_DEFINES)
8890 rm -f confdefs.h
8891 mv confdefs.h.save confdefs.h
8893 dnl Load the list of Makefiles to generate.
8894 dnl   To add new Makefiles, edit allmakefiles.sh.
8895 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8896 . ${srcdir}/allmakefiles.sh
8898 dnl Run a perl script to quickly create the makefiles.
8899 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8900 dnl   for the files it cannot handle correctly. This way, config.status
8901 dnl   will handle these files.
8902 dnl If it fails, nothing is set and config.status will run as usual.
8904 dnl This does not change the $MAKEFILES variable.
8906 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8907 . ./conftest.sh
8908 rm conftest.sh
8910 echo $MAKEFILES > unallmakefiles
8912 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8914 AC_OUTPUT($MAKEFILES)
8916 # Generate a JSON config file for unittest harnesses etc to read
8917 # build configuration details from in a standardized way.
8918 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
8919 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8920   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8921 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8922   rm ./mozinfo.json.tmp
8923 else
8924   mv -f ./mozinfo.json.tmp ./mozinfo.json
8927 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8928 if test "$CAIRO_FEATURES_H"; then
8929   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8930     echo "$CAIRO_FEATURES_H is unchanged"
8931     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8932   else
8933     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8934   fi
8937 dnl Build libunwind for Android profiling builds
8938 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
8939   old_ac_configure_arg="$ac_configure_args"
8940   ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
8941   if test "$MOZ_DEBUG"; then
8942     ac_configure_args="$ac_configure_args --enable-debug"
8943   fi
8944   if test "$DSO_PIC_CFLAGS"; then
8945     ac_configure_args="$ac_configure_args --with-pic"
8946   fi
8947   ac_configure_args="$ac_configure_args \
8948       CC=\"$CC\" \
8949       CXX=\"$CXX\" \
8950       CPP=\"$CPP\" \
8951       CFLAGS=\"$CFLAGS\" \
8952       CXXFLAGS=\"$CXXFLAGS\" \
8953       CPPFLAGS=\"$CPPFLAGS\" \
8954       LD=\"$LD\" \
8955       LDFLAGS=\"$LDFLAGS\" \
8956       AR=\"$AR\" \
8957       RANLIB=\"$RANLIB\" \
8958       STRIP=\"$STRIP\" \
8959       LIBS=\"$LIBS\""
8961   # Use a separate cache file for libunwind, since it does not use caching.
8962   mkdir -p $_objdir/tools/profiler/libunwind/src
8963   old_cache_file=$cache_file
8964   cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
8965   old_config_files=$CONFIG_FILES
8966   unset CONFIG_FILES
8967   AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
8968   cache_file=$old_cache_file
8969   ac_configure_args="$old_ac_configure_args"
8970   CONFIG_FILES=$old_config_files
8973 # Run freetype configure script
8975 if test "$MOZ_TREE_FREETYPE"; then
8976    export CFLAGS="$CFLAGS -std=c99"
8977    export CPPFLAGS="$CPPFLAGS"
8978    export CXXFLAGS="$CXXFLAGS"
8979    export LDFLAGS="$LDFLAGS"
8980    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
8981    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
8982    AC_OUTPUT_SUBDIRS(modules/freetype2)
8985 if test -z "$direct_nspr_config"; then
8986     dnl ========================================================
8987     dnl = Setup a nice relatively clean build environment for
8988     dnl = sub-configures.
8989     dnl ========================================================
8990     CC="$_SUBDIR_CC"
8991     CXX="$_SUBDIR_CXX"
8992     CFLAGS="$_SUBDIR_CFLAGS"
8993     CPPFLAGS="$_SUBDIR_CPPFLAGS"
8994     CXXFLAGS="$_SUBDIR_CXXFLAGS"
8995     LDFLAGS="$_SUBDIR_LDFLAGS"
8996     HOST_CC="$_SUBDIR_HOST_CC"
8997     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8998     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8999     RC=
9002 unset MAKEFILES
9003 unset CONFIG_FILES
9005 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9006 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9008 export WRAP_LDFLAGS
9010 if test -n "$_WRAP_MALLOC"; then
9011     # Avoid doubling wrap malloc arguments
9012     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9015 if test -z "$MOZ_NATIVE_NSPR"; then
9016     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9017     if test -z "$MOZ_DEBUG"; then
9018         ac_configure_args="$ac_configure_args --disable-debug"
9019     else
9020         ac_configure_args="$ac_configure_args --enable-debug"
9021     fi
9022     if test "$MOZ_OPTIMIZE" = "1"; then
9023         ac_configure_args="$ac_configure_args --enable-optimize"
9024     elif test -z "$MOZ_OPTIMIZE"; then
9025         ac_configure_args="$ac_configure_args --disable-optimize"
9026     fi
9027     if test -n "$HAVE_64BIT_OS"; then
9028         ac_configure_args="$ac_configure_args --enable-64bit"
9029     fi
9030     if test -n "$USE_ARM_KUSER"; then
9031         ac_configure_args="$ac_configure_args --with-arm-kuser"
9032     fi
9033     ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9034     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9035       # dladdr is supported by the new linker, even when the system linker doesn't
9036       # support it. Trick nspr into using dladdr when it's not supported.
9037       _SAVE_CPPFLAGS="$CPPFLAGS"
9038       export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9039     fi
9040     _SAVE_LDFLAGS="$LDFLAGS"
9041     export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9042     AC_OUTPUT_SUBDIRS(nsprpub)
9043     LDFLAGS="$_SAVE_LDFLAGS"
9044     if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9045       unset CPPFLAGS
9046       CPPFLAGS="$_SAVE_CFLAGS"
9047     fi
9048     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9051 if test -z "$MOZ_NATIVE_NSPR"; then
9052     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9053     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9054     if test "$OS_ARCH" != "WINNT"; then
9055        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9056        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9057        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9058        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9059     fi
9060     rm -f config/autoconf.mk.bak
9063 dnl ========================================================
9064 dnl = Setup a nice relatively clean build environment for
9065 dnl = sub-configures.
9066 dnl ========================================================
9067 CC="$_SUBDIR_CC"
9068 CXX="$_SUBDIR_CXX"
9069 CFLAGS="$_SUBDIR_CFLAGS"
9070 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9071 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9072 LDFLAGS="$_SUBDIR_LDFLAGS"
9073 HOST_CC="$_SUBDIR_HOST_CC"
9074 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9075 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9078 # Run the SpiderMonkey 'configure' script.
9079 dist=$MOZ_BUILD_ROOT/dist
9080 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9081 ac_configure_args="$ac_configure_args --enable-threadsafe"
9082 if test "$BUILD_CTYPES"; then
9083     # Build js-ctypes on the platforms we can.
9084     ac_configure_args="$ac_configure_args --enable-ctypes"
9086 if test -z "$JS_SHARED_LIBRARY" ; then
9087     ac_configure_args="$ac_configure_args --disable-shared-js"
9089 if test -z "$MOZ_NATIVE_NSPR"; then
9090     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9091     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9093 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9094 ac_configure_args="$ac_configure_args --prefix=$dist"
9095 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9096 if test "$MOZ_MEMORY"; then
9097    ac_configure_args="$ac_configure_args --enable-jemalloc"
9099 if test -n "$MOZ_GLUE_LDFLAGS"; then
9100    export MOZ_GLUE_LDFLAGS
9102 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9103    export MOZ_GLUE_PROGRAM_LDFLAGS
9105 export MOZ_APP_NAME
9106 export STLPORT_CPPFLAGS
9107 export STLPORT_LDFLAGS
9108 export STLPORT_LIBS
9109 AC_OUTPUT_SUBDIRS(js/src)
9110 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9112 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9114 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9115 dnl Needs to be at the end to respect possible changes from NSPR configure
9116 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9117   echo "config/autoconf.mk is unchanged"
9118   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9119 else
9120   rm -f config/autoconf.mk.orig 2> /dev/null