Bug 620376 - follow up to fix the test to correctly report when timeout function...
[mozilla-central.git] / configure.in
blob726ba4e95f550976554876de7a99eb472bbcc8fd
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
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=10401
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 LIBIDL_VERSION=0.6.3
120 PERL_VERSION=5.006
121 PYTHON_VERSION=2.5
122 CAIRO_VERSION=1.10
123 PANGO_VERSION=1.14.0
124 GTK2_VERSION=2.10.0
125 WINDRES_VERSION=2.14.90
126 W32API_VERSION=3.8
127 GNOMEVFS_VERSION=2.0
128 GNOMEUI_VERSION=2.2.0
129 GCONF_VERSION=1.2.1
130 GIO_VERSION=2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
132 DBUS_VERSION=0.60
133 SQLITE_VERSION=3.7.3
134 LIBNOTIFY_VERSION=0.4
136 MSMANIFEST_TOOL=
138 dnl Set various checks
139 dnl ========================================================
140 MISSING_X=
141 AC_PROG_AWK
143 dnl Initialize the Pthread test variables early so they can be
144 dnl  overridden by each platform.
145 dnl ========================================================
146 USE_PTHREADS=
147 _PTHREAD_LDFLAGS=""
149 dnl Do not allow a separate objdir build if a srcdir build exists.
150 dnl ==============================================================
151 _topsrcdir=`cd \`dirname $0\`; pwd`
152 _objdir=`pwd`
154 if test "$_topsrcdir" != "$_objdir"
155 then
156   # Check for a couple representative files in the source tree
157   _conflict_files=
158   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
159     if test -f $file; then
160       _conflict_files="$_conflict_files $file"
161     fi
162   done
163   if test "$_conflict_files"; then
164     echo "***"
165     echo "*   Your source tree contains these files:"
166     for file in $_conflict_files; do
167       echo "*         $file"
168     done
169     cat 1>&2 <<-EOF
170         *   This indicates that you previously built in the source tree.
171         *   A source tree build can confuse the separate objdir build.
172         *
173         *   To clean up the source tree:
174         *     1. cd $_topsrcdir
175         *     2. gmake distclean
176         ***
177         EOF
178     exit 1
179     break
180   fi
182 MOZ_BUILD_ROOT=`pwd`
184 dnl Default to MSVC for win32 and gcc-4.2 for darwin
185 dnl ==============================================================
186 if test -z "$CROSS_COMPILE"; then
187 case "$target" in
188 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
189     if test -z "$CC"; then CC=cl; fi
190     if test -z "$CXX"; then CXX=cl; fi
191     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
192     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
193     if test -z "$LD"; then LD=link; fi
194     if test -z "$AS"; then
195         case "${target_cpu}" in
196         i*86)
197             AS=ml;
198             ;;
199         x86_64)
200             AS=ml64;
201             ;;
202         esac
203     fi
204     if test -z "$MIDL"; then MIDL=midl; fi
205     ;;
206 *-darwin*)
207     if test -z "$CC"; then CC=gcc-4.2; fi
208     if test -z "$CXX"; then CXX=g++-4.2; fi
209     ;;
210 esac
213 COMPILE_ENVIRONMENT=1
214 MOZ_ARG_DISABLE_BOOL(compile-environment,
215 [  --disable-compile-environment
216                           Disable compiler/library checks.],
217     COMPILE_ENVIRONMENT= )
218 AC_SUBST(COMPILE_ENVIRONMENT)
220 MOZ_ARG_WITH_STRING(l10n-base,
221 [  --with-l10n-base=DIR    path to l10n repositories],
222     L10NBASEDIR=$withval)
223 if test ! -z "$L10NBASEDIR"; then
224     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
225         AC_MSG_ERROR([--with-l10n-base must specify a path])
226     elif test -d "$L10NBASEDIR"; then
227         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
228     else
229         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
230     fi
232 AC_SUBST(L10NBASEDIR)
234 dnl Check for Perl first -- needed for win32 SDK checks
235 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
236 if test -z "$PERL" -o "$PERL" = ":"; then
237     AC_MSG_ERROR([perl not found in \$PATH])
240 dnl ========================================================
241 dnl = Android uses a very custom (hacky) toolchain; we need to do this
242 dnl = here, so that the compiler checks can succeed
243 dnl ========================================================
245 MOZ_ARG_WITH_STRING(android-ndk,
246 [  --with-android-ndk=DIR
247                           location where the Android NDK can be found],
248     android_ndk=$withval)
250 MOZ_ARG_WITH_STRING(android-toolchain,
251 [  --with-android-toolchain=DIR
252                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
253     android_toolchain=$withval)
256 MOZ_ARG_WITH_STRING(android-version,
257 [  --with-android-version=VER
258                           android platform version, default 5],
259     android_version=$withval,
260     android_version=5)
262 MOZ_ARG_WITH_STRING(android-sdk,
263 [  --with-android-sdk=DIR
264                           location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
265     android_sdk=$withval)
267 if test "$target" = "arm-android-eabi" ; then
268     if test -z "$android_ndk" ; then
269         AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
270     fi
272     if test -z "$android_sdk" ; then
273         AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
274     fi
276     android_platform_tools="$android_sdk"/../../platform-tools
277     if test ! -d "$android_platform_tools" ; then
278         android_platform_tools="$android_sdk"/tools # SDK Tools < r8
279     fi
281     if test -z "$android_toolchain" ; then
282         android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
283     fi
285     if test -z "$android_platform" ; then
286        android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
287     fi
289     dnl set up compilers
290     AS="$android_toolchain"/bin/arm-eabi-as
291     CC="$android_toolchain"/bin/arm-eabi-gcc
292     CXX="$android_toolchain"/bin/arm-eabi-g++
293     CPP="$android_toolchain"/bin/arm-eabi-cpp
294     LD="$android_toolchain"/bin/arm-eabi-ld
295     AR="$android_toolchain"/bin/arm-eabi-ar
296     RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
297     STRIP="$android_toolchain"/bin/arm-eabi-strip
299     CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
300     CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS"
301     CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CXXFLAGS"
303     dnl Add -llog by default, since we use it all over the place.
304     dnl Add --allow-shlib-undefined, because libGLESv2 links to an
305     dnl undefined symbol (present on the hardware, just not in the
306     dnl NDK.)
307     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
309     dnl prevent cross compile section from using these flags as host flags
310     if test -z "$HOST_CPPFLAGS" ; then
311         HOST_CPPFLAGS=" "
312     fi
313     if test -z "$HOST_CFLAGS" ; then
314         HOST_CFLAGS=" "
315     fi
316     if test -z "$HOST_CXXFLAGS" ; then
317         HOST_CXXFLAGS=" "
318     fi
319     if test -z "$HOST_LDFLAGS" ; then
320         HOST_LDFLAGS=" "
321     fi
323     ANDROID_NDK="${android_ndk}"
324     ANDROID_TOOLCHAIN="{android_toolchain}"
325     ANDROID_PLATFORM="{android_platform}"
326     ANDROID_SDK="${android_sdk}"
327     ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
328     ANDROID_VERSION="${android_version}"
329     if test -z "$ANDROID_PACKAGE_NAME" ; then
330         ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
331     fi
333     AC_DEFINE(ANDROID)
334     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
335     AC_SUBST(ANDROID_VERSION)
336     CROSS_COMPILE=1
337     MOZ_CHROME_FILE_FORMAT=omni
338     ZLIB_DIR=yes
341 AC_SUBST(ANDROID_NDK)
342 AC_SUBST(ANDROID_TOOLCHAIN)
343 AC_SUBST(ANDROID_PLATFORM)
344 AC_SUBST(ANDROID_SDK)
345 AC_SUBST(ANDROID_PLATFORM_TOOLS)
346 AC_SUBST(ANDROID_PACKAGE_NAME)
348 dnl ========================================================
349 dnl Checks for compilers.
350 dnl ========================================================
351 dnl Set CROSS_COMPILE in the environment when running configure
352 dnl to use the cross-compile setup for now
353 dnl ========================================================
355 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
356 AR_FLAGS='cr $@'
358 if test "$COMPILE_ENVIRONMENT"; then
360 dnl Do some special WinCE toolchain stuff
361 case "$target" in
362 *wince|*winmo)
364     MOZ_ARG_WITH_STRING(wince-sdk,
365     [  --with-wince-sdk=WINCE_SDK_DIR
366                           The path to the Windows CE SDK],
367     WINCE_SDK_DIR=$withval)
369     MOZ_ARG_WITH_STRING(ogles-sdk,
370     [  --with-ogles-sdk=OGLES_SDK_DIR
371                           The path to the OGLES SDK],
372     OGLES_SDK_DIR=$withval)
374     AC_DEFINE(WINCE)
375     
376     export WINCE=1
378     echo -----------------------------------------------------------------------------
379     echo Building Windows CE Shunt Library and Tool Chain
380     echo Using SDK in:
381     echo $WINCE_SDK_DIR
383     ac_exeext=.exe
385     _pwd=`pwd -W`
386     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
387     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
388     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
389     -C $srcdir/build/wince/tools
391     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
392     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
393     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
394     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
395     LD="$_pwd/dist/sdk/bin/$target-link.exe"
396     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
397     AS="$_pwd/dist/sdk/bin/$target-as.exe"
398     RC="$_pwd/dist/sdk/bin/$target-res.exe"
401     echo -----------------------------------------------------------------------------
403     ;;
404 esac
406 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
407     echo "cross compiling from $host to $target"
408     cross_compiling=yes
410     _SAVE_CC="$CC"
411     _SAVE_CFLAGS="$CFLAGS"
412     _SAVE_LDFLAGS="$LDFLAGS"
414     AC_MSG_CHECKING([for host c compiler])
415     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
416     if test -z "$HOST_CC"; then
417         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
418     fi
419     AC_MSG_RESULT([$HOST_CC])
420     AC_MSG_CHECKING([for host c++ compiler])
421     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
422     if test -z "$HOST_CXX"; then
423         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
424     fi
425     AC_MSG_RESULT([$HOST_CXX])
427     if test -z "$HOST_CFLAGS"; then
428         HOST_CFLAGS="$CFLAGS"
429     fi
430     if test -z "$HOST_CXXFLAGS"; then
431         HOST_CXXFLAGS="$CXXFLAGS"
432     fi
433     if test -z "$HOST_LDFLAGS"; then
434         HOST_LDFLAGS="$LDFLAGS"
435     fi
436     if test -z "$HOST_AR_FLAGS"; then
437         HOST_AR_FLAGS="$AR_FLAGS"
438     fi
439     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
440     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
441     CC="$HOST_CC"
442     CFLAGS="$HOST_CFLAGS"
443     LDFLAGS="$HOST_LDFLAGS"
445     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
446     AC_TRY_COMPILE([], [return(0);], 
447         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
448         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
450     CC="$HOST_CXX"
451     CFLAGS="$HOST_CXXFLAGS"
453     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
454     AC_TRY_COMPILE([], [return(0);], 
455         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
456         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
457     
458     CC=$_SAVE_CC
459     CFLAGS=$_SAVE_CFLAGS
460     LDFLAGS=$_SAVE_LDFLAGS
462     case "$build:$target" in
463       powerpc-apple-darwin8*:i?86-apple-darwin*)
464         dnl The Darwin cross compiler doesn't necessarily point itself at a
465         dnl root that has libraries for the proper architecture, it defaults
466         dnl to the system root.  The libraries in the system root on current
467         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
468         dnl checks will fail.  Fake a working SDK in that case.
469         _SAVE_CFLAGS=$CFLAGS
470         _SAVE_CXXFLAGS=$CXXLAGS
471         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
472         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
473         ;;
474     esac
476     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
477     unset ac_cv_prog_CC
478     AC_PROG_CC
479     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
480     unset ac_cv_prog_CXX
481     AC_PROG_CXX
483     case "$build:$target" in
484       powerpc-apple-darwin8*:i?86-apple-darwin*)
485         dnl Revert the changes made above.  From this point on, the target
486         dnl compiler will never be used without applying the SDK to CFLAGS
487         dnl (see --with-macos-sdk below).
488         CFLAGS=$_SAVE_CFLAGS
489         CXXFLAGS=$_SAVE_CXXFLAGS
490         ;;
491     esac
493     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
494     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
495     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
496     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
497     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
498     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
499     AC_DEFINE(CROSS_COMPILE)
500 else
501     AC_PROG_CC
502     AC_PROG_CXX
503     AC_PROG_RANLIB
504     MOZ_PATH_PROGS(AS, $AS as, $CC)
505     AC_CHECK_PROGS(AR, ar, :)
506     AC_CHECK_PROGS(LD, ld, :)
507     AC_CHECK_PROGS(STRIP, strip, :)
508     AC_CHECK_PROGS(WINDRES, windres, :)
509     if test -z "$HOST_CC"; then
510         HOST_CC='$(CC)'
511     fi
512     if test -z "$HOST_CFLAGS"; then
513         HOST_CFLAGS='$(CFLAGS)'
514     fi
515     if test -z "$HOST_CXX"; then
516         HOST_CXX='$(CXX)'
517     fi
518     if test -z "$HOST_CXXFLAGS"; then
519         HOST_CXXFLAGS='$(CXXFLAGS)'
520     fi
521     if test -z "$HOST_LDFLAGS"; then
522         HOST_LDFLAGS='$(LDFLAGS)'
523     fi
524     if test -z "$HOST_RANLIB"; then
525         HOST_RANLIB='$(RANLIB)'
526     fi
527     if test -z "$HOST_AR"; then
528         HOST_AR='$(AR)'
529     fi
530     if test -z "$HOST_AR_FLAGS"; then
531         HOST_AR_FLAGS='$(AR_FLAGS)'
532     fi
535 GNU_AS=
536 GNU_LD=
537 GNU_CC=
538 GNU_CXX=
539 CC_VERSION='N/A'
540 CXX_VERSION='N/A'
541 if test "$GCC" = "yes"; then
542     GNU_CC=1
543     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
545 if test "$GXX" = "yes"; then
546     GNU_CXX=1
547     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
549 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
550     GNU_AS=1
552 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
553     GNU_LD=1
555 if test "$GNU_CC"; then
556     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
557         GCC_USE_GNU_LD=1
558     fi
561 INTEL_CC=
562 INTEL_CXX=
563 if test "$GCC" = yes; then
564    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
565      INTEL_CC=1
566    fi
569 if test "$GXX" = yes; then
570    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
571      INTEL_CXX=1
572    fi
575 dnl Special win32 checks
576 dnl ========================================================
577 case "$target" in
578 *-wince|*-winmo)
579     WINVER=500
580     WINSDK_TARGETVER=502
581     ;;
583     WINVER=502
584     dnl Target the Windows 7 SDK by default
585     WINSDK_TARGETVER=601
586     ;;
587 esac
589 MOZ_ARG_WITH_STRING(windows-version,
590 [  --with-windows-version=WINSDK_TARGETVER
591                           Highest Windows version to target using this SDK
592                               502: Windows Server 2003
593                               600: Windows Vista
594                               601: Windows 7],
595   WINSDK_TARGETVER=$withval)
597 case "$WINSDK_TARGETVER" in
598 502|600|601)
599     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
600     ;;
603     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
604     ;;
606 esac
608 if test -n "$COMPILE_ENVIRONMENT"; then
609 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
610     # We can't build parental controls either
611     MOZ_DISABLE_PARENTAL_CONTROLS=1
615 case "$target" in
616 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
617     if test "$GCC" != "yes"; then
618         # Check to see if we are really running in a msvc environemnt
619         _WIN32_MSVC=1
620         AC_CHECK_PROGS(MIDL, midl)
622         # Make sure compilers are valid
623         CFLAGS="$CFLAGS -TC -nologo"
624         CXXFLAGS="$CXXFLAGS -TP -nologo"
625         AC_LANG_SAVE
626         AC_LANG_C
627         AC_TRY_COMPILE([#include <stdio.h>],
628             [ printf("Hello World\n"); ],,
629             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
631         AC_LANG_CPLUSPLUS
632         AC_TRY_COMPILE([#include <new.h>],
633             [ unsigned *test = new unsigned(42); ],,
634             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
635         AC_LANG_RESTORE
636         
637         changequote(,)
638         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
639         changequote([,])
640         
641         # Determine compiler version
642         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
643         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
644         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
645         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
646         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
647         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
649         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
650         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
652         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
653             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
654         fi
656         if test "$_CC_MAJOR_VERSION" = "14"; then
657             dnl Require VC8SP1 or newer.
658             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
659             if test "$_CC_RELEASE" -lt 50727 -o \
660                     \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
661               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.])
662             fi
664             _CC_SUITE=8
665             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
666             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
667             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
668         elif test "$_CC_MAJOR_VERSION" = "15"; then
669             _CC_SUITE=9
670             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
671             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
672             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
673         elif test "$_CC_MAJOR_VERSION" = "16"; then
674             _CC_SUITE=10
675             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
676             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
677             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
678         else
679             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
680         fi
682         _MOZ_RTTI_FLAGS_ON='-GR'
683         _MOZ_RTTI_FLAGS_OFF='-GR-'
684         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
685         _MOZ_EXCEPTIONS_FLAGS_OFF=''
687         if test -n "$WIN32_REDIST_DIR"; then
688             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
689         fi
691         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
692         dnl not something else like "magnetic tape manipulation utility".
693         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
694         if test -z "$MSMT_TOOL"; then
695           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
696         fi
698         changequote(,)
699         _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
700         changequote([,])
701         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
702         if test -z "$MSMANIFEST_TOOL_VERSION"; then
703           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
704         fi
706         MSMANIFEST_TOOL=1
707         unset MSMT_TOOL
709         # Check linker version
710         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
711         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
712         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
713             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
714         fi
716         INCREMENTAL_LINKER=1
718         # Check midl version
719         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
720         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
721         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
722         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
723         # Add flags if necessary
724         AC_MSG_CHECKING([for midl flags])
725         case "$target" in
726         i*86-*)
727             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
728                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
729                 # MIDL version 7.00.0500 or later has no problem.
730                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
731                 AC_MSG_RESULT([need -env win32])
732             else
733                 AC_MSG_RESULT([none needed])
734             fi
735             ;;
736         x86_64-*)
737             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
738             ;;
739         *)
740             AC_MSG_RESULT([none needed])
741             ;;
742         esac
744         # Identify which version of the SDK we're building with
745         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
746         # from there
747         AC_CHECK_HEADERS([winsdkver.h])
748         if test "$ac_cv_header_winsdkver_h" = "yes"; then
749             # Get the highest _WIN32_WINNT and NTDDI versions supported
750             # Take the higher of the two
751             # This is done because the Windows 7 beta SDK reports its
752             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
753             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
754                            ac_cv_winsdk_maxver,
755                            [cat > conftest.h <<EOF
756 #include <winsdkver.h>
757 #include <sdkddkver.h>
759 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
760 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
761 #else
762 #define WINSDK_MAXVER NTDDI_MAXVER
763 #endif
765 WINSDK_MAXVER
767                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
768                             rm -f conftest.h
769                            ])
770             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
771         else
772             # The Vista SDK is the only one to have sdkddkver.h but not
773             # WinSDKVer.h
774             AC_CHECK_HEADERS([sdkddkver.h])
775             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
776                 MOZ_WINSDK_MAXVER=0x06000000
777             else
778                 # Assume the Server 2003 Platform SDK
779                 MOZ_WINSDK_MAXVER=0x05020000
780             fi
781         fi
783         unset _MSVC_VER_FILTER
785         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
786             [
787                 AC_LANG_SAVE
788                 AC_LANG_CPLUSPLUS
789                 _SAVE_CXXFLAGS="$CXXFLAGS"
790                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
791                 AC_TRY_COMPILE([#include <exception>],
792                             [std::_Throw(std::exception()); return 0;],
793                             ac_cv_have_std__Throw="yes",
794                             ac_cv_have_std__Throw="no")
795                 CXXFLAGS="$_SAVE_CXXFLAGS"
796                 AC_LANG_RESTORE
797             ])
799         if test "$ac_cv_have_std__Throw" = "yes"; then
800             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
801                            ac_cv_have_dllimport_exception_bug,
802                 [
803                     AC_LANG_SAVE
804                     AC_LANG_CPLUSPLUS
805                     _SAVE_CXXFLAGS="$CXXFLAGS"
806                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
807                     AC_TRY_LINK([#include <vector>],
808                                 [std::vector<int> v; return v.at(1);],
809                                 ac_cv_have_dllimport_exception_bug="no",
810                                 ac_cv_have_dllimport_exception_bug="yes")
811                     CXXFLAGS="$_SAVE_CXXFLAGS"
812                     AC_LANG_RESTORE
813                 ])
814             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
815                 WRAP_STL_INCLUDES=1
816                 MOZ_MSVC_STL_WRAP__Throw=1
817                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
818             fi
819         else
820             AC_CACHE_CHECK(for overridable _RAISE,
821                            ac_cv_have__RAISE,
822                 [
823                     AC_LANG_SAVE
824                     AC_LANG_CPLUSPLUS
825                     _SAVE_CXXFLAGS="$CXXFLAGS"
826                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
827                     AC_TRY_COMPILE([#include <xstddef>
828                                     #undef _RAISE
829                                     #define _RAISE(x) externallyDefinedFunction((x).what())
830                                     #include <vector>
831                                    ],
832                                    [std::vector<int> v; return v.at(1);],
833                                    ac_cv_have__RAISE="no",
834                                    ac_cv_have__RAISE="yes")
835                     CXXFLAGS="$_SAVE_CXXFLAGS"
836                     AC_LANG_RESTORE
837                 ])
838             if test "$ac_cv_have__RAISE" = "yes"; then
839                 WRAP_STL_INCLUDES=1
840                 MOZ_MSVC_STL_WRAP__RAISE=1
841                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
842             else
843                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
844             fi
845         fi
847         if test "$WRAP_STL_INCLUDES" = "1"; then
848             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
849         fi
850     else
851         # Check w32api version
852         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
853         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
854         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
855         AC_TRY_COMPILE([#include <w32api.h>],
856             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
857                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
858                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
859                 #error "test failed."
860             #endif
861             , [ res=yes ], [ res=no ])
862         AC_MSG_RESULT([$res])
863         if test "$res" != "yes"; then
864             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
865         fi
866         # Check windres version
867         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
868         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
869         AC_MSG_RESULT([$_WINDRES_VERSION])
870         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
871         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
872         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
873         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
874         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
875         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
876         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
877                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
878                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
879                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
880                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
881                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
882         then
883             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
884         fi
886         # Server 2003 is the highest version supported
887         MOZ_WINSDK_MAXVER=0x05020000
888     fi # !GNU_CC
890     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
891     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
892     # Require OS features provided by IE 5.0
893     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
895     # If the maximum version supported by this SDK is lower than the target
896     # version, error out
897     AC_MSG_CHECKING([for Windows SDK being recent enough])
898     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
899         AC_MSG_RESULT("yes")
900     else
901         AC_MSG_RESULT("no")
902         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.])
903     fi
905     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
906     # Definitions matching sdkddkver.h
907     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
908     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
909     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
910     ;;
911 esac
913 dnl Test breaks icc on OS/2 && MSVC
914 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
915     AC_PROG_CC_C_O
916     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
917         USING_HCC=1
918         _OLDCC=$CC
919         _OLDCXX=$CXX
920         CC="${srcdir}/build/hcc '$CC'"
921         CXX="${srcdir}/build/hcpp '$CXX'"
922     fi
925 AC_PROG_CPP
926 AC_PROG_CXXCPP
928 if test -n "$_WIN32_MSVC"; then
929     SKIP_PATH_CHECKS=1
930     SKIP_COMPILER_CHECKS=1
931     SKIP_LIBRARY_CHECKS=1
933     # Since we're skipping compiler and library checks, hard-code
934     # some facts here.
935     case "$target" in
936     *-wince|*-winmo)
937         ;;
938     *)
939         AC_DEFINE(HAVE_IO_H)
940         AC_DEFINE(HAVE_SETBUF)
941         AC_DEFINE(HAVE_ISATTY)
942         ;;
943     esac
946 fi # COMPILE_ENVIRONMENT
948 AC_SUBST(MIDL_FLAGS)
949 AC_SUBST(_MSC_VER)
951 AC_SUBST(GNU_AS)
952 AC_SUBST(GNU_LD)
953 AC_SUBST(GNU_CC)
954 AC_SUBST(GNU_CXX)
955 AC_SUBST(INTEL_CC)
956 AC_SUBST(INTEL_CXX)
958 AC_SUBST(STL_FLAGS)
959 AC_SUBST(WRAP_STL_INCLUDES)
960 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
961 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
963 dnl ========================================================
964 dnl Checks for programs.
965 dnl ========================================================
966 AC_PROG_INSTALL
967 AC_PROG_LN_S
969 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
970 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
971 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
972 _perl_res=$?
973 AC_MSG_RESULT([$_perl_version])
975 if test "$_perl_res" != 0; then
976     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
980 AC_MSG_CHECKING([for full perl installation])
981 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
982 _perl_res=$?
983 if test "$_perl_res" != 0; then
984     AC_MSG_RESULT([no])
985     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
986 else
987     AC_MSG_RESULT([yes])    
990 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
991 if test -z "$PYTHON"; then
992     AC_MSG_ERROR([python was not found in \$PATH])
995 if test -z "$COMPILE_ENVIRONMENT"; then
996     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
998 AC_SUBST(NSINSTALL_BIN)
1000 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1001 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1002 MOZ_PATH_PROG(UNZIP, unzip, :)
1003 MOZ_PATH_PROGS(ZIP, zip)
1004 if test -z "$ZIP" -o "$ZIP" = ":"; then
1005     AC_MSG_ERROR([zip not found in \$PATH])
1007 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1008 MOZ_PATH_PROG(XARGS, xargs)
1009 if test -z "$XARGS" -o "$XARGS" = ":"; then
1010     AC_MSG_ERROR([xargs not found in \$PATH .])
1013 if test "$COMPILE_ENVIRONMENT"; then
1015 dnl ========================================================
1016 dnl = Mac OS X toolchain support
1017 dnl ========================================================
1019 case "$target_os" in
1020 darwin*)
1021     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1022     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1023     dnl the environment and includedir purposes (when using an SDK, below),
1024     dnl but remember the full version number for the libdir (SDK).
1025     changequote(,)
1026     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1027     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1028     changequote([,])
1029     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1030         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1031         dnl 4.0.0/4061 is the default compiler in Tiger.
1032         changequote(,)
1033         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1034         changequote([,])
1035         if test "$GCC_BUILD" = "4061" ; then
1036             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1037 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1038 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1039         fi
1040     fi
1042     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1043     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1044     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1045     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1047     case "$PBBUILD" in
1048       *xcodebuild*)
1049         changequote(,)
1050         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1051         changequote([,])
1052         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
1053           HAS_XCODE_2_1=1;
1054         fi
1055       ;;
1056     esac
1058     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1059     dnl it has moved into /usr/bin.
1060     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1061     ;;
1062 esac
1064 AC_SUBST(GCC_VERSION)
1065 AC_SUBST(XCODEBUILD_VERSION)
1066 AC_SUBST(HAS_XCODE_2_1)
1068 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1069 dnl that a universal binary is being produced.
1070 AC_SUBST(UNIVERSAL_BINARY)
1072 dnl ========================================================
1073 dnl Check for MacOS deployment target version
1074 dnl ========================================================
1076 MOZ_ARG_ENABLE_STRING(macos-target,
1077                       [  --enable-macos-target=VER (default=10.5)
1078                           Set the minimum MacOS version needed at runtime],
1079                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1081 case "$target" in
1082 *-darwin*)
1083     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1084         dnl Use the specified value
1085         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1086         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1087     else
1088         dnl No value specified on the command line or in the environment,
1089         dnl use architecture minimum.
1090         case "${target_cpu}" in
1091           ppc*)
1092             export MACOSX_DEPLOYMENT_TARGET=10.5
1093             ;;
1094           i*86)
1095             export MACOSX_DEPLOYMENT_TARGET=10.5
1096             ;;
1097           x86_64)
1098             export MACOSX_DEPLOYMENT_TARGET=10.6
1099             ;;
1100         esac
1101     fi
1102     ;;
1103 esac
1105 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1107 dnl ========================================================
1108 dnl = Mac OS X SDK support
1109 dnl ========================================================
1110 MACOS_SDK_DIR=
1111 NEXT_ROOT=
1112 MOZ_ARG_WITH_STRING(macos-sdk,
1113 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1114     MACOS_SDK_DIR=$withval)
1116 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1117 dnl NEXT_ROOT will be set and exported only if it's needed.
1118 AC_SUBST(MACOS_SDK_DIR)
1119 AC_SUBST(NEXT_ROOT)
1121 if test "$MACOS_SDK_DIR"; then
1122   dnl Sync this section with the ones in NSPR and NSS.
1123   dnl Changes to the cross environment here need to be accounted for in
1124   dnl the libIDL checks (below) and xpidl build.
1126   if test ! -d "$MACOS_SDK_DIR"; then
1127     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1128 specify a valid SDK.  SDKs are installed when the optional cross-development
1129 tools are selected during the Xcode/Developer Tools installation.])
1130   fi
1132   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1133   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1134     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1135   else
1136     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1137     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1139     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1140     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1141     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1143     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1144       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1145       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1146       dnl be ignored and cause warnings when -syslibroot is specified.
1147       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1148       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1149       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1150     fi
1151   fi
1153   AC_LANG_SAVE
1154   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1155   AC_LANG_CPLUSPLUS
1156   AC_TRY_COMPILE([#include <new>
1157                  int main() { return 0; }],
1158    result=yes,
1159    result=no)
1160   AC_LANG_RESTORE
1161   AC_MSG_RESULT($result)
1163   if test "$result" = "no" ; then
1164     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1165   fi
1168 fi # COMPILE_ENVIRONMENT
1170 if test -n "$MAKE"; then
1171   if test `echo $MAKE | grep -c make.py` != 1; then
1172      NOT_PYMAKE=$MAKE
1173   fi
1176 case "$host_os" in
1177 cygwin*|mingw*|mks*|msvc*)
1178     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1179     ;;
1181     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1182     ;;
1183 esac
1184 if test "$GMAKE" = ":"; then
1185    AC_MSG_ERROR([GNU make not found])
1187 AC_SUBST(GMAKE)
1189 if test "$COMPILE_ENVIRONMENT"; then
1191 AC_PATH_XTRA
1193 XCFLAGS="$X_CFLAGS"
1195 fi # COMPILE_ENVIRONMENT
1197 dnl ========================================================
1198 dnl set the defaults first
1199 dnl ========================================================
1200 AS_BIN=$AS
1201 AR_LIST='$(AR) t'
1202 AR_EXTRACT='$(AR) x'
1203 AR_DELETE='$(AR) d'
1204 AS='$(CC)'
1205 AS_DASH_C_FLAG='-c'
1206 DLL_PREFIX=lib
1207 LIB_PREFIX=lib
1208 DLL_SUFFIX=.so
1209 OBJ_SUFFIX=o
1210 LIB_SUFFIX=a
1211 ASM_SUFFIX=s
1212 IMPORT_LIB_SUFFIX=
1213 TARGET_MD_ARCH=unix
1214 DIRENT_INO=d_ino
1215 CYGWIN_WRAPPER=
1216 WIN_TOP_SRC=
1217 MOZ_USER_DIR=".mozilla"
1219 MOZ_JPEG_CFLAGS=
1220 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1221 MOZ_ZLIB_CFLAGS=
1222 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1223 MOZ_BZ2_CFLAGS=
1224 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1225 MOZ_PNG_CFLAGS=
1226 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1228 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
1229 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1230 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1231 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1232 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1233 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1234 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1235 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1237 MOZ_FS_LAYOUT=unix
1239 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1241 USE_DEPENDENT_LIBS=1
1243 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1245 if test -n "$CROSS_COMPILE"; then
1246     OS_TARGET="${target_os}"
1247     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1248     OS_RELEASE=
1249     case "${target_os}" in
1250         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1251         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1252         gnu*)         OS_ARCH=GNU ;;
1253         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1254         mingw*)       OS_ARCH=WINNT ;;
1255         wince*)       OS_ARCH=WINCE ;;
1256         winmo*)       OS_ARCH=WINCE ;;
1257         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1258     esac
1259     case "${target}" in
1260         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1261     esac
1262 else
1263     OS_TARGET=`uname -s`
1264     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1265     OS_RELEASE=`uname -r`
1268 # Before this used `uname -m` when not cross compiling
1269 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1270 OS_TEST="${target_cpu}"
1272 _COMPILER_PREFIX=
1274 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1276 #######################################################################
1277 # Master "Core Components" macros for getting the OS target           #
1278 #######################################################################
1281 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1282 # cross-compilation.
1286 # Define and override various archtecture-specific variables, including
1287 # HOST_OS_ARCH
1288 # OS_ARCH
1289 # OS_TEST
1290 # OS_TARGET
1291 # OS_RELEASE
1292 # OS_MINOR_RELEASE
1295 case "$HOST_OS_ARCH" in
1296 cygwin*|mingw*|mks*|msvc*)
1297     HOST_OS_ARCH=WINNT
1298     ;;
1299 darwin*)
1300     HOST_OS_ARCH=Darwin
1301     ;;
1302 linux*)
1303     HOST_OS_ARCH=Linux
1304     ;;
1305 solaris*)
1306     HOST_OS_ARCH=SunOS
1307     SOLARIS_SUNPRO_CC=
1308     SOLARIS_SUNPRO_CXX=
1309     if test -z "$GNU_CC"; then
1310         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1311             SOLARIS_SUNPRO_CC=1
1312        fi
1313     fi
1315     if test -z "$GNU_CXX"; then
1316        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1317            SOLARIS_SUNPRO_CXX=1
1318        fi
1319     fi
1320     AC_SUBST(SOLARIS_SUNPRO_CC)
1321     AC_SUBST(SOLARIS_SUNPRO_CXX)
1322     ;;
1323 BSD_386)
1324     HOST_OS_ARCH=BSD
1325     ;;
1326 dgux)
1327     HOST_OS_ARCH=DGUX
1328     ;;
1329 IRIX64)
1330     HOST_OS_ARCH=IRIX
1331     ;;
1332 UNIX_SV)
1333     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1334         HOST_OS_ARCH=NCR
1335     else
1336         HOST_OS_ARCH=UNIXWARE
1337     fi
1338     ;;
1339 ncr)
1340     HOST_OS_ARCH=NCR
1341     ;;
1342 UNIX_SYSTEM_V)
1343     HOST_OS_ARCH=NEC
1344     ;;
1345 OSF1)
1346     ;;
1347 *OpenVMS*)
1348     HOST_OS_ARCH=OpenVMS
1349     ;;
1350 OS_2)
1351     HOST_OS_ARCH=OS2
1352     ;;
1353 QNX)
1354     ;;
1355 SCO_SV)
1356     HOST_OS_ARCH=SCOOS
1357     ;;
1358 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1359     HOST_OS_ARCH=SINIX
1360     ;;
1361 UnixWare)
1362     HOST_OS_ARCH=UNIXWARE
1363     ;;
1364 esac
1366 case "$OS_ARCH" in
1367 WINNT)
1368     if test -z "$CROSS_COMPILE" ; then
1369         OS_TEST=`uname -p`
1370     fi
1371     ;;
1372 Windows_NT)
1374 # If uname -s returns "Windows_NT", we assume that we are using
1375 # the uname.exe in MKS toolkit.
1377 # The -r option of MKS uname only returns the major version number.
1378 # So we need to use its -v option to get the minor version number.
1379 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1381     OS_ARCH=WINNT
1382     OS_TARGET=WINNT
1383     OS_MINOR_RELEASE=`uname -v`
1384     if test "$OS_MINOR_RELEASE" = "00"; then
1385         OS_MINOR_RELEASE=0
1386     fi
1387     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1388     ;;
1389 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1391 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1392 # the uname.exe in the Cygwin tools.
1393 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1394 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1395 # the uname.exe in the GNU-Win32 tools.
1396 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1397 # the uname.exe in the MSYS tools.
1399     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1400     OS_ARCH=WINNT
1401     OS_TARGET=WINNT
1402     ;;
1403 AIX)
1404     OS_RELEASE=`uname -v`.`uname -r`
1405     OS_TEST=${target_cpu}
1406     ;;
1407 BSD_386)
1408     OS_ARCH=BSD
1409     ;;
1410 dgux)
1411     OS_ARCH=DGUX
1412     ;;
1413 IRIX64)
1414     OS_ARCH=IRIX
1415     ;;
1416 UNIX_SV)
1417     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1418         OS_ARCH=NCR
1419     else
1420         OS_ARCH=UNIXWARE
1421         OS_RELEASE=`uname -v`
1422     fi
1423     ;;
1424 ncr)
1425     OS_ARCH=NCR
1426     ;;
1427 UNIX_SYSTEM_V)
1428     OS_ARCH=NEC
1429     ;;
1430 OSF1)
1431     case `uname -v` in
1432     148)
1433         OS_RELEASE=V3.2C
1434         ;;
1435     564)
1436         OS_RELEASE=V4.0B
1437         ;;
1438     878)
1439         OS_RELEASE=V4.0D
1440         ;;
1441     esac
1442     ;;
1443 *OpenVMS*)
1444     OS_ARCH=OpenVMS
1445     OS_RELEASE=`uname -v`
1446     OS_TEST=`uname -p`
1447     ;;
1448 OS_2)
1449     OS_ARCH=OS2
1450     OS_TARGET=OS2
1451     OS_RELEASE=`uname -v`
1452     ;;
1453 QNX)
1454     if test "$OS_TARGET" != "NTO"; then
1455         changequote(,)
1456         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1457         changequote([,])
1458     fi
1459     OS_TEST=x86
1460     ;;
1461 SCO_SV)
1462     OS_ARCH=SCOOS
1463     OS_RELEASE=5.0
1464     ;;
1465 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1466     OS_ARCH=SINIX
1467     OS_TEST=`uname -p`
1468     ;;
1469 UnixWare)
1470     OS_ARCH=UNIXWARE
1471     OS_RELEASE=`uname -v`
1472     ;;
1473 WINCE)
1474     OS_ARCH=WINCE
1475     case "${target_os}" in
1476     *winmo)
1477         OS_TARGET=WINMO
1478         WINCE_WINDOWS_MOBILE=1
1479         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1480         ;;
1481     *)
1482         OS_TARGET=WINCE
1483         ;;
1484     esac
1485     ;;
1486 Darwin)
1487     case "${target_cpu}" in
1488     powerpc*)
1489         OS_TEST=ppc
1490         ;;
1491     i*86*)
1492         OS_TEST=i386 
1493         ;;
1494     x86_64)
1495         OS_TEST=x86_64
1496         ;;
1497     *)
1498         if test -z "$CROSS_COMPILE" ; then
1499             OS_TEST=`uname -p`
1500         fi
1501         ;;
1502     esac
1503     ;;
1504 esac
1506 if test "$OS_ARCH" = "NCR"; then
1507     changequote(,)
1508     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1509     changequote([,])
1512 # Only set CPU_ARCH if we recognize the value of OS_TEST
1514 case "$OS_TEST" in
1515 *86 | i86pc)
1516     CPU_ARCH=x86
1517     ;;
1519 powerpc64 | ppc64)
1520     CPU_ARCH=ppc64
1521     ;;
1523 powerpc | ppc | rs6000)
1524     CPU_ARCH=ppc
1525     ;;
1527 Alpha | alpha | ALPHA)
1528     CPU_ARCH=Alpha
1529     ;;
1531 s390)
1532     CPU_ARCH=s390
1533     ;;
1535 s390x)
1536     CPU_ARCH=s390x
1537     ;;
1539 hppa* | parisc)
1540     CPU_ARCH=hppa
1541     ;;
1543 sun4u | sparc*)
1544     CPU_ARCH=sparc
1545     ;;
1547 x86_64 | ia64)
1548     CPU_ARCH="$OS_TEST"
1549     ;;
1551 arm*)
1552     CPU_ARCH=arm
1553     ;;
1554 esac
1556 if test -z "$OS_TARGET"; then
1557     OS_TARGET=$OS_ARCH
1559 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1561 dnl ========================================================
1562 dnl GNU specific defaults
1563 dnl ========================================================
1564 if test "$GNU_CC"; then
1565     # FIXME: Let us build with strict aliasing. bug 414641.
1566     CFLAGS="$CFLAGS -fno-strict-aliasing"
1567     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1568     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1569     DSO_LDOPTS='-shared'
1570     if test "$GCC_USE_GNU_LD"; then
1571         # Don't allow undefined symbols in libraries
1572         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1573     fi
1574     WARNINGS_AS_ERRORS='-Werror'
1575     DSO_CFLAGS=''
1576     DSO_PIC_CFLAGS='-fPIC'
1577     ASFLAGS="$ASFLAGS -fPIC"
1578     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1579     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1580     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1581     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1583     # Turn on GNU specific features
1584     # -Wall - turn on all warnings
1585     # -pedantic - make compiler warn about non-ANSI stuff, and
1586     #             be a little bit stricter
1587     # Warnings slamm took out for now (these were giving more noise than help):
1588     # -Wbad-function-cast - warns when casting a function to a new return type
1589     # -Wshadow - removed because it generates more noise than help --pete
1590     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1591     if test -z "$INTEL_CC"; then
1592        # Don't use -Wcast-align with ICC
1593        case "$CPU_ARCH" in
1594            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1595            hppa | ia64 | sparc | arm)
1596            ;;
1597            *)
1598         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1599            ;;
1600        esac
1601     fi
1603     dnl Turn pedantic on but disable the warnings for long long
1604     _PEDANTIC=1
1606     if test -z "$INTEL_CC"; then
1607       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1608     fi
1610     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1611     _USE_CPP_INCLUDE_FLAG=1
1612 elif test "$SOLARIS_SUNPRO_CC"; then
1613     DSO_CFLAGS=''
1614     if test "$CPU_ARCH" = "sparc"; then
1615         # for Sun Studio on Solaris/SPARC
1616         DSO_PIC_CFLAGS='-xcode=pic32'
1617     else
1618         DSO_PIC_CFLAGS='-KPIC'
1619     fi
1620     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1621 else
1622     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1623     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1625     DSO_LDOPTS='-shared'
1626     if test "$GNU_LD"; then
1627         # Don't allow undefined symbols in libraries
1628         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1629     fi
1631     DSO_CFLAGS=''
1632     DSO_PIC_CFLAGS='-KPIC'
1633     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1636 if test "$GNU_CXX"; then
1637     # FIXME: Let us build with strict aliasing. bug 414641.
1638     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1639     # Turn on GNU specific features
1640     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1641     if test -z "$INTEL_CC"; then
1642        # Don't use -Wcast-align with ICC
1643        case "$CPU_ARCH" in
1644            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1645            hppa | ia64 | sparc | arm)
1646            ;;
1647            *)
1648         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1649            ;;
1650        esac
1651     fi
1653     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1654     _USE_CPP_INCLUDE_FLAG=1
1656     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1657                    ac_has_wno_invalid_offsetof,
1658         [
1659             AC_LANG_SAVE
1660             AC_LANG_CPLUSPLUS
1661             _SAVE_CXXFLAGS="$CXXFLAGS"
1662             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1663             AC_TRY_COMPILE([],
1664                            [return(0);],
1665                            ac_has_wno_invalid_offsetof="yes",
1666                            ac_has_wno_invalid_offsetof="no")
1667             CXXFLAGS="$_SAVE_CXXFLAGS"
1668             AC_LANG_RESTORE
1669         ])
1670     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1671         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1672     fi
1674     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1675                    ac_has_wno_variadic_macros,
1676         [
1677             AC_LANG_SAVE
1678             AC_LANG_CPLUSPLUS
1679             _SAVE_CXXFLAGS="$CXXFLAGS"
1680             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1681             AC_TRY_COMPILE([],
1682                            [return(0);],
1683                            ac_has_wno_variadic_macros="yes",
1684                            ac_has_wno_variadic_macros="no")
1685             CXXFLAGS="$_SAVE_CXXFLAGS"
1686             AC_LANG_RESTORE
1687         ])
1688     if test "$ac_has_wno_variadic_macros" = "yes"; then
1689         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1690     fi
1692     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1693                    ac_has_werror_return_type,
1694         [
1695             AC_LANG_SAVE
1696             AC_LANG_CPLUSPLUS
1697             _SAVE_CXXFLAGS="$CXXFLAGS"
1698             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1699             AC_TRY_COMPILE([],
1700                            [return(0);],
1701                            ac_has_werror_return_type="yes",
1702                            ac_has_werror_return_type="no")
1703             CXXFLAGS="$_SAVE_CXXFLAGS"
1704             AC_LANG_RESTORE
1705         ])
1706     if test "$ac_has_werror_return_type" = "yes"; then
1707         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1708     fi
1710 else
1711     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1714 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1715 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1716 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1717 dnl normal behavior.
1718 dnl ========================================================
1719 MKSHLIB_FORCE_ALL=
1720 MKSHLIB_UNFORCE_ALL=
1722 if test "$COMPILE_ENVIRONMENT"; then
1723 if test "$GNU_CC"; then
1724   AC_MSG_CHECKING(whether ld has archive extraction flags)
1725   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1726    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1727     ac_cv_mkshlib_force_and_unforce="no"
1728     exec 3<&0 <<LOOP_INPUT
1729         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1730         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1731         force="-Wl,-all";              unforce="-Wl,-none"
1732 LOOP_INPUT
1733     while read line
1734     do
1735       eval $line
1736       LDFLAGS=$force
1737       LIBS=$unforce
1738       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1739     done
1740     exec 0<&3 3<&-
1741     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1742    ])
1743   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1744     AC_MSG_RESULT(no)
1745   else
1746     AC_MSG_RESULT(yes)
1747     eval $ac_cv_mkshlib_force_and_unforce
1748     MKSHLIB_FORCE_ALL=$force
1749     MKSHLIB_UNFORCE_ALL=$unforce
1750   fi
1751 fi # GNU_CC
1752 fi # COMPILE_ENVIRONMENT
1754 dnl =================================================================
1755 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1756 dnl which is bad when cross compiling.
1757 dnl =================================================================
1758 if test "$COMPILE_ENVIRONMENT"; then
1759 configure_static_assert_macros='
1760 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1761 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1762 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1765 dnl test that the macros actually work:
1766 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1767 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1768  [AC_LANG_SAVE
1769   AC_LANG_C
1770   ac_cv_static_assertion_macros_work="yes"
1771   AC_TRY_COMPILE([$configure_static_assert_macros],
1772                  [CONFIGURE_STATIC_ASSERT(1)],
1773                  ,
1774                  ac_cv_static_assertion_macros_work="no")
1775   AC_TRY_COMPILE([$configure_static_assert_macros],
1776                  [CONFIGURE_STATIC_ASSERT(0)],
1777                  ac_cv_static_assertion_macros_work="no",
1778                  )
1779   AC_LANG_CPLUSPLUS
1780   AC_TRY_COMPILE([$configure_static_assert_macros],
1781                  [CONFIGURE_STATIC_ASSERT(1)],
1782                  ,
1783                  ac_cv_static_assertion_macros_work="no")
1784   AC_TRY_COMPILE([$configure_static_assert_macros],
1785                  [CONFIGURE_STATIC_ASSERT(0)],
1786                  ac_cv_static_assertion_macros_work="no",
1787                  )
1788   AC_LANG_RESTORE
1789  ])
1790 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1791 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1792     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1794 fi # COMPILE_ENVIRONMENT
1796 dnl ========================================================
1797 dnl Checking for 64-bit OS
1798 dnl ========================================================
1799 if test "$COMPILE_ENVIRONMENT"; then
1800 AC_LANG_SAVE
1801 AC_LANG_C
1802 AC_MSG_CHECKING(for 64-bit OS)
1803 AC_TRY_COMPILE([$configure_static_assert_macros],
1804                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1805                result="yes", result="no")
1806 AC_MSG_RESULT("$result")
1807 if test "$result" = "yes"; then
1808     AC_DEFINE(HAVE_64BIT_OS)
1809     HAVE_64BIT_OS=1
1811 AC_SUBST(HAVE_64BIT_OS)
1812 AC_LANG_RESTORE
1813 fi # COMPILE_ENVIRONMENT
1815 dnl ========================================================
1816 dnl Enable high-memory support on OS/2 by default.
1817 dnl ========================================================
1818 MOZ_OS2_HIGH_MEMORY=1
1819 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1820 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1821     MOZ_OS2_HIGH_MEMORY=,
1822     MOZ_OS2_HIGH_MEMORY=1 )
1823 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1825 dnl ========================================================
1826 dnl = Use profiling compile flags
1827 dnl ========================================================
1828 MOZ_ARG_ENABLE_BOOL(profiling,
1829 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1830     MOZ_PROFILING=1,
1831     MOZ_PROFILING= )
1833 dnl ========================================================
1834 dnl System overrides of the defaults for host
1835 dnl ========================================================
1836 case "$host" in
1837 *-beos*)
1838     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1839     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1840     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1841     ;;
1843 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1844     if test -n "$_WIN32_MSVC"; then
1845         HOST_AR=lib
1846         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1847         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1848         HOST_RANLIB='echo ranlib'
1849     else
1850         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1851     fi
1852     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1853     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1854     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1855     HOST_BIN_SUFFIX=.exe
1856     case "$host" in
1857     *mingw*)
1858     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1859         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1860         ;;
1861     *)
1862         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1863         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1864             _pwd=`pwd`
1865             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1866         fi
1867         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1868             AS_PERL=1
1869             PERL="${CYGWIN_WRAPPER} $PERL"
1870         fi
1872         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1873             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1874         fi
1875         ;;
1876     esac
1878     case "${host_cpu}" in
1879     x86_64)
1880         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1881         ;;
1882     esac
1883     ;;
1885 *-darwin*)
1886     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1887     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1888     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1889     ;;
1891 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1892     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1893     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1894     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1895     ;;
1897 *os2*)
1898     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1899     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1900     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1901     HOST_BIN_SUFFIX=.exe
1902     MOZ_FIX_LINK_PATHS=
1903     ;;
1905 *-osf*)
1906     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1907     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1908     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1909     ;;
1912     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1913     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1914     ;;
1915 esac
1917 dnl We require version 2.5 or newer of Python to build.
1918 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1919 changequote(,)
1920 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1921 _python_res=$?
1922 changequote([,])
1923 if test "$_python_res" != 0; then
1924     AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1926 AC_MSG_RESULT([yes])
1928 dnl Get mozilla version from central milestone file
1929 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1931 dnl Get version of various core apps from the version files.
1932 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1934 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1935 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1937 dnl ========================================================
1938 dnl System overrides of the defaults for target
1939 dnl ========================================================
1941 case "$target" in
1942 *-aix*)
1943     AC_DEFINE(AIX)
1944     if test ! "$GNU_CC"; then
1945         if test ! "$HAVE_64BIT_OS"; then
1946             # Compiling with Visual Age C++ object model compat is the
1947             # default. To compile with object model ibm, add 
1948             # AIX_OBJMODEL=ibm to .mozconfig.
1949             if test "$AIX_OBJMODEL" = "ibm"; then
1950                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1951             else
1952                 AIX_OBJMODEL=compat
1953             fi
1954         else
1955             AIX_OBJMODEL=compat
1956         fi
1957         AC_SUBST(AIX_OBJMODEL)
1958         DSO_LDOPTS='-qmkshrobj=1'
1959         DSO_CFLAGS='-qflag=w:w'
1960         DSO_PIC_CFLAGS=
1961         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1962         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1963         MOZ_FIX_LINK_PATHS=
1964         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1965         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1966         if test "$COMPILE_ENVIRONMENT"; then
1967             AC_LANG_SAVE
1968             AC_LANG_CPLUSPLUS
1969             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1970             AC_TRY_COMPILE([],
1971                 [#if (__IBMCPP__ < 600)
1972                  #error "Bad compiler"
1973                  #endif],
1974                 _BAD_COMPILER=,_BAD_COMPILER=1)
1975             if test -n "$_BAD_COMPILER"; then
1976                 AC_MSG_RESULT([no])    
1977                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1978             else
1979                 AC_MSG_RESULT([yes])    
1980             fi
1981             AC_LANG_RESTORE
1982             TARGET_COMPILER_ABI="ibmc"
1983             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1984             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1985         fi
1986     fi
1987     case "${target_os}" in
1988     aix4.1*)
1989         DLL_SUFFIX='_shr.a'
1990         ;;
1991     esac
1992     if test "$COMPILE_ENVIRONMENT"; then
1993         AC_CHECK_HEADERS(sys/inttypes.h)
1994     fi
1995     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1996     ;;
1998 *-beos*)
1999     no_x=yes
2000     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
2001     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
2002     DSO_LDOPTS='-nostart'
2003     TK_LIBS='-lbe -lroot'
2004     LIBS="$LIBS -lbe"
2005     if test "$COMPILE_ENVIRONMENT"; then
2006         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
2007         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
2008     fi
2009     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2010     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2011     _MOZ_USE_RTTI=1
2012     USE_DEPENDENT_LIBS=
2013     MOZ_USER_DIR="Mozilla"
2014     ;;
2016 *-bsdi*)
2017     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2018     _PEDANTIC=
2019     case $OS_RELEASE in
2020         4.*|5.*)
2021             STRIP="$STRIP -d"
2022             ;;
2023         *)
2024             DSO_CFLAGS=''
2025             DSO_LDOPTS='-r'
2026             _WARNINGS_CFLAGS="-Wall"
2027             _WARNINGS_CXXFLAGS="-Wall"
2028             # The test above doesn't work properly, at least on 3.1.
2029             MKSHLIB_FORCE_ALL=''
2030             MKSHLIB_UNFORCE_ALL=''
2031         ;;
2032     esac
2033     ;;
2035 *-darwin*) 
2036     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2037     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2038     # If we're building with --enable-profiling, we need a frame pointer.
2039     if test -z "$MOZ_PROFILING"; then
2040         MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2041     else
2042         MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2043     fi
2044     _PEDANTIC=
2045     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2046     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2047     DLL_SUFFIX=".dylib"
2048     DSO_LDOPTS=''
2049     STRIP="$STRIP -x -S"
2050     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2051     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2052     # The ExceptionHandling framework is needed for Objective-C exception
2053     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2054     # builds.
2055     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2057     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2058     dnl ===================================================================
2059     if test "x$enable_dtrace" = "xyes"; then
2060         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2061     else
2062         dnl check for the presence of the -dead_strip linker flag
2063         AC_MSG_CHECKING([for -dead_strip option to ld])
2064         _SAVE_LDFLAGS=$LDFLAGS
2065         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2066         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2067         if test -n "$_HAVE_DEAD_STRIP" ; then
2068             AC_MSG_RESULT([yes])
2069             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2070         else
2071             AC_MSG_RESULT([no])
2072         fi
2073         
2074         LDFLAGS=$_SAVE_LDFLAGS
2075     fi
2076     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2077     ;;
2079 *-freebsd*)
2080     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2081         DLL_SUFFIX=".so.1.0"
2082         DSO_LDOPTS="-shared"
2083     fi
2084     if test ! "$GNU_CC"; then
2085         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2086     fi
2087     ;; 
2089 ia64*-hpux*)
2090     DLL_SUFFIX=".so"
2091     if test ! "$GNU_CC"; then
2092        DSO_LDOPTS='-b'
2093        DSO_CFLAGS=""
2094        DSO_PIC_CFLAGS=
2095        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2096        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2097        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2098     else
2099        DSO_LDOPTS='-b -E'
2100        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2101        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2102     fi
2103     MOZ_FIX_LINK_PATHS=
2104     SYSTEM_MAKEDEPEND=
2105     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2106     AC_DEFINE(_LARGEFILE64_SOURCE)
2107     ;;
2109 *-hpux*)
2110     DLL_SUFFIX=".sl"
2111     if test ! "$GNU_CC"; then
2112         DSO_LDOPTS='-b -Wl,+s'
2113         DSO_CFLAGS=""
2114         DSO_PIC_CFLAGS="+Z"
2115         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2116         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2117         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2118     else
2119         DSO_LDOPTS='-b -E +s'
2120         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2121         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2122     fi
2123     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2124     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2125     ;;
2127 *-irix5*)
2128     AC_DEFINE(IRIX)
2129     DSO_LDOPTS='-elf -shared'
2131     if test "$GNU_CC"; then
2132        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2133        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2134        MKSHLIB_FORCE_ALL='-Wl,-all'
2135        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2136        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2137     else
2138        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2139        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2140        MKSHLIB_FORCE_ALL='-all'
2141        MKSHLIB_UNFORCE_ALL='-none'
2142     fi
2143     ;;
2145 *-irix6*)
2146     AC_DEFINE(IRIX)
2147     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2148     dnl compile and link using -n32
2149     USE_N32=1
2150     TARGET_COMPILER_ABI=n32
2151     DSO_LDOPTS='-elf -shared'
2152     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2153     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2154     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2155     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2156     if test "$GNU_CC"; then
2157        MKSHLIB_FORCE_ALL='-Wl,-all'
2158        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2159        _WARNINGS_CFLAGS="-Wall"
2160        _WARNINGS_CXXFLAGS="-Wall"
2161        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2162     else
2163        MKSHLIB_FORCE_ALL='-all'
2164        MKSHLIB_UNFORCE_ALL='-none'
2165            AR_LIST="$AR t"
2166            AR_EXTRACT="$AR x"
2167            AR_DELETE="$AR d"
2168            AR='$(CXX) -ar'
2169            AR_FLAGS='-o $@'
2170        CFLAGS="$CFLAGS -woff 3262 -G 4"
2171        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2172        if test -n "$USE_N32"; then
2173            ASFLAGS="$ASFLAGS -n32"
2174            CFLAGS="$CFLAGS -n32"
2175            CXXFLAGS="$CXXFLAGS -n32"
2176            LDFLAGS="$LDFLAGS -n32"
2177        fi
2178        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2179        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2180        MOZ_FIX_LINK_PATHS=
2181     fi
2182     if test -z "$GNU_CXX"; then
2183       MIPSPRO_CXX=1
2184     fi
2185     ;;
2187 *-*linux*)
2188     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2189     # Similarly for GNU_CXX and INTEL_CXX.
2190     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2191         # -Os has been broken on Intel's C/C++ compilers for quite a
2192         # while; Intel recommends against using it.
2193         MOZ_OPTIMIZE_FLAGS="-O2"
2194         MOZ_DEBUG_FLAGS="-g"
2195     elif test "$GNU_CC" -o "$GNU_CXX"; then
2196         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2197         case $GCC_VERSION in
2198         4.1.*|4.2.*|4.5.*)
2199             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2200             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2201         esac
2202         # If we're building with --enable-profiling, we need a frame pointer.
2203         if test -z "$MOZ_PROFILING"; then
2204             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2205         else
2206             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2207         fi
2208         MOZ_DEBUG_FLAGS="-g"
2209     fi
2211     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2213     MOZ_MEMORY=1
2215     case "${target_cpu}" in
2216     alpha*)
2217         CFLAGS="$CFLAGS -mieee"
2218         CXXFLAGS="$CXXFLAGS -mieee"
2219     ;;
2220     i*86)
2221         USE_ELF_DYNSTR_GC=1
2222     ;;
2223     mips*)
2224         MOZ_DEBUG_FLAGS="-g" # We want inlining
2225     ;;
2226     esac
2227     ;;
2229 *-wince*|*-winmo*)
2230     TARGET_COMPILER_ABI=msvc
2231     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2232     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2233     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2234     AR_LIST="$AR -list"
2235     AR_EXTRACT="$AR -extract"
2236     AR_DELETE="$AR d"
2237     AR_FLAGS='-OUT:"$@"'
2238     MOZ_MEMORY=1
2239     NSS_DISABLE_DBM=1
2240     MOZ_OGG=
2241     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2243     if test "$AS_BIN"; then
2244         AS="$AS_BIN"
2245     fi
2246     DSO_CFLAGS=
2247     DSO_PIC_CFLAGS=
2248     DLL_SUFFIX=.dll
2249     BIN_SUFFIX='.exe'
2250     if test -z "$RC"; then 
2251         RC=rc.exe  
2252     fi
2253     # certain versions of cygwin's makedepend barf on the 
2254     # #include <string> vs -I./dist/include/string issue so don't use it
2255     SYSTEM_MAKEDEPEND=
2257     HOST_CC=cl
2258     HOST_CXX=cl
2259     HOST_LD=link
2260     HOST_AR='lib -OUT:$@'
2261     HOST_RANLIB='echo ranlib'
2262     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2263         
2264         
2265     WARNINGS_AS_ERRORS='-WX'
2266     MOZ_OPTIMIZE_FLAGS='-Ox'
2267     AR_FLAGS='-NOLOGO -OUT:"$@"'
2268     ASM_SUFFIX=asm
2269     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2270     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2271     DLL_PREFIX=
2272     DOXYGEN=:
2273     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2274     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2275     GARBAGE=
2276     IMPORT_LIB_SUFFIX=lib
2277     dnl Need to force-link against mozalloc because it's used in the shunt
2278     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2279     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2280     LIB_PREFIX=
2281     LIB_SUFFIX=lib 
2282     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2283     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2284     MKSHLIB_FORCE_ALL=
2285     MKSHLIB_UNFORCE_ALL=
2286     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2287     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2288     MOZ_DEBUG_FLAGS='-Zi'
2289     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2290     MOZ_FIX_LINK_PATHS=
2291     MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2292     MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2293     OBJ_SUFFIX=obj
2294     RANLIB='echo not_ranlib'
2295     STRIP='echo not_strip'
2296     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2297     UNZIP=unzip
2298     XARGS=xargs
2299     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2300     ZIP=zip
2301     MOZ_TREE_FREETYPE=1
2303     AC_DEFINE(HAVE_SNPRINTF)
2304     AC_DEFINE(_WINDOWS)
2305     AC_DEFINE(WIN32)
2306     AC_DEFINE(XP_WIN)
2307     AC_DEFINE(XP_WIN32)
2308     AC_DEFINE(HW_THREADS)
2309     AC_DEFINE(STDC_HEADERS)
2310     AC_DEFINE(NEW_H, <new>)
2311     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2312     AC_DEFINE(HAVE_LOCALTIME_R)
2314     TARGET_MD_ARCH=win32
2315     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2316     BIN_SUFFIX='.exe'
2317     MOZ_USER_DIR="Mozilla"
2319     MOZ_GFX_OPTIMIZE_MOBILE=1
2321     # Sanity check for WINCE_WINDOWS_MOBILE
2322     # XXX disabled until we can fix the mobile tinderbox
2323     ##if test "$WINCE_WINDOWS_MOBILE"; then
2324     ##   AC_CHECK_HEADER(tpcshell.h, [],
2325     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2326     ##fi
2330 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2331     DSO_CFLAGS=
2332     DSO_PIC_CFLAGS=
2333     DLL_SUFFIX=.dll
2334     RC=rc.exe
2335     # certain versions of cygwin's makedepend barf on the 
2336     # #include <string> vs -I./dist/include/string issue so don't use it
2337     SYSTEM_MAKEDEPEND=
2338     if test -n "$GNU_CC"; then
2339         CC="$CC -mno-cygwin"
2340         CXX="$CXX -mno-cygwin"
2341         CPP="$CPP -mno-cygwin"
2342         CFLAGS="$CFLAGS -mms-bitfields"
2343         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2344         DSO_LDOPTS='-shared'
2345         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2346         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2347         RC='$(WINDRES)'
2348         # Use temp file for windres (bug 213281)
2349         RCFLAGS='-O coff --use-temp-file'
2350         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2351         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2352         MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
2353         MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
2354         MOZ_FIX_LINK_PATHS=
2355         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2356         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2357         DLL_PREFIX=
2358         IMPORT_LIB_SUFFIX=dll.a
2359         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2360     else
2361         TARGET_COMPILER_ABI=msvc
2362         HOST_CC='$(CC)'
2363         HOST_CXX='$(CXX)'
2364         HOST_LD='$(LD)'
2365         if test "$AS_BIN"; then
2366             AS="$(basename "$AS_BIN")"
2367         fi
2368         AR='lib -NOLOGO -OUT:"$@"'
2369         AR_FLAGS=
2370         RANLIB='echo not_ranlib'
2371         STRIP='echo not_strip'
2372         PKG_SKIP_STRIP=1
2373         XARGS=xargs
2374         ZIP=zip
2375         UNZIP=unzip
2376         DOXYGEN=:
2377         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2378         ASM_SUFFIX=asm
2379         OBJ_SUFFIX=obj
2380         LIB_SUFFIX=lib
2381         DLL_PREFIX=
2382         LIB_PREFIX=
2383         IMPORT_LIB_SUFFIX=lib
2384         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2385         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2386         MKSHLIB_FORCE_ALL=
2387         MKSHLIB_UNFORCE_ALL=
2388         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2389         _USE_CPP_INCLUDE_FLAG=1
2390         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2391         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2392         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2393         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2394         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2395         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2396         MOZ_DEBUG_FLAGS='-Zi'
2397         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2398         WARNINGS_AS_ERRORS='-WX'
2399         # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2400         if test -z "$MOZ_PROFILING"; then
2401             MOZ_OPTIMIZE_FLAGS='-O1'
2402         else
2403             MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2404         fi
2405         MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2406         MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2407         MOZ_FIX_LINK_PATHS=
2408         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2409         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2410         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2411         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2412         if test $_MSC_VER -ge 1400; then
2413             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2414             dnl For profile-guided optimization
2415             PROFILE_GEN_CFLAGS="-GL"
2416             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2417             dnl XXX: PGO builds can fail with warnings treated as errors,
2418             dnl specifically "no profile data available" appears to be
2419             dnl treated as an error sometimes. This might be a consequence
2420             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2421             dnl with the linker doing most of the work in the whole-program
2422             dnl optimization/PGO case. I think it's probably a compiler bug,
2423             dnl but we work around it here.
2424             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2425             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2426             dnl Probably also a compiler bug, but what can you do?
2427             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2428             LDFLAGS="$LDFLAGS -DYNAMICBASE"
2429         fi
2430     fi
2431     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2432     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2433     AC_DEFINE(HAVE_SNPRINTF)
2434     AC_DEFINE(_WINDOWS)
2435     AC_DEFINE(WIN32)
2436     AC_DEFINE(XP_WIN)
2437     AC_DEFINE(XP_WIN32)
2438     AC_DEFINE(HW_THREADS)
2439     AC_DEFINE(STDC_HEADERS)
2440     AC_DEFINE(NEW_H, <new>)
2441     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2442     TARGET_MD_ARCH=win32
2443     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2444     BIN_SUFFIX='.exe'
2445     MOZ_USER_DIR="Mozilla"
2447     dnl Hardcode to win95 for now - cls
2448     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2450     dnl set NO_X11 defines here as the general check is skipped on win32
2451     no_x=yes
2452     AC_DEFINE(NO_X11)
2454     dnl MinGW/MSYS doesn't provide or need cygpath
2455     case "$host" in
2456     *-mingw*)
2457         CYGPATH_W=echo
2458         CYGPATH_S=cat
2459         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2460         ;;
2461     *-cygwin*|*-msvc*|*-mks*)
2462         CYGPATH_W="cygpath -a -w"
2463         CYGPATH_S="sed -e s|\\\\|/|g"
2464         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2465         ;;
2466     esac
2467     case "$host" in
2468     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2470     if test -z "$MOZ_TOOLS"; then
2471         AC_MSG_ERROR([MOZ_TOOLS is not set])
2472     fi
2474     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2475     if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2476         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2477     fi
2478     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2479     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2480         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2481     fi
2482     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2483     ;;
2484     esac 
2487     case "$host_os" in
2488     cygwin*|msvc*|mks*)
2489         AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
2490         ;;
2492     *)
2493         AC_CHECK_HEADERS(oleacc.idl)
2495         AC_LANG_SAVE
2496         AC_LANG_CPLUSPLUS
2497         AC_CHECK_HEADERS(atlbase.h)
2498         AC_LANG_RESTORE
2499         ;;
2500     esac
2502     case "$target" in
2503     i*86-*)
2504         if test "$HAVE_64BIT_OS"; then
2505             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2506         fi
2508         if test $_MSC_VER -ge 1400; then
2509             LDFLAGS="$LDFLAGS -SAFESEH"
2510         fi
2511         AC_CHECK_HEADERS(mmintrin.h)
2512         AC_DEFINE(_X86_)
2513         ;;
2514     alpha-*)
2515         AC_DEFINE(_ALPHA_)
2516         ;;
2517     mips-*)
2518         AC_DEFINE(_MIPS_)
2519         ;;
2520     x86_64-*)
2521         AC_DEFINE(_AMD64_)
2522         ;;
2523     *)
2524         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2525         ;;
2526     esac
2528     if test "$HAVE_64BIT_OS"; then
2529         AC_DEFINE(_WIN64)
2530     fi
2531     ;;
2533 *-netbsd*)
2534     DSO_CFLAGS=''
2535     CFLAGS="$CFLAGS -Dunix"
2536     CXXFLAGS="$CXXFLAGS -Dunix"
2537     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2538         DLL_SUFFIX=".so"
2539         DSO_PIC_CFLAGS='-fPIC -DPIC'
2540         DSO_LDOPTS='-shared'
2541         BIN_FLAGS='-Wl,--export-dynamic'
2542     else
2543         DSO_PIC_CFLAGS='-fPIC -DPIC'
2544         DLL_SUFFIX=".so.1.0"
2545         DSO_LDOPTS='-shared'
2546     fi
2547     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2548     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2549     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2550     if test "$LIBRUNPATH"; then
2551         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2552     fi
2553     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2554     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2555     ;;
2557 *-nto*) 
2558         AC_DEFINE(NTO)  
2559         AC_DEFINE(_QNX_SOURCE)
2560         AC_DEFINE(_i386)
2561         OS_TARGET=NTO
2562         WARNINGS_AS_ERRORS=''
2563         MOZ_OPTIMIZE_FLAGS="-O"
2564         MOZ_DEBUG_FLAGS="-gstabs"
2565         USE_PTHREADS=1
2566         _PEDANTIC=
2567         LIBS="$LIBS -lsocket -lstdc++"
2568         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2569         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2570         if test "$with_x" != "yes"
2571         then
2572                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2573             TK_CFLAGS='-I/usr/include/photon'
2574                 TK_LIBS='-lph'
2575         fi
2576         case "${target_cpu}" in
2577         ppc*)
2578         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2579         ;;
2580         esac
2581         case "${host_cpu}" in
2582         i*86)
2583         USE_ELF_DYNSTR_GC=1
2584         ;;
2585         esac
2586         ;;
2588 *-openbsd*)
2589     DLL_SUFFIX=".so.1.0"
2590     DSO_CFLAGS=''
2591     DSO_PIC_CFLAGS='-fPIC'
2592     DSO_LDOPTS='-shared -fPIC'
2593     if test "$LIBRUNPATH"; then
2594         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2595     fi
2596     ;;
2598 *-openvms*) 
2599     AC_DEFINE(NO_PW_GECOS)
2600     AC_DEFINE(NO_UDSOCK)
2601     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2602     USE_PTHREADS=1
2603     MKSHLIB_FORCE_ALL='-all'
2604     MKSHLIB_UNFORCE_ALL='-none'
2605     AS='as'
2606     AS_DASH_C_FLAG='-Wc/names=as_is'
2607     AR_FLAGS='c $@'
2608     DSO_LDOPTS='-shared -auto_symvec'
2609     DSO_PIC_CFLAGS=
2610     MOZ_DEBUG_LDFLAGS='-g'
2611     COMPAQ_CXX=1
2612     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2613     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2614     ;;
2617 *-os2*)
2618     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2619     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2620     AC_DEFINE(OS2)
2621     AC_DEFINE(XP_OS2)
2622     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2623     AC_DEFINE(TCPV40HDRS)
2624     DLL_PREFIX=
2625     LIB_PREFIX=
2626     LIB_SUFFIX=lib
2627     BIN_SUFFIX=".exe"
2628     DLL_SUFFIX=".dll"
2629     IMPORT_LIB_SUFFIX=lib
2630     DSO_PIC_CFLAGS=
2631     AR=emxomfar
2632     AR_FLAGS='r $@'
2633     CFLAGS="$CFLAGS -Zomf"
2634     CXXFLAGS="$CXXFLAGS -Zomf"
2635     DSO_LDOPTS='-Zdll'
2636     BIN_FLAGS='-Zlinker /ST:0x100000'
2637     IMPLIB='emximp -o'
2638     FILTER='true'
2639     LDFLAGS='-Zmap'
2640     WARNINGS_AS_ERRORS='-Werror'
2641     MOZ_DEBUG_FLAGS="-g -fno-inline"
2642     MOZ_OPTIMIZE_FLAGS="-O2"
2643     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2644     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2645     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2646     TARGET_MD_ARCH=os2
2647     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2648     RC=rc.exe
2649     RCFLAGS='-n'
2650     MOZ_USER_DIR="Mozilla"
2652     if test "$MOZTOOLS"; then
2653         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2654     else
2655         AC_MSG_ERROR([MOZTOOLS is not set])
2656     fi
2657     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2658         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2659         LDFLAGS="$LDFLAGS -Zhigh-mem"
2660         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2661         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2662     fi
2664     # GCC for OS/2 currently predefines these, but we don't want them
2665     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2666     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2668     AC_CACHE_CHECK(for __declspec(dllexport),
2669         ac_os2_declspec,
2670         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2671                         [return 0;],
2672                         ac_os2_declspec="yes",
2673                         ac_os2_declspec="no")])
2674     if test "$ac_os2_declspec" != "yes"; then
2675         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2676     fi
2677     ;;
2679 alpha*-*-osf*)
2680     if test "$GNU_CC"; then
2681       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2682       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2684     else
2685         MOZ_DEBUG_FLAGS='-g'
2686         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2687         CFLAGS="$CFLAGS -ieee"
2688         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2689         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2690         DSO_CFLAGS=
2691         DSO_PIC_CFLAGS=
2692         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2693         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2694         MKSHLIB_FORCE_ALL='-all'
2695         MKSHLIB_UNFORCE_ALL='-none'
2696         dnl Might fix the libxpcom.so breakage on this platform as well....
2697         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2698         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2699     fi
2700     if test -z "$GNU_CXX"; then
2701       COMPAQ_CXX=1
2702     fi
2703     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2704     ;;
2706 *-qnx*) 
2707     DIRENT_INO=d_stat.st_ino
2708     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2709     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2710     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2711     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2712     AC_DEFINE(STDC_HEADERS)
2713     if test "$no_x" = "yes"; then
2714             _PLATFORM_DEFAULT_TOOLKIT='photon'
2715             TK_CFLAGS='-I/usr/nto/include/photon'
2716             TK_LIBS='-lphoton -lphrender'
2717     fi
2718     ;;
2720 *-sco*) 
2721     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2722     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2723     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2724     if test ! "$GNU_CC"; then
2725        DSO_LDOPTS='-G'
2726     fi
2727     ;;
2729 *-solaris*) 
2730     AC_DEFINE(SOLARIS)
2731     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2732     SYSTEM_MAKEDEPEND=
2733     MOZ_FIX_LINK_PATHS=
2734     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2735     # libraries one level up (e.g. libnspr4.so)
2736     if test "$SOLARIS_SUNPRO_CC"; then
2737        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2738        LIBS="-lCrun -lCstd -lc $LIBS"
2739        NS_USE_NATIVE=1
2740        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2741        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2742        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2743        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2744        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2745        LDFLAGS="-xildoff $LDFLAGS"
2746        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2747            _SAVE_LDFLAGS=$LDFLAGS
2748            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2749            AC_TRY_LINK([#include <stdio.h>],
2750                        [printf("Hello World\n");],
2751                        ,
2752                        [LDFLAGS=$_SAVE_LDFLAGS])
2753        fi
2754        WARNINGS_AS_ERRORS='-Werror'
2755        MOZ_OPTIMIZE_FLAGS="-xO4"
2756        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2757        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2758        MKSHLIB_FORCE_ALL='-z allextract'
2759        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2760        DSO_LDOPTS='-G'
2761        AR_LIST="$AR t"
2762        AR_EXTRACT="$AR x"
2763        AR_DELETE="$AR d"
2764        AR='$(CXX) -xar'
2765        AR_FLAGS='-o $@'
2766        AS='/usr/ccs/bin/as'
2767        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2768        AS_DASH_C_FLAG=''
2769        TARGET_COMPILER_ABI="sunc"
2770        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2771        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2772        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2773        AC_LANG_SAVE
2774        AC_LANG_CPLUSPLUS
2775        AC_TRY_COMPILE([],
2776            [#if (__SUNPRO_CC < 0x590)
2777            #error "Denied"
2778            #endif],
2779            _BAD_COMPILER=,_BAD_COMPILER=1)
2780        if test -n "$_BAD_COMPILER"; then
2781            _res="no"
2782            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2783        else
2784            _res="yes"
2785        fi
2786        AC_TRY_COMPILE([],
2787            [#if (__SUNPRO_CC >= 0x5100)
2788            #error "Sun C++ 5.10 or above"
2789            #endif],
2790            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2791        if test "$_ABOVE_SS12U1"; then
2792            # disable xannotate
2793            CXXFLAGS="$CXXFLAGS -xannotate=no"
2794        fi
2795        AC_MSG_RESULT([$_res])
2796        AC_LANG_RESTORE
2797     else
2798        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2799        LIBS="-lc $LIBS"
2800        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2801        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2802        ASFLAGS="$ASFLAGS -fPIC"
2803        DSO_LDOPTS='-shared'
2804        _WARNINGS_CFLAGS=''
2805        _WARNINGS_CXXFLAGS=''
2806        if test "$OS_RELEASE" = "5.3"; then
2807            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2808        fi
2809     fi
2810     if test "$OS_RELEASE" = "5.5.1"; then
2811         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2812     fi
2813     ;;
2815 *-sunos*) 
2816     DSO_LDOPTS='-Bdynamic'
2817     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2818     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2819     AC_DEFINE(SUNOS4)
2820     AC_DEFINE(SPRINTF_RETURNS_STRING)
2821     case "$(target_os)" in
2822     sunos4.1*)
2823         DLL_SUFFIX='.so.1.0'
2824         ;;
2825     esac
2826     ;;
2828 *-sysv4.2uw7*) 
2829         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2830     ;;
2832 *-os2*)
2833     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2834     ;;
2836 *-android*)
2837     AC_DEFINE(NO_PW_GECOS)
2838     no_x=yes
2839     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2840     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2842     MOZ_GFX_OPTIMIZE_MOBILE=1
2843     # If we're building with --enable-profiling, we need a frame pointer.
2844     if test -z "$MOZ_PROFILING"; then
2845         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2846     else
2847         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2848     fi
2849     ;;
2851 esac
2853 dnl Only one oddball right now (QNX), but this gives us flexibility
2854 dnl if any other platforms need to override this in the future.
2855 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2857 dnl ========================================================
2858 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2859 dnl by now will not have any way to link most binaries (tests
2860 dnl as well as viewer, apprunner, etc.), because some symbols
2861 dnl will be left out of the "composite" .so's by ld as unneeded.
2862 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2863 dnl they can link in the static libs that provide the missing
2864 dnl symbols.
2865 dnl ========================================================
2866 NO_LD_ARCHIVE_FLAGS=
2867 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2868     NO_LD_ARCHIVE_FLAGS=1
2870 case "$target" in
2871 *-os2*)
2872     NO_LD_ARCHIVE_FLAGS=
2873     ;;
2874 *-aix4.3*|*-aix5*)
2875     NO_LD_ARCHIVE_FLAGS=
2876     ;;
2877 *-openvms*)
2878     NO_LD_ARCHIVE_FLAGS=
2879     ;;
2880 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2881     if test -z "$GNU_CC"; then
2882         NO_LD_ARCHIVE_FLAGS=
2883     fi
2884     ;;
2885 esac
2886 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2888 dnl ========================================================
2889 dnl = Flags to strip unused symbols from .so components and
2890 dnl = to export jemalloc symbols when linking a program
2891 dnl ========================================================
2892 case "$target" in
2893     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2894         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2895         MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS='-rdynamic -Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/jemalloc-standalone-linkage-version-script'
2896         ;;
2897     *-solaris*)
2898         if test -z "$GNU_CC"; then
2899          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2900         else
2901          if test -z "$GCC_USE_GNU_LD"; then
2902           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2903          else
2904           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2905          fi
2906         fi
2907         ;;
2908     *-nto*) 
2909         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2910         ;;
2911     *-darwin*)
2912         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2913         ;;
2914     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2915         if test -n "$GNU_CC"; then
2916            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2917         fi
2918         ;;
2919 esac
2921 if test -z "$COMPILE_ENVIRONMENT"; then
2922     SKIP_COMPILER_CHECKS=1
2923     SKIP_LIBRARY_CHECKS=1
2926 if test -z "$SKIP_COMPILER_CHECKS"; then
2927 dnl Checks for typedefs, structures, and compiler characteristics.
2928 dnl ========================================================
2929 AC_HEADER_STDC
2930 AC_C_CONST
2931 AC_TYPE_MODE_T
2932 AC_TYPE_OFF_T
2933 AC_TYPE_PID_T
2934 AC_TYPE_SIZE_T
2935 AC_LANG_CPLUSPLUS
2936 AC_MSG_CHECKING(for __stdcall)
2937 AC_CACHE_VAL(ac_cv___stdcall,
2938  [AC_TRY_COMPILE([template <typename Method> struct foo;
2939                   template <> struct foo<void (*)()> {};
2940                   template <> struct foo<void (__stdcall*)()> {};],
2941                  [],
2942                  [ac_cv___stdcall=true],
2943                  [ac_cv___stdcall=false])])
2944 if test "$ac_cv___stdcall" = true ; then
2945   AC_DEFINE(HAVE_STDCALL)
2946   AC_MSG_RESULT(yes)
2947 else
2948   AC_MSG_RESULT(no)
2950 AC_LANG_C
2951 AC_MSG_CHECKING(for ssize_t)
2952 AC_CACHE_VAL(ac_cv_type_ssize_t,
2953  [AC_TRY_COMPILE([#include <stdio.h>
2954                   #include <sys/types.h>],
2955                  [ssize_t foo = 0;],
2956                  [ac_cv_type_ssize_t=true],
2957                  [ac_cv_type_ssize_t=false])])
2958 if test "$ac_cv_type_ssize_t" = true ; then
2959   AC_DEFINE(HAVE_SSIZE_T)
2960   AC_MSG_RESULT(yes)
2961 else
2962   AC_MSG_RESULT(no)
2964 AC_STRUCT_ST_BLKSIZE
2965 AC_MSG_CHECKING(for siginfo_t)
2966 AC_CACHE_VAL(ac_cv_siginfo_t,
2967  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2968                   #include <signal.h>],
2969                  [siginfo_t* info;],
2970                  [ac_cv_siginfo_t=true],
2971                  [ac_cv_siginfo_t=false])])
2972 if test "$ac_cv_siginfo_t" = true ; then
2973   AC_DEFINE(HAVE_SIGINFO_T)
2974   AC_MSG_RESULT(yes)
2975 else
2976   AC_MSG_RESULT(no)
2979 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2980 dnl ========================================================
2981 AC_MSG_CHECKING(for int16_t)
2982 AC_CACHE_VAL(ac_cv_int16_t,
2983  [AC_TRY_COMPILE([#include <stdio.h>
2984                   #include <sys/types.h>],
2985                  [int16_t foo = 0;],
2986                  [ac_cv_int16_t=true],
2987                  [ac_cv_int16_t=false])])
2988 if test "$ac_cv_int16_t" = true ; then
2989   AC_DEFINE(HAVE_INT16_T)
2990   AC_MSG_RESULT(yes)
2991 else
2992   AC_MSG_RESULT(no)
2994 AC_MSG_CHECKING(for int32_t)
2995 AC_CACHE_VAL(ac_cv_int32_t,
2996  [AC_TRY_COMPILE([#include <stdio.h>
2997                   #include <sys/types.h>],
2998                  [int32_t foo = 0;],
2999                  [ac_cv_int32_t=true],
3000                  [ac_cv_int32_t=false])])
3001 if test "$ac_cv_int32_t" = true ; then
3002   AC_DEFINE(HAVE_INT32_T)
3003   AC_MSG_RESULT(yes)
3004 else
3005   AC_MSG_RESULT(no)
3007 AC_MSG_CHECKING(for int64_t)
3008 AC_CACHE_VAL(ac_cv_int64_t,
3009  [AC_TRY_COMPILE([#include <stdio.h>
3010                   #include <sys/types.h>],
3011                  [int64_t foo = 0;],
3012                  [ac_cv_int64_t=true],
3013                  [ac_cv_int64_t=false])])
3014 if test "$ac_cv_int64_t" = true ; then
3015   AC_DEFINE(HAVE_INT64_T)
3016   AC_MSG_RESULT(yes)
3017 else
3018   AC_MSG_RESULT(no)
3020 AC_MSG_CHECKING(for int64)
3021 AC_CACHE_VAL(ac_cv_int64,
3022  [AC_TRY_COMPILE([#include <stdio.h>
3023                   #include <sys/types.h>],
3024                  [int64 foo = 0;],
3025                  [ac_cv_int64=true],
3026                  [ac_cv_int64=false])])
3027 if test "$ac_cv_int64" = true ; then
3028   AC_DEFINE(HAVE_INT64)
3029   AC_MSG_RESULT(yes)
3030 else
3031   AC_MSG_RESULT(no)
3033 AC_MSG_CHECKING(for uint)
3034 AC_CACHE_VAL(ac_cv_uint,
3035  [AC_TRY_COMPILE([#include <stdio.h>
3036                   #include <sys/types.h>],
3037                  [uint foo = 0;],
3038                  [ac_cv_uint=true],
3039                  [ac_cv_uint=false])])
3040 if test "$ac_cv_uint" = true ; then
3041   AC_DEFINE(HAVE_UINT)
3042   AC_MSG_RESULT(yes)
3043 else
3044   AC_MSG_RESULT(no)
3046 AC_MSG_CHECKING(for uint_t)
3047 AC_CACHE_VAL(ac_cv_uint_t,
3048  [AC_TRY_COMPILE([#include <stdio.h>
3049                   #include <sys/types.h>],
3050                  [uint_t foo = 0;],
3051                  [ac_cv_uint_t=true],
3052                  [ac_cv_uint_t=false])])
3053 if test "$ac_cv_uint_t" = true ; then
3054   AC_DEFINE(HAVE_UINT_T)
3055   AC_MSG_RESULT(yes)
3056 else
3057   AC_MSG_RESULT(no)
3059 AC_MSG_CHECKING(for uint16_t)
3060 AC_CACHE_VAL(ac_cv_uint16_t,
3061  [AC_TRY_COMPILE([#include <stdio.h>
3062                   #include <sys/types.h>],
3063                  [uint16_t foo = 0;],
3064                  [ac_cv_uint16_t=true],
3065                  [ac_cv_uint16_t=false])])
3066 if test "$ac_cv_uint16_t" = true ; then
3067   AC_DEFINE(HAVE_UINT16_T)
3068   AC_MSG_RESULT(yes)
3069 else
3070   AC_MSG_RESULT(no)
3073 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3074 dnl are defined when compiling C++ but not C.  Since the result of this
3075 dnl test is used only in C++, do it in C++.
3076 AC_LANG_CPLUSPLUS
3078 AC_MSG_CHECKING(for uname.domainname)
3079 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3080     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3081         [ struct utsname *res; char *domain; 
3082             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3083         [ac_cv_have_uname_domainname_field=true],
3084         [ac_cv_have_uname_domainname_field=false])])
3086 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3087     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3088     AC_MSG_RESULT(yes)
3089 else
3090     AC_MSG_RESULT(no)
3093 AC_MSG_CHECKING(for uname.__domainname)
3094 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3095     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3096         [ struct utsname *res; char *domain; 
3097             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3098         [ac_cv_have_uname_us_domainname_field=true],
3099         [ac_cv_have_uname_us_domainname_field=false])])
3101 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3102     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3103     AC_MSG_RESULT(yes)
3104 else
3105     AC_MSG_RESULT(no)
3108 AC_LANG_CPLUSPLUS
3110 dnl Check for usable char16_t (2 bytes, unsigned)
3111 dnl (we might not need the unsignedness check anymore)
3112 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3113     ac_cv_have_usable_char16_t,
3114     [AC_TRY_COMPILE([$configure_static_assert_macros],
3115                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3116                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3117                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3118                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3119                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3120                     ac_cv_have_usable_char16_t="yes",
3121                     ac_cv_have_usable_char16_t="no")])
3122 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3123     AC_DEFINE(HAVE_CPP_CHAR16_T)
3124     HAVE_CPP_CHAR16_T=1
3127 dnl Check for usable wchar_t (2 bytes, unsigned)
3128 dnl (we really don't need the unsignedness check anymore)
3129 dnl ========================================================
3131 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3132     ac_cv_have_usable_wchar_v2,
3133     [AC_TRY_COMPILE([#include <stddef.h>
3134                      $configure_static_assert_macros],
3135                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3136                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3137                     ac_cv_have_usable_wchar_v2="yes",
3138                     ac_cv_have_usable_wchar_v2="no")])
3139 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3140     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3141     HAVE_CPP_2BYTE_WCHAR_T=1
3142 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3143 dnl This is really gcc-only
3144 dnl Do this test using CXX only since some versions of gcc
3145 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3146 dnl only have short-wchar support for c++.
3147 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3149     _SAVE_CXXFLAGS=$CXXFLAGS
3150     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3152     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3153         ac_cv_have_usable_wchar_option_v2,
3154         [AC_TRY_LINK([#include <stddef.h>
3155                       $configure_static_assert_macros],
3156                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3157                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3158                      ac_cv_have_usable_wchar_option_v2="yes",
3159                      ac_cv_have_usable_wchar_option_v2="no")])
3161     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3162         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3163         HAVE_CPP_2BYTE_WCHAR_T=1
3164         if test "$OS_TARGET" = Android; then
3165             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3166             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3167             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3168             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3169         else
3170             WCHAR_CFLAGS="-fshort-wchar"
3171         fi
3172     else    
3173         CXXFLAGS=$_SAVE_CXXFLAGS
3174     fi
3177 AC_LANG_C
3179 dnl Check for .hidden assembler directive and visibility attribute.
3180 dnl Borrowed from glibc configure.in
3181 dnl ===============================================================
3182 if test "$GNU_CC"; then
3183   AC_CACHE_CHECK(for visibility(hidden) attribute,
3184                  ac_cv_visibility_hidden,
3185                  [cat > conftest.c <<EOF
3186                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3188                   ac_cv_visibility_hidden=no
3189                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3190                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3191                       ac_cv_visibility_hidden=yes
3192                     fi
3193                   fi
3194                   rm -f conftest.[cs]
3195                  ])
3196   if test "$ac_cv_visibility_hidden" = "yes"; then
3197     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3199     AC_CACHE_CHECK(for visibility(default) attribute,
3200                    ac_cv_visibility_default,
3201                    [cat > conftest.c <<EOF
3202                     int foo __attribute__ ((visibility ("default"))) = 1;
3204                     ac_cv_visibility_default=no
3205                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3206                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3207                         ac_cv_visibility_default=yes
3208                       fi
3209                     fi
3210                     rm -f conftest.[cs]
3211                    ])
3212     if test "$ac_cv_visibility_default" = "yes"; then
3213       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3215       AC_CACHE_CHECK(for visibility pragma support,
3216                      ac_cv_visibility_pragma,
3217                      [cat > conftest.c <<EOF
3218 #pragma GCC visibility push(hidden)
3219                       int foo_hidden = 1;
3220 #pragma GCC visibility push(default)
3221                       int foo_default = 1;
3223                       ac_cv_visibility_pragma=no
3224                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3225                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3226                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3227                             ac_cv_visibility_pragma=yes
3228                           fi
3229                         fi
3230                       fi
3231                       rm -f conftest.[cs]
3232                     ])
3233       if test "$ac_cv_visibility_pragma" = "yes"; then
3234         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3235                        ac_cv_have_visibility_class_bug,
3236                        [cat > conftest.c <<EOF
3237 #pragma GCC visibility push(hidden)
3238 struct __attribute__ ((visibility ("default"))) TestStruct {
3239   static void Init();
3241 __attribute__ ((visibility ("default"))) void TestFunc() {
3242   TestStruct::Init();
3245                        ac_cv_have_visibility_class_bug=no
3246                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3247                          ac_cv_have_visibility_class_bug=yes
3248                        else
3249                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3250                            ac_cv_have_visibility_class_bug=yes
3251                          fi
3252                        fi
3253                        rm -rf conftest.{c,S}
3254                        ])
3256         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3257                        ac_cv_have_visibility_builtin_bug,
3258                        [cat > conftest.c <<EOF
3259 #pragma GCC visibility push(hidden)
3260 #pragma GCC visibility push(default)
3261 #include <string.h>
3262 #pragma GCC visibility pop
3264 __attribute__ ((visibility ("default"))) void Func() {
3265   char c[[100]];
3266   memset(c, 0, sizeof(c));
3269                        ac_cv_have_visibility_builtin_bug=no
3270                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3271                          ac_cv_have_visibility_builtin_bug=yes
3272                        else
3273                          if test `grep -c "@PLT" conftest.S` = 0; then
3274                            ac_cv_visibility_builtin_bug=yes
3275                          fi
3276                        fi
3277                        rm -f conftest.{c,S}
3278                        ])
3279         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3280                 "$ac_cv_have_visibility_class_bug" = "no"; then
3281           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3282           WRAP_SYSTEM_INCLUDES=1
3283           STL_FLAGS='-I$(DIST)/stl_wrappers'
3284           WRAP_STL_INCLUDES=1
3285         else
3286           VISIBILITY_FLAGS='-fvisibility=hidden'
3287         fi # have visibility pragma bug
3288       fi   # have visibility pragma
3289     fi     # have visibility(default) attribute
3290   fi       # have visibility(hidden) attribute
3291 fi         # GNU_CC
3293 # visibility hidden flag for Sun Studio on Solaris
3294 if test "$SOLARIS_SUNPRO_CC"; then
3295 VISIBILITY_FLAGS='-xldscope=hidden'
3296 fi         # Sun Studio on Solaris
3298 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3299 AC_SUBST(VISIBILITY_FLAGS)
3301 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3302 dnl ========================================================
3303 if test "$GNU_CC"; then
3304   CFLAGS_save="${CFLAGS}"
3305   CFLAGS="${CFLAGS} -Werror"
3306   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3307                  ac_cv_force_align_arg_pointer,
3308                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3309                                  [],
3310                                  ac_cv_force_align_arg_pointer="yes",
3311                                  ac_cv_force_align_arg_pointer="no")])
3312   CFLAGS="${CFLAGS_save}"
3313   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3314     HAVE_GCC_ALIGN_ARG_POINTER=1
3315   else
3316     HAVE_GCC_ALIGN_ARG_POINTER=
3317   fi
3319 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3321 dnl Checks for header files.
3322 dnl ========================================================
3323 AC_HEADER_DIRENT
3324 case "$target_os" in
3325 freebsd*)
3326 # for stuff like -lXshm
3327     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3328     ;;
3329 esac
3330 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3331 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3332 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3333 AC_CHECK_HEADERS(malloc.h)
3334 AC_CHECK_HEADERS(X11/XKBlib.h)
3335 AC_CHECK_HEADERS(io.h)
3337 dnl These are all the places some variant of statfs can be hiding.
3338 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3340 dnl Quota support
3341 AC_CHECK_HEADERS(sys/quota.h)
3342 AC_CHECK_HEADERS(linux/quota.h)
3344 dnl Try for MMX support
3345 dnl NB - later gcc versions require -mmmx for this header to be successfully
3346 dnl included (or another option which implies it, such as -march=pentium-mmx)
3347 AC_CHECK_HEADERS(mmintrin.h)
3349 dnl Check whether the compiler supports the new-style C++ standard
3350 dnl library headers (i.e. <new>) or needs the old "new.h"
3351 AC_LANG_CPLUSPLUS
3352 NEW_H=new.h
3353 AC_CHECK_HEADER(new, [NEW_H=new])
3354 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3355 AC_LANG_C
3357 AC_ARG_ENABLE(dtrace,
3358               [  --enable-dtrace         build with dtrace support if available (default=no)],
3359               [enable_dtrace="yes"],)
3360 if test "x$enable_dtrace" = "xyes"; then
3361   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3362   if test -n "$HAVE_DTRACE"; then
3363       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3364   else
3365       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3366   fi
3368 AC_SUBST(HAVE_DTRACE)
3370 case $target in
3371 *-aix4.3*|*-aix5*)
3372         ;;
3374         AC_CHECK_HEADERS(sys/cdefs.h)
3375         ;;
3376 esac
3378 dnl Checks for libraries.
3379 dnl ========================================================
3380 case $target in
3381 *-hpux11.*)
3382         ;;
3384         AC_CHECK_LIB(c_r, gethostbyname_r)
3385         ;;
3386 esac
3388 dnl We don't want to link with libdl even if it's present on OS X, since
3389 dnl it's not used and not part of the default installation.
3390 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3391 dnl We don't want to link against libm or libpthread on Darwin since
3392 dnl they both are just symlinks to libSystem and explicitly linking
3393 dnl against libSystem causes issues when debugging (see bug 299601).
3394 case $target in
3395 *-darwin*)
3396     ;;
3397 *-beos*)
3398     ;;
3399 *-os2*)
3400     ;;
3402     AC_SEARCH_LIBS(dlopen, dl, 
3403         AC_CHECK_HEADER(dlfcn.h, 
3404         AC_DEFINE(HAVE_DLOPEN)))
3405     ;;
3406 esac
3408 _SAVE_CFLAGS="$CFLAGS"
3409 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3410 AC_CHECK_FUNCS(dladdr)
3411 CFLAGS="$_SAVE_CFLAGS"
3413 if test ! "$GNU_CXX"; then
3415     case $target in
3416     *-aix*)
3417         AC_CHECK_LIB(C_r, demangle)
3418         ;;
3419      *)
3420         AC_CHECK_LIB(C, demangle)
3421         ;;
3422      esac
3425 dnl OS/2 has socket in libc.
3426 case $target in
3427 *-os2*)
3428     ;;
3430     AC_CHECK_LIB(socket, socket)
3431 esac
3433 dnl ========================================================
3434 dnl Check whether we can compile code for Core Text
3435 dnl (available on Mac OS X 10.5 or later)
3436 dnl ========================================================
3437 case "$target" in
3438 *-darwin*)
3439   AC_MSG_CHECKING([for Core Text])
3440   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3441                  [CTLineRef lineRef;],
3442                   ac_cv_have_core_text="yes",
3443                   ac_cv_have_core_text="no")
3444   AC_MSG_RESULT([$ac_cv_have_core_text])
3446   if test "$ac_cv_have_core_text" = "no"; then
3447     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3448   fi
3449   ;;
3450 esac
3452 XLDFLAGS="$X_LIBS"
3453 XLIBS="$X_EXTRA_LIBS"
3455 dnl ========================================================
3456 dnl Checks for X libraries.
3457 dnl Ordering is important.
3458 dnl Xt is dependent upon SM as of X11R6
3459 dnl ========================================================
3460 if test "$no_x" = "yes"; then
3461     AC_DEFINE(NO_X11)
3462 else
3463     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3464         XLIBS="-lX11 $XLIBS"
3465         _SAVE_LDFLAGS="$LDFLAGS"
3466         LDFLAGS="$XLDFLAGS $LDFLAGS"
3467         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3468                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3469         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3470                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3471      
3472         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3473         unset ac_cv_lib_Xt_XtFree
3474             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3475             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3476         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3477                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3478         ])
3480     # AIX needs the motif library linked before libXt to prevent
3481     # crashes in plugins linked against Motif - Bug #98892
3482     case "${target_os}" in
3483     aix*)
3484         XT_LIBS="-lXm $XT_LIBS"
3485         ;;
3486     esac
3488     dnl ========================================================
3489     dnl = Check for XShm
3490     dnl ========================================================
3491     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3492         $XLIBS $XEXT_LIBS)
3493     AC_CHECK_HEADER(X11/extensions/XShm.h)
3494     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3495         test -n "$_HAVE_XSHM_XEXT"; then
3496         AC_DEFINE(HAVE_XSHM)
3497     fi
3499     dnl ========================================================
3500     dnl = Check for Xss
3501     dnl ========================================================
3502     AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
3503         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3504             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3505              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3507     dnl ========================================================
3508     dnl = Check for XIE
3509     dnl ========================================================
3510     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3511         $XLIBS $XEXT_LIBS)
3512     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3514     if test "$MOZ_XIE_LIBS"; then
3515         dnl ====================================================
3516         dnl = If XIE is present and is desired, turn it on
3517         dnl ====================================================
3518         case $target in
3519             *-hpux*)
3520                 ;;
3521             *)
3522                 HAVE_XIE=1
3523                 ;;
3524         esac
3525     fi
3527         LDFLAGS="$_SAVE_LDFLAGS"
3529     dnl ========================================================
3530     dnl = Check for freetype2 and its functionality
3531     dnl ========================================================
3532     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3534     if test "$_HAVE_FREETYPE2"; then
3535         _SAVE_LIBS="$LIBS"
3536         _SAVE_CFLAGS="$CFLAGS"
3537         LIBS="$LIBS $FT2_LIBS"
3538         CFLAGS="$CFLAGS $FT2_CFLAGS"
3540         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3541             ac_cv_member_FT_Bitmap_Size_y_ppem,
3542             [AC_TRY_COMPILE([#include <ft2build.h>
3543                              #include FT_FREETYPE_H],
3544                             [FT_Bitmap_Size s;
3545                              if (sizeof s.y_ppem) return 0;
3546                              return 1],
3547                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3548                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3549         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3550             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3551         else
3552             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3553         fi
3554         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3555                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3556                            [FT_Bitmap_Size structure includes y_ppem field])
3558         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3560         LIBS="$_SAVE_LIBS"
3561         CFLAGS="$_SAVE_CFLAGS"
3562     fi
3564 fi # $no_x
3566 AC_SUBST(XCFLAGS)
3567 AC_SUBST(XLDFLAGS)
3568 AC_SUBST(XLIBS)
3569 AC_SUBST(XEXT_LIBS)
3570 AC_SUBST(XT_LIBS)
3571 AC_SUBST(XSS_LIBS)
3573 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3574 AC_TRY_COMPILE([],
3575                [asm("uqadd8 r1, r1, r2");],
3576                result="yes", result="no")
3577 AC_MSG_RESULT("$result")
3578 if test "$result" = "yes"; then
3579     AC_DEFINE(HAVE_ARM_SIMD)
3580     HAVE_ARM_SIMD=1
3582 AC_SUBST(HAVE_ARM_SIMD)
3584 AC_MSG_CHECKING(for ARM NEON support in compiler)
3585 _SAVE_CFLAGS="$CFLAGS"
3586 if test "$GNU_CC"; then
3587   # gcc needs -mfpu=neon to recognize NEON instructions
3588   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3590 AC_TRY_COMPILE([],
3591                [asm("vadd.i8 d0, d0, d0");],
3592                result="yes", result="no")
3593 AC_MSG_RESULT("$result")
3594 if test "$result" = "yes"; then
3595     AC_DEFINE(HAVE_ARM_NEON)
3596     HAVE_ARM_NEON=1
3598 CFLAGS="$_SAVE_CFLAGS"
3599 AC_SUBST(HAVE_ARM_NEON)
3601 dnl ========================================================
3602 dnl = pthread support
3603 dnl = Start by checking whether the system support pthreads
3604 dnl ========================================================
3605 case "$target_os" in
3606 darwin*)
3607     USE_PTHREADS=1
3608     ;;
3610     MOZ_CHECK_PTHREADS(pthreads,
3611         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3612         MOZ_CHECK_PTHREADS(pthread,
3613             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3614             MOZ_CHECK_PTHREADS(c_r,
3615                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3616                 MOZ_CHECK_PTHREADS(c,
3617                     USE_PTHREADS=1
3618                 )
3619             )
3620         )
3621     )
3622     ;;
3623 esac
3625 dnl ========================================================
3626 dnl Check the command line for --with-pthreads 
3627 dnl ========================================================
3628 MOZ_ARG_WITH_BOOL(pthreads,
3629 [  --with-pthreads         Force use of system pthread library with NSPR ],
3630 [ if test "$USE_PTHREADS"x = x; then
3631     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3632 fi],
3633     USE_PTHREADS=
3634     _PTHREAD_LDFLAGS=
3637 dnl ========================================================
3638 dnl Do the platform specific pthread hackery
3639 dnl ========================================================
3640 if test "$USE_PTHREADS"x != x
3641 then
3642         dnl
3643         dnl See if -pthread is supported.
3644         dnl
3645         rm -f conftest*
3646         ac_cv_have_dash_pthread=no
3647         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3648         echo 'int main() { return 0; }' | cat > conftest.c
3649         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3650         if test $? -eq 0; then
3651                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3652                         ac_cv_have_dash_pthread=yes
3653                 case "$target_os" in
3654                 freebsd*)
3655 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3656                 ;;
3657                 *)
3658                             CFLAGS="$CFLAGS -pthread"
3659                             CXXFLAGS="$CXXFLAGS -pthread"
3660                 ;;
3661                 esac
3662                 fi
3663         fi
3664         rm -f conftest*
3665     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3667         dnl
3668         dnl See if -pthreads is supported.
3669         dnl
3670     ac_cv_have_dash_pthreads=no
3671     if test "$ac_cv_have_dash_pthread" = "no"; then
3672             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3673         echo 'int main() { return 0; }' | cat > conftest.c
3674             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3675         if test $? -eq 0; then
3676                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3677                             ac_cv_have_dash_pthreads=yes
3678                             CFLAGS="$CFLAGS -pthreads"
3679                             CXXFLAGS="$CXXFLAGS -pthreads"
3680                     fi
3681             fi
3682             rm -f conftest*
3683         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3684     fi
3686         case "$target" in
3687             *-*-freebsd*)
3688                         AC_DEFINE(_REENTRANT)
3689                         AC_DEFINE(_THREAD_SAFE)
3690                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3691                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3692                                 _PTHREAD_LDFLAGS="-pthread"
3693                         else
3694                                 _PTHREAD_LDFLAGS="-lc_r"
3695                         fi
3696                         ;;
3698             *-*-openbsd*|*-*-bsdi*)
3699                         AC_DEFINE(_REENTRANT)
3700                         AC_DEFINE(_THREAD_SAFE)
3701                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3702                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3703                 _PTHREAD_LDFLAGS="-pthread"
3704                         fi
3705                         ;;
3707             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3708                         AC_DEFINE(_REENTRANT) 
3709                         ;;
3711             *-*-nto*) 
3712                         AC_DEFINE(_REENTRANT) 
3713                         ;;
3715             *-aix4.3*|*-aix5*)
3716                         AC_DEFINE(_REENTRANT) 
3717                         ;;
3719             *-hpux11.*)
3720                         AC_DEFINE(_REENTRANT) 
3721                         ;;
3723             alpha*-*-osf*)
3724                         AC_DEFINE(_REENTRANT)
3725                         ;;
3727             *-*-solaris*) 
3728                         AC_DEFINE(_REENTRANT)
3729                         if test "$SOLARIS_SUNPRO_CC"; then
3730                                 CFLAGS="$CFLAGS -mt" 
3731                                 CXXFLAGS="$CXXFLAGS -mt" 
3732                         fi
3733                         ;;
3734         esac
3735     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3738 dnl ========================================================
3739 dnl See if mmap sees writes
3740 dnl For cross compiling, just define it as no, which is a safe default
3741 dnl ========================================================
3742 AC_MSG_CHECKING(whether mmap() sees write()s)
3744 changequote(,)
3745 mmap_test_prog='
3746     #include <stdlib.h>
3747     #include <unistd.h>
3748     #include <sys/mman.h>
3749     #include <sys/types.h>
3750     #include <sys/stat.h>
3751     #include <fcntl.h>
3753     char fname[] = "conftest.file";
3754     char zbuff[1024]; /* Fractional page is probably worst case */
3756     int main() {
3757         char *map;
3758         int fd;
3759         int i;
3760         unlink(fname);
3761         fd = open(fname, O_RDWR | O_CREAT, 0660);
3762         if(fd<0) return 1;
3763         unlink(fname);
3764         write(fd, zbuff, sizeof(zbuff));
3765         lseek(fd, 0, SEEK_SET);
3766         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3767         if(map==(char*)-1) return 2;
3768         for(i=0; fname[i]; i++) {
3769             int rc = write(fd, &fname[i], 1);
3770             if(map[i]!=fname[i]) return 4;
3771         }
3772         return 0;
3773     }
3775 changequote([,])
3777 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3779 AC_MSG_RESULT("$result")
3781 if test "$result" = "no"; then
3782     AC_DEFINE(MMAP_MISSES_WRITES)
3786 dnl Checks for library functions.
3787 dnl ========================================================
3788 AC_PROG_GCC_TRADITIONAL
3789 AC_FUNC_MEMCMP
3790 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3791 AC_CHECK_FUNCS(flockfile getpagesize)
3792 AC_CHECK_FUNCS(localtime_r strtok_r)
3794 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3795 _SAVE_LDFLAGS=$LDFLAGS
3796 LDFLAGS="$LDFLAGS -lrt"
3797 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3798                ac_cv_have_clock_monotonic,
3799                [AC_TRY_LINK([#include <time.h>],
3800                             [ struct timespec ts;
3801                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3802                             ac_cv_have_clock_monotonic=yes,
3803                             ac_cv_have_clock_monotonic=no)])
3804 LDFLAGS=$_SAVE_LDFLAGS
3805 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3806     HAVE_CLOCK_MONOTONIC=1
3807     REALTIME_LIBS=-lrt
3808     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3809     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3810     AC_SUBST(REALTIME_LIBS)
3813 dnl check for wcrtomb/mbrtowc
3814 dnl =======================================================================
3815 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3816 AC_LANG_SAVE
3817 AC_LANG_CPLUSPLUS
3818 AC_CACHE_CHECK(for wcrtomb,
3819     ac_cv_have_wcrtomb,
3820     [AC_TRY_LINK([#include <wchar.h>],
3821                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3822                  ac_cv_have_wcrtomb="yes",
3823                  ac_cv_have_wcrtomb="no")])
3824 if test "$ac_cv_have_wcrtomb" = "yes"; then
3825     AC_DEFINE(HAVE_WCRTOMB)
3827 AC_CACHE_CHECK(for mbrtowc,
3828     ac_cv_have_mbrtowc,
3829     [AC_TRY_LINK([#include <wchar.h>],
3830                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3831                  ac_cv_have_mbrtowc="yes",
3832                  ac_cv_have_mbrtowc="no")])
3833 if test "$ac_cv_have_mbrtowc" = "yes"; then
3834     AC_DEFINE(HAVE_MBRTOWC)
3836 AC_LANG_RESTORE
3839 AC_CACHE_CHECK(
3840     [for res_ninit()],
3841     ac_cv_func_res_ninit,
3842     [AC_TRY_LINK([
3843         #ifdef linux
3844         #define _BSD_SOURCE 1
3845         #endif
3846         #include <resolv.h>
3847         ],
3848         [int foo = res_ninit(&_res);],
3849         [ac_cv_func_res_ninit=yes],
3850         [ac_cv_func_res_ninit=no])
3851     ])
3853 if test "$ac_cv_func_res_ninit" = "yes"; then
3854     AC_DEFINE(HAVE_RES_NINIT)
3855 dnl must add the link line we do something as foolish as this... dougt
3856 dnl else
3857 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3858 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3861 AC_LANG_CPLUSPLUS
3862 AC_CACHE_CHECK(
3863     [for gnu_get_libc_version()],
3864     ac_cv_func_gnu_get_libc_version,
3865     [AC_TRY_LINK([
3866         #ifdef HAVE_GNU_LIBC_VERSION_H
3867         #include <gnu/libc-version.h>
3868         #endif
3869         ],
3870         [const char *glibc_version = gnu_get_libc_version();],
3871         [ac_cv_func_gnu_get_libc_version=yes],
3872         [ac_cv_func_gnu_get_libc_version=no] 
3873         )]
3874     )
3876 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3877     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3880 case $target_os in
3881     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3882         ;;
3883     *)
3884     
3885 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3886     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3887         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3888 _SAVE_LIBS=$LIBS
3889 LIBS="$LIBS $_ICONV_LIBS"
3890 AC_CACHE_CHECK(
3891     [for iconv()],
3892     ac_cv_func_iconv,
3893     [AC_TRY_LINK([
3894         #include <stdlib.h>
3895         #include <iconv.h>
3896         ],
3897         [
3898             iconv_t h = iconv_open("", "");
3899             iconv(h, NULL, NULL, NULL, NULL);
3900             iconv_close(h);
3901         ],
3902         [ac_cv_func_iconv=yes],
3903         [ac_cv_func_iconv=no] 
3904         )]
3905     )
3906 if test "$ac_cv_func_iconv" = "yes"; then
3907     AC_DEFINE(HAVE_ICONV)
3908     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3909     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3910     LIBICONV="$_ICONV_LIBS"
3911     AC_CACHE_CHECK(
3912         [for iconv() with const input],
3913         ac_cv_func_const_iconv,
3914         [AC_TRY_COMPILE([
3915             #include <stdlib.h>
3916             #include <iconv.h>
3917             ],
3918             [
3919                 const char *input = "testing";
3920                 iconv_t h = iconv_open("", "");
3921                 iconv(h, &input, NULL, NULL, NULL);
3922                 iconv_close(h);
3923             ],
3924             [ac_cv_func_const_iconv=yes],
3925             [ac_cv_func_const_iconv=no] 
3926             )]
3927         )
3928     if test "$ac_cv_func_const_iconv" = "yes"; then
3929         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3930     fi
3932 LIBS=$_SAVE_LIBS
3934     ;;
3935 esac
3937 AM_LANGINFO_CODESET
3939 AC_LANG_C
3941 dnl **********************
3942 dnl *** va_copy checks ***
3943 dnl **********************
3944 dnl we currently check for all three va_copy possibilities, so we get
3945 dnl all results in config.log for bug reports.
3946 AC_MSG_CHECKING(for an implementation of va_copy())
3947 AC_CACHE_VAL(ac_cv_va_copy,[
3948     AC_TRY_RUN([
3949         #include <stdarg.h>
3950         void f (int i, ...) {
3951             va_list args1, args2;
3952             va_start (args1, i);
3953             va_copy (args2, args1);
3954             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3955                 exit (1);
3956             va_end (args1); va_end (args2);
3957         }
3958         int main() { f (0, 42); return 0; }],
3959         ac_cv_va_copy=yes,
3960         ac_cv_va_copy=no,
3961         ac_cv_va_copy=no
3962     )
3964 AC_MSG_RESULT($ac_cv_va_copy)
3965 AC_MSG_CHECKING(for an implementation of __va_copy())
3966 AC_CACHE_VAL(ac_cv___va_copy,[
3967     AC_TRY_RUN([
3968         #include <stdarg.h>
3969         void f (int i, ...) {
3970             va_list args1, args2;
3971             va_start (args1, i);
3972             __va_copy (args2, args1);
3973             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3974                 exit (1);
3975             va_end (args1); va_end (args2);
3976         }
3977         int main() { f (0, 42); return 0; }],
3978         ac_cv___va_copy=yes,
3979         ac_cv___va_copy=no,
3980         ac_cv___va_copy=no
3981     )
3983 AC_MSG_RESULT($ac_cv___va_copy)
3984 AC_MSG_CHECKING(whether va_lists can be copied by value)
3985 AC_CACHE_VAL(ac_cv_va_val_copy,[
3986     AC_TRY_RUN([
3987         #include <stdarg.h>
3988         void f (int i, ...) {
3989             va_list args1, args2;
3990             va_start (args1, i);
3991             args2 = args1;
3992             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3993                 exit (1);
3994             va_end (args1); va_end (args2);
3995         }
3996         int main() { f (0, 42); return 0; }],
3997         ac_cv_va_val_copy=yes,
3998         ac_cv_va_val_copy=no,
3999         ac_cv_va_val_copy=yes
4000     )
4002 if test "x$ac_cv_va_copy" = "xyes"; then
4003     AC_DEFINE(VA_COPY, va_copy)
4004     AC_DEFINE(HAVE_VA_COPY)
4005 elif test "x$ac_cv___va_copy" = "xyes"; then
4006     AC_DEFINE(VA_COPY, __va_copy)
4007     AC_DEFINE(HAVE_VA_COPY)
4010 if test "x$ac_cv_va_val_copy" = "xno"; then
4011    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
4013 AC_MSG_RESULT($ac_cv_va_val_copy)
4015 dnl Check for dll-challenged libc's.
4016 dnl This check is apparently only needed for Linux.
4017 case "$target" in
4018         *-linux*)
4019             dnl ===================================================================
4020             _curdir=`pwd`
4021             export _curdir
4022             rm -rf conftest* _conftest
4023             mkdir _conftest
4024             cat >> conftest.C <<\EOF
4025 #include <stdio.h>
4026 #include <link.h>
4027 #include <dlfcn.h>
4028 #ifdef _dl_loaded
4029 void __dump_link_map(void) {
4030   struct link_map *map = _dl_loaded;
4031   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4033 int main() {
4034   dlopen("./conftest1.so",RTLD_LAZY);
4035   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4036   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4037   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4038   __dump_link_map();
4040 #else
4041 /* _dl_loaded isn't defined, so this should be either a libc5 (glibc1) system, or a glibc2 system that doesn't have the multiple load bug (i.e., RH6.0).*/
4042 int main() { printf("./conftest1.so\n"); }
4043 #endif
4046             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4048             cat >> conftest1.C <<\EOF
4049 #include <stdio.h>
4050 void foo(void) {printf("foo in dll called\n");}
4052             ${CXX-g++} -fPIC -c -g conftest1.C
4053             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4054             ${CXX-g++} -g conftest.C -o conftest -ldl
4055             cp -f conftest1.so conftest _conftest
4056             cd _conftest
4057             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4058             then
4059                 echo
4060                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4061                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4062                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4063                 echo "*** will be excessive memory usage at runtime."
4064                 echo
4065             fi
4066             cd ${_curdir}
4067             rm -rf conftest* _conftest
4068             dnl ===================================================================
4069             ;;
4070 esac
4072 dnl ===================================================================
4073 dnl ========================================================
4074 dnl Put your C++ language/feature checks below
4075 dnl ========================================================
4076 AC_LANG_CPLUSPLUS
4078 ARM_ABI_PREFIX=
4079 HAVE_GCC3_ABI=
4080 if test "$GNU_CC"; then
4081   if test "$CPU_ARCH" = "arm" ; then
4082     AC_CACHE_CHECK(for ARM EABI,
4083         ac_cv_gcc_arm_eabi,
4084         [AC_TRY_COMPILE([],
4085                         [
4086 #if defined(__ARM_EABI__)
4087   return 0;
4088 #else
4089 #error Not ARM EABI.
4090 #endif
4091                         ],
4092                         ac_cv_gcc_arm_eabi="yes",
4093                         ac_cv_gcc_arm_eabi="no")])
4094     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4095         HAVE_ARM_EABI=1
4096         ARM_ABI_PREFIX=eabi-
4097     else
4098         ARM_ABI_PREFIX=oabi-
4099     fi
4100   fi
4102   AC_CACHE_CHECK(for gcc 3.0 ABI,
4103       ac_cv_gcc_three_abi,
4104       [AC_TRY_COMPILE([],
4105                       [
4106 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4107   return 0;
4108 #else
4109 #error Not gcc3.
4110 #endif
4111                       ],
4112                       ac_cv_gcc_three_abi="yes",
4113                       ac_cv_gcc_three_abi="no")])
4114   if test "$ac_cv_gcc_three_abi" = "yes"; then
4115       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4116       HAVE_GCC3_ABI=1
4117   else
4118       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4119   fi
4121 AC_SUBST(HAVE_GCC3_ABI)
4124 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4125                ac_cv_cpp_explicit,
4126                [AC_TRY_COMPILE(class X {
4127                                public: explicit X(int i) : i_(i) {}
4128                                private: int i_;
4129                                };,
4130                                X x(3);,
4131                                ac_cv_cpp_explicit=yes,
4132                                ac_cv_cpp_explicit=no)])
4133 if test "$ac_cv_cpp_explicit" = yes ; then
4134    AC_DEFINE(HAVE_CPP_EXPLICIT)
4137 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4138                ac_cv_cpp_typename,
4139                [AC_TRY_COMPILE(class param {
4140                                public:
4141                                    typedef unsigned long num_type;
4142                                };
4144                                template <class T> class tplt {
4145                                public:
4146                                    typedef typename T::num_type t_num_type;
4147                                    t_num_type foo(typename T::num_type num) {
4148                                        return num;
4149                                    }
4150                                };,
4151                                tplt<param> A;
4152                                A.foo(0);,
4153                                ac_cv_cpp_typename=yes,
4154                                ac_cv_cpp_typename=no)])
4155 if test "$ac_cv_cpp_typename" = yes ; then
4156    AC_DEFINE(HAVE_CPP_TYPENAME)
4159 dnl Check for support of modern template specialization syntax
4160 dnl Test code and requirement from scc@netscape.com.
4161 dnl Autoconf cut-and-paste job by waterson@netscape.com
4162 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4163                ac_cv_cpp_modern_specialize_template_syntax,
4164                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4165                                class Y {};
4166                                template <> struct X<Y> { double a; };,
4167                                X<int> int_x;
4168                                X<Y> y_x;,
4169                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4170                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4171 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4172   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4176 dnl Some compilers support only full specialization, and some don't.
4177 AC_CACHE_CHECK(whether partial template specialization works,
4178                ac_cv_cpp_partial_specialization,
4179                [AC_TRY_COMPILE(template <class T> class Foo {};
4180                                template <class T> class Foo<T*> {};,
4181                                return 0;,
4182                                ac_cv_cpp_partial_specialization=yes,
4183                                ac_cv_cpp_partial_specialization=no)])
4184 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4185   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4188 dnl Some compilers have limited support for operators with templates;
4189 dnl specifically, it is necessary to define derived operators when a base
4190 dnl class's operator declaration should suffice.
4191 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4192                ac_cv_need_derived_template_operators,
4193                [AC_TRY_COMPILE([template <class T> class Base { };
4194                                 template <class T>
4195                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4196                                 template <class T> class Derived : public Base<T> { };],
4197                                [Derived<char> a, b;
4198                                 Base<char> c = a + b;
4199                                 return 0;],
4200                                ac_cv_need_derived_template_operators=no,
4201                                ac_cv_need_derived_template_operators=yes)])
4202 if test "$ac_cv_need_derived_template_operators" = yes ; then
4203   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4207 dnl Some compilers have trouble detecting that a template class
4208 dnl that derives from another template is actually an instance
4209 dnl of the base class. This test checks for that.
4210 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4211                ac_cv_need_cpp_template_cast_to_base,
4212                [AC_TRY_COMPILE([template <class T> class Base { };
4213                                 template <class T> class Derived : public Base<T> { };
4214                                 template <class T> int foo(const Base<T>&) { return 0; }],
4215                                [Derived<char> bar; return foo(bar);],
4216                                ac_cv_need_cpp_template_cast_to_base=no,
4217                                ac_cv_need_cpp_template_cast_to_base=yes)])
4218 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4219   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4222 dnl Some compilers have trouble resolving the ambiguity between two
4223 dnl functions whose arguments differ only by cv-qualifications.
4224 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4225                ac_cv_can_resolve_const_ambiguity,
4226                [AC_TRY_COMPILE([
4227                                 template <class T> class ptrClass {
4228                                   public: T* ptr;
4229                                 };
4231                                 template <class T> T* a(ptrClass<T> *arg) {
4232                                   return arg->ptr;
4233                                 }
4235                                 template <class T>
4236                                 const T* a(const ptrClass<T> *arg) {
4237                                   return arg->ptr;
4238                                 }
4239                                ],
4240                                [ ptrClass<int> i;
4241                                  a(&i); ],
4242                                ac_cv_can_resolve_const_ambiguity=yes,
4243                                ac_cv_can_resolve_const_ambiguity=no)])
4244 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4245   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4249 dnl We don't do exceptions on unix.  The only reason this used to be here
4250 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4251 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4252 dnl So im commenting this out until someone writes some artificial 
4253 dnl intelligence to detect not only if the compiler has exceptions, but if 
4254 dnl they are enabled as well.
4255 dnl 
4256 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4257 dnl                ac_cv_cpp_exceptions,
4258 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4259 dnl                                static void F() { throw X(); },
4260 dnl                                try { F(); } catch(X & e) { },
4261 dnl                                ac_cv_cpp_exceptions=yes,
4262 dnl                                ac_cv_cpp_exceptions=no)])
4263 dnl if test $ac_cv_cpp_exceptions = yes ; then
4264 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4265 dnl fi
4267 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4268 dnl supports it well enough to allow us to use it to change access, but not
4269 dnl to resolve ambiguity. The next two tests determine how well the |using|
4270 dnl keyword is supported.
4272 dnl Check to see if we can change access with |using|.  Test both a
4273 dnl legal and an illegal example.
4274 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4275                ac_cv_cpp_access_changing_using2,
4276                [AC_TRY_COMPILE(
4277                    class A { protected: int foo() { return 0; } };
4278                    class B : public A { public: using A::foo; };,
4279                    B b; return b.foo();,
4280                    [AC_TRY_COMPILE(
4281                        class A { public: int foo() { return 1; } };
4282                        class B : public A { private: using A::foo; };,
4283                        B b; return b.foo();,
4284                        ac_cv_cpp_access_changing_using2=no,
4285                        ac_cv_cpp_access_changing_using2=yes)],
4286                    ac_cv_cpp_access_changing_using2=no)])
4287 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4288    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4291 dnl Check to see if we can resolve ambiguity with |using|.
4292 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4293                ac_cv_cpp_ambiguity_resolving_using,
4294                [AC_TRY_COMPILE(class X { 
4295                                  public: int go(const X&) {return 3;}
4296                                          int jo(const X&) {return 3;}
4297                                };
4298                                class Y : public X {
4299                                  public:  int go(int) {return 2;}
4300                                           int jo(int) {return 2;}
4301                                           using X::jo;
4302                                  private: using X::go;
4303                                };,
4304                                X x; Y y; y.jo(x);,
4305                                ac_cv_cpp_ambiguity_resolving_using=yes,
4306                                ac_cv_cpp_ambiguity_resolving_using=no)])
4307 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4308    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4311 dnl Check to see if the |std| namespace is supported. If so, we'll want
4312 dnl to qualify any standard library calls with "std::" to ensure that
4313 dnl those functions can be resolved.
4314 AC_CACHE_CHECK(for \"std::\" namespace,
4315                ac_cv_cpp_namespace_std,
4316                [AC_TRY_COMPILE([#include <algorithm>],
4317                                [return std::min(0, 1);],
4318                                ac_cv_cpp_namespace_std=yes,
4319                                ac_cv_cpp_namespace_std=no)])
4320 if test "$ac_cv_cpp_namespace_std" = yes ; then
4321    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4324 dnl Older compilers are overly ambitious with respect to using the standard
4325 dnl template library's |operator!=()| when |operator==()| is defined. In
4326 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4327 dnl ambiguity at compile-time. This test checks for that case.
4328 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4329                ac_cv_cpp_unambiguous_std_notequal,
4330                [AC_TRY_COMPILE([#include <algorithm>
4331                                 struct T1 {};
4332                                 int operator==(const T1&, const T1&) { return 0; }
4333                                 int operator!=(const T1&, const T1&) { return 0; }],
4334                                [T1 a,b; return a != b;],
4335                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4336                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4337 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4338   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4342 AC_CACHE_CHECK(for C++ reinterpret_cast,
4343                ac_cv_cpp_reinterpret_cast,
4344                [AC_TRY_COMPILE(struct X { int i; };
4345                                struct Y { int i; };,
4346                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4347                                ac_cv_cpp_reinterpret_cast=yes,
4348                                ac_cv_cpp_reinterpret_cast=no)])
4349 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4350    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4353 dnl See if a dynamic_cast to void* gives the most derived object.
4354 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4355                ac_cv_cpp_dynamic_cast_void_ptr,
4356                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4357                             class Y { int j; public: virtual ~Y() { } };
4358                             class Z : public X, public Y { int k; };
4360                             int main() {
4361                                  Z mdo;
4362                                  X *subx = (X*)&mdo;
4363                                  Y *suby = (Y*)&mdo;
4364                                  return !((((void*)&mdo != (void*)subx) &&
4365                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4366                                           (((void*)&mdo != (void*)suby) &&
4367                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4368                             }],
4369                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4370                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4371                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4372 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4373    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4377 dnl note that this one is reversed - if the test fails, then
4378 dnl we require implementations of unused virtual methods. Which
4379 dnl really blows because it means we'll have useless vtable
4380 dnl bloat.
4381 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4382                ac_cv_cpp_unused_required,
4383                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4384                                X x;,
4385                                ac_cv_cpp_unused_required=no,
4386                                ac_cv_cpp_unused_required=yes)])
4387 if test "$ac_cv_cpp_unused_required" = yes ; then
4388    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4392 dnl Some compilers have trouble comparing a constant reference to a templatized
4393 dnl class to zero, and require an explicit operator==() to be defined that takes
4394 dnl an int. This test separates the strong from the weak.
4396 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4397                ac_cv_trouble_comparing_to_zero,
4398                [AC_TRY_COMPILE([#include <algorithm>
4399                                 template <class T> class Foo {};
4400                                 class T2;
4401                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4402                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4403                                [Foo<int> f; return (0 != f);],
4404                                ac_cv_trouble_comparing_to_zero=no,
4405                                ac_cv_trouble_comparing_to_zero=yes)])
4406 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4407   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4410 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4411 _SAVE_LDFLAGS=$LDFLAGS
4412 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4413 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4414                ac_cv_thread_keyword,
4415                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4416                             [return tlsIsMainThread;],
4417                             ac_cv_thread_keyword=yes,
4418                             ac_cv_thread_keyword=no)])
4419 LDFLAGS=$_SAVE_LDFLAGS
4420 if test "$ac_cv_thread_keyword" = yes; then
4421   # mips builds fail with TLS variables because of a binutils bug.
4422   # See bug 528687
4423   case "${target}" in
4424     mips*-*)
4425       :
4426       ;;
4427     *-android*)
4428       :
4429       ;;
4430     *)
4431       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4432       ;;
4433   esac
4436 dnl Check for the existence of various allocation headers/functions
4438 MALLOC_H=
4439 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4440 if test "$MALLOC_H" = ""; then
4441   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4442   if test "$MALLOC_H" = ""; then
4443     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4444   fi
4446 if test "$MALLOC_H" != ""; then
4447    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4450 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4451 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4453 dnl See if compiler supports some gcc-style attributes
4455 AC_CACHE_CHECK(for __attribute__((always_inline)),
4456                ac_cv_attribute_always_inline,
4457                [AC_TRY_COMPILE([],
4458                                [inline void f(void) __attribute__((always_inline));],
4459                                ac_cv_attribute_always_inline=yes,
4460                                ac_cv_attribute_always_inline=no)])
4462 AC_CACHE_CHECK(for __attribute__((malloc)),
4463                ac_cv_attribute_malloc,
4464                [AC_TRY_COMPILE([],
4465                                [void* f(int) __attribute__((malloc));],
4466                                ac_cv_attribute_malloc=yes,
4467                                ac_cv_attribute_malloc=no)])
4469 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4470                ac_cv_attribute_warn_unused,
4471                [AC_TRY_COMPILE([],
4472                                [int f(void) __attribute__((warn_unused_result));],
4473                                ac_cv_attribute_warn_unused=yes,
4474                                ac_cv_attribute_warn_unused=no)])
4476 AC_CACHE_CHECK(for __attribute__((noreturn)),
4477                ac_cv_attribute_noreturn,
4478                [AC_TRY_COMPILE([],
4479                                [void f(void) __attribute__((noreturn));],
4480                                ac_cv_attribute_noreturn=yes,
4481                                ac_cv_attribute_noreturn=no)])
4483 dnl End of C++ language/feature checks
4484 AC_LANG_C
4486 dnl ========================================================
4487 dnl =  Internationalization checks
4488 dnl ========================================================
4490 dnl Internationalization and Locale support is different
4491 dnl on various UNIX platforms.  Checks for specific i18n
4492 dnl features go here.
4494 dnl check for LC_MESSAGES
4495 AC_CACHE_CHECK(for LC_MESSAGES,
4496                 ac_cv_i18n_lc_messages,
4497                 [AC_TRY_COMPILE([#include <locale.h>],
4498                                 [int category = LC_MESSAGES;],
4499                                 ac_cv_i18n_lc_messages=yes,
4500                                 ac_cv_i18n_lc_messages=no)])
4501 if test "$ac_cv_i18n_lc_messages" = yes; then
4502    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4505 AC_HAVE_FUNCS(localeconv)
4507 fi # SKIP_COMPILER_CHECKS
4509 TARGET_XPCOM_ABI=
4510 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4511     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4514 dnl Mozilla specific options
4515 dnl ========================================================
4516 dnl The macros used for command line options
4517 dnl are defined in build/autoconf/altoptions.m4.
4519 dnl If the compiler supports these attributes, define them as
4520 dnl convenience macros.
4521 if test "$ac_cv_attribute_always_inline" = yes ; then
4522   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4523 else
4524   AC_DEFINE(NS_ALWAYS_INLINE,)
4527 if test "$ac_cv_attribute_malloc" = yes ; then
4528   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4529 else
4530   AC_DEFINE(NS_ATTR_MALLOC,)
4533 if test "$ac_cv_attribute_warn_unused" = yes ; then
4534   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4535 else
4536   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4539 if test "$ac_cv_attribute_noreturn" = yes ; then
4540   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4541 else
4542   AC_DEFINE(NS_NORETURN,)
4545 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4546 dnl features that Windows actually does support.
4548 if test -n "$SKIP_COMPILER_CHECKS"; then
4549    dnl Windows has malloc.h
4550    AC_DEFINE(MALLOC_H, [<malloc.h>])
4551    AC_DEFINE(HAVE_FORCEINLINE)
4552    AC_DEFINE(HAVE_LOCALECONV)
4553 fi # SKIP_COMPILER_CHECKS
4555 dnl ========================================================
4556 dnl =
4557 dnl = Check for external package dependencies
4558 dnl =
4559 dnl ========================================================
4560 MOZ_ARG_HEADER(External Packages)
4562 MOZ_ENABLE_LIBXUL=1
4564 MOZ_ARG_WITH_STRING(libxul-sdk,
4565 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4566   LIBXUL_SDK_DIR=$withval)
4568 if test "$LIBXUL_SDK_DIR" = "yes"; then
4569     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4570 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4571     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4573     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4574         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4575     fi
4577     MOZ_ENABLE_LIBXUL=1
4579 AC_SUBST(LIBXUL_SDK)
4581 if test -n "$LIBXUL_SDK"; then
4582     LIBXUL_DIST="$LIBXUL_SDK"
4583 else
4584     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4586 AC_SUBST(LIBXUL_DIST)
4588 SYSTEM_LIBXUL=
4590 MOZ_ARG_WITH_BOOL(system-libxul,
4591 [  --with-system-libxul    Use system installed libxul SDK],
4592     SYSTEM_LIBXUL=1)
4594 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4595     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4598 dnl ========================================================
4599 dnl = If NSPR was not detected in the system, 
4600 dnl = use the one in the source tree (mozilla/nsprpub)
4601 dnl ========================================================
4602 MOZ_ARG_WITH_BOOL(system-nspr,
4603 [  --with-system-nspr      Use system installed NSPR],
4604     _USE_SYSTEM_NSPR=1 )
4606 if test -n "$_USE_SYSTEM_NSPR"; then
4607     AM_PATH_NSPR(4.8.7, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4610 if test -n "$MOZ_NATIVE_NSPR"; then
4611     _SAVE_CFLAGS=$CFLAGS
4612     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4613     AC_TRY_COMPILE([#include "prtypes.h"],
4614                 [#ifndef PR_STATIC_ASSERT
4615                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4616                  #endif],
4617                 [MOZ_NATIVE_NSPR=1],
4618                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4619     CFLAGS=$_SAVE_CFLAGS
4620 else
4621     if test "$OS_ARCH" = "WINCE"; then
4622         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4623         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4624     elif test "$OS_ARCH" = "WINNT"; then
4625         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4626         if test -n "$GNU_CC"; then
4627             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4628         else
4629             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4630         fi
4631     else
4632         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4633         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4634     fi
4637 dnl system libevent Support
4638 dnl ========================================================
4639 MOZ_ARG_WITH_STRING(system-libevent,
4640 [  --with-system-libevent=[PFX]
4641                           Use system libevent [installed at prefix PFX]],
4642     LIBEVENT_DIR=$withval)
4644 _SAVE_CFLAGS=$CFLAGS
4645 _SAVE_LDFLAGS=$LDFLAGS
4646 _SAVE_LIBS=$LIBS
4647 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4648     MOZ_NATIVE_LIBEVENT=
4649 else
4650     if test "${LIBEVENT_DIR}" = "yes"; then
4651         LIBEVENT_DIR=/usr
4652     fi
4653     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4654     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4655     AC_CHECK_HEADER(event.h,
4656                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4657                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4658                      fi],
4659                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4660     AC_CHECK_LIB(event, event_init,
4661                  [MOZ_NATIVE_LIBEVENT=1
4662                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4663                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4664                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4666 CFLAGS=$_SAVE_CFLAGS
4667 LDFLAGS=$_SAVE_LDFLAGS
4668 LIBS=$_SAVE_LIBS
4670 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4671 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4672 AC_SUBST(MOZ_LIBEVENT_LIBS)
4674 dnl ========================================================
4675 dnl = If NSS was not detected in the system, 
4676 dnl = use the one in the source tree (mozilla/security/nss)
4677 dnl ========================================================
4679 MOZ_ARG_WITH_BOOL(system-nss,
4680 [  --with-system-nss       Use system installed NSS],
4681     _USE_SYSTEM_NSS=1 )
4683 if test -n "$_USE_SYSTEM_NSS"; then
4684     AM_PATH_NSS(3.12.9, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4687 if test -n "$MOZ_NATIVE_NSS"; then
4688    NSS_LIBS="$NSS_LIBS -lcrmf"
4689 else
4690    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4691    NSS_DEP_LIBS="\
4692         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4693         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4694         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4695         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4696         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4698    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4699        NSS_LIBS="\
4700         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4701         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4702         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4703         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4704         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4705    else
4706        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4707    fi
4710 dnl ======================
4711 dnl Detect yasm
4712 dnl ======================
4714 AC_MSG_CHECKING([for YASM assembler])
4715 AC_CHECK_PROGS(YASM, yasm, "")
4717 if test -n "$YASM"; then
4718   dnl Pull out yasm's version string
4719   changequote(,)
4720   _YASM_VER_FILTER='s|.* \([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\).*|\1|p'
4721   changequote([,])
4723   YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4724   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4725   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4726   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4727   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4730 if test -z "$SKIP_LIBRARY_CHECKS"; then
4731 dnl system JPEG support
4732 dnl ========================================================
4733 MOZ_ARG_WITH_STRING(system-jpeg,
4734 [  --with-system-jpeg[=PFX]
4735                           Use system libjpeg [installed at prefix PFX]],
4736     JPEG_DIR=$withval)
4738 _SAVE_CFLAGS=$CFLAGS
4739 _SAVE_LDFLAGS=$LDFLAGS
4740 _SAVE_LIBS=$LIBS
4741 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4742     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4743     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4745 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4746     SYSTEM_JPEG=
4747 else
4748     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4751 if test "$SYSTEM_JPEG" = 1; then
4752     LIBS="$JPEG_LIBS $LIBS"
4753     AC_TRY_COMPILE([ #include <stdio.h>
4754                      #include <sys/types.h>
4755                      #include <jpeglib.h> ],
4756                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4757                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4758                      #endif ],
4759                    SYSTEM_JPEG=1,
4760                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4761 fi 
4762 CFLAGS=$_SAVE_CFLAGS
4763 LDFLAGS=$_SAVE_LDFLAGS
4764 LIBS=$_SAVE_LIBS
4766 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4767     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4768     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4771 dnl system ZLIB support
4772 dnl ========================================================
4773 MOZ_ARG_WITH_STRING(system-zlib,
4774 [  --with-system-zlib[=PFX]
4775                           Use system libz [installed at prefix PFX]],
4776     ZLIB_DIR=$withval)
4778 _SAVE_CFLAGS=$CFLAGS
4779 _SAVE_LDFLAGS=$LDFLAGS
4780 _SAVE_LIBS=$LIBS
4781 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4782     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4783     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4785 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4786     SYSTEM_ZLIB=
4787 else
4788     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4789         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4791 if test "$SYSTEM_ZLIB" = 1; then
4792     LIBS="$ZLIB_LIBS $LIBS"
4793     AC_TRY_COMPILE([ #include <stdio.h>
4794                      #include <string.h>
4795                      #include <zlib.h> ],
4796                    [ #if ZLIB_VERNUM < $MOZZLIB 
4797                      #error "Insufficient zlib version ($MOZZLIB required)."
4798                      #endif ],
4799                    SYSTEM_ZLIB=1,
4800                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4802 CFLAGS=$_SAVE_CFLAGS
4803 LDFLAGS=$_SAVE_LDFLAGS
4804 LIBS=$_SAVE_LIBS
4806 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4807     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4808     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4811 dnl system BZIP2 Support
4812 dnl ========================================================
4813 MOZ_ARG_WITH_STRING(system-bz2,
4814 [  --with-system-bz2[=PFX]
4815                           Use system libbz2 [installed at prefix PFX]],
4816     BZ2_DIR=$withval)
4818 _SAVE_CFLAGS=$CFLAGS
4819 _SAVE_LDFLAGS=$LDFLAGS
4820 _SAVE_LIBS=$LIBS
4821 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4822     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4823     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4825 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4826     SYSTEM_BZ2=
4827 else
4828     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4829         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4831 CFLAGS=$_SAVE_CFLAGS
4832 LDFLAGS=$_SAVE_LDFLAGS
4833 LIBS=$_SAVE_LIBS
4835 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4836     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4837     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4840 dnl system PNG Support
4841 dnl ========================================================
4842 MOZ_ARG_WITH_STRING(system-png, 
4843 [  --with-system-png[=PFX]
4844                           Use system libpng [installed at prefix PFX]],
4845     PNG_DIR=$withval)
4847 _SAVE_CFLAGS=$CFLAGS
4848 _SAVE_LDFLAGS=$LDFLAGS
4849 _SAVE_LIBS=$LIBS
4850 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4851 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4852 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4853     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4854     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4856 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4857     SYSTEM_PNG=
4858 else
4859     _SAVE_PNG_LIBS=$PNG_LIBS
4860     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4861                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4862                  $PNG_LIBS)
4863     AC_CHECK_LIB(png, png_get_acTL, ,
4864                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4865                  $_SAVE_PNG_LIBS)
4867 if test "$SYSTEM_PNG" = 1; then
4868     LIBS="$PNG_LIBS $LIBS"
4869     AC_TRY_COMPILE([ #include <stdio.h>
4870                      #include <sys/types.h>
4871                      #include <png.h> ],
4872                    [ #if PNG_LIBPNG_VER < $MOZPNG
4873                      #error "Insufficient libpng version ($MOZPNG required)."
4874                      #endif
4875                      #ifndef PNG_UINT_31_MAX
4876                      #error "Insufficient libpng version."
4877                      #endif ],
4878                    SYSTEM_PNG=1,
4879                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4881 CFLAGS=$_SAVE_CFLAGS
4882 LDFLAGS=$_SAVE_LDFLAGS
4883 LIBS=$_SAVE_LIBS
4885 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4886     PNG_CFLAGS="-I${PNG_DIR}/include"
4887     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4890 fi # SKIP_LIBRARY_CHECKS
4892 dnl system HunSpell Support
4893 dnl ========================================================
4894 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4895 [  --enable-system-hunspell
4896                           Use system hunspell (located with pkgconfig)],
4897     SYSTEM_HUNSPELL=1 )
4899 if test -n "$SYSTEM_HUNSPELL"; then
4900     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4903 AC_SUBST(SYSTEM_HUNSPELL)
4905 dnl ========================================================
4906 dnl Java SDK support
4907 dnl ========================================================
4908 JAVA_INCLUDE_PATH=
4909 MOZ_ARG_WITH_STRING(java-include-path,
4910 [  --with-java-include-path=dir
4911                           Location of Java SDK headers],
4912     JAVA_INCLUDE_PATH=$withval)
4914 JAVA_BIN_PATH=
4915 MOZ_ARG_WITH_STRING(java-bin-path,
4916 [  --with-java-bin-path=dir
4917                           Location of Java binaries (java, javac, jar)],
4918     JAVA_BIN_PATH=$withval)
4920 dnl ========================================================
4921 dnl =
4922 dnl = Application
4923 dnl =
4924 dnl ========================================================
4926 MOZ_ARG_HEADER(Application)
4928 BUILD_STATIC_LIBS=
4929 ENABLE_TESTS=1
4930 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4931 MOZ_BRANDING_DIRECTORY=
4932 MOZ_OFFICIAL_BRANDING=
4933 MOZ_FEEDS=1
4934 MOZ_INSTALLER=1
4935 MOZ_IPC=1
4936 MOZ_JAVAXPCOM=
4937 MOZ_JSDEBUGGER=1
4938 MOZ_JSLOADER=1
4939 MOZ_MATHML=1
4940 MOZ_MORK=
4941 MOZ_MORKREADER=1
4942 MOZ_AUTH_EXTENSION=1
4943 MOZ_NO_ACTIVEX_SUPPORT=1
4944 MOZ_NO_FAST_LOAD=
4945 MOZ_OGG=1
4946 MOZ_RAW=
4947 MOZ_SYDNEYAUDIO=
4948 MOZ_VORBIS=
4949 MOZ_TREMOR=
4950 MOZ_WAVE=1
4951 MOZ_MEDIA=
4952 MOZ_WEBM=1
4953 VPX_AS=
4954 VPX_ASFLAGS=
4955 VPX_AS_DASH_C_FLAG=
4956 VPX_AS_CONVERSION=
4957 VPX_ASM_SUFFIX=
4958 VPX_X86_ASM=
4959 VPX_ARM_ASM=
4960 MOZ_PANGO=1
4961 MOZ_PERMISSIONS=1
4962 MOZ_PLACES=1
4963 MOZ_PLAINTEXT_EDITOR_ONLY=
4964 MOZ_PLUGINS=1
4965 MOZ_PREF_EXTENSIONS=1
4966 MOZ_PROFILELOCKING=1
4967 MOZ_PSM=1
4968 MOZ_RDF=1
4969 MOZ_REFLOW_PERF=
4970 MOZ_SAFE_BROWSING=
4971 MOZ_FASTSTART=
4972 MOZ_HELP_VIEWER=
4973 MOZ_SPELLCHECK=1
4974 MOZ_SPLASHSCREEN=
4975 MOZ_STORAGE=1
4976 MOZ_SVG=1
4977 MOZ_THUMB2=
4978 MOZ_TIMELINE=
4979 MOZ_TOOLKIT_SEARCH=1
4980 MOZ_UI_LOCALE=en-US
4981 MOZ_UNIVERSALCHARDET=1
4982 MOZ_URL_CLASSIFIER=
4983 MOZ_USE_NATIVE_UCONV=
4984 MOZ_VIEW_SOURCE=1
4985 MOZ_XSLT_STANDALONE=
4986 MOZ_XTF=1
4987 MOZ_XUL=1
4988 MOZ_ZIPWRITER=1
4989 NS_PRINTING=1
4990 MOZ_PDF_PRINTING=
4991 MOZ_DISABLE_DOMCRYPTO=
4992 NSS_DISABLE_DBM=
4993 NECKO_WIFI=1
4994 NECKO_COOKIES=1
4995 NECKO_DISK_CACHE=1
4996 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource wyciwyg"
4997 USE_ARM_KUSER=
4998 BUILD_CTYPES=1
4999 XPC_IDISPATCH_SUPPORT=
5002 case "${target}" in
5003 *android*|*darwin*|*wince*|*winmo*)
5004     ACCESSIBILITY=
5005     ;;
5007     ACCESSIBILITY=1
5008     ;;
5009 esac
5011 case "$target_os" in
5012     msvc*|mks*|cygwin*|mingw*)
5013         NS_ENABLE_TSF=1
5014         if test -z "$GNU_CC"; then 
5015             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
5016                 NS_ENABLE_TSF=
5017             fi
5018         fi
5019         if test -n "$NS_ENABLE_TSF"; then
5020             AC_DEFINE(NS_ENABLE_TSF)
5021         fi
5022         ;;
5023 esac
5025 case "${target}" in
5026     arm-android-eabi)
5027         NSS_DISABLE_DBM=1
5028         USE_ARM_KUSER=1
5029         MOZ_INSTALLER=
5030         NECKO_WIFI=
5031         MOZ_THUMB2=1
5032         MOZ_THEME_FASTSTRIPE=1
5033         MOZ_TREE_FREETYPE=1
5034         MOZ_MEMORY=1
5035         ;;
5036 esac
5038 MOZ_ARG_ENABLE_STRING(application,
5039 [  --enable-application=APP
5040                           Options include:
5041                             browser (Firefox)
5042                             xulrunner
5043                             content/xslt (Standalone Transformiix XSLT)
5044                             netwerk (Standalone Necko)
5045                             tools/update-packaging (AUS-related packaging tools)
5046                             standalone (use this for standalone
5047                               xpcom/xpconnect or to manually drive a build)],
5048 [ MOZ_BUILD_APP=$enableval ] )
5050 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5051 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
5052   XULRUNNER_STUB_NAME=$withval)
5054 if test -z "$XULRUNNER_STUB_NAME"; then
5055   case "$target_os" in
5056   darwin*)
5057     XULRUNNER_STUB_NAME=xulrunner
5058     ;;
5059   *)
5060     XULRUNNER_STUB_NAME=xulrunner-stub
5061   esac
5063 AC_SUBST(XULRUNNER_STUB_NAME)
5065 if test -z "$MOZ_BUILD_APP"; then
5066   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5067 else
5068   # We have a valid application only if it has a build.mk file in its top
5069   # directory.
5070   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5071     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5072   fi
5075 # Allow the application to influence configure with a confvars.sh script.
5077 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5078 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5079   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5080   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5081 else
5082   AC_MSG_RESULT([no])
5085 # Now is a good time to test for logic errors, define mismatches, etc.
5086 case "$MOZ_BUILD_APP" in
5087 xulrunner)
5088   if test "$LIBXUL_SDK"; then
5089     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5090   fi
5091   ;;
5092 esac
5094 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5095 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5096 # MOZ_BUILD_APP.
5097 case "$MOZ_BUILD_APP" in
5098 browser)
5099   AC_DEFINE(MOZ_PHOENIX)
5100   ;;
5102 xulrunner)
5103   AC_DEFINE(MOZ_XULRUNNER)
5104   ;;
5106 content/xslt)
5107   AC_DEFINE(TX_EXE)
5108   ;;
5110 standalone) 
5111   MOZ_APP_NAME=mozilla
5112   MOZ_APP_DISPLAYNAME=Mozilla
5113   MOZ_APP_VERSION=$MOZILLA_VERSION
5114   ;;
5116 esac
5118 AC_SUBST(MOZ_BUILD_APP)
5119 AC_SUBST(MOZ_PHOENIX)
5120 AC_SUBST(MOZ_XULRUNNER)
5122 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5124 dnl ========================================================
5125 dnl = 
5126 dnl = Toolkit Options
5127 dnl = 
5128 dnl ========================================================
5129 MOZ_ARG_HEADER(Toolkit Options)
5131     dnl ========================================================
5132     dnl = Select the default toolkit
5133     dnl ========================================================
5134         MOZ_ARG_ENABLE_STRING(default-toolkit,
5135         [  --enable-default-toolkit=TK
5136                           Select default toolkit
5137                           Platform specific defaults:
5138                             BeOS - cairo-beos
5139                             Mac OS X - cairo-cocoa
5140                             Neutrino/QNX - photon
5141                             OS/2 - cairo-os2
5142                             Win32/WinCE - cairo-windows
5143                             Gtk2 with DirectFB - cairo-gtk2-dfb
5144                             * - cairo-gtk2
5145                             * - cairo-qt],
5146     [ _DEFAULT_TOOLKIT=$enableval ],
5147     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5149     if test "$_DEFAULT_TOOLKIT" = "photon" \
5150         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5151         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5152         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5153         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5154         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5155         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5156         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5157         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5158         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5159     then
5160         dnl nglayout only supports building with one toolkit,
5161         dnl so ignore everything after the first comma (",").
5162         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5163     else
5164         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5165     fi
5167 dnl ========================================================
5168 dnl = Enable the toolkit as needed                         =
5169 dnl ========================================================
5171 case "$MOZ_WIDGET_TOOLKIT" in
5172 photon)
5173         MOZ_ENABLE_PHOTON=1
5174         AC_DEFINE(MOZ_WIDGET_PHOTON)
5175     ;;
5177 cairo-windows)
5178     MOZ_WIDGET_TOOLKIT=windows
5179     MOZ_WEBGL=1
5180     case "${target}" in
5181     *-wince*)
5182         NS_PRINTING=
5183         ;;
5184     esac
5185     MOZ_PDF_PRINTING=1
5186     ;;
5188 cairo-gtk2|cairo-gtk2-x11)
5189     MOZ_WIDGET_TOOLKIT=gtk2
5190     MOZ_ENABLE_GTK2=1
5191     MOZ_ENABLE_XREMOTE=1
5192     MOZ_WEBGL=1
5193     MOZ_WEBGL_GLX=1
5195     AC_DEFINE(MOZ_X11)
5196     MOZ_X11=1
5197     USE_FC_FREETYPE=1
5199     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5200     TK_LIBS='$(MOZ_GTK2_LIBS)'
5201     AC_DEFINE(MOZ_WIDGET_GTK2)
5202     MOZ_PDF_PRINTING=1
5203     ;;
5205 cairo-gtk2-dfb)
5206     MOZ_WIDGET_TOOLKIT=gtk2
5207     MOZ_ENABLE_GTK2=1
5208     MOZ_WEBGL=
5210     AC_DEFINE(MOZ_DFB)
5211     MOZ_DFB=1
5213     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5214     TK_LIBS='$(MOZ_GTK2_LIBS)'
5215     AC_DEFINE(MOZ_WIDGET_GTK2)
5216     if test "$no_x" != "yes"; then
5217         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5218         no_x=yes
5219     fi
5220     MOZ_PDF_PRINTING=1
5221     ;;
5223 cairo-qt)
5224     MOZ_WIDGET_TOOLKIT=qt
5225     MOZ_ENABLE_QT=1
5226     MOZ_ENABLE_XREMOTE=1
5227     MOZ_WEBGL=1
5228     MOZ_WEBGL_GLX=1
5229     USE_ELF_DYNSTR_GC=
5231     AC_DEFINE(MOZ_X11)
5232     MOZ_X11=1
5233     USE_FC_FREETYPE=1
5235     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5236     TK_LIBS='$(MOZ_QT_LIBS)'
5237     AC_DEFINE(MOZ_WIDGET_QT)
5238     MOZ_PDF_PRINTING=1
5239     ;;
5241 cairo-beos)
5242     MOZ_WIDGET_TOOLKIT=beos
5243     USE_FC_FREETYPE=1
5244     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5245     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5246     ;;
5248 cairo-os2)
5249     MOZ_WIDGET_TOOLKIT=os2
5250     USE_FC_FREETYPE=1
5251     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5252     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5253     MOZ_PDF_PRINTING=1
5254     ;;
5256 cairo-cocoa)
5257     MOZ_WIDGET_TOOLKIT=cocoa
5258     AC_DEFINE(MOZ_WIDGET_COCOA)
5259     MOZ_USER_DIR="Mozilla"
5260     AC_DEFINE(XP_MACOSX)
5261     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5262     TK_CFLAGS="-DNO_X11"
5263     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5264     CFLAGS="$CFLAGS $TK_CFLAGS"
5265     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5266     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5267     MOZ_FS_LAYOUT=bundle
5268     MOZ_WEBGL=1
5269     ;;
5271 cairo-android)
5272     AC_DEFINE(MOZ_WIDGET_ANDROID)
5273     MOZ_WIDGET_TOOLKIT=android
5274     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5275     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5276     MOZ_WEBGL=1
5277     MOZ_PDF_PRINTING=1
5278     ;;
5280 esac
5282 AC_SUBST(MOZ_PDF_PRINTING)
5283 if test "$MOZ_PDF_PRINTING"; then
5284    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
5285    AC_DEFINE(MOZ_PDF_PRINTING)
5288 if test "$MOZ_ENABLE_XREMOTE"; then
5289     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5292 if test "$COMPILE_ENVIRONMENT"; then
5293   if test "$MOZ_ENABLE_GTK2"; then
5294     if test "$MOZ_X11"; then
5295       GDK_PACKAGES=gdk-x11-2.0
5296     elif test "$MOZ_DFB"; then
5297       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5298       GDK_PACKAGES=directfb
5299     fi
5301     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5302   fi
5304 fi # COMPILE_ENVIRONMENT
5306 AC_SUBST(MOZ_FS_LAYOUT)
5308 dnl ========================================================
5309 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5310 dnl their usage and use them in spidermonkey.
5311 dnl ========================================================
5312 MOZ_ARG_WITH_BOOL(arm-kuser,
5313 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5314     USE_ARM_KUSER=1,)
5315 if test -n "$USE_ARM_KUSER"; then
5316    AC_DEFINE(USE_ARM_KUSER)
5319 dnl ========================================================
5320 dnl = startup-notification support module
5321 dnl ========================================================
5323 if test "$MOZ_ENABLE_GTK2"
5324 then
5325     MOZ_ENABLE_STARTUP_NOTIFICATION=
5327     MOZ_ARG_ENABLE_BOOL(startup-notification,
5328     [  --enable-startup-notification
5329                           Enable startup-notification support (default: disabled) ],
5330         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5331         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5332     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5333     then
5334         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5335                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5336         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5337             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5338             then
5339                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5340             fi
5341             MOZ_ENABLE_STARTUP_NOTIFICATION=
5342         ])
5343     fi
5345     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5346         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5347     fi
5349     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5351 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5352 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5353 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5355 dnl ========================================================
5356 dnl = QT support
5357 dnl ========================================================
5358 if test "$MOZ_ENABLE_QT"
5359 then
5360     MOZ_ARG_WITH_STRING(qtdir,
5361     [  --with-qtdir=\$dir       Specify Qt directory ],
5362     [ QTDIR=$withval])
5364     if test -z "$QTDIR"; then
5365         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5366         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5367     else
5368         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5370         MOZ_QT_CFLAGS="-DQT_SHARED"
5371         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5372         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5373         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5374         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5375         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5376         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5377         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5378         HOST_MOC="$QTDIR/bin/moc"
5379     fi
5380     if test -z "$HOST_MOC"; then
5381         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5382 incorrect])
5383     fi
5384     MOC=$HOST_MOC
5386     MOZ_ENABLE_QTNETWORK=
5387     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5388                       MOZ_ENABLE_QTNETWORK=1,
5389                       MOZ_ENABLE_QTNETWORK=)
5391     if test "$MOZ_ENABLE_QTNETWORK"; then
5392       MOZ_ENABLE_QTNETWORK=1
5393       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5394     fi
5397 AC_SUBST(GTK_CONFIG)
5398 AC_SUBST(TK_CFLAGS)
5399 AC_SUBST(TK_LIBS)
5401 AC_SUBST(MOZ_ENABLE_GTK2)
5402 AC_SUBST(MOZ_ENABLE_PHOTON)
5403 AC_SUBST(MOZ_ENABLE_QT)
5404 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5405 AC_SUBST(MOZ_ENABLE_XREMOTE)
5406 AC_SUBST(MOZ_GTK2_CFLAGS)
5407 AC_SUBST(MOZ_GTK2_LIBS)
5408 AC_SUBST(MOZ_QT_CFLAGS)
5409 AC_SUBST(MOZ_QT_LIBS)
5410 AC_SUBST(MOZ_ENABLE_MEEGOTOUCH)
5412 AC_SUBST(MOC)
5414 AC_SUBST(MOZ_DFB)
5415 AC_SUBST(MOZ_X11)
5417 dnl ========================================================
5418 dnl =
5419 dnl = Components & Features
5420 dnl = 
5421 dnl ========================================================
5422 MOZ_ARG_HEADER(Components and Features)
5424 dnl ========================================================
5425 dnl = Localization
5426 dnl ========================================================
5427 MOZ_ARG_ENABLE_STRING(ui-locale,
5428 [  --enable-ui-locale=ab-CD
5429                           Select the user interface locale (default: en-US)],
5430     MOZ_UI_LOCALE=$enableval )
5431 AC_SUBST(MOZ_UI_LOCALE)
5433 dnl ========================================================
5434 dnl = Trademarked Branding 
5435 dnl ========================================================
5436 MOZ_ARG_ENABLE_BOOL(official-branding,
5437 [  --enable-official-branding
5438                           Enable Official mozilla.org Branding
5439                           Do not distribute builds with
5440                           --enable-official-branding unless you have
5441                           permission to use trademarks per
5442                           http://www.mozilla.org/foundation/trademarks/ .],
5444   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5445     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5446   else
5447     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5448     MOZ_OFFICIAL_BRANDING=1
5449   fi
5450 ], MOZ_OFFICIAL_BRANDING=)
5452 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5453 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5454   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5457 MOZ_ARG_WITH_STRING(branding,
5458 [  --with-branding=dir     Use branding from the specified directory.],
5459     MOZ_BRANDING_DIRECTORY=$withval)
5461 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5462 if test -z "$REAL_BRANDING_DIRECTORY"; then
5463   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5466 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5467   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5470 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5472 dnl ========================================================
5473 dnl = Distribution ID
5474 dnl ========================================================
5475 MOZ_ARG_WITH_STRING(distribution-id,
5476 [  --with-distribution-id=ID
5477                           Set distribution-specific id (default=org.mozilla)],
5478 [ val=`echo $withval`
5479     MOZ_DISTRIBUTION_ID="$val"])
5481 if test -z "$MOZ_DISTRIBUTION_ID"; then
5482    MOZ_DISTRIBUTION_ID="org.mozilla"
5485 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5486 AC_SUBST(MOZ_DISTRIBUTION_ID)
5489 dnl ========================================================
5490 dnl complex text support off by default
5491 dnl ========================================================
5492 MOZ_ARG_DISABLE_BOOL(pango,
5493 [  --disable-pango         Disable usage of Pango ],
5494     MOZ_PANGO=,
5495     MOZ_PANGO=1)
5497 dnl ========================================================
5498 dnl = Pango
5499 dnl ========================================================
5500 if test "$MOZ_ENABLE_GTK2"
5501 then
5502     AC_SUBST(MOZ_PANGO)
5504     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5506     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5507     AC_SUBST(MOZ_PANGO_CFLAGS)
5508     AC_SUBST(MOZ_PANGO_LIBS)
5509     if test "$MOZ_PANGO"
5510     then
5511         AC_DEFINE(MOZ_PANGO)
5512     else
5513         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5514         AC_SUBST(FT2_CFLAGS)
5515         AC_SUBST(FT2_LIBS)
5516     fi
5519 if test "$MOZ_ENABLE_QT"
5520 then
5521     if test "$MOZ_PANGO"
5522     then
5523         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5524         [
5525             AC_SUBST(MOZ_PANGO_CFLAGS)
5526             AC_SUBST(MOZ_PANGO_LIBS)
5527             AC_DEFINE(MOZ_PANGO)
5528         ],
5529         [
5530             echo "Pango library not found, will use FT2 font engine"
5531             MOZ_PANGO=
5532         ])
5533     fi
5534     AC_SUBST(MOZ_PANGO)
5537 dnl ========================================================
5538 dnl = GnomeVFS, GIO and GConf support module
5539 dnl ========================================================
5541 if test "$MOZ_X11"
5542 then
5543     dnl build the gnomevfs extension by default only when the
5544     dnl GTK2 toolkit is in use.
5545     if test "$MOZ_ENABLE_GTK2"
5546     then
5547         MOZ_ENABLE_GNOMEVFS=1
5548         MOZ_ENABLE_GCONF=1
5549     fi
5551     dnl ========================================================
5552     dnl = GnomeVFS support module
5553     dnl ========================================================
5554     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5555     [  --disable-gnomevfs      Disable GnomeVFS support ],
5556         MOZ_ENABLE_GNOMEVFS=,
5557         MOZ_ENABLE_GNOMEVFS=force)
5559     if test "$MOZ_ENABLE_GNOMEVFS"
5560     then
5561         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5562             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5563             MOZ_ENABLE_GNOMEVFS=1
5564             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5565         ],[
5566             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5567             then
5568                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5569             fi
5570             MOZ_ENABLE_GNOMEVFS=
5571         ])
5572     else
5573         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5574             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5575               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5576             ])
5577         fi
5578     fi
5580     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5581     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5582     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5584     dnl ========================================================
5585     dnl = GIO support module
5586     dnl ========================================================
5587     MOZ_ARG_ENABLE_BOOL(gio,
5588     [  --enable-gio            Enable GIO support (default: disabled)],
5589         MOZ_ENABLE_GIO=force,
5590         MOZ_ENABLE_GIO=)
5592     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5593     then
5594         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5595             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5596             MOZ_ENABLE_GIO=1
5597             AC_DEFINE(MOZ_ENABLE_GIO)
5598         ],[
5599             if test "$MOZ_ENABLE_GIO" = "force"
5600             then
5601                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5602             fi
5603             MOZ_ENABLE_GIO=
5604         ])
5605     fi
5607     AC_SUBST(MOZ_ENABLE_GIO)
5608     AC_SUBST(MOZ_GIO_CFLAGS)
5609     AC_SUBST(MOZ_GIO_LIBS)
5610    
5611     dnl ========================================================
5612     dnl = GConf support module
5613     dnl ========================================================
5614     if test "$MOZ_ENABLE_GCONF"
5615     then
5616         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5617             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5618             MOZ_ENABLE_GCONF=1
5619         ],[
5620             if test "$MOZ_ENABLE_GCONF" = "force"
5621             then
5622                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5623             fi
5624             MOZ_ENABLE_GCONF=
5625         ])
5626     fi
5628     if test "$MOZ_ENABLE_GCONF"; then
5629         AC_DEFINE(MOZ_ENABLE_GCONF)
5630     fi
5632     AC_SUBST(MOZ_ENABLE_GCONF)
5633     AC_SUBST(MOZ_GCONF_CFLAGS)
5634     AC_SUBST(MOZ_GCONF_LIBS)
5637 dnl ========================================================
5638 dnl = libproxy support
5639 dnl ========================================================
5641 if test "$MOZ_ENABLE_GTK2"
5642 then
5643     MOZ_ENABLE_LIBPROXY=
5645     MOZ_ARG_ENABLE_BOOL(libproxy,
5646     [  --enable-libproxy         Enable libproxy support ],
5647     MOZ_ENABLE_LIBPROXY=1,
5648     MOZ_ENABLE_LIBPROXY=)
5650     if test "$MOZ_ENABLE_LIBPROXY"
5651     then
5652         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5653         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5654     fi
5656 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5657 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5658 AC_SUBST(MOZ_LIBPROXY_LIBS)
5660 dnl ========================================================
5661 dnl = libnotify support
5662 dnl ========================================================
5664 if test "$MOZ_ENABLE_GTK2"
5665 then
5666     MOZ_ENABLE_LIBNOTIFY=1
5668     MOZ_ARG_DISABLE_BOOL(libnotify,
5669     [  --disable-libnotify     Disable libnotify support ],
5670     MOZ_ENABLE_LIBNOTIFY=,
5671     MOZ_ENABLE_LIBNOTIFY=1)
5673     if test "$MOZ_ENABLE_LIBNOTIFY"
5674     then
5675         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5676     fi
5679 if test -z "$SKIP_LIBRARY_CHECKS"
5680 then
5681     if test "$MOZ_ENABLE_GTK2"
5682     then
5683         if test "$MOZ_ENABLE_LIBNOTIFY"
5684         then
5685             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5686         fi
5687     fi
5689 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5690 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5691 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5693 dnl ========================================================
5694 dnl = GNOME component (mozgnome)
5695 dnl ========================================================
5697 # The GNOME component is built if one of 
5698 # gnome-vfs, gio, gconf or libnotify is available.
5699 if test "$MOZ_ENABLE_GCONF" -o \
5700    "$MOZ_ENABLE_GNOMEVFS" -o \
5701    "$MOZ_ENABLE_GIO" -o \
5702    "$MOZ_ENABLE_LIBNOTIFY"; then
5703     MOZ_ENABLE_GNOME_COMPONENT=1
5704 else
5705     MOZ_ENABLE_GNOME_COMPONENT=
5707 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5709 dnl ========================================================
5710 dnl = libgnomeui support module
5711 dnl ========================================================
5713 if test "$MOZ_ENABLE_GTK2"
5714 then
5715     MOZ_ENABLE_GNOMEUI=1
5717     MOZ_ARG_DISABLE_BOOL(gnomeui,
5718     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5719         MOZ_ENABLE_GNOMEUI=,
5720         MOZ_ENABLE_GNOMEUI=force)
5722     if test "$MOZ_ENABLE_GNOMEUI"
5723     then
5724         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5725         [
5726             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5727             MOZ_ENABLE_GNOMEUI=1
5728         ],[
5729             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5730             then
5731                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5732             fi
5733             MOZ_ENABLE_GNOMEUI=
5734         ])
5735     fi
5737     if test "$MOZ_ENABLE_GNOMEUI"; then
5738         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5739     fi
5742 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5743 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5744 AC_SUBST(MOZ_GNOMEUI_LIBS)
5746 dnl ========================================================
5747 dnl = dbus support
5748 dnl ========================================================
5750 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5751 then
5752     MOZ_ENABLE_DBUS=1
5754     MOZ_ARG_DISABLE_BOOL(dbus,
5755     [  --disable-dbus          Disable dbus support ],
5756         MOZ_ENABLE_DBUS=,
5757         MOZ_ENABLE_DBUS=1)
5759     if test "$MOZ_ENABLE_DBUS"
5760     then
5761         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5762         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5763         AC_DEFINE(MOZ_ENABLE_DBUS)
5764     fi
5766 AC_SUBST(MOZ_ENABLE_DBUS)
5767 AC_SUBST(MOZ_DBUS_CFLAGS)
5768 AC_SUBST(MOZ_DBUS_LIBS)
5769 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5770 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5772 dnl ========================================================
5773 dnl = Build Personal Security Manager
5774 dnl ========================================================
5775 MOZ_ARG_DISABLE_BOOL(crypto,
5776 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5777     MOZ_PSM=,
5778     MOZ_PSM=1 )
5780 dnl ========================================================
5781 dnl = JS Debugger XPCOM component (js/jsd)
5782 dnl ========================================================
5783 MOZ_ARG_DISABLE_BOOL(jsd,
5784 [  --disable-jsd           Disable JavaScript debug library],
5785     MOZ_JSDEBUGGER=,
5786     MOZ_JSDEBUGGER=1)
5789 dnl ========================================================
5790 dnl = Disable IPC support for tabs and plugins
5791 dnl ========================================================
5792 MOZ_ARG_DISABLE_BOOL(ipc,
5793 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5794     MOZ_IPC=,
5795     MOZ_IPC=1)
5797 if test -n "$MOZ_IPC"; then
5798     AC_DEFINE(MOZ_IPC)
5801 AC_SUBST(MOZ_IPC)
5803 dnl ========================================================
5804 dnl = Enable IPDL's "expensive" unit tests
5805 dnl ========================================================
5806 MOZ_IPDL_TESTS=
5808 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5809 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5810     MOZ_IPDL_TESTS=1,
5811     MOZ_IPDL_TESTS=)
5813 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5814     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5817 if test -n "$MOZ_IPDL_TESTS"; then
5818     AC_DEFINE(MOZ_IPDL_TESTS)
5821 AC_SUBST(MOZ_IPDL_TESTS)
5823 dnl ========================================================
5824 dnl = Disable plugin support
5825 dnl ========================================================
5826 MOZ_ARG_DISABLE_BOOL(plugins,
5827 [  --disable-plugins       Disable plugins support],
5828     MOZ_PLUGINS=,
5829     MOZ_PLUGINS=1)
5831 dnl ========================================================
5832 dnl = Disable building dbm
5833 dnl ========================================================
5834 MOZ_ARG_DISABLE_BOOL(dbm,
5835 [  --disable-dbm           Disable building dbm],
5836     NSS_DISABLE_DBM=1,
5837     NSS_DISABLE_DBM=)
5839 dnl bi-directional support always on
5840 IBMBIDI=1
5841 AC_DEFINE(IBMBIDI)
5843 dnl ========================================================
5844 dnl view source support on by default
5845 dnl ========================================================
5846 if test "$MOZ_VIEW_SOURCE"; then
5847     AC_DEFINE(MOZ_VIEW_SOURCE)
5850 dnl ========================================================
5851 dnl accessibility support on by default on all platforms 
5852 dnl except OS X.
5853 dnl ========================================================
5854 MOZ_ARG_DISABLE_BOOL(accessibility,
5855 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5856     ACCESSIBILITY=,
5857     ACCESSIBILITY=1 )
5858 if test "$ACCESSIBILITY"; then
5859     AC_DEFINE(ACCESSIBILITY)
5862 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5863 case "$target" in
5864 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5865     if test "$ac_cv_header_atlbase_h" = "no"; then
5866         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
5867     fi
5868     if test "$ac_cv_header_oleacc_idl" = "no"; then
5869         AC_MSG_ERROR([System header oleacc.idl is not available. See http://developer.mozilla.org/en/docs/oleacc.idl for details on fixing this problem.])
5870     fi
5871     ;;
5872 esac
5875 dnl ========================================================
5876 dnl xpcom js loader support on by default
5877 dnl ========================================================
5878 if test "$MOZ_JSLOADER"; then
5879     AC_DEFINE(MOZ_JSLOADER)
5882 dnl ========================================================
5883 dnl Disable printing
5884 dnl ========================================================
5885 MOZ_ARG_DISABLE_BOOL(printing,
5886 [  --disable-printing      Disable printing support],
5887     NS_PRINTING=,
5888     NS_PRINTING=1)
5890 if test "$NS_PRINTING"; then
5891     AC_DEFINE(NS_PRINTING)
5892     AC_DEFINE(NS_PRINT_PREVIEW)
5894 dnl ========================================================
5895 dnl use native unicode converters
5896 dnl ========================================================
5897 MOZ_ARG_ENABLE_BOOL(native-uconv,
5898 [  --enable-native-uconv   Enable iconv support],
5899     MOZ_USE_NATIVE_UCONV=1,
5900     MOZ_USE_NATIVE_UCONV= )
5901 if test "$MOZ_USE_NATIVE_UCONV"; then
5902     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5904 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5905     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5909 dnl ========================================================
5910 dnl Libeditor can be build as plaintext-only,
5911 dnl or as a full html and text editing component.
5912 dnl We build both by default.
5913 dnl ========================================================
5914 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5915 [  --enable-plaintext-editor-only
5916                           Allow only plaintext editing],
5917     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5918     MOZ_PLAINTEXT_EDITOR_ONLY= )
5919 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5920 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5922 dnl ========================================================
5923 dnl = Disable Fast Load
5924 dnl ========================================================
5925 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5926 [  --disable-xpcom-fastload
5927                           Disable XPCOM fastload support],
5928     MOZ_NO_FAST_LOAD=1,
5929     MOZ_NO_FAST_LOAD=)
5931 AC_SUBST(MOZ_NO_FAST_LOAD)
5933 if test -n "$MOZ_NO_FAST_LOAD"; then
5934     AC_DEFINE(MOZ_NO_FAST_LOAD)
5937 dnl ========================================================
5938 dnl = Enable Raw Codecs
5939 dnl ========================================================
5940 MOZ_ARG_ENABLE_BOOL(raw,
5941 [  --enable-raw           Enable support for RAW media],
5942     MOZ_RAW=1,
5943     MOZ_RAW=)
5945 if test -n "$MOZ_RAW"; then
5946     AC_DEFINE(MOZ_RAW)
5947     MOZ_MEDIA=1
5950 AC_SUBST(MOZ_RAW)
5952 dnl ========================================================
5953 dnl = Disable Ogg Codecs
5954 dnl ========================================================
5955 MOZ_ARG_DISABLE_BOOL(ogg,
5956 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5957     MOZ_OGG=,
5958     MOZ_OGG=1)
5960 if test -n "$MOZ_OGG"; then
5961     AC_DEFINE(MOZ_OGG)
5962     MOZ_SYDNEYAUDIO=1
5963     MOZ_MEDIA=1
5964     case "$target_cpu" in
5965     arm*)
5966         MOZ_TREMOR=1
5967     ;;
5968     *)
5969         MOZ_VORBIS=1
5970     ;;
5971     esac
5973     dnl Checks for __attribute__(aligned()) directive
5974     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5975         [ac_cv_c_attribute_aligned],
5976         [ac_cv_c_attribute_aligned=0
5977          CFLAGS_save="${CFLAGS}"
5978          CFLAGS="${CFLAGS} -Werror"
5979          for ac_cv_c_attr_align_try in 64 32 16 8; do
5980            echo "trying $ac_cv_c_attr_align_try"
5981            AC_TRY_COMPILE([],
5982                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5983                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5984            if test "$ac_cv_c_attribute_aligned" != 0; then
5985              break;
5986            fi
5987          done
5988            CFLAGS="${CFLAGS_save}"])
5989     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5990       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5991                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5992     fi
5995 dnl ========================================================
5996 dnl = Disable VP8 decoder support
5997 dnl ========================================================
5998 MOZ_ARG_DISABLE_BOOL(webm,
5999 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
6000     MOZ_WEBM=,
6001     MOZ_WEBM=1)
6003 dnl system libvpx Support
6004 dnl ========================================================
6005 MOZ_ARG_WITH_STRING(system-libvpx,
6006 [  --with-system-libvpx=[PFX]
6007                           Use system libvpx [installed at prefix PFX]],
6008     LIBVPX_DIR=$withval)
6010 MOZ_NATIVE_LIBVPX=
6011 MOZ_LIBVPX_INCLUDES=
6012 MOZ_LIBVPX_LIBS=
6014 if test -n "$MOZ_WEBM"; then
6015     AC_DEFINE(MOZ_WEBM)
6017     if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
6018         _SAVE_CFLAGS=$CFLAGS
6019         _SAVE_LDFLAGS=$LDFLAGS
6020         _SAVE_LIBS=$LIBS
6021         if test "${LIBVPX_DIR}" = "yes"; then
6022             LIBVPX_DIR=/usr
6023         fi
6024         CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
6025         LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
6026         AC_CHECK_HEADER(vpx/vpx_decoder.h,
6027                         [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
6028                              AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
6029                          fi],
6030                         AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
6031         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
6032                      [MOZ_NATIVE_LIBVPX=1
6033                       MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
6034                       MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
6035                      ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
6036         CFLAGS=$_SAVE_CFLAGS
6037         LDFLAGS=$_SAVE_LDFLAGS
6038         LIBS=$_SAVE_LIBS
6039     fi
6042 AC_SUBST(MOZ_NATIVE_LIBVPX)
6043 AC_SUBST(MOZ_LIBVPX_INCLUDES)
6044 AC_SUBST(MOZ_LIBVPX_LIBS)
6046 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
6047     MOZ_SYDNEYAUDIO=1
6048     MOZ_MEDIA=1
6049     case "$target_cpu" in
6050     arm*)
6051         MOZ_TREMOR=1
6052     ;;
6053     *)
6054         MOZ_VORBIS=1
6055     ;;
6056     esac
6059     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
6060     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
6061     dnl We currently require gcc on all arm platforms.
6062     VPX_AS=$YASM
6063     VPX_ASM_SUFFIX=asm
6065     dnl See if we have assembly on this platform.  
6066     case "$OS_ARCH:$CPU_ARCH" in
6067     Linux:x86)
6068       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6069       VPX_X86_ASM=1
6070     ;;
6071     Linux:x86_64)
6072       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6073       VPX_X86_ASM=1
6074     ;;
6075     SunOS:x86)
6076       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6077       VPX_X86_ASM=1
6078     ;;
6079     SunOS:x86_64)
6080       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6081       VPX_X86_ASM=1
6082     ;;
6083     Darwin:x86)
6084       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
6085       VPX_X86_ASM=1
6086     ;;
6087     Darwin:x86_64)
6088       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
6089       VPX_X86_ASM=1
6090     ;;
6091     WINNT:x86_64)
6092       if test -z "$GNU_CC"; then
6093         VPX_ASFLAGS="-f x64 -rnasm -pnasm"
6094         VPX_X86_ASM=1
6095       fi
6096     ;;
6097     WINNT:x86)
6098       if test -z "$GNU_CC"; then
6099         dnl Check for yasm 1.1 or greater.
6100         if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
6101           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.])
6102         elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6103           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.])
6104         else
6105           VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
6106           VPX_X86_ASM=1
6107         fi
6108       fi
6109     ;;
6110     *:arm*)
6111       if test -n "$GNU_AS" ; then
6112         VPX_AS=$AS
6113         dnl These flags are a lie; they're just used to enable the requisite
6114         dnl opcodes; actual arch detection is done at runtime.
6115         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
6116         VPX_DASH_C_FLAG="-c"
6117         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
6118         VPX_ASM_SUFFIX="$ASM_SUFFIX"
6119         VPX_ARM_ASM=1
6120       fi
6121     esac
6123     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
6124       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.])
6125     fi
6127     if test -n "$VPX_X86_ASM"; then
6128       AC_DEFINE(VPX_X86_ASM)
6129     elif test -n "$VPX_ARM_ASM"; then
6130       AC_DEFINE(VPX_ARM_ASM)
6131     else
6132       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
6133     fi
6136 dnl ========================================================
6137 dnl = Disable Wave decoder support
6138 dnl ========================================================
6139 MOZ_ARG_DISABLE_BOOL(wave,
6140 [  --disable-wave          Disable Wave decoder support],
6141     MOZ_WAVE=,
6142     MOZ_WAVE=1)
6144 if test -n "$MOZ_WAVE"; then
6145     AC_DEFINE(MOZ_WAVE)
6146     MOZ_SYDNEYAUDIO=1
6147     MOZ_MEDIA=1
6150 dnl ========================================================
6151 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
6152 dnl ========================================================
6154 if test -n "$MOZ_SYDNEYAUDIO"; then
6155     AC_DEFINE(MOZ_SYDNEYAUDIO)
6158 if test -n "$MOZ_MEDIA"; then
6159     AC_DEFINE(MOZ_MEDIA)
6162 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
6163     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/])
6166 if test -n "$MOZ_VORBIS"; then
6167     AC_DEFINE(MOZ_VORBIS)
6170 if test -n "$MOZ_TREMOR"; then
6171     AC_DEFINE(MOZ_TREMOR)
6174 dnl ========================================================
6175 dnl = Check alsa availability on Linux if using sydneyaudio
6176 dnl ========================================================
6178 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6179 if test -n "$MOZ_SYDNEYAUDIO"; then
6180    case "$target_os" in
6181 linux*)
6182       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6183          [echo "$MOZ_ALSA_PKG_ERRORS"
6184           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.)])])
6185       ;;
6186    esac
6189 dnl ========================================================
6190 dnl Splashscreen
6191 dnl ========================================================
6192 AC_ARG_ENABLE(splashscreen,
6193               [  --enable-splashscreen   display splashscreen while loading (default=no)],
6194               [enable_splash="yes"],[enable_splash=""])
6195 if test "x$enable_splash" = "xyes"; then
6196   MOZ_SPLASHSCREEN=1
6197   AC_DEFINE(MOZ_SPLASHSCREEN)
6199 AC_SUBST(MOZ_SPLASHSCREEN)
6201 dnl ========================================================
6202 dnl Permissions System
6203 dnl ========================================================
6204 MOZ_ARG_DISABLE_BOOL(permissions,
6205 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6206     MOZ_PERMISSIONS=,
6207     MOZ_PERMISSIONS=1
6210 dnl ========================================================
6211 dnl NegotiateAuth
6212 dnl ========================================================
6213 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6214 [  --disable-negotiateauth Disable GSS-API negotiation ],
6215     MOZ_AUTH_EXTENSION=,
6216     MOZ_AUTH_EXTENSION=1 )
6218 dnl ========================================================
6219 dnl XTF
6220 dnl ========================================================
6221 MOZ_ARG_DISABLE_BOOL(xtf,
6222 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6223     MOZ_XTF=,
6224     MOZ_XTF=1 )
6225 if test "$MOZ_XTF"; then
6226   AC_DEFINE(MOZ_XTF)
6229 dnl ========================================================
6230 dnl Pref extensions (autoconfig and system-pref)
6231 dnl ========================================================
6232 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6233 [  --disable-pref-extensions
6234                           Disable pref extensions such as autoconfig and
6235                           system-pref],
6236   MOZ_PREF_EXTENSIONS=,
6237   MOZ_PREF_EXTENSIONS=1 )
6239 dnl ========================================================
6240 dnl = Universalchardet
6241 dnl ========================================================
6242 MOZ_ARG_DISABLE_BOOL(universalchardet,
6243 [  --disable-universalchardet
6244                           Disable universal encoding detection],
6245   MOZ_UNIVERSALCHARDET=,
6246   MOZ_UNIVERSALCHARDET=1 )
6248 dnl ========================================================
6249 dnl JavaXPCOM
6250 dnl ========================================================
6251 case "${target}" in
6252 *-wince*)
6253     MOZ_JAVAXPCOM=
6254     ;;
6255 esac
6257 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6258 [  --enable-javaxpcom
6259                           Enable Java-XPCOM bridge],
6260     MOZ_JAVAXPCOM=1,
6261     MOZ_JAVAXPCOM=)
6263 case "$host_os" in
6264   cygwin*|msvc*|mks*)
6265     if test -n "$JAVA_HOME"; then
6266       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6267     fi
6268     ;;
6269   *mingw*)
6270     if test -n "$JAVA_HOME"; then
6271       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6272     fi
6273     ;;
6274 esac
6276 if test -n "${JAVA_BIN_PATH}"; then
6277   dnl Look for javac and jar in the specified path.
6278   JAVA_PATH="$JAVA_BIN_PATH"
6279 else
6280   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6281   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6284 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6285 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6286 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6288 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6289   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6290     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}])
6291   fi
6294 if test -n "${MOZ_JAVAXPCOM}"; then
6295   if test -n "${JAVA_INCLUDE_PATH}"; then
6296     dnl Make sure jni.h exists in the given include path.
6297     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6298       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6299     fi
6300   else
6301     case "$target_os" in
6302       darwin*)
6303         dnl Default to java system location
6304         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6305         ;;
6306       *)
6307         dnl Try $JAVA_HOME
6308         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6309         ;;
6310     esac
6311     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6312       AC_MSG_ERROR([The header jni.h was not found.  Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
6313     fi
6314   fi
6317 dnl ========================================================
6318 dnl = ANGLE OpenGL->D3D translator for WebGL
6319 dnl = * only applies to win32
6320 dnl = * enabled by default (shipping build); requires explicit --disable to disable
6321 dnl ========================================================
6322 MOZ_ANGLE=
6323 MOZ_DIRECTX_SDK_PATH=
6324 case "$target_os" in
6325     *msvc*|*mks*|*cygwin*|*mingw*)
6326         MOZ_ANGLE=1
6327         ;;
6328 esac
6330 if test -n "$MOZ_ANGLE"; then
6331 MOZ_ARG_DISABLE_BOOL(angle,
6332 [  --disable-angle     Disable building of ANGLE for WebGL->D3D translation],
6333     MOZ_ANGLE=,
6334     MOZ_ANGLE=1)
6336 if test -n "$MOZ_ANGLE"; then
6337   if test -z "$_WIN32_MSVC"; then
6338     AC_MSG_ERROR([Building ANGLE requires MSVC.  To build without ANGLE, reconfigure with --disable-angle.])
6339   fi
6341   AC_CHECK_HEADER(d3dx9.h, [], [MOZ_ANGLE=])
6343   if test -z "$MOZ_ANGLE"; then
6344     # Try again, but try to get the SDK path from the registry.  We're going to hardcode
6345     # the February 2010 SDK, since that's the one that's installed on the tinderboxen.
6346     MOZ_DIRECTX_SDK_PATH=`reg query 'HKLM\Software\Microsoft\DirectX\Microsoft DirectX SDK (February 2010)' //v InstallPath | grep REG_SZ | sed 's,  *, ,g' | cut -d' ' -f4`
6347     if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6348       if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/x86/dxguid.lib ; then
6349         AC_MSG_WARN([Found DirectX SDK in registry, using $MOZ_DIRECTX_SDK])
6350         MOZ_ANGLE=1
6351       fi
6352     fi
6353   fi
6355   if test -z "$MOZ_ANGLE"; then
6356     AC_MSG_WARN([Couldn't find d3dx9.h in your INCLUDE path, needed for ANGLE.  Please install the February 2010 DirectX SDK, or make another version available in your LIB and INCLUDE path env variables.  To explicitly build without ANGLE, reconfigure with --disable-angle.])
6357     AC_MSG_WARN([This will become an error in the future.])
6358   fi
6362 dnl ========================================================
6363 dnl = Breakpad crash reporting (on by default on supported platforms)
6364 dnl ========================================================
6366 case $target in
6367 i?86-*-mingw*|x86_64-*-mingw*)
6368   MOZ_CRASHREPORTER=1
6369   ;;
6370 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6371   MOZ_CRASHREPORTER=1
6372   ;;
6373 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6374   MOZ_CRASHREPORTER=1
6375   ;;
6376 arm-android-eabi)
6377   MOZ_CRASHREPORTER=1
6378   ;;
6379 *solaris*)
6380   MOZ_CRASHREPORTER=1
6381   ;;
6382 esac
6384 MOZ_ARG_DISABLE_BOOL(crashreporter,
6385 [  --disable-crashreporter Disable breakpad crash reporting],
6386     MOZ_CRASHREPORTER=,
6387     MOZ_CRASHREPORTER=1)
6389 if test -n "$MOZ_CRASHREPORTER"; then
6390    AC_DEFINE(MOZ_CRASHREPORTER)
6392   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6393     test -z "$SKIP_LIBRARY_CHECKS"; then
6394     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6395     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6396     AC_SUBST(MOZ_GTHREAD_LIBS)
6398     AC_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.])])
6399   fi
6402 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6403 [  --with-crashreporter-enable-percent=NN
6404                           Enable sending crash reports by default on NN% of users. (default=100)],
6405 [ val=`echo $withval | sed 's/[^0-9]//g'`
6406     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6408 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6409    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6411 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6413 dnl ========================================================
6414 dnl = Enable compilation of specific extension modules
6415 dnl ========================================================
6417 MOZ_ARG_ENABLE_STRING(extensions,
6418 [  --enable-extensions     Enable extensions],
6419 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6420     if test "$option" = "yes" -o "$option" = "all"; then
6421         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6422     elif test "$option" = "no" -o "$option" = "none"; then
6423         MOZ_EXTENSIONS=""
6424     elif test "$option" = "default"; then
6425         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6426     elif test `echo "$option" | grep -c \^-` != 0; then
6427         option=`echo $option | sed 's/^-//'`
6428         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6429     else
6430         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6431     fi
6432 done],
6433     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6435 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6436     # Suppress warning on non-X11 platforms
6437     if test -n "$MOZ_X11"; then
6438         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6439     fi
6440     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6443 dnl Do not build gnomevfs with libxul based apps
6444 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6445     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6448 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6449     # Suppress warning on non-X11 platforms
6450     if test -n "$MOZ_X11"; then
6451         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6452     fi
6453     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6456 dnl Do not build gio with libxul based apps
6457 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6458     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6461 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6462     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6463     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6466 dnl This might be temporary: build tridentprofile only on Windows
6467 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6468     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6469     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6472 dnl cookie must be built before tridentprofile. put it at list's end.
6473 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6474   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6475   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6478 dnl xforms requires xtf
6479 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6480     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6481     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6484 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6485     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6486     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6489 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6490     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6491     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6494 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6495     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6496     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6499 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6500     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6501     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6504 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6505     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6506     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6509 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6510     AC_MSG_WARN([spellcheck is no longer an extension.])
6511     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6514 dnl Remove dupes
6515 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6517 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6518 dnl when trying to build a nonexistent extension.
6519 for extension in $MOZ_EXTENSIONS; do
6520     if test ! -d "${srcdir}/extensions/${extension}"; then
6521         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6522     fi
6523 done
6525 dnl ========================================================
6526 dnl MathML on by default
6527 dnl ========================================================
6528 MOZ_ARG_DISABLE_BOOL(mathml,
6529 [  --disable-mathml        Disable MathML support],
6530     MOZ_MATHML=,
6531     MOZ_MATHML=1 )
6532 if test "$MOZ_MATHML"; then
6533   AC_DEFINE(MOZ_MATHML)
6536 dnl ========================================================
6537 dnl Keeping AC_DEFINE(MOZ_SVG) for the moment in case of something needs it.
6538 dnl ========================================================
6539 AC_DEFINE(MOZ_SVG)
6541 dnl ========================================================
6542 dnl SMIL
6543 dnl ========================================================
6544 MOZ_SMIL=1
6545 MOZ_ARG_DISABLE_BOOL(smil,
6546 [  --disable-smil          Disable SMIL animation support],
6547     MOZ_SMIL=,
6548     MOZ_SMIL=1 )
6549 if test -n "$MOZ_SMIL"; then
6550   AC_DEFINE(MOZ_SMIL)
6553 dnl ========================================================
6554 dnl Build Freetype in the tree
6555 dnl ========================================================
6556 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6557 [  --enable-tree-freetype  Enable Tree FreeType],
6558     MOZ_TREE_FREETYPE=1,
6559     MOZ_TREE_FREETYPE= )
6560 if test -n "$MOZ_TREE_FREETYPE"; then
6561    if test -n "$_WIN32_MSVC"; then
6562       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6563    fi
6564    AC_DEFINE(MOZ_TREE_FREETYPE)
6565    AC_SUBST(MOZ_TREE_FREETYPE)
6566    MOZ_ENABLE_CAIRO_FT=1       
6567    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6568    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6569    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6570    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6571    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6572    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6573    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6574    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6575    AC_SUBST(CAIRO_FT_CFLAGS)
6579 dnl ========================================================
6580 dnl Installer
6581 dnl ========================================================
6582 case "$target_os" in
6583     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6584         MOZ_INSTALLER=1
6585         ;;
6586 esac
6588 MOZ_ARG_DISABLE_BOOL(installer,
6589 [  --disable-installer     Disable building of installer],
6590     MOZ_INSTALLER=,
6591     MOZ_INSTALLER=1)
6592 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6593     # Disable installer for Windows builds that use the new toolkit if the
6594     # required major version and minimum minor version of Unicode NSIS isn't in
6595     # the path.
6596     REQ_NSIS_MAJOR_VER=2
6597     MIN_NSIS_MINOR_VER=33
6598     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6599     if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6600         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. To build without the installer reconfigure using --disable-installer.])
6601     fi
6602     changequote(,)
6603     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6604     changequote([,])
6605     if test ! "$MAKENSISU_VER" = ""; then
6606         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6607         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6608     fi
6609     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6610     if test "$MAKENSISU_VER" = "" ||
6611        test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6612             ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6613         AC_MSG_RESULT([no])
6614         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. To build without the installer reconfigure using --disable-installer.])
6615     fi
6616     AC_MSG_RESULT([yes])
6617     MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6620 AC_SUBST(MOZ_INSTALLER)
6622 AC_MSG_CHECKING([for tar archiver])
6623 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6624 if test -z "$TAR"; then
6625     AC_MSG_ERROR([no tar archiver found in \$PATH])
6627 AC_MSG_RESULT([$TAR])
6628 AC_SUBST(TAR)
6630 AC_MSG_CHECKING([for wget])
6631 AC_CHECK_PROGS(WGET, wget, "")
6632 AC_MSG_RESULT([$WGET])
6633 AC_SUBST(WGET)
6635 dnl ========================================================
6636 dnl Updater
6637 dnl ========================================================
6639 MOZ_ARG_DISABLE_BOOL(updater,
6640 [  --disable-updater       Disable building of updater],
6641     MOZ_UPDATER=,
6642     MOZ_UPDATER=1 )
6644 if test -n "$MOZ_UPDATER"; then
6645     AC_DEFINE(MOZ_UPDATER)
6648 # app update channel is 'default' when not supplied.
6649 MOZ_ARG_ENABLE_STRING([update-channel],
6650 [  --enable-update-channel=CHANNEL
6651                           Select application update channel (default=default)],
6652     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6654 if test -z "$MOZ_UPDATE_CHANNEL"; then
6655     MOZ_UPDATE_CHANNEL=default
6657 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6658 AC_SUBST(MOZ_UPDATE_CHANNEL)
6660 # tools/update-packaging is not checked out by default.
6661 MOZ_ARG_ENABLE_BOOL(update-packaging,
6662 [  --enable-update-packaging
6663                           Enable tools/update-packaging],
6664     MOZ_UPDATE_PACKAGING=1,
6665     MOZ_UPDATE_PACKAGING= )
6666 AC_SUBST(MOZ_UPDATE_PACKAGING)
6668 dnl ========================================================
6669 dnl ActiveX
6670 dnl ========================================================
6672 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6673 [  --disable-xpconnect-idispatch
6674                           Disable building of xpconnect support for IDispatch
6675                           (win32 only)],
6676     XPC_IDISPATCH_SUPPORT=,
6677     XPC_IDISPATCH_SUPPORT=1)
6678 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6680 MOZ_ARG_DISABLE_BOOL(activex,
6681 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6682     MOZ_NO_ACTIVEX_SUPPORT=1,
6683     MOZ_NO_ACTIVEX_SUPPORT= )
6684 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6686 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6687 [  --enable-activex-scripting
6688                           Enable building of ActiveX scripting support (win32)],
6689     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6690     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6691 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6693 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6694 then
6695     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6698 if test "$COMPILE_ENVIRONMENT" = "1"; then
6699 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6700 case "$target" in
6701 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6702     if test "$ac_cv_header_atlbase_h" = "no"; then
6703         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
6704     fi
6705     ;;
6706 esac
6710 dnl ========================================================
6711 dnl leaky
6712 dnl ========================================================
6713 MOZ_ARG_ENABLE_BOOL(leaky,
6714 [  --enable-leaky          Build leaky memory tool],
6715     MOZ_LEAKY=1,
6716     MOZ_LEAKY=)
6719 dnl ========================================================
6720 dnl build the tests by default
6721 dnl ========================================================
6722 MOZ_ARG_DISABLE_BOOL(tests,
6723 [  --disable-tests         Do not build test libraries & programs],
6724     ENABLE_TESTS=,
6725     ENABLE_TESTS=1 )
6727 dnl ========================================================
6728 dnl parental controls (for Windows Vista)
6729 dnl ========================================================
6730 MOZ_ARG_DISABLE_BOOL(parental-controls,
6731 [  --disable-parental-controls
6732                           Do not build parental controls],
6733    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6734    MOZ_DISABLE_PARENTAL_CONTROLS=)
6735 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6736     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6739 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6741 dnl ========================================================
6742 dnl = Disable DOMCrypto
6743 dnl ========================================================
6744 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6745     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6748 dnl ========================================================
6749 dnl =
6750 dnl = Module specific options
6751 dnl =
6752 dnl ========================================================
6753 MOZ_ARG_HEADER(Individual module options)
6755 dnl ========================================================
6756 dnl = Disable feed handling components
6757 dnl ========================================================
6758 MOZ_ARG_DISABLE_BOOL(feeds,
6759 [  --disable-feeds         Disable feed handling and processing components],
6760     MOZ_FEEDS=,
6761     MOZ_FEEDS=1 )
6762 if test -n "$MOZ_FEEDS"; then
6763     AC_DEFINE(MOZ_FEEDS)
6764 else
6765     if test "$MOZ_BUILD_APP" = "browser"; then
6766         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6767     fi
6770 dnl ========================================================
6771 dnl = Enable mozStorage
6772 dnl ========================================================
6773 dnl Implicitly enabled by default if building calendar or places
6774 MOZ_ARG_ENABLE_BOOL(storage,
6775 [  --enable-storage        Enable mozStorage module and related components],
6776     MOZ_STORAGE=1,
6777     MOZ_STORAGE= )
6778 if test -n "$MOZ_STORAGE"; then
6779     AC_DEFINE(MOZ_STORAGE)
6782 dnl ========================================================
6783 dnl Check for sqlite
6784 dnl ========================================================
6786 MOZ_NATIVE_SQLITE=
6787 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6788 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6789 MOZ_NATIVE_SQLITE=1,
6790 MOZ_NATIVE_SQLITE= )
6792 if test -z "$MOZ_NATIVE_SQLITE"
6793 then
6794     SQLITE_CFLAGS=
6795     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6796 else
6797     dnl ============================
6798     dnl === SQLite Version check ===
6799     dnl ============================
6800     dnl Check to see if the system SQLite package is new enough.
6801     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6803     dnl ==================================
6804     dnl === SQLITE_SECURE_DELETE check ===
6805     dnl ==================================
6806     dnl Check to see if the system SQLite package is compiled with
6807     dnl SQLITE_SECURE_DELETE enabled.
6808     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6809     _SAVE_CFLAGS="$CFLAGS"
6810     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6811     _SAVE_LIBS="$LIBS"
6812     LIBS="$LIBS $SQLITE_LIBS"
6813     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6814         AC_TRY_RUN([
6815             #include "sqlite3.h"
6817             int main(int argc, char **argv){
6818               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6819             }],
6820             ac_cv_sqlite_secure_delete=yes,
6821             ac_cv_sqlite_secure_delete=no,
6822             ac_cv_sqlite_secure_delete=no
6823         )
6824     ])
6825     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6826     CFLAGS="$_SAVE_CFLAGS"
6827     LIBS="$_SAVE_LIBS"
6828     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6829         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6830     fi
6832     dnl ===============================
6833     dnl === SQLITE_THREADSAFE check ===
6834     dnl ===============================
6835     dnl Check to see if the system SQLite package is compiled with
6836     dnl SQLITE_THREADSAFE enabled.
6837     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6838     _SAVE_CFLAGS="$CFLAGS"
6839     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6840     _SAVE_LIBS="$LIBS"
6841     LIBS="$LIBS $SQLITE_LIBS"
6842     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6843         AC_TRY_RUN([
6844             #include "sqlite3.h"
6846             int main(int argc, char **argv){
6847               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6848             }],
6849             ac_cv_sqlite_threadsafe=yes,
6850             ac_cv_sqlite_threadsafe=no,
6851             ac_cv_sqlite_threadsafe=no
6852         )
6853     ])
6854     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6855     CFLAGS="$_SAVE_CFLAGS"
6856     LIBS="$_SAVE_LIBS"
6857     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6858         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6859     fi
6861     dnl ================================
6862     dnl === SQLITE_ENABLE_FTS3 check ===
6863     dnl ================================
6864     dnl check to see if the system SQLite package is compiled with
6865     dnl SQLITE_ENABLE_FTS3 enabled.
6866     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6867     _SAVE_CFLAGS="$CFLAGS"
6868     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6869     _SAVE_LIBS="$LIBS"
6870     LIBS="$LIBS $SQLITE_LIBS"
6871     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6872         AC_TRY_RUN([
6873             #include "sqlite3.h"
6875             int main(int argc, char **argv){
6876               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6877             }],
6878             ac_cv_sqlite_enable_fts3=yes,
6879             ac_cv_sqlite_enable_fts3=no,
6880             ac_cv_sqlite_enable_fts3=no
6881         )
6882     ])
6883     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6884     CFLAGS="$_SAVE_CFLAGS"
6885     LIBS="$_SAVE_LIBS"
6886     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6887         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6888     fi
6890     dnl =========================================
6891     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6892     dnl =========================================
6893     dnl check to see if the system SQLite package is compiled with
6894     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6895     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6896     _SAVE_CFLAGS="$CFLAGS"
6897     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6898     _SAVE_LIBS="$LIBS"
6899     LIBS="$LIBS $SQLITE_LIBS"
6900     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6901         AC_TRY_RUN([
6902             #include "sqlite3.h"
6904             int main(int argc, char **argv){
6905               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6906             }],
6907             ac_cv_sqlite_enable_unlock_notify=yes,
6908             ac_cv_sqlite_enable_unlock_notify=no,
6909             ac_cv_sqlite_enable_unlock_notify=no
6910         )
6911     ])
6912     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6913     CFLAGS="$_SAVE_CFLAGS"
6914     LIBS="$_SAVE_LIBS"
6915     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6916         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6917     fi
6920 AC_SUBST(MOZ_NATIVE_SQLITE)
6922 dnl ========================================================
6923 dnl = Enable help viewer (off by default)
6924 dnl ========================================================
6925 if test -n "$MOZ_HELP_VIEWER"; then
6926      dnl Do this if defined in confvars.sh
6927      AC_DEFINE(MOZ_HELP_VIEWER)
6930 dnl ========================================================
6931 dnl = Enable safe browsing (anti-phishing)
6932 dnl ========================================================
6933 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6934 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6935     MOZ_SAFE_BROWSING=1,
6936     MOZ_SAFE_BROWSING= )
6937 if test -n "$MOZ_SAFE_BROWSING"; then
6938     AC_DEFINE(MOZ_SAFE_BROWSING)
6940 AC_SUBST(MOZ_SAFE_BROWSING)
6942 dnl ========================================================
6943 dnl = Enable faststart component
6944 dnl ========================================================
6945 MOZ_ARG_ENABLE_BOOL(faststart,
6946 [  --enable-faststart      Enable the faststart component],
6947     MOZ_FASTSTART=1,
6948     MOZ_FASTSTART= )
6949 if test -n "$MOZ_FASTSTART"; then
6950     AC_DEFINE(MOZ_FASTSTART)
6952 AC_SUBST(MOZ_FASTSTART)
6954 dnl ========================================================
6955 dnl = Enable url-classifier
6956 dnl ========================================================
6957 dnl Implicitly enabled by default if building with safe-browsing
6958 if test -n "$MOZ_SAFE_BROWSING"; then
6959     MOZ_URL_CLASSIFIER=1
6961 MOZ_ARG_ENABLE_BOOL(url-classifier,
6962 [  --enable-url-classifier Enable url classifier module],
6963     MOZ_URL_CLASSIFIER=1,
6964     MOZ_URL_CLASSIFIER= )
6965 if test -n "$MOZ_URL_CLASSIFIER"; then
6966     AC_DEFINE(MOZ_URL_CLASSIFIER)
6968 AC_SUBST(MOZ_URL_CLASSIFIER)
6970 dnl ========================================================
6971 dnl = Disable zipwriter
6972 dnl ========================================================
6973 MOZ_ARG_DISABLE_BOOL(zipwriter,
6974 [  --disable-zipwriter     Disable zipwriter component],
6975     MOZ_ZIPWRITER=,
6976     MOZ_ZIPWRITER=1 )
6977 AC_SUBST(MOZ_ZIPWRITER)
6979 dnl ========================================================
6980 dnl = libconic
6981 dnl ========================================================
6982 dnl superseded by QtNetwork starting from 4.7
6983 MOZ_ENABLE_LIBCONIC=1
6985 if test -n "$MOZ_ENABLE_QT"; then
6986   if test "$MOZ_ENABLE_QTNETWORK"; then
6987     MOZ_ENABLE_LIBCONIC=
6988   fi
6991 MOZ_ARG_DISABLE_BOOL(libconic,
6992 [  --disable-libconic      Disable libconic],
6993     MOZ_ENABLE_LIBCONIC=,
6994     MOZ_ENABLE_LIBCONIC=1 )
6996 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6997     PKG_CHECK_MODULES(LIBCONIC, conic,
6998                       MOZ_ENABLE_LIBCONIC=1,
6999                       MOZ_ENABLE_LIBCONIC=)
7001 if test "$MOZ_ENABLE_LIBCONIC"; then
7002     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
7005 AC_SUBST(MOZ_ENABLE_LIBCONIC)
7006 AC_SUBST(LIBCONIC_CFLAGS)
7007 AC_SUBST(LIBCONIC_LIBS)
7009 dnl ========================================================
7010 dnl = Maemo checks
7011 dnl ========================================================
7013 MAEMO_SDK_TARGET_VER=-1
7015 MOZ_ARG_WITH_STRING(maemo-version,
7016 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
7017                           Maemo SDK Version],
7018   MAEMO_SDK_TARGET_VER=$withval)
7020 case "$MAEMO_SDK_TARGET_VER" in
7022     MOZ_PLATFORM_MAEMO=5
7023     ;;
7026     MOZ_PLATFORM_MAEMO=6
7027     ;;
7030     dnl We aren't compiling for Maemo, move on.
7031     ;;
7033     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
7034     ;;
7035 esac
7037 if test $MOZ_PLATFORM_MAEMO; then
7038    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
7040    if test -z "$MOZ_ENABLE_DBUS"; then
7041        AC_MSG_ERROR([DBus is required when building for Maemo])
7042    fi
7044    MOZ_GFX_OPTIMIZE_MOBILE=1
7045    MOZ_WEBGL_GLX=
7046    MOZ_MAEMO_LIBLOCATION=
7048    if test $MOZ_PLATFORM_MAEMO = 5; then
7049       dnl if we have Xcomposite we should also have Xdamage and Xfixes
7050       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
7051                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
7052       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
7053                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
7055       AC_SUBST(XCOMPOSITE_LIBS)
7057       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
7058       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
7059       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
7060       if test -z "$_LIB_FOUND"; then
7061          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
7062       fi
7065       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
7066       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
7067       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
7068       if test -z "$_LIB_FOUND"; then
7069          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
7070       fi
7072       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
7073       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
7074       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
7075       if test -z "$_LIB_FOUND"; then
7076          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
7077       fi
7079    fi
7080    if test $MOZ_PLATFORM_MAEMO = 6; then
7081       PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
7082       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
7083       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
7084       if test -z "$_LIB_FOUND"; then
7085          AC_MSG_ERROR([libcontentaction is required when build for Maemo])
7086       fi
7087      
7088      MOZ_THUMB2=1
7089      PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore)
7090      MOZ_ENABLE_MEEGOTOUCH=1
7091      AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
7092      MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
7093      MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
7094    fi
7096    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
7097    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
7098    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
7099    if test "$_LIB_FOUND"; then
7100       MOZ_MAEMO_LIBLOCATION=1
7101       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
7102    else
7103       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
7104    fi
7105    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
7107    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
7108    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
7109    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
7110    if test "$_LIB_FOUND"; then
7111       MOZ_ENABLE_MEEGOTOUCHSHARE=1
7112       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
7113    else
7114       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
7115    fi
7116    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
7118    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
7119    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
7122 dnl ========================================================
7123 dnl = Enable building the Thumb2 instruction set
7124 dnl ========================================================
7125 MOZ_ARG_ENABLE_BOOL(thumb2,
7126  [  --enable-thumb2         Enable Thumb2 instruction set],
7127     MOZ_THUMB2=1,
7128     MOZ_THUMB2=)
7130 if test -n "$MOZ_THUMB2"; then
7131   case "$target_cpu" in
7132     arm*)
7133       if test "$GNU_CC"; then
7134         CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7135         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7136         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
7137       else
7138         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
7139       fi
7140     ;;
7141     *)
7142       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
7143     ;;
7144   esac
7145 else
7146   case "$target_cpu" in
7147     arm*)
7148       if test "$GNU_CC"; then
7149        CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
7150         CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
7151         ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork"
7152       fi
7153       ;;
7154   esac
7157 AC_SUBST(MOZ_THUMB2)
7159 dnl ========================================================
7160 dnl = faststripe theme
7161 dnl ========================================================
7162 MOZ_ARG_ENABLE_BOOL(faststripe,
7163 [  --enable-faststripe     Use faststripe theme],
7164     MOZ_THEME_FASTSTRIPE=1,
7165     MOZ_THEME_FASTSTRIPE= )
7166 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7168 dnl ========================================================
7169 dnl =
7170 dnl = Feature options that require extra sources to be pulled
7171 dnl =
7172 dnl ========================================================
7173 dnl MOZ_ARG_HEADER(Features that require extra sources)
7175 dnl ========================================================
7176 dnl =
7177 dnl = Debugging Options
7178 dnl = 
7179 dnl ========================================================
7180 MOZ_ARG_HEADER(Debugging and Optimizations)
7182 dnl ========================================================
7183 dnl = Disable building with debug info.
7184 dnl = Debugging is OFF by default
7185 dnl ========================================================
7186 if test -z "$MOZ_DEBUG_FLAGS"; then
7187   MOZ_DEBUG_FLAGS="-g"
7190 MOZ_ARG_ENABLE_STRING(debug,
7191 [  --enable-debug[=DBG]    Enable building with developer debug info
7192                            (using compiler flags DBG)],
7193 [ if test "$enableval" != "no"; then
7194     MOZ_DEBUG=1
7195     if test -n "$enableval" -a "$enableval" != "yes"; then
7196         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7197         _MOZ_DEBUG_FLAGS_SET=1
7198     fi
7199   else
7200     MOZ_DEBUG=
7201   fi ],
7202   MOZ_DEBUG=)
7204 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7205 MOZ_ARG_WITH_STRING(debug-label,
7206 [  --with-debug-label=LABELS
7207                           Define DEBUG_<value> for each comma-separated
7208                           value given.],
7209 [ for option in `echo $withval | sed 's/,/ /g'`; do
7210     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7211 done])
7213 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7215 if test -n "$MOZ_DEBUG"; then
7216     AC_MSG_CHECKING([for valid debug flags])
7217     _SAVE_CFLAGS=$CFLAGS
7218     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7219     AC_TRY_COMPILE([#include <stdio.h>], 
7220         [printf("Hello World\n");],
7221         _results=yes,
7222         _results=no)
7223     AC_MSG_RESULT([$_results])
7224     if test "$_results" = "no"; then
7225         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7226     fi
7227     CFLAGS=$_SAVE_CFLAGS
7230 dnl ========================================================
7231 dnl enable mobile optimizations
7232 dnl ========================================================
7233 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7234 [  --enable-mobile-optimize
7235                           Enable mobile optimizations],
7236     MOZ_GFX_OPTIMIZE_MOBILE=1)
7238 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7240 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7241     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7244 dnl ========================================================
7245 dnl = Enable code optimization. ON by default.
7246 dnl ========================================================
7247 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7248         MOZ_OPTIMIZE_FLAGS="-O"
7251 MOZ_ARG_ENABLE_STRING(optimize,
7252 [  --disable-optimize      Disable compiler optimization
7253   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7254 [ if test "$enableval" != "no"; then
7255     MOZ_OPTIMIZE=1
7256     if test -n "$enableval" -a "$enableval" != "yes"; then
7257         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7258         MOZ_OPTIMIZE=2
7259     fi
7260 else
7261     MOZ_OPTIMIZE=
7262 fi ], MOZ_OPTIMIZE=1)
7264 if test "$COMPILE_ENVIRONMENT"; then
7265 if test -n "$MOZ_OPTIMIZE"; then
7266     AC_MSG_CHECKING([for valid optimization flags])
7267     _SAVE_CFLAGS=$CFLAGS
7268     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7269     AC_TRY_COMPILE([#include <stdio.h>], 
7270         [printf("Hello World\n");],
7271         _results=yes,
7272         _results=no)
7273     AC_MSG_RESULT([$_results])
7274     if test "$_results" = "no"; then
7275         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7276     fi
7277     CFLAGS=$_SAVE_CFLAGS
7279 fi # COMPILE_ENVIRONMENT
7281 AC_SUBST(MOZ_OPTIMIZE)
7282 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7283 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7284 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7286 dnl ========================================================
7287 dnl = (Deprecated) generation of debugger info for specific modules
7288 dnl ========================================================
7289 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7290 [  --enable-debugger-info-modules
7291                           Enable/disable debugger info for specific modules],
7292 [ if test "$enableval" != "no"; then
7293     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7294     MOZ_DEBUG_SYMBOLS=1
7295   fi ])
7297 dnl ========================================================
7298 dnl = Enable generation of debug symbols
7299 dnl ========================================================
7300 MOZ_ARG_ENABLE_STRING(debug-symbols,
7301 [  --enable-debug-symbols[=DBG]
7302                           Enable debugging symbols (using compiler flags DBG)],
7303 [ if test "$enableval" != "no"; then
7304       MOZ_DEBUG_SYMBOLS=1
7305       if test -n "$enableval" -a "$enableval" != "yes"; then
7306           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7307               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7308           else
7309               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7310           fi
7311       fi
7312   fi ])
7314 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7315     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7316     export MOZ_DEBUG_SYMBOLS
7319 dnl ========================================================
7320 dnl = Disable any treating of compile warnings as errors
7321 dnl ========================================================
7322 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7323 [  --disable-warnings-as-errors
7324                           Disable treating of warnings as errors],
7325     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7326     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7327 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7328    WARNINGS_AS_ERRORS=''
7331 dnl ========================================================
7332 dnl = Disable runtime logging checks
7333 dnl ========================================================
7334 MOZ_ARG_DISABLE_BOOL(logging,
7335 [  --disable-logging       Disable logging facilities],
7336     NS_DISABLE_LOGGING=1,
7337     NS_DISABLE_LOGGING= )
7338 if test "$NS_DISABLE_LOGGING"; then
7339     AC_DEFINE(NS_DISABLE_LOGGING)
7340 else
7341     AC_DEFINE(MOZ_LOGGING)
7344 dnl ========================================================
7345 dnl = This will enable logging of addref, release, ctor, dtor.
7346 dnl ========================================================
7347 _ENABLE_LOGREFCNT=42
7348 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7349 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7350     _ENABLE_LOGREFCNT=1,
7351     _ENABLE_LOGREFCNT= )
7352 if test "$_ENABLE_LOGREFCNT" = "1"; then
7353     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7354 elif test -z "$_ENABLE_LOGREFCNT"; then
7355     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7358 dnl ========================================================
7359 dnl = Enable trace malloc
7360 dnl ========================================================
7361 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7362 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7363 [  --enable-trace-malloc   Enable malloc tracing],
7364     NS_TRACE_MALLOC=1,
7365     NS_TRACE_MALLOC= )
7366 if test "$NS_TRACE_MALLOC"; then
7367   # Please, Mr. Linker Man, don't take away our symbol names
7368   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7369   USE_ELF_DYNSTR_GC=
7370   AC_DEFINE(NS_TRACE_MALLOC)
7372 AC_SUBST(NS_TRACE_MALLOC)
7374 dnl ========================================================
7375 dnl = Enable jemalloc
7376 dnl ========================================================
7377 MOZ_ARG_ENABLE_BOOL(jemalloc,
7378 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7379     MOZ_MEMORY=1,
7380     MOZ_MEMORY=)
7382 if test "$NS_TRACE_MALLOC"; then
7383     MOZ_MEMORY=
7386 if test "$MOZ_MEMORY"; then
7388   dnl Don't try to run compiler tests on Windows  
7389   if test "$OS_ARCH" = "WINNT"; then
7390     if test -z "$HAVE_64BIT_OS"; then
7391       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7392     else
7393       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7394     fi
7395   else
7396     AC_CHECK_SIZEOF([int *], [4])
7397     case "${ac_cv_sizeof_int_p}" in
7398     4)
7399       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7400       ;;
7401     8)
7402       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7403       ;;
7404     *)
7405       AC_MSG_ERROR([Unexpected pointer size])
7406       ;;
7407     esac
7408   fi
7410   AC_DEFINE(MOZ_MEMORY)
7411   if test "x$MOZ_DEBUG" = "x1"; then
7412     AC_DEFINE(MOZ_MEMORY_DEBUG)
7413   fi
7414   dnl The generic feature tests that determine how to compute ncpus are long and
7415   dnl complicated.  Therefore, simply define special cpp variables for the
7416   dnl platforms we have special knowledge of.
7417   case "${target}" in
7418   *-darwin*)
7419     AC_DEFINE(MOZ_MEMORY_DARWIN)
7420     ;;
7421   *-*freebsd*)
7422     AC_DEFINE(MOZ_MEMORY_BSD)
7423     ;;
7424   *-*linux*)
7425     AC_DEFINE(MOZ_MEMORY_LINUX)
7426     ;;
7427   *-netbsd*)
7428     AC_DEFINE(MOZ_MEMORY_BSD)
7429     ;;
7430   *-solaris*)
7431     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7432     ;;
7433   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7434     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7435     dnl This is sort of awful. Will revisit if we add support for more versions
7436     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7437         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7438     fi
7439     if test -z "$WIN32_CRT_SRC_DIR"; then
7440       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7441         AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
7442       else
7443         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7444       fi
7445     fi
7446     dnl cpu check
7447     case "${target_cpu}" in
7448     i*86)
7449       MOZ_CRT_CPU_ARCH=intel
7450       ;;
7451     x86_64)
7452       MOZ_CRT_CPU_ARCH=amd64
7453       ;;
7454     *)
7455       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7456       ;;
7457     esac
7459     AC_SUBST(MOZ_CRT_CPU_ARCH)
7461     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7462       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7463     fi
7464     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7465     _objdir_win=`pwd -W`
7466     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7467     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7468     dnl Also pass this to NSPR/NSS
7469     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7470     export DLLFLAGS
7471     ;;
7472   *-*wince)
7473     AC_DEFINE(MOZ_MEMORY_WINCE)
7474     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7475     if test -z "$WINCE_WINDOWS_MOBILE"; then
7476       AC_DEFINE(MOZ_MEMORY_WINCE6)
7477     fi
7478     ;;
7479   *-*winmo)
7480     AC_DEFINE(MOZ_MEMORY_WINCE)
7481     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7482     ;;
7483   *-android*)
7484     AC_DEFINE(MOZ_MEMORY_LINUX)
7485     AC_DEFINE(MOZ_MEMORY_ANDROID)
7486     _WRAP_MALLOC=1
7487     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7488     WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7489     ;;
7490   *)
7491     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7492     ;;
7493   esac
7495   if test "$OS_ARCH" != "Darwin"; then
7496     dnl NB: this must be kept in sync with jemalloc.h
7497     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7498     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7499     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7500   fi
7502 AC_SUBST(MOZ_MEMORY)
7503 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7504 AC_SUBST(WIN32_CRT_SRC_DIR)
7505 dnl Need to set this for make because NSS doesn't have configure
7506 AC_SUBST(DLLFLAGS)
7508 dnl ========================================================
7509 dnl = Use malloc wrapper lib
7510 dnl ========================================================
7511 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7512 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7513     _WRAP_MALLOC=1,
7514     _WRAP_MALLOC= )
7516 if test -n "$_WRAP_MALLOC"; then
7517     if test "$GNU_CC"; then
7518     WRAP_MALLOC_CFLAGS="${LDFLAGS} ${WRAP_MALLOC_CFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
7519     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7520     MKCSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7521     fi
7524 dnl ========================================================
7525 dnl = Location of malloc wrapper lib
7526 dnl ========================================================
7527 MOZ_ARG_WITH_STRING(wrap-malloc,
7528 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7529     WRAP_MALLOC_LIB=$withval)
7531 dnl ========================================================
7532 dnl = Use JS Call tracing
7533 dnl ========================================================
7534 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7535 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7536     MOZ_TRACE_JSCALLS=1,
7537     MOZ_TRACE_JSCALLS= )
7538 if test -n "$MOZ_TRACE_JSCALLS"; then
7539     AC_DEFINE(MOZ_TRACE_JSCALLS)
7542 dnl ========================================================
7543 dnl = Use TraceVis
7544 dnl ========================================================
7545 MOZ_ARG_ENABLE_BOOL(tracevis,
7546 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7547     MOZ_TRACEVIS=1,
7548     MOZ_TRACEVIS= )
7549 if test -n "$MOZ_TRACEVIS"; then
7550     AC_DEFINE(MOZ_TRACEVIS)
7553 dnl ========================================================
7554 dnl = Use GCTimer
7555 dnl ========================================================
7556 MOZ_ARG_ENABLE_BOOL(gctimer,
7557 [  --enable-gctimer        Enable GC timer (default=no)],
7558     MOZ_GCTIMER=1,
7559     MOZ_GCTIMER= )
7560 if test -n "$MOZ_GCTIMER"; then
7561     AC_DEFINE(MOZ_GCTIMER)
7564 dnl ========================================================
7565 dnl = Use Valgrind
7566 dnl ========================================================
7567 MOZ_ARG_ENABLE_BOOL(valgrind,
7568 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7569     MOZ_VALGRIND=1,
7570     MOZ_VALGRIND= )
7571 if test -n "$MOZ_VALGRIND"; then
7572     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7573         AC_MSG_ERROR(
7574             [--enable-valgrind specified but Valgrind is not installed]))
7575     AC_DEFINE(MOZ_VALGRIND)
7578 dnl ========================================================
7579 dnl jprof
7580 dnl ========================================================
7581 MOZ_ARG_ENABLE_BOOL(jprof,
7582 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
7583     MOZ_JPROF=1,
7584     MOZ_JPROF= )
7585 if test -n "$MOZ_JPROF"; then
7586     MOZ_PROFILING=1
7587     AC_DEFINE(MOZ_JPROF)
7590 dnl ========================================================
7591 dnl shark
7592 dnl ========================================================
7593 MOZ_ARG_ENABLE_BOOL(shark,
7594 [  --enable-shark          Enable shark remote profiling (needs CHUD framework). Implies --enable-profiling.],
7595     MOZ_SHARK=1,
7596     MOZ_SHARK= )
7597 if test -n "$MOZ_SHARK"; then
7598     MOZ_PROFILING=1
7599     AC_DEFINE(MOZ_SHARK)
7602 dnl ========================================================
7603 dnl callgrind
7604 dnl ========================================================
7605 MOZ_ARG_ENABLE_BOOL(callgrind,
7606 [  --enable-callgrind      Enable callgrind profiling],
7607     MOZ_CALLGRIND=1,
7608     MOZ_CALLGRIND= )
7609 if test -n "$MOZ_CALLGRIND"; then
7610     AC_DEFINE(MOZ_CALLGRIND)
7613 dnl ========================================================
7614 dnl vtune
7615 dnl ========================================================
7616 MOZ_ARG_ENABLE_BOOL(vtune,
7617 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
7618     MOZ_VTUNE=1,
7619     MOZ_VTUNE= )
7620 if test -n "$MOZ_VTUNE"; then
7621     MOZ_PROFILING=1
7622     AC_DEFINE(MOZ_VTUNE)
7625 dnl ========================================================
7626 dnl Zealous JavaScript GC
7627 dnl ========================================================
7628 MOZ_ARG_ENABLE_BOOL(gczeal,
7629 [  --enable-gczeal         Enable zealous JavaScript GCing],
7630     JS_GC_ZEAL=1,
7631     JS_GC_ZEAL= )
7632 if test -n "$JS_GC_ZEAL"; then
7633     AC_DEFINE(JS_GC_ZEAL)
7636 dnl ======================================================
7637 dnl = Enable compiling with ccache
7638 dnl ======================================================
7639 MOZ_ARG_WITH_STRING(ccache,
7640 [  --with-ccache[=path/to/ccache]
7641                           Enable compiling with ccache],
7642     CCACHE=$withval, CCACHE="no")
7644 if test "$CCACHE" != "no"; then
7645     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7646         CCACHE=
7647     else
7648         if test ! -e "$CCACHE"; then
7649             AC_MSG_ERROR([$CCACHE not found])
7650         fi
7651     fi
7652     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7653     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7654         AC_MSG_ERROR([ccache not found])
7655     elif test -x "$CCACHE"; then
7656         CC="$CCACHE $CC"
7657         CXX="$CCACHE $CXX"
7658     else
7659         AC_MSG_ERROR([$CCACHE is not executable])
7660     fi
7663 dnl ========================================================
7664 dnl = Enable static checking using gcc-dehydra
7665 dnl ========================================================
7667 MOZ_ARG_WITH_STRING(static-checking,
7668 [  --with-static-checking=path/to/gcc_dehydra.so
7669                           Enable static checking of code using GCC-dehydra],
7670     DEHYDRA_PATH=$withval,
7671     DEHYDRA_PATH= )
7673 if test -n "$DEHYDRA_PATH"; then
7674     if test ! -f "$DEHYDRA_PATH"; then
7675         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7676     fi
7677     AC_DEFINE(NS_STATIC_CHECKING)
7679 AC_SUBST(DEHYDRA_PATH)
7681 dnl ========================================================
7682 dnl = Enable stripping of libs & executables
7683 dnl ========================================================
7684 MOZ_ARG_ENABLE_BOOL(strip,
7685 [  --enable-strip          Enable stripping of libs & executables ],
7686     ENABLE_STRIP=1,
7687     ENABLE_STRIP= )
7689 dnl ========================================================
7690 dnl = Enable stripping of libs & executables when packaging
7691 dnl ========================================================
7692 MOZ_ARG_ENABLE_BOOL(install-strip,
7693 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7694     PKG_SKIP_STRIP= ,
7695     PKG_SKIP_STRIP=1)
7697 dnl ========================================================
7698 dnl = --enable-elf-dynstr-gc
7699 dnl ========================================================
7700 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7701 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7702     USE_ELF_DYNSTR_GC=1,
7703     USE_ELF_DYNSTR_GC= )
7705 dnl ========================================================
7706 dnl = 
7707 dnl = Profiling and Instrumenting
7708 dnl = 
7709 dnl ========================================================
7710 MOZ_ARG_HEADER(Profiling and Instrumenting)
7712 dnl ========================================================
7713 dnl = Enable timeline service, which provides lightweight
7714 dnl = instrumentation of mozilla for performance measurement.
7715 dnl = Timeline is off by default.
7716 dnl ========================================================
7717 MOZ_ARG_ENABLE_BOOL(timeline,
7718 [  --enable-timeline       Enable timeline services ],
7719     MOZ_TIMELINE=1,
7720     MOZ_TIMELINE= )
7721 if test -n "$MOZ_TIMELINE"; then
7722     AC_DEFINE(MOZ_TIMELINE)
7725 dnl ========================================================
7726 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7727 dnl = timing for identifying code bottlenecks 
7728 dnl = NS_FUNCTION_TIMER is off by default.
7729 dnl ========================================================
7730 MOZ_ARG_ENABLE_BOOL(functiontimer,
7731 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7732     NS_FUNCTION_TIMER=1,
7733     NS_FUNCTION_TIMER= )
7734 if test -n "$NS_FUNCTION_TIMER"; then
7735     AC_DEFINE(NS_FUNCTION_TIMER)
7738 dnl ========================================================
7739 dnl Turn on reflow counting
7740 dnl ========================================================
7741 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7742 [  --enable-reflow-perf    Enable reflow performance tracing],
7743     MOZ_REFLOW_PERF=1,
7744     MOZ_REFLOW_PERF= )
7745 if test -n "$MOZ_REFLOW_PERF"; then
7746     AC_DEFINE(MOZ_REFLOW_PERF)
7749 dnl ========================================================
7750 dnl Enable code size metrics.
7751 dnl ========================================================
7752 MOZ_ARG_ENABLE_BOOL(codesighs,
7753 [  --enable-codesighs      Enable code size analysis tools],
7754     _ENABLE_CODESIGHS=1,
7755     _ENABLE_CODESIGHS= )
7756 if test -n "$_ENABLE_CODESIGHS"; then
7757     if test -d $srcdir/tools/codesighs; then 
7758         MOZ_MAPINFO=1
7759     else
7760         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7761     fi
7764 dnl ========================================================
7765 dnl = Support for Quantify (Windows)
7766 dnl ========================================================
7767 MOZ_ARG_ENABLE_BOOL(quantify,
7768 [  --enable-quantify       Enable Quantify support (Windows only) ],
7769     MOZ_QUANTIFY=1,
7770     MOZ_QUANTIFY= )
7772 dnl ========================================================
7773 dnl = Support for demangling undefined symbols
7774 dnl ========================================================
7775 if test -z "$SKIP_LIBRARY_CHECKS"; then
7776     AC_LANG_SAVE
7777     AC_LANG_CPLUSPLUS
7778     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7779     AC_LANG_RESTORE
7782 # Demangle only for debug or trace-malloc builds
7783 MOZ_DEMANGLE_SYMBOLS=
7784 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7785     MOZ_DEMANGLE_SYMBOLS=1
7786     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7788 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7790 dnl ========================================================
7791 dnl = Support for gcc stack unwinding (from gcc 3.3)
7792 dnl ========================================================
7793 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7794     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7797 dnl ========================================================
7798 dnl =
7799 dnl = Misc. Options
7800 dnl = 
7801 dnl ========================================================
7802 MOZ_ARG_HEADER(Misc. Options)
7804 dnl ========================================================
7805 dnl update xterm title
7806 dnl ========================================================
7807 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7808 [  --enable-xterm-updates  Update XTERM titles with current command.],
7809     MOZ_UPDATE_XTERM=1,
7810     MOZ_UPDATE_XTERM= )
7812 dnl =========================================================
7813 dnl = Chrome format
7814 dnl =========================================================
7815 MOZ_ARG_ENABLE_STRING([chrome-format],
7816 [  --enable-chrome-format=jar|flat|both|symlink|omni
7817                           Select FORMAT of chrome files (default=jar)],
7818     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7820 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7821     MOZ_CHROME_FILE_FORMAT=jar
7824 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7825     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7826     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7827     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7828     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7829     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7832 dnl =========================================================
7833 dnl Omnijar packaging (bug 552121)
7834 dnl =========================================================
7835 dnl Omnijar packaging is compatible with flat packaging.
7836 dnl In unpackaged builds, omnijar looks for files as if
7837 dnl things were flat packaged. After packaging, all files
7838 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7839 dnl is set to flat since putting files into jars is only
7840 dnl done during packaging with omnijar.
7841 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7842     MOZ_OMNIJAR=1
7843     AC_DEFINE(MOZ_OMNIJAR)
7844     MOZ_CHROME_FILE_FORMAT=flat
7845 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7846     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7849 AC_SUBST(MOZ_OMNIJAR)
7851 dnl ========================================================
7852 dnl = Define default location for MOZILLA_FIVE_HOME
7853 dnl ========================================================
7854 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7855 [  --with-default-mozilla-five-home
7856                           Set the default value for MOZILLA_FIVE_HOME],
7857 [ val=`echo $withval`
7858   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7860 dnl ========================================================
7861 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7862 dnl ========================================================
7863 MOZ_ARG_WITH_STRING(user-appdir,
7864 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7865 [ val=`echo $withval`
7866 if echo "$val" | grep "\/" >/dev/null; then
7867     AC_MSG_ERROR("Homedir must be single relative path.")
7868 else 
7869     MOZ_USER_DIR="$val"
7870 fi])
7872 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7874 dnl ========================================================
7875 dnl = Doxygen configuration
7876 dnl ========================================================
7877 dnl Use commas to specify multiple dirs to this arg
7878 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7879 MOZ_ARG_WITH_STRING(doc-input-dirs,
7880 [  --with-doc-input-dirs=DIRS
7881                           Header/idl dirs to create docs from],
7882 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7883 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7885 dnl Use commas to specify multiple dirs to this arg
7886 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7887 MOZ_ARG_WITH_STRING(doc-include-dirs,
7888 [  --with-doc-include-dirs=DIRS  
7889                           Include dirs to preprocess doc headers],
7890 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7891 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7893 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7894 MOZ_ARG_WITH_STRING(doc-output-dir,
7895 [  --with-doc-output-dir=DIR
7896                           Dir to generate docs into],
7897 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7898 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7900 if test -z "$SKIP_COMPILER_CHECKS"; then
7901 dnl ========================================================
7902 dnl =
7903 dnl = Compiler Options
7904 dnl = 
7905 dnl ========================================================
7906 MOZ_ARG_HEADER(Compiler Options)
7908 dnl ========================================================
7909 dnl Check for gcc -pipe support
7910 dnl ========================================================
7911 AC_MSG_CHECKING([for gcc -pipe support])
7912 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7913     echo '#include <stdio.h>' > dummy-hello.c
7914     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7915     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7916     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7917     if test $? = 0; then
7918         _res_as_stdin="yes"
7919     else
7920         _res_as_stdin="no"
7921     fi
7922     if test "$_res_as_stdin" = "yes"; then
7923         _SAVE_CFLAGS=$CFLAGS
7924         CFLAGS="$CFLAGS -pipe"
7925         AC_TRY_COMPILE( [ #include <stdio.h> ],
7926             [printf("Hello World\n");],
7927             [_res_gcc_pipe="yes"],
7928             [_res_gcc_pipe="no"] )
7929         CFLAGS=$_SAVE_CFLAGS
7930     fi
7931     if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7932         _res="yes";
7933         CFLAGS="$CFLAGS -pipe"
7934         CXXFLAGS="$CXXFLAGS -pipe"
7935     else
7936         _res="no"
7937     fi
7938     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7939     AC_MSG_RESULT([$_res])
7940 else
7941     AC_MSG_RESULT([no])
7944 dnl ========================================================
7945 dnl Profile guided optimization
7946 dnl ========================================================
7947 dnl Test for profiling options
7948 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7950 dnl Provide a switch to disable PGO even when called via profiledbuild.
7951 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7952 [  --disable-profile-guided-optimization
7953                           Don't build with PGO even if called via make profiledbuild],
7954 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7955 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7957 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7959 _SAVE_CFLAGS="$CFLAGS"
7960 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7962 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7963 AC_TRY_COMPILE([], [return 0;],
7964                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7965                  result="yes" ], result="no")
7966 AC_MSG_RESULT([$result])
7968 if test $result = "yes"; then
7969   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7970   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7971   PROFILE_USE_LDFLAGS="-fprofile-use"
7974 CFLAGS="$_SAVE_CFLAGS"
7976 if test -n "$INTEL_CC"; then
7977   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7978   PROFILE_GEN_LDFLAGS=
7979   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7980   PROFILE_USE_LDFLAGS=
7983 dnl Sun Studio on Solaris
7984 if test "$SOLARIS_SUNPRO_CC"; then
7985   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7986   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7987   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7988   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7991 AC_SUBST(PROFILE_GEN_CFLAGS)
7992 AC_SUBST(PROFILE_GEN_LDFLAGS)
7993 AC_SUBST(PROFILE_USE_CFLAGS)
7994 AC_SUBST(PROFILE_USE_LDFLAGS)
7996 AC_LANG_CPLUSPLUS
7998 dnl ========================================================
7999 dnl Test for -pedantic bustage
8000 dnl ========================================================
8001 MOZ_ARG_DISABLE_BOOL(pedantic,
8002 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
8003 _PEDANTIC= )
8004 if test "$_PEDANTIC"; then
8005     _SAVE_CXXFLAGS=$CXXFLAGS
8006     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8007     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
8008     AC_TRY_COMPILE([$configure_static_assert_macros],
8009                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
8010                    result="no", result="yes" )
8011     AC_MSG_RESULT([$result])
8012     CXXFLAGS="$_SAVE_CXXFLAGS"
8014     case "$result" in
8015     no)
8016         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8017         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8018         ;;
8019     yes)
8020         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
8021         ;;
8022     esac
8025 dnl ========================================================
8026 dnl Test for correct temporary object destruction order
8027 dnl ========================================================
8028 dnl We want to make sure the compiler follows the C++ spec here as 
8029 dnl xpcom and the string classes depend on it (bug 235381).
8030 AC_MSG_CHECKING([for correct temporary object destruction order])
8031 AC_TRY_RUN([ class A {
8032              public:  A(int& x) : mValue(x) {}
8033                       ~A() { mValue--; }
8034                       operator char**() { return 0; }
8035              private:  int& mValue;
8036              };
8037              void func(char **arg) {}
8038              int m=2;
8039              void test() {
8040                   func(A(m));
8041                   if (m==1) m = 0;
8042              }
8043              int main() {
8044                  test();
8045                  return(m);
8046              }
8047              ],
8048      result="yes", result="no", result="maybe")
8049 AC_MSG_RESULT([$result])
8051 if test "$result" = "no"; then
8052     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
8055 dnl ========================================================
8056 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
8057 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8058 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
8059 dnl ========================================================
8060 _SAVE_CXXFLAGS=$CXXFLAGS
8061 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8062 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8063     ac_nscap_nonconst_opeq_bug,
8064     [AC_TRY_COMPILE([
8065                       template <class T>
8066                       class Pointer
8067                         {
8068                         public:
8069                           T* myPtr;
8070                         };
8071                       
8072                       template <class T, class U>
8073                       int operator==(const Pointer<T>& rhs, U* lhs)
8074                         {
8075                           return rhs.myPtr == lhs;
8076                         }
8077                       
8078                       template <class T, class U>
8079                       int operator==(const Pointer<T>& rhs, const U* lhs)
8080                         {
8081                           return rhs.myPtr == lhs;
8082                         }
8083                     ],
8084                     [
8085                       Pointer<int> foo;
8086                       const int* bar;
8087                       return foo == bar;
8088                     ],
8089                     ac_nscap_nonconst_opeq_bug="no",
8090                     ac_nscap_nonconst_opeq_bug="yes")])
8091 CXXFLAGS="$_SAVE_CXXFLAGS"
8093 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8094     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8096 fi # SKIP_COMPILER_CHECKS
8098 dnl ========================================================
8099 dnl C++ rtti
8100 dnl Should be smarter and check that the compiler does indeed have rtti
8101 dnl ========================================================
8103 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
8104 [  --enable-cpp-rtti       Enable C++ RTTI ],
8105 [ _MOZ_USE_RTTI=1 ],
8106 [ _MOZ_USE_RTTI= ])
8108 if test "$_MOZ_USE_RTTI"; then
8109    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
8110 else
8111    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
8114 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
8116 dnl ========================================================
8117 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8118 dnl Should be smarter and check that the compiler does indeed have exceptions
8119 dnl ========================================================
8120 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8121 [  --enable-cpp-exceptions Enable C++ exceptions ],
8122 [ _MOZ_CPP_EXCEPTIONS=1 ],
8123 [ _MOZ_CPP_EXCEPTIONS= ])
8125 if test "$_MOZ_CPP_EXCEPTIONS"; then
8126     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8127     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8128 else
8129     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8132 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8134 # Irix & OSF native compilers do not like exception declarations 
8135 # when exceptions are disabled
8136 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8137     AC_DEFINE(CPP_THROW_NEW, [])
8138 else
8139     AC_DEFINE(CPP_THROW_NEW, [throw()])
8141 AC_LANG_C
8143 dnl ========================================================
8144 dnl =
8145 dnl = Build depencency options
8146 dnl =
8147 dnl ========================================================
8148 MOZ_ARG_HEADER(Build dependencies)
8150 dnl ========================================================
8151 dnl = Do not auto generate dependency info
8152 dnl ========================================================
8153 MOZ_AUTO_DEPS=1
8154 MOZ_ARG_DISABLE_BOOL(auto-deps,
8155 [  --disable-auto-deps     Do not automatically generate dependency info],
8156     MOZ_AUTO_DEPS=,
8157     MOZ_AUTO_DEPS=1)
8159 if test -n "$MOZ_AUTO_DEPS"; then
8160 dnl ========================================================
8161 dnl = Use mkdepend instead of $CC -MD for dependency generation
8162 dnl ========================================================
8163 _cpp_md_flag=
8164 MOZ_ARG_DISABLE_BOOL(md,
8165 [  --disable-md            Do not use compiler-based dependencies ],
8166   [_cpp_md_flag=],
8167   [_cpp_md_flag=1],
8168   [dnl Default is to turn on -MD if using GNU-compatible compilers
8169    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
8170      _cpp_md_flag=1
8171    fi
8172   dnl Default is to use -xM if using Sun Studio on Solaris
8173    if test "$SOLARIS_SUNPRO_CC"; then
8174      _cpp_md_flag=1
8175    fi])
8176 if test "$_cpp_md_flag"; then
8177   COMPILER_DEPEND=1
8178   if test "$OS_ARCH" = "OpenVMS"; then
8179     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
8180   else
8181     _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8182   fi
8183   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8184   if test "$SOLARIS_SUNPRO_CC"; then
8185     _DEPEND_CFLAGS=
8186   fi
8187 else
8188   COMPILER_DEPEND=
8189   dnl Don't override this for MSVC
8190   if test -z "$_WIN32_MSVC"; then
8191     _USE_CPP_INCLUDE_FLAG=
8192     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8193     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8194   else
8195     echo '#include <stdio.h>' > dummy-hello.c
8196     changequote(,)
8197     CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8198     changequote([,])
8199     if test -z "$CL_INCLUDES_PREFIX"; then
8200         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8201     fi
8202     AC_SUBST(CL_INCLUDES_PREFIX)
8203     rm -f dummy-hello.c
8204     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8205     dnl cl.py provides dependency generation for MSVC
8206     CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8207     CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8208     COMPILER_DEPEND=1
8209   fi
8211 fi # MOZ_AUTO_DEPS
8212 MDDEPDIR='.deps'
8213 AC_SUBST(MOZ_AUTO_DEPS)
8214 AC_SUBST(COMPILER_DEPEND)
8215 AC_SUBST(MDDEPDIR)
8216 AC_SUBST(CC_WRAPPER)
8217 AC_SUBST(CXX_WRAPPER)
8220 dnl ========================================================
8221 dnl =
8222 dnl = Static Build Options
8223 dnl =
8224 dnl ========================================================
8225 MOZ_ARG_HEADER(Static build options)
8227 MOZ_ARG_ENABLE_BOOL(static,
8228 [  --enable-static         Enable building of internal static libs],
8229     BUILD_STATIC_LIBS=1,
8230     BUILD_STATIC_LIBS=)
8232 MOZ_ARG_ENABLE_BOOL(libxul,
8233 [  --enable-libxul         Enable building of libxul],
8234     MOZ_ENABLE_LIBXUL=1,
8235     MOZ_ENABLE_LIBXUL=)
8237 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8238 if test "$OS_ARCH" = "WINNT"; then
8239   ENABLE_SHARED_JS=1
8242 MOZ_ARG_ENABLE_BOOL(shared-js,
8243 [  --enable-shared-js
8244                           Create a shared JavaScript library.],
8245     ENABLE_SHARED_JS=1,
8246     ENABLE_SHARED_JS=)
8248 if test -z "$MOZ_ENABLE_LIBXUL"; then
8249   dnl --disable-libxul implies shared js
8250   ENABLE_SHARED_JS=1
8253 if test -n "$ENABLE_SHARED_JS"; then
8254   JS_SHARED_LIBRARY=1
8255   MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8256 else
8257   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8258   AC_DEFINE(MOZ_STATIC_JS)
8260 AC_SUBST(JS_SHARED_LIBRARY)
8262 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8263         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8266 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8267         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8270 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8271     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8274 if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
8275     AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
8278 AC_SUBST(LIBXUL_LIBS)
8280 if test -n "$MOZ_ENABLE_LIBXUL"; then
8281     XPCOM_LIBS="$LIBXUL_LIBS"
8282     AC_DEFINE(MOZ_ENABLE_LIBXUL)
8283 else
8284     if test -n "$BUILD_STATIC_LIBS"; then
8285         AC_DEFINE(MOZ_STATIC_BUILD)
8286     fi
8287     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8290 dnl ========================================================
8291 dnl =
8292 dnl = Standalone module options
8293 dnl = 
8294 dnl ========================================================
8295 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8297 dnl Check for GLib and libIDL.
8298 dnl ========================================================
8299 SKIP_IDL_CHECK="no"
8301 if test -z "$COMPILE_ENVIRONMENT"; then
8302     SKIP_IDL_CHECK="yes"
8305 dnl = Allow users to disable libIDL checking for standalone modules
8306 MOZ_ARG_WITHOUT_BOOL(libIDL,
8307 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8308         SKIP_IDL_CHECK="yes")
8310 if test -z "$CROSS_COMPILE"; then
8311     if test -z "$HOST_LIBIDL_CONFIG"; then
8312         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8313     fi
8314     if test -z "$HOST_LIBIDL_PREFIX"; then
8315         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8316     fi
8319 if test "$SKIP_IDL_CHECK" = "no"
8320 then
8321     _LIBIDL_FOUND=
8322     case "$host" in
8323     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8324         if test -n "$GLIB_PREFIX"; then
8325             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8326             if test "$?" = "0"; then
8327                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8328                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8329                 fi
8330                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8331             else
8332                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8333             fi
8334         else
8335             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8336         fi
8337         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8338             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8339         fi
8340         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8341         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8342             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8343         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8344             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8345         else
8346             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8347         fi
8349         if test -n "$HOST_LIBIDL_PREFIX"; then
8350             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8351             if test "$?" = "0"; then
8352                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8353                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8354                 fi
8355                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8356             else
8357                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8358             fi
8359         else
8360             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8361         fi        
8362         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8363             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8364         fi
8365         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8366         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8367             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8368             STATIC_LIBIDL=1
8369         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8370             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8371         else
8372             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8373         fi
8374         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8375         _LIBIDL_FOUND=1
8376         ;;
8377     esac
8379     if test -z "$_LIBIDL_FOUND"; then
8380         if test "$MACOS_SDK_DIR"; then 
8381             dnl xpidl, and therefore libIDL, is only needed on the build host.
8382             dnl Don't build it against the SDK, as that causes problems.
8383             _MACSAVE_CFLAGS="$CFLAGS"
8384             _MACSAVE_LIBS="$LIBS"
8385             _MACSAVE_LDFLAGS="$LDFLAGS"
8386             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8387           changequote(,)
8388           CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"`
8389           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8390           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8391           changequote([,])
8392           unset NEXT_ROOT
8393         fi
8395         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8396     fi
8398     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8399     dnl to either libIDL1 or libIDL2.
8400     if test -z "$_LIBIDL_FOUND"; then
8401         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8402         if test -z "$_LIBIDL_FOUND"; then
8403             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8404         fi
8405     fi
8406     dnl
8407     dnl If we don't have a libIDL config program & not cross-compiling, 
8408     dnl     look for orbit-config instead.
8409     dnl
8410     if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8411         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8412         if test -n "$ORBIT_CONFIG"; then
8413             AC_MSG_CHECKING([for ORBit libIDL usability])
8414                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8415             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8416             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8417             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8418             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8419             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8420             HOST_LIBIDL_CONFIG=
8421             _SAVE_CFLAGS="$CFLAGS"
8422             _SAVE_LIBS="$LIBS"
8423             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8424             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8425             AC_TRY_RUN([
8426 #include <stdlib.h>
8427 #include <libIDL/IDL.h>
8428 int main() {
8429   char *s;
8430   s=strdup(IDL_get_libver_string());
8431   if(s==NULL) {
8432     exit(1);
8433   }
8434   exit(0);
8436             ], [_LIBIDL_FOUND=1
8437                 result="yes"],
8438                [HOST_LIBIDL_CFLAGS=
8439                 HOST_LIBIDL_LIBS=
8440                 result="no"],
8441                [_LIBIDL_FOUND=1
8442                 result="maybe"] )
8443             AC_MSG_RESULT($result)
8444             CFLAGS="$_SAVE_CFLAGS"
8445             LIBS="$_SAVE_LIBS"
8446         fi
8447     fi
8448     if test -z "$_LIBIDL_FOUND"; then
8449         AC_MSG_ERROR([libIDL not found.
8450         libIDL $LIBIDL_VERSION or higher is required.])
8451     fi
8452     if test "$MACOS_SDK_DIR"; then
8453       CFLAGS="$_MACSAVE_CFLAGS"
8454       LIBS="$_MACSAVE_LIBS"
8455       LDFLAGS="$_MACSAVE_LDFLAGS"
8456       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8457         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8458       fi
8459     fi
8462 if test -n "$CROSS_COMPILE"; then
8463     case "$target" in
8464     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8465         if test -n "$GLIB_PREFIX"; then
8466             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8467             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8468                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8469             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8470                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8471             else
8472                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8473             fi
8474         fi
8476         if test -n "$LIBIDL_PREFIX"; then
8477             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8478             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8479                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8480                 STATIC_LIBIDL=1
8481             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8482                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8483             else
8484                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8485             fi
8486         fi
8487         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8488         ;;
8489     *)
8490         if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8491             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8492             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8493         fi
8494         ;;
8495     esac
8496 else
8497     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8498     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8501 if test -z "$SKIP_PATH_CHECKS"; then
8502 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8503     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8504         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8505     else
8506         AM_PATH_GLIB(${GLIB_VERSION})
8507     fi
8511 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8512     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8515 AC_SUBST(LIBIDL_CFLAGS)
8516 AC_SUBST(LIBIDL_LIBS)
8517 AC_SUBST(STATIC_LIBIDL)
8518 AC_SUBST(GLIB_CFLAGS)
8519 AC_SUBST(GLIB_LIBS)
8520 AC_SUBST(GLIB_GMODULE_LIBS)
8521 AC_SUBST(HOST_LIBIDL_CONFIG)
8522 AC_SUBST(HOST_LIBIDL_CFLAGS)
8523 AC_SUBST(HOST_LIBIDL_LIBS)
8525 dnl ========================================================
8526 dnl Check for cairo
8527 dnl ========================================================
8528 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8530 MOZ_TREE_CAIRO=1
8531 MOZ_ARG_ENABLE_BOOL(system-cairo,
8532 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8533 MOZ_TREE_CAIRO=,
8534 MOZ_TREE_CAIRO=1 )
8536 MOZ_TREE_PIXMAN=1
8537 MOZ_ARG_ENABLE_BOOL(system-pixman,
8538 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8539 MOZ_TREE_PIXMAN=,
8540 MOZ_TREE_PIXMAN=1 )
8542 # Check for headers defining standard int types.
8543 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8545 if test "$MOZ_TREE_CAIRO"; then
8546     AC_DEFINE(MOZ_TREE_CAIRO)
8548     # For now we assume that we will have a uint64_t available through
8549     # one of the above headers or mozstdint.h.
8550     AC_DEFINE(HAVE_UINT64_T)
8552     # Define macros for cairo-features.h
8553     if test "$MOZ_X11"; then
8554         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8555         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8556         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8557         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8558         MOZ_ENABLE_CAIRO_FT=1
8559         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8560     fi
8561     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8562         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8563     fi
8564     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8565         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8566         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8567         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8568     fi
8569     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8570         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8571         if test -z "$WINCE"; then
8572             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8573             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8574                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8575                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8576                 MOZ_ENABLE_D2D_SURFACE=1
8577                 MOZ_ENABLE_DWRITE_FONT=1
8578             else
8579                 WIN32_DWRITE_FONT_FEATURE=
8580                 WIN32_D2D_SURFACE_FEATURE=
8581             fi
8582         else
8583             WIN32_FONT_FEATURE=
8584             WIN32_DWRITE_FONT_FEATURE=
8585             WIN32_D2D_SURFACE_FEATURE=
8586         fi
8588         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8590         dnl D3D10 Layers depend on D2D Surfaces.
8591         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8592           AC_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8593         fi
8595     fi
8596     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8597         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8598         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8599         MOZ_ENABLE_CAIRO_FT=1
8600         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8601         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8602     fi
8603     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8604         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8605         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8606         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8607         MOZ_ENABLE_CAIRO_FT=1
8608     fi
8609     if test "$USE_FC_FREETYPE"; then
8610         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8611     fi
8612     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8613     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8614     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8615     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8616     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8617     AC_SUBST(CAIRO_FT_CFLAGS)
8618     AC_SUBST(HAS_OGLES)
8620     if test "$MOZ_DEBUG"; then
8621       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8622     else
8623       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8624     fi
8626     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8628     AC_SUBST(PS_SURFACE_FEATURE)
8629     AC_SUBST(PDF_SURFACE_FEATURE)
8630     AC_SUBST(SVG_SURFACE_FEATURE)
8631     AC_SUBST(XLIB_SURFACE_FEATURE)
8632     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8633     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8634     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8635     AC_SUBST(XCB_SURFACE_FEATURE)
8636     AC_SUBST(WIN32_SURFACE_FEATURE)
8637     AC_SUBST(OS2_SURFACE_FEATURE)
8638     AC_SUBST(BEOS_SURFACE_FEATURE)
8639     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8640     AC_SUBST(FT_FONT_FEATURE)
8641     AC_SUBST(FC_FONT_FEATURE)
8642     AC_SUBST(WIN32_FONT_FEATURE)
8643     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8644     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8645     AC_SUBST(QUARTZ_FONT_FEATURE)
8646     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8647     AC_SUBST(QT_SURFACE_FEATURE)
8649     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8651     if test "$MOZ_TREE_PIXMAN"; then
8652         AC_DEFINE(MOZ_TREE_PIXMAN)
8653         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8654     else
8655         PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8656         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8657         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8658     fi
8660     if test "$MOZ_X11"; then
8661         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8662     fi
8664     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8665     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8667 else
8668    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8669    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8670    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8671    if test "$MOZ_X11"; then
8672         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8673         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8674         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8675    fi
8678 AC_SUBST(MOZ_TREE_CAIRO)
8679 AC_SUBST(MOZ_CAIRO_CFLAGS)
8680 AC_SUBST(MOZ_CAIRO_LIBS)
8681 AC_SUBST(MOZ_TREE_PIXMAN)
8683 dnl ========================================================
8684 dnl qcms
8685 dnl ========================================================
8687 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8688 AC_SUBST(QCMS_LIBS)
8690 dnl ========================================================
8691 dnl HarfBuzz
8692 dnl ========================================================
8693 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8694 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8696 dnl ========================================================
8697 dnl OTS
8698 dnl ========================================================
8699 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8700 AC_SUBST(MOZ_OTS_LIBS)
8702 dnl ========================================================
8703 dnl disable xul
8704 dnl ========================================================
8705 MOZ_ARG_DISABLE_BOOL(xul,
8706 [  --disable-xul           Disable XUL],
8707     MOZ_XUL= )
8708 if test "$MOZ_XUL"; then
8709   AC_DEFINE(MOZ_XUL)
8710 else
8711   dnl remove extensions that require XUL
8712   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8715 AC_SUBST(MOZ_XUL)
8717 dnl ========================================================
8718 dnl disable profile locking
8719 dnl   do no use this in applications that can have more than
8720 dnl   one process accessing the profile directory.
8721 dnl ========================================================
8722 MOZ_ARG_DISABLE_BOOL(profilelocking,
8723 [  --disable-profilelocking
8724                           Disable profile locking],
8725     MOZ_PROFILELOCKING=,
8726     MOZ_PROFILELOCKING=1 )
8727 if test "$MOZ_PROFILELOCKING"; then
8728   AC_DEFINE(MOZ_PROFILELOCKING)
8731 dnl ========================================================
8732 dnl disable rdf services
8733 dnl ========================================================
8734 MOZ_ARG_DISABLE_BOOL(rdf,
8735 [  --disable-rdf           Disable RDF],
8736     MOZ_RDF= )
8737 if test "$MOZ_RDF"; then
8738   AC_DEFINE(MOZ_RDF)
8741 AC_SUBST(MOZ_RDF)
8743 dnl ========================================================
8744 dnl necko configuration options
8745 dnl ========================================================
8748 dnl option to disable various necko protocols
8750 MOZ_ARG_ENABLE_STRING(necko-protocols,
8751 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8752                           Enable/disable specific protocol handlers],
8753 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8754     if test "$option" = "yes" -o "$option" = "all"; then
8755         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8756     elif test "$option" = "no" -o "$option" = "none"; then
8757         NECKO_PROTOCOLS=""
8758     elif test "$option" = "default"; then
8759         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8760     elif test `echo "$option" | grep -c \^-` != 0; then
8761         option=`echo $option | sed 's/^-//'`
8762         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8763     else
8764         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8765     fi
8766 done],
8767     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8768 dnl Remove dupes
8769 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8770 AC_SUBST(NECKO_PROTOCOLS)
8771 for p in $NECKO_PROTOCOLS; do
8772     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8773 done
8776 dnl option to disable necko's disk cache
8778 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8779 [  --disable-necko-disk-cache
8780                           Disable necko disk cache],
8781     NECKO_DISK_CACHE=,
8782     NECKO_DISK_CACHE=1)
8783 AC_SUBST(NECKO_DISK_CACHE)
8784 if test "$NECKO_DISK_CACHE"; then
8785     AC_DEFINE(NECKO_DISK_CACHE)
8789 dnl option to disable necko's wifi scanner
8791 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8792 [  --disable-necko-wifi    Disable necko wifi scanner],
8793     NECKO_WIFI=,
8794     NECKO_WIFI=1)
8796 if test "$OS_ARCH" = "OS2"; then
8797   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8798   NECKO_WIFI=
8800 if test "$NECKO_WIFI" -a \
8801         "$OS_ARCH" != "Linux" -a \
8802         "$OS_ARCH" != "Darwin" -a \
8803         "$OS_ARCH" != "SunOS" -a \
8804         "$OS_ARCH" != "WINNT" -a \
8805         "$OS_ARCH" != "WINCE"; then
8806   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8809 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8810 then
8811   AC_CHECK_HEADER([iwlib.h])
8812   if test "$ac_cv_header_iwlib_h" != "yes"; then
8813     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)); use --disable-necko-wifi to disable])
8814   fi
8817 if test "$NECKO_WIFI"; then
8818   AC_DEFINE(NECKO_WIFI)
8820 AC_SUBST(NECKO_WIFI)
8823 dnl option to disable cookies
8825 MOZ_ARG_DISABLE_BOOL(cookies,
8826 [  --disable-cookies       Disable cookie support],
8827     NECKO_COOKIES=,
8828     NECKO_COOKIES=1)
8829 AC_SUBST(NECKO_COOKIES)
8830 if test "$NECKO_COOKIES"; then
8831     AC_DEFINE(NECKO_COOKIES)
8835 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8837 MOZ_ARG_DISABLE_BOOL(ctypes,
8838 [  --disable-ctypes        Disable js-ctypes],
8839     BUILD_CTYPES=,
8840     BUILD_CTYPES=1)
8841 AC_SUBST(BUILD_CTYPES)
8842 if test "$BUILD_CTYPES"; then
8843   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8844     # Disable ctypes for arm/wince.
8845     BUILD_CTYPES=
8846   else
8847     AC_DEFINE(BUILD_CTYPES)
8848   fi
8851 dnl NECKO_ configuration options are not global
8852 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8854 dnl Only build Mork if it's required
8855 AC_SUBST(MOZ_MORK)
8856 if test "$MOZ_MORK"; then
8857   AC_DEFINE(MOZ_MORK)
8860 dnl Build the lightweight Mork reader if required
8861 AC_SUBST(MOZ_MORKREADER)
8862 if test "$MOZ_MORKREADER"; then
8863   AC_DEFINE(MOZ_MORKREADER)
8866 dnl Build Places if required
8867 if test "$MOZ_PLACES"; then
8868   AC_DEFINE(MOZ_PLACES)
8871 dnl Build Sync Services if required
8872 AC_SUBST(MOZ_SERVICES_SYNC)
8873 if test -n "$MOZ_SERVICES_SYNC"; then
8874   AC_DEFINE(MOZ_SERVICES_SYNC)
8877 dnl ========================================================
8878 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8879     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8882 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8883   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8886 dnl ========================================================
8887 dnl =
8888 dnl = Maintainer debug option (no --enable equivalent)
8889 dnl =
8890 dnl ========================================================
8892 AC_SUBST(AR)
8893 AC_SUBST(AR_FLAGS)
8894 AC_SUBST(AR_LIST)
8895 AC_SUBST(AR_EXTRACT)
8896 AC_SUBST(AR_DELETE)
8897 AC_SUBST(AS)
8898 AC_SUBST(ASFLAGS)
8899 AC_SUBST(AS_DASH_C_FLAG)
8900 AC_SUBST(LD)
8901 AC_SUBST(RC)
8902 AC_SUBST(RCFLAGS)
8903 AC_SUBST(WINDRES)
8904 AC_SUBST(IMPLIB)
8905 AC_SUBST(FILTER)
8906 AC_SUBST(BIN_FLAGS)
8907 AC_SUBST(NS_USE_NATIVE)
8908 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8909 AC_SUBST(MOZ_UPDATE_XTERM)
8910 AC_SUBST(MINIMO)
8911 AC_SUBST(MOZ_PLATFORM_MAEMO)
8912 AC_SUBST(MOZ_AUTH_EXTENSION)
8913 AC_SUBST(MOZ_MATHML)
8914 AC_SUBST(MOZ_PERMISSIONS)
8915 AC_SUBST(MOZ_XTF)
8916 AC_SUBST(MOZ_PREF_EXTENSIONS)
8917 AC_SUBST(MOZ_SVG)
8918 AC_SUBST(MOZ_SMIL)
8919 AC_SUBST(MOZ_XSLT_STANDALONE)
8920 AC_SUBST(MOZ_JS_LIBS)
8921 AC_SUBST(MOZ_PSM)
8922 AC_SUBST(MOZ_DEBUG)
8923 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8924 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8925 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8926 AC_SUBST(MOZ_DEBUG_FLAGS)
8927 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8928 AC_SUBST(WARNINGS_AS_ERRORS)
8929 AC_SUBST(MOZ_EXTENSIONS)
8930 AC_SUBST(MOZ_JSDEBUGGER)
8931 AC_SUBST(MOZ_PLUGINS)
8932 AC_SUBST(MOZ_LOG_REFCNT)
8933 AC_SUBST(MOZ_LEAKY)
8934 AC_SUBST(MOZ_JPROF)
8935 AC_SUBST(MOZ_SHARK)
8936 AC_SUBST(MOZ_CALLGRIND)
8937 AC_SUBST(MOZ_VTUNE)
8938 AC_SUBST(MOZ_PROFILING)
8939 AC_SUBST(MOZ_JSLOADER)
8940 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8941 AC_SUBST(MOZ_QUANTIFY)
8942 AC_SUBST(LIBICONV)
8943 AC_SUBST(MOZ_PLACES)
8944 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8945 AC_SUBST(MOZ_STORAGE)
8946 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8947 AC_SUBST(MOZ_FEEDS)
8948 AC_SUBST(NS_PRINTING)
8949 AC_SUBST(MOZ_WEBGL)
8950 AC_SUBST(MOZ_HELP_VIEWER)
8952 AC_SUBST(MOZ_JAVAXPCOM)
8953 AC_SUBST(JAVA_INCLUDE_PATH)
8954 AC_SUBST(JAVA)
8955 AC_SUBST(JAVAC)
8956 AC_SUBST(JAR)
8958 AC_SUBST(MOZ_PROFILELOCKING)
8960 AC_SUBST(HAVE_XIE)
8961 AC_SUBST(MOZ_XIE_LIBS)
8963 AC_SUBST(BUILD_STATIC_LIBS)
8964 AC_SUBST(MOZ_ENABLE_LIBXUL)
8965 AC_SUBST(ENABLE_TESTS)
8966 AC_SUBST(IBMBIDI)
8967 AC_SUBST(MOZ_UNIVERSALCHARDET)
8968 AC_SUBST(ACCESSIBILITY)
8969 AC_SUBST(MOZ_VIEW_SOURCE)
8970 AC_SUBST(MOZ_SPELLCHECK)
8971 AC_SUBST(MOZ_USER_DIR)
8972 AC_SUBST(MOZ_CRASHREPORTER)
8973 AC_SUBST(MOZ_UPDATER)
8974 AC_SUBST(MOZ_ANGLE)
8975 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8977 AC_SUBST(ENABLE_STRIP)
8978 AC_SUBST(PKG_SKIP_STRIP)
8979 AC_SUBST(USE_ELF_DYNSTR_GC)
8980 AC_SUBST(INCREMENTAL_LINKER)
8981 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8982 AC_SUBST(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
8983 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8985 AC_SUBST(MOZ_FIX_LINK_PATHS)
8986 AC_SUBST(XPCOM_LIBS)
8987 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8988 AC_SUBST(XPCOM_GLUE_LDOPTS)
8989 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8991 AC_SUBST(USE_DEPENDENT_LIBS)
8993 AC_SUBST(MOZ_BUILD_ROOT)
8994 AC_SUBST(MOZ_OS2_TOOLS)
8996 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8997 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8998 AC_SUBST(MOZ_TIMELINE)
8999 AC_SUBST(OGLES_SDK_DIR)
9001 AC_SUBST(MOZ_APP_NAME)
9002 AC_SUBST(MOZ_APP_DISPLAYNAME)
9003 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
9004 AC_SUBST(MOZ_APP_UA_NAME)
9005 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
9006 AC_SUBST(MOZ_APP_VERSION)
9007 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
9008 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
9009 AC_SUBST(FIREFOX_VERSION)
9010 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
9011 AC_SUBST(MOZ_UA_BUILDID)
9013 AC_SUBST(MOZ_PKG_SPECIAL)
9015 AC_SUBST(MOZILLA_OFFICIAL)
9017 dnl win32 options
9018 AC_SUBST(MOZ_MAPINFO)
9019 AC_SUBST(MOZ_BROWSE_INFO)
9020 AC_SUBST(MOZ_TOOLS_DIR)
9021 AC_SUBST(CYGWIN_WRAPPER)
9022 AC_SUBST(AS_PERL)
9023 AC_SUBST(WIN32_REDIST_DIR)
9024 AC_SUBST(PYTHON)
9025 AC_SUBST(MAKENSISU)
9027 AC_SUBST(WINCE)
9028 AC_SUBST(WINCE_SDK_DIR)
9029 AC_SUBST(WINCE_WINDOWS_MOBILE)
9031 dnl Echo the CFLAGS to remove extra whitespace.
9032 CFLAGS=`echo \
9033         $_WARNINGS_CFLAGS \
9034         $CFLAGS`
9036 CXXFLAGS=`echo \
9037         $_MOZ_RTTI_FLAGS \
9038         $_MOZ_EXCEPTIONS_FLAGS \
9039         $_WARNINGS_CXXFLAGS \
9040         $CXXFLAGS`
9042 COMPILE_CFLAGS=`echo \
9043     $_DEFINES_CFLAGS \
9044         $_DEPEND_CFLAGS \
9045     $COMPILE_CFLAGS`
9047 COMPILE_CXXFLAGS=`echo \
9048     $_DEFINES_CXXFLAGS \
9049         $_DEPEND_CFLAGS \
9050     $COMPILE_CXXFLAGS`
9052 AC_SUBST(SYSTEM_MAKEDEPEND)
9053 AC_SUBST(SYSTEM_LIBXUL)
9054 AC_SUBST(SYSTEM_JPEG)
9055 AC_SUBST(SYSTEM_PNG)
9056 AC_SUBST(SYSTEM_ZLIB)
9057 AC_SUBST(SYSTEM_BZ2)
9059 AC_SUBST(JPEG_CFLAGS)
9060 AC_SUBST(JPEG_LIBS)
9061 AC_SUBST(ZLIB_CFLAGS)
9062 AC_SUBST(ZLIB_LIBS)
9063 AC_SUBST(BZ2_CFLAGS)
9064 AC_SUBST(BZ2_LIBS)
9065 AC_SUBST(PNG_CFLAGS)
9066 AC_SUBST(PNG_LIBS)
9068 AC_SUBST(MOZ_JPEG_CFLAGS)
9069 AC_SUBST(MOZ_JPEG_LIBS)
9070 AC_SUBST(MOZ_ZLIB_CFLAGS)
9071 AC_SUBST(MOZ_ZLIB_LIBS)
9072 AC_SUBST(MOZ_BZ2_CFLAGS)
9073 AC_SUBST(MOZ_BZ2_LIBS)
9074 AC_SUBST(MOZ_PNG_CFLAGS)
9075 AC_SUBST(MOZ_PNG_LIBS)
9077 AC_SUBST(NSPR_CFLAGS)
9078 AC_SUBST(NSPR_LIBS)
9079 AC_SUBST(MOZ_NATIVE_NSPR)
9081 AC_SUBST(NSS_CFLAGS)
9082 AC_SUBST(NSS_LIBS)
9083 AC_SUBST(NSS_DEP_LIBS)
9084 AC_SUBST(MOZ_NATIVE_NSS)
9085 AC_SUBST(NSS_DISABLE_DBM)
9087 AC_SUBST(CFLAGS)
9088 AC_SUBST(CXXFLAGS)
9089 AC_SUBST(CPPFLAGS)
9090 AC_SUBST(COMPILE_CFLAGS)
9091 AC_SUBST(COMPILE_CXXFLAGS)
9092 AC_SUBST(LDFLAGS)
9093 AC_SUBST(LIBS)
9094 AC_SUBST(CROSS_COMPILE)
9095 AC_SUBST(WCHAR_CFLAGS)
9097 AC_SUBST(HOST_CC)
9098 AC_SUBST(HOST_CXX)
9099 AC_SUBST(HOST_CFLAGS)
9100 AC_SUBST(HOST_CXXFLAGS)
9101 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9102 AC_SUBST(HOST_AR)
9103 AC_SUBST(HOST_AR_FLAGS)
9104 AC_SUBST(HOST_LD)
9105 AC_SUBST(HOST_RANLIB)
9106 AC_SUBST(HOST_NSPR_MDCPUCFG)
9107 AC_SUBST(HOST_BIN_SUFFIX)
9108 AC_SUBST(HOST_OS_ARCH)
9110 AC_SUBST(TARGET_CPU)
9111 AC_SUBST(TARGET_VENDOR)
9112 AC_SUBST(TARGET_OS)
9113 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9114 AC_SUBST(TARGET_MD_ARCH)
9115 AC_SUBST(TARGET_XPCOM_ABI)
9116 AC_SUBST(OS_TARGET)
9117 AC_SUBST(OS_ARCH)
9118 AC_SUBST(OS_RELEASE)
9119 AC_SUBST(OS_TEST)
9121 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9122 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9124 AC_SUBST(WRAP_MALLOC_CFLAGS)
9125 AC_SUBST(WRAP_MALLOC_LIB)
9126 AC_SUBST(MKSHLIB)
9127 AC_SUBST(MKCSHLIB)
9128 AC_SUBST(MKSHLIB_FORCE_ALL)
9129 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9130 AC_SUBST(DSO_CFLAGS)
9131 AC_SUBST(DSO_PIC_CFLAGS)
9132 AC_SUBST(DSO_LDOPTS)
9133 AC_SUBST(LIB_PREFIX)
9134 AC_SUBST(DLL_PREFIX)
9135 AC_SUBST(DLL_SUFFIX)
9136 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9137 AC_SUBST(LIB_SUFFIX)
9138 AC_SUBST(OBJ_SUFFIX)
9139 AC_SUBST(BIN_SUFFIX)
9140 AC_SUBST(ASM_SUFFIX)
9141 AC_SUBST(IMPORT_LIB_SUFFIX)
9142 AC_SUBST(USE_N32)
9143 AC_SUBST(CC_VERSION)
9144 AC_SUBST(CXX_VERSION)
9145 AC_SUBST(MSMANIFEST_TOOL)
9146 AC_SUBST(NS_ENABLE_TSF)
9147 AC_SUBST(MOZ_NSS_PATCH)
9148 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9149 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9151 AC_SUBST(MOZ_MEDIA)
9152 AC_SUBST(MOZ_SYDNEYAUDIO)
9153 AC_SUBST(MOZ_WAVE)
9154 AC_SUBST(MOZ_VORBIS)
9155 AC_SUBST(MOZ_TREMOR)
9156 AC_SUBST(MOZ_WEBM)
9157 AC_SUBST(MOZ_OGG)
9158 AC_SUBST(MOZ_ALSA_LIBS)
9159 AC_SUBST(VPX_AS)
9160 AC_SUBST(VPX_ASFLAGS)
9161 AC_SUBST(VPX_DASH_C_FLAG)
9162 AC_SUBST(VPX_AS_CONVERSION)
9163 AC_SUBST(VPX_ASM_SUFFIX)
9164 AC_SUBST(VPX_X86_ASM)
9165 AC_SUBST(VPX_ARM_ASM)
9167 if test "$USING_HCC"; then
9168    CC='${topsrcdir}/build/hcc'
9169    CC="$CC '$_OLDCC'"
9170    CXX='${topsrcdir}/build/hcpp'
9171    CXX="$CXX '$_OLDCXX'"
9172    AC_SUBST(CC)
9173    AC_SUBST(CXX)
9176 AC_MSG_CHECKING([for posix_fallocate])       
9177 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9178   #include <fcntl.h>],
9179                  [posix_fallocate(0, 0, 0);],
9180                  [ac_cv___posix_fallocate=true],
9181                  [ac_cv___posix_fallocate=false])
9183 if test "$ac_cv___posix_fallocate" = true ; then
9184   AC_DEFINE(HAVE_POSIX_FALLOCATE)
9185   AC_MSG_RESULT(yes)
9186 else
9187   AC_MSG_RESULT(no)
9190 dnl Check for missing components
9191 if test "$COMPILE_ENVIRONMENT"; then
9192 if test "$MOZ_X11"; then
9193     dnl ====================================================
9194     dnl = Check if X headers exist
9195     dnl ====================================================
9196     _SAVE_CFLAGS=$CFLAGS
9197     CFLAGS="$CFLAGS $XCFLAGS"
9198     AC_TRY_COMPILE([
9199         #include <stdio.h>
9200         #include <stdlib.h>
9201         #include <X11/Xlib.h>
9202         #include <X11/Intrinsic.h>
9203     ],
9204     [
9205         Display *dpy = 0;
9206         if ((dpy = XOpenDisplay(NULL)) == NULL) {
9207             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9208             exit(1);
9209         }
9210     ], [], 
9211     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9212     CFLAGS="$_SAVE_CFLAGS"
9214     if test ! -z "$MISSING_X"; then
9215         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9216     fi
9218 fi # MOZ_X11
9220 dnl Check for headers, etc. needed by WebGL.
9221 if test -n "$MOZ_WEBGL_GLX"; then
9222     AC_CHECK_HEADER(GL/glx.h)
9223     if test "$ac_cv_header_GL_glx_h" != "yes"; then
9224         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
9225     fi
9226 fi # MOZ_WEBGL_GLX
9227 fi # COMPILE_ENVIRONMENT
9229 if test "$USE_FC_FREETYPE"; then
9230     if test "$COMPILE_ENVIRONMENT"; then
9231         _SAVE_CPPFLAGS="$CPPFLAGS"
9232         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9233         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
9234             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9235         CPPFLAGS="$_SAVE_CPPFLAGS"
9236     else
9237         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9238     fi
9241 dnl Set various defines and substitutions
9242 dnl ========================================================
9244 if test "$OS_ARCH" = "BeOS"; then
9245   AC_DEFINE(XP_BEOS)
9246 elif test "$OS_ARCH" = "Darwin"; then
9247   AC_DEFINE(XP_UNIX)
9248   AC_DEFINE(UNIX_ASYNC_DNS)
9249 elif test "$OS_ARCH" = "OpenVMS"; then
9250   AC_DEFINE(XP_UNIX)
9251 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9252   AC_DEFINE(XP_UNIX)
9253   AC_DEFINE(UNIX_ASYNC_DNS)
9256 if test "$MOZ_DEBUG"; then
9257     AC_DEFINE(MOZ_REFLOW_PERF)
9258     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9261 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9262     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9263     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9264     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9265     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9266     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9267     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9268     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9269     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9272 dnl ========================================================
9273 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9274 dnl ========================================================
9275 case "$host_os" in
9276 mingw*)
9277     WIN_TOP_SRC=`cd $srcdir; pwd -W`
9278     ;;
9279 cygwin*|msvc*|mks*)
9280     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9281     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9282     CC="\$(CYGWIN_WRAPPER) $CC"
9283     CXX="\$(CYGWIN_WRAPPER) $CXX"
9284     CPP="\$(CYGWIN_WRAPPER) $CPP"
9285     LD="\$(CYGWIN_WRAPPER) $LD"
9286     AS="\$(CYGWIN_WRAPPER) $AS"
9287     RC="\$(CYGWIN_WRAPPER) $RC"
9288     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9289     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9290     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9291     ;;
9292 esac
9294 AC_SUBST(CYGDRIVE_MOUNT)
9295 AC_SUBST(WIN_TOP_SRC)
9297 AC_SUBST(MOZILLA_VERSION)
9299 AC_SUBST(ac_configure_args)
9301 dnl Spit out some output
9302 dnl ========================================================
9304 dnl The following defines are used by xpcom
9305 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9306 CPP_THROW_NEW
9307 HAVE_CPP_2BYTE_WCHAR_T
9308 HAVE_CPP_ACCESS_CHANGING_USING
9309 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9310 HAVE_CPP_BOOL
9311 HAVE_CPP_CHAR16_T
9312 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9313 HAVE_CPP_EXPLICIT
9314 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9315 HAVE_CPP_NAMESPACE_STD
9316 HAVE_CPP_NEW_CASTS
9317 HAVE_CPP_PARTIAL_SPECIALIZATION
9318 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9319 HAVE_CPP_TYPENAME
9320 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9321 HAVE_STATVFS
9322 NEED_CPP_UNUSED_IMPLEMENTATIONS
9323 NEW_H
9324 HAVE_GETPAGESIZE
9325 HAVE_ICONV
9326 HAVE_ICONV_WITH_CONST_INPUT
9327 HAVE_MBRTOWC
9328 HAVE_SYS_MOUNT_H
9329 HAVE_SYS_VFS_H
9330 HAVE_WCRTOMB
9333 AC_CONFIG_HEADER(
9334 netwerk/necko-config.h
9335 xpcom/xpcom-config.h
9336 xpcom/xpcom-private.h
9339 # Save the defines header file before autoconf removes it.
9340 # (Do not add AC_DEFINE calls after this line.)
9341   _CONFIG_TMP=confdefs-tmp.h
9342   _CONFIG_DEFS_H=mozilla-config.h
9344   cat > $_CONFIG_TMP <<\EOF
9345 /* List of defines generated by configure. Included with preprocessor flag,
9346  * -include, to avoid long list of -D defines on the compile command-line.
9347  * Do not edit.
9348  */
9350 #ifndef _MOZILLA_CONFIG_H_
9351 #define _MOZILLA_CONFIG_H_
9354 _EGREP_PATTERN='^#define ('
9355 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9356     for f in $_NON_GLOBAL_ACDEFINES; do
9357         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9358     done
9360 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9362   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9364   cat >> $_CONFIG_TMP <<\EOF
9366 #endif /* _MOZILLA_CONFIG_H_ */
9370   # Only write mozilla-config.h when something changes (or it doesn't exist)
9371   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9372     rm $_CONFIG_TMP
9373   else
9374     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9375     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9377     echo ==== $_CONFIG_DEFS_H =================================
9378     cat $_CONFIG_DEFS_H
9379   fi
9381 dnl Probably shouldn't call this manually but we always want the output of DEFS
9382 rm -f confdefs.h.save
9383 mv confdefs.h confdefs.h.save
9384 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9385 AC_OUTPUT_MAKE_DEFS()
9386 MOZ_DEFINES=$DEFS
9387 AC_SUBST(MOZ_DEFINES)
9388 rm -f confdefs.h
9389 mv confdefs.h.save confdefs.h
9391 dnl Load the list of Makefiles to generate.
9392 dnl   To add new Makefiles, edit allmakefiles.sh.
9393 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9394 . ${srcdir}/allmakefiles.sh
9395 dnl 
9396 dnl Run a perl script to quickly create the makefiles.
9397 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9398 dnl   for the files it cannot handle correctly. This way, config.status
9399 dnl   will handle these files.
9400 dnl If it fails, nothing is set and config.status will run as usual.
9402 dnl This does not change the $MAKEFILES variable.
9404 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9406 if test -z "${AS_PERL}"; then
9407 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9408 else
9409 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9411 . ./conftest.sh
9412 rm conftest.sh
9414 echo $MAKEFILES > unallmakefiles
9416 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9418 AC_OUTPUT($MAKEFILES)
9420 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9421 if test "$CAIRO_FEATURES_H"; then
9422   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9423     echo "$CAIRO_FEATURES_H is unchanged"
9424     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9425   else
9426     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9427   fi
9430 # Run freetype configure script
9432 if test "$MOZ_TREE_FREETYPE"; then
9433    export CFLAGS="$CFLAGS -std=c99"
9434    export CPPFLAGS="$CPPFLAGS"
9435    export CXXFLAGS="$CXXFLAGS"
9436    export LDFLAGS="$LDFLAGS"
9437    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9438    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9439    AC_OUTPUT_SUBDIRS(modules/freetype2)
9442 dnl ========================================================
9443 dnl = Setup a nice relatively clean build environment for
9444 dnl = sub-configures.
9445 dnl ========================================================
9446 CC="$_SUBDIR_CC" 
9447 CXX="$_SUBDIR_CXX" 
9448 CFLAGS="$_SUBDIR_CFLAGS" 
9449 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9450 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9451 LDFLAGS="$_SUBDIR_LDFLAGS"
9452 HOST_CC="$_SUBDIR_HOST_CC" 
9453 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9454 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9457 unset MAKEFILES
9458 unset CONFIG_FILES
9460 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9461 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9463 if test -n "$MOZ_THUMB2"; then
9464   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9466 if test -n "$_WRAP_MALLOC"; then
9467   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9470 if test -z "$MOZ_NATIVE_NSPR"; then
9471     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9472     if test -z "$MOZ_DEBUG"; then
9473         ac_configure_args="$ac_configure_args --disable-debug"
9474     fi
9475     if test "$MOZ_OPTIMIZE" = "1"; then
9476         ac_configure_args="$ac_configure_args --enable-optimize"
9477     fi
9478     if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9479        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9480     fi
9481     if test -n "$HAVE_64BIT_OS"; then
9482         ac_configure_args="$ac_configure_args --enable-64bit"
9483     fi
9484     if test -n "$USE_ARM_KUSER"; then
9485         ac_configure_args="$ac_configure_args --with-arm-kuser"
9486     fi
9487     AC_OUTPUT_SUBDIRS(nsprpub)
9488     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9491 if test -z "$MOZ_NATIVE_NSPR"; then
9492     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9493     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9494     if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9495        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9496        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9497        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9498        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9499     fi
9500     rm -f config/autoconf.mk.bak
9503 # Run the SpiderMonkey 'configure' script.
9504 dist=$MOZ_BUILD_ROOT/dist
9505 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9506 ac_configure_args="$ac_configure_args --enable-threadsafe"
9507 if test "$BUILD_CTYPES"; then
9508     # Build js-ctypes on the platforms we can.
9509     ac_configure_args="$ac_configure_args --enable-ctypes"
9511 if test -z "$JS_SHARED_LIBRARY" ; then
9512     ac_configure_args="$ac_configure_args --disable-shared-js"
9514 if test -z "$MOZ_NATIVE_NSPR"; then
9515     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9516     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9518 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9519 ac_configure_args="$ac_configure_args --prefix=$dist"
9520 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9521 if test "$MOZ_MEMORY"; then
9522    ac_configure_args="$ac_configure_args --enable-jemalloc"
9523    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9524      export MOZ_MEMORY_LDFLAGS
9525    fi
9527 AC_OUTPUT_SUBDIRS(js/src)
9528 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9530 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9532 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9533 dnl Needs to be at the end to respect possible changes from NSPR configure
9534 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9535   echo "config/autoconf.mk is unchanged"
9536   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9537 else
9538   rm -f config/autoconf.mk.orig 2> /dev/null