bug 313956: expand installer .exe contents to make complete mar. r=ted.
[gecko.git] / configure.in
blob05bd8e27836b7ce77a71c6208123e21ea9bcdbeb
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.4
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 *-mingw*)
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 -fno-short-enums -fno-exceptions $CFLAGS"
301     CXXFLAGS="-mandroid -I$android_platform/usr/include -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 *-mingw*|*-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=''
686         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
688         if test -n "$WIN32_REDIST_DIR"; then
689             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
690         fi
692         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
693         dnl not something else like "magnetic tape manipulation utility".
694         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
695         if test -z "$MSMT_TOOL"; then
696           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
697         fi
699         changequote(,)
700         _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
701         changequote([,])
702         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
703         if test -z "$MSMANIFEST_TOOL_VERSION"; then
704           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
705         fi
707         MSMANIFEST_TOOL=1
708         unset MSMT_TOOL
710         # Check linker version
711         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
712         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
713         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
714             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
715         fi
717         INCREMENTAL_LINKER=1
719         # Check midl version
720         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
721         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
722         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
723         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
724         # Add flags if necessary
725         AC_MSG_CHECKING([for midl flags])
726         case "$target" in
727         i*86-*)
728             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
729                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
730                 # MIDL version 7.00.0500 or later has no problem.
731                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
732                 AC_MSG_RESULT([need -env win32])
733             else
734                 AC_MSG_RESULT([none needed])
735             fi
736             ;;
737         x86_64-*)
738             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
739             ;;
740         *)
741             AC_MSG_RESULT([none needed])
742             ;;
743         esac
745         # Identify which version of the SDK we're building with
746         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
747         # from there
748         MOZ_CHECK_HEADERS([winsdkver.h])
749         if test "$ac_cv_header_winsdkver_h" = "yes"; then
750             # Get the highest _WIN32_WINNT and NTDDI versions supported
751             # Take the higher of the two
752             # This is done because the Windows 7 beta SDK reports its
753             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
754             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
755                            ac_cv_winsdk_maxver,
756                            [cat > conftest.h <<EOF
757 #include <winsdkver.h>
758 #include <sdkddkver.h>
760 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
761 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
762 #else
763 #define WINSDK_MAXVER NTDDI_MAXVER
764 #endif
766 WINSDK_MAXVER
768                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
769                             rm -f conftest.h
770                            ])
771             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
772         else
773             # The Vista SDK is the only one to have sdkddkver.h but not
774             # WinSDKVer.h
775             MOZ_CHECK_HEADERS([sdkddkver.h])
776             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
777                 MOZ_WINSDK_MAXVER=0x06000000
778             else
779                 # Assume the Server 2003 Platform SDK
780                 MOZ_WINSDK_MAXVER=0x05020000
781             fi
782         fi
784         unset _MSVC_VER_FILTER
786         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
787             [
788                 AC_LANG_SAVE
789                 AC_LANG_CPLUSPLUS
790                 _SAVE_CXXFLAGS="$CXXFLAGS"
791                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
792                 AC_TRY_COMPILE([#include <exception>],
793                             [std::_Throw(std::exception()); return 0;],
794                             ac_cv_have_std__Throw="yes",
795                             ac_cv_have_std__Throw="no")
796                 CXXFLAGS="$_SAVE_CXXFLAGS"
797                 AC_LANG_RESTORE
798             ])
800         if test "$ac_cv_have_std__Throw" = "yes"; then
801             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
802                            ac_cv_have_dllimport_exception_bug,
803                 [
804                     AC_LANG_SAVE
805                     AC_LANG_CPLUSPLUS
806                     _SAVE_CXXFLAGS="$CXXFLAGS"
807                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
808                     AC_TRY_LINK([#include <vector>],
809                                 [std::vector<int> v; return v.at(1);],
810                                 ac_cv_have_dllimport_exception_bug="no",
811                                 ac_cv_have_dllimport_exception_bug="yes")
812                     CXXFLAGS="$_SAVE_CXXFLAGS"
813                     AC_LANG_RESTORE
814                 ])
815             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
816                 WRAP_STL_INCLUDES=1
817                 MOZ_MSVC_STL_WRAP__Throw=1
818                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
819             fi
820         else
821             AC_CACHE_CHECK(for overridable _RAISE,
822                            ac_cv_have__RAISE,
823                 [
824                     AC_LANG_SAVE
825                     AC_LANG_CPLUSPLUS
826                     _SAVE_CXXFLAGS="$CXXFLAGS"
827                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
828                     AC_TRY_COMPILE([#include <xstddef>
829                                     #undef _RAISE
830                                     #define _RAISE(x) externallyDefinedFunction((x).what())
831                                     #include <vector>
832                                    ],
833                                    [std::vector<int> v; return v.at(1);],
834                                    ac_cv_have__RAISE="no",
835                                    ac_cv_have__RAISE="yes")
836                     CXXFLAGS="$_SAVE_CXXFLAGS"
837                     AC_LANG_RESTORE
838                 ])
839             if test "$ac_cv_have__RAISE" = "yes"; then
840                 WRAP_STL_INCLUDES=1
841                 MOZ_MSVC_STL_WRAP__RAISE=1
842                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
843             else
844                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
845             fi
846         fi
848         if test "$WRAP_STL_INCLUDES" = "1"; then
849             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
850         fi
851     else
852         # Check w32api version
853         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
854         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
855         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
856         AC_TRY_COMPILE([#include <w32api.h>],
857             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
858                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
859                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
860                 #error "test failed."
861             #endif
862             , [ res=yes ], [ res=no ])
863         AC_MSG_RESULT([$res])
864         if test "$res" != "yes"; then
865             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
866         fi
867         # Check windres version
868         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
869         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
870         AC_MSG_RESULT([$_WINDRES_VERSION])
871         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
872         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
873         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
874         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
875         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
876         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
877         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
878                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
879                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
880                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
881                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
882                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
883         then
884             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
885         fi
887         # Server 2003 is the highest version supported
888         MOZ_WINSDK_MAXVER=0x05020000
889     fi # !GNU_CC
891     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
892     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
893     # Require OS features provided by IE 5.0
894     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
896     # If the maximum version supported by this SDK is lower than the target
897     # version, error out
898     AC_MSG_CHECKING([for Windows SDK being recent enough])
899     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
900         AC_MSG_RESULT("yes")
901     else
902         AC_MSG_RESULT("no")
903         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.])
904     fi
906     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
907     # Definitions matching sdkddkver.h
908     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
909     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
910     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
911     ;;
912 esac
914 dnl Test breaks icc on OS/2 && MSVC
915 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
916     AC_PROG_CC_C_O
917     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
918         USING_HCC=1
919         _OLDCC=$CC
920         _OLDCXX=$CXX
921         CC="${srcdir}/build/hcc '$CC'"
922         CXX="${srcdir}/build/hcpp '$CXX'"
923     fi
926 AC_PROG_CPP
927 AC_PROG_CXXCPP
929 if test -n "$_WIN32_MSVC"; then
930     SKIP_PATH_CHECKS=1
931     SKIP_COMPILER_CHECKS=1
932     SKIP_LIBRARY_CHECKS=1
934     # Since we're skipping compiler and library checks, hard-code
935     # some facts here.
936     case "$target" in
937     *-wince|*-winmo)
938         ;;
939     *)
940         AC_DEFINE(HAVE_IO_H)
941         AC_DEFINE(HAVE_SETBUF)
942         AC_DEFINE(HAVE_ISATTY)
943         ;;
944     esac
947 fi # COMPILE_ENVIRONMENT
949 AC_SUBST(MIDL_FLAGS)
950 AC_SUBST(_MSC_VER)
952 AC_SUBST(GNU_AS)
953 AC_SUBST(GNU_LD)
954 AC_SUBST(GNU_CC)
955 AC_SUBST(GNU_CXX)
956 AC_SUBST(INTEL_CC)
957 AC_SUBST(INTEL_CXX)
959 AC_SUBST(STL_FLAGS)
960 AC_SUBST(WRAP_STL_INCLUDES)
961 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
962 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
964 dnl ========================================================
965 dnl Checks for programs.
966 dnl ========================================================
967 AC_PROG_INSTALL
968 AC_PROG_LN_S
970 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
971 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
972 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
973 _perl_res=$?
974 AC_MSG_RESULT([$_perl_version])
976 if test "$_perl_res" != 0; then
977     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
981 AC_MSG_CHECKING([for full perl installation])
982 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
983 _perl_res=$?
984 if test "$_perl_res" != 0; then
985     AC_MSG_RESULT([no])
986     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
987 else
988     AC_MSG_RESULT([yes])    
991 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
992 if test -z "$PYTHON"; then
993     AC_MSG_ERROR([python was not found in \$PATH])
996 if test -z "$COMPILE_ENVIRONMENT"; then
997     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
999 AC_SUBST(NSINSTALL_BIN)
1001 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1002 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1003 MOZ_PATH_PROG(UNZIP, unzip, :)
1004 MOZ_PATH_PROGS(ZIP, zip)
1005 if test -z "$ZIP" -o "$ZIP" = ":"; then
1006     AC_MSG_ERROR([zip not found in \$PATH])
1008 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1009 MOZ_PATH_PROG(XARGS, xargs)
1010 if test -z "$XARGS" -o "$XARGS" = ":"; then
1011     AC_MSG_ERROR([xargs not found in \$PATH .])
1014 if test "$COMPILE_ENVIRONMENT"; then
1016 dnl ========================================================
1017 dnl = Mac OS X toolchain support
1018 dnl ========================================================
1020 case "$target_os" in
1021 darwin*)
1022     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1023     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1024     dnl the environment and includedir purposes (when using an SDK, below),
1025     dnl but remember the full version number for the libdir (SDK).
1026     changequote(,)
1027     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1028     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1029     changequote([,])
1030     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1031         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1032         dnl 4.0.0/4061 is the default compiler in Tiger.
1033         changequote(,)
1034         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1035         changequote([,])
1036         if test "$GCC_BUILD" = "4061" ; then
1037             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1038 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1039 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1040         fi
1041     fi
1043     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1044     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1045     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1046     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1048     case "$PBBUILD" in
1049       *xcodebuild*)
1050         changequote(,)
1051         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1052         changequote([,])
1053         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
1054           HAS_XCODE_2_1=1;
1055         fi
1056       ;;
1057     esac
1059     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1060     dnl it has moved into /usr/bin.
1061     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1062     ;;
1063 esac
1065 AC_SUBST(GCC_VERSION)
1066 AC_SUBST(XCODEBUILD_VERSION)
1067 AC_SUBST(HAS_XCODE_2_1)
1069 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1070 dnl that a universal binary is being produced.
1071 AC_SUBST(UNIVERSAL_BINARY)
1073 dnl ========================================================
1074 dnl Check for MacOS deployment target version
1075 dnl ========================================================
1077 MOZ_ARG_ENABLE_STRING(macos-target,
1078                       [  --enable-macos-target=VER (default=10.5)
1079                           Set the minimum MacOS version needed at runtime],
1080                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1082 case "$target" in
1083 *-darwin*)
1084     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1085         dnl Use the specified value
1086         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1087         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1088     else
1089         dnl No value specified on the command line or in the environment,
1090         dnl use architecture minimum.
1091         case "${target_cpu}" in
1092           ppc*)
1093             export MACOSX_DEPLOYMENT_TARGET=10.5
1094             ;;
1095           i*86)
1096             export MACOSX_DEPLOYMENT_TARGET=10.5
1097             ;;
1098           x86_64)
1099             export MACOSX_DEPLOYMENT_TARGET=10.6
1100             ;;
1101         esac
1102     fi
1103     ;;
1104 esac
1106 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1108 dnl ========================================================
1109 dnl = Mac OS X SDK support
1110 dnl ========================================================
1111 MACOS_SDK_DIR=
1112 NEXT_ROOT=
1113 MOZ_ARG_WITH_STRING(macos-sdk,
1114 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1115     MACOS_SDK_DIR=$withval)
1117 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1118 dnl NEXT_ROOT will be set and exported only if it's needed.
1119 AC_SUBST(MACOS_SDK_DIR)
1120 AC_SUBST(NEXT_ROOT)
1122 if test "$MACOS_SDK_DIR"; then
1123   dnl Sync this section with the ones in NSPR and NSS.
1124   dnl Changes to the cross environment here need to be accounted for in
1125   dnl the libIDL checks (below) and xpidl build.
1127   if test ! -d "$MACOS_SDK_DIR"; then
1128     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1129 specify a valid SDK.  SDKs are installed when the optional cross-development
1130 tools are selected during the Xcode/Developer Tools installation.])
1131   fi
1133   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1134   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1135     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1136   else
1137     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1138     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1140     dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1141     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1142     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1144     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1145       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1146       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1147       dnl be ignored and cause warnings when -syslibroot is specified.
1148       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1149       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1150       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1151     fi
1152   fi
1154   AC_LANG_SAVE
1155   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1156   AC_LANG_CPLUSPLUS
1157   AC_TRY_COMPILE([#include <new>],[],
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 dnl clang prior to 2.9 (including Xcode 4) does not support all the
1171 dnl constructs required by the libtheora inline asm. This is used to
1172 dnl detect and disable it
1173 AC_LANG_SAVE
1174 AC_LANG_C
1175 AC_TRY_COMPILE([
1176 #if defined(__clang__)
1177 # if __clang_major__<2 || (__clang_major__==2 && __clang_minor__<9)
1178 #  error "clang older than 2.9 detected"
1179 # endif
1180 #endif
1181                ],
1182                [],
1183                result="yes",
1184                result="no")
1185 if test "$result" = "no"; then
1186     AC_DEFINE(HAVE_OLD_CLANG)
1187     HAVE_OLD_CLANG=1
1189 AC_LANG_RESTORE
1190 AC_SUBST(HAVE_OLD_CLANG)
1192 if test -n "$MAKE"; then
1193   if test `echo $MAKE | grep -c make.py` != 1; then
1194      NOT_PYMAKE=$MAKE
1195   fi
1198 case "$host_os" in
1199 mingw*)
1200     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1201     ;;
1203     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1204     ;;
1205 esac
1206 if test "$GMAKE" = ":"; then
1207    AC_MSG_ERROR([GNU make not found])
1209 AC_SUBST(GMAKE)
1211 if test "$COMPILE_ENVIRONMENT"; then
1213 AC_PATH_XTRA
1215 XCFLAGS="$X_CFLAGS"
1217 fi # COMPILE_ENVIRONMENT
1219 dnl ========================================================
1220 dnl set the defaults first
1221 dnl ========================================================
1222 AS_BIN=$AS
1223 AR_LIST='$(AR) t'
1224 AR_EXTRACT='$(AR) x'
1225 AR_DELETE='$(AR) d'
1226 AS='$(CC)'
1227 AS_DASH_C_FLAG='-c'
1228 DLL_PREFIX=lib
1229 LIB_PREFIX=lib
1230 DLL_SUFFIX=.so
1231 OBJ_SUFFIX=o
1232 LIB_SUFFIX=a
1233 ASM_SUFFIX=s
1234 IMPORT_LIB_SUFFIX=
1235 TARGET_MD_ARCH=unix
1236 DIRENT_INO=d_ino
1237 WIN_TOP_SRC=
1238 MOZ_USER_DIR=".mozilla"
1240 MOZ_JPEG_CFLAGS=
1241 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1242 MOZ_ZLIB_CFLAGS=
1243 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1244 MOZ_BZ2_CFLAGS=
1245 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1246 MOZ_PNG_CFLAGS=
1247 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1249 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1250 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1251 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1252 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1253 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1254 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1255 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1256 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1258 MOZ_FS_LAYOUT=unix
1260 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1262 USE_DEPENDENT_LIBS=1
1264 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1266 if test -n "$CROSS_COMPILE"; then
1267     OS_TARGET="${target_os}"
1268     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1269     OS_RELEASE=
1270     case "${target_os}" in
1271         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1272         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1273         gnu*)         OS_ARCH=GNU ;;
1274         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1275         mingw*)       OS_ARCH=WINNT ;;
1276         wince*)       OS_ARCH=WINCE ;;
1277         winmo*)       OS_ARCH=WINCE ;;
1278         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1279     esac
1280     case "${target}" in
1281         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1282     esac
1283 else
1284     OS_TARGET=`uname -s`
1285     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1286     OS_RELEASE=`uname -r`
1289 # Before this used `uname -m` when not cross compiling
1290 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1291 OS_TEST="${target_cpu}"
1293 _COMPILER_PREFIX=
1295 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1297 #######################################################################
1298 # Master "Core Components" macros for getting the OS target           #
1299 #######################################################################
1302 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1303 # cross-compilation.
1307 # Define and override various archtecture-specific variables, including
1308 # HOST_OS_ARCH
1309 # OS_ARCH
1310 # OS_TEST
1311 # OS_TARGET
1312 # OS_RELEASE
1313 # OS_MINOR_RELEASE
1316 case "$HOST_OS_ARCH" in
1317 mingw*)
1318     HOST_OS_ARCH=WINNT
1319     ;;
1320 darwin*)
1321     HOST_OS_ARCH=Darwin
1322     ;;
1323 linux*)
1324     HOST_OS_ARCH=Linux
1325     ;;
1326 solaris*)
1327     HOST_OS_ARCH=SunOS
1328     SOLARIS_SUNPRO_CC=
1329     SOLARIS_SUNPRO_CXX=
1330     if test -z "$GNU_CC"; then
1331         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1332             SOLARIS_SUNPRO_CC=1
1333        fi
1334     fi
1336     if test -z "$GNU_CXX"; then
1337        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1338            SOLARIS_SUNPRO_CXX=1
1339        fi
1340     fi
1341     AC_SUBST(SOLARIS_SUNPRO_CC)
1342     AC_SUBST(SOLARIS_SUNPRO_CXX)
1343     ;;
1344 BSD_386)
1345     HOST_OS_ARCH=BSD
1346     ;;
1347 dgux)
1348     HOST_OS_ARCH=DGUX
1349     ;;
1350 IRIX64)
1351     HOST_OS_ARCH=IRIX
1352     ;;
1353 UNIX_SV)
1354     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1355         HOST_OS_ARCH=NCR
1356     else
1357         HOST_OS_ARCH=UNIXWARE
1358     fi
1359     ;;
1360 ncr)
1361     HOST_OS_ARCH=NCR
1362     ;;
1363 UNIX_SYSTEM_V)
1364     HOST_OS_ARCH=NEC
1365     ;;
1366 OSF1)
1367     ;;
1368 OS_2)
1369     HOST_OS_ARCH=OS2
1370     ;;
1371 QNX)
1372     ;;
1373 SCO_SV)
1374     HOST_OS_ARCH=SCOOS
1375     ;;
1376 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1377     HOST_OS_ARCH=SINIX
1378     ;;
1379 UnixWare)
1380     HOST_OS_ARCH=UNIXWARE
1381     ;;
1382 esac
1384 case "$OS_ARCH" in
1385 WINNT)
1386     if test -z "$CROSS_COMPILE" ; then
1387         OS_TEST=`uname -p`
1388     fi
1389     ;;
1390 Windows_NT)
1392 # If uname -s returns "Windows_NT", we assume that we are using
1393 # the uname.exe in MKS toolkit.
1395 # The -r option of MKS uname only returns the major version number.
1396 # So we need to use its -v option to get the minor version number.
1397 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1399     OS_ARCH=WINNT
1400     OS_TARGET=WINNT
1401     OS_MINOR_RELEASE=`uname -v`
1402     if test "$OS_MINOR_RELEASE" = "00"; then
1403         OS_MINOR_RELEASE=0
1404     fi
1405     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1406     ;;
1407 MINGW*_NT*)
1409 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1410 # the uname.exe in the MSYS tools.
1412     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1413     OS_ARCH=WINNT
1414     OS_TARGET=WINNT
1415     ;;
1416 AIX)
1417     OS_RELEASE=`uname -v`.`uname -r`
1418     OS_TEST=${target_cpu}
1419     ;;
1420 BSD_386)
1421     OS_ARCH=BSD
1422     ;;
1423 dgux)
1424     OS_ARCH=DGUX
1425     ;;
1426 IRIX64)
1427     OS_ARCH=IRIX
1428     ;;
1429 UNIX_SV)
1430     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1431         OS_ARCH=NCR
1432     else
1433         OS_ARCH=UNIXWARE
1434         OS_RELEASE=`uname -v`
1435     fi
1436     ;;
1437 ncr)
1438     OS_ARCH=NCR
1439     ;;
1440 UNIX_SYSTEM_V)
1441     OS_ARCH=NEC
1442     ;;
1443 OSF1)
1444     case `uname -v` in
1445     148)
1446         OS_RELEASE=V3.2C
1447         ;;
1448     564)
1449         OS_RELEASE=V4.0B
1450         ;;
1451     878)
1452         OS_RELEASE=V4.0D
1453         ;;
1454     esac
1455     ;;
1456 OS_2)
1457     OS_ARCH=OS2
1458     OS_TARGET=OS2
1459     OS_RELEASE=`uname -v`
1460     ;;
1461 QNX)
1462     if test "$OS_TARGET" != "NTO"; then
1463         changequote(,)
1464         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1465         changequote([,])
1466     fi
1467     OS_TEST=x86
1468     ;;
1469 SCO_SV)
1470     OS_ARCH=SCOOS
1471     OS_RELEASE=5.0
1472     ;;
1473 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1474     OS_ARCH=SINIX
1475     OS_TEST=`uname -p`
1476     ;;
1477 UnixWare)
1478     OS_ARCH=UNIXWARE
1479     OS_RELEASE=`uname -v`
1480     ;;
1481 WINCE)
1482     OS_ARCH=WINCE
1483     case "${target_os}" in
1484     *winmo)
1485         OS_TARGET=WINMO
1486         WINCE_WINDOWS_MOBILE=1
1487         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1488         ;;
1489     *)
1490         OS_TARGET=WINCE
1491         ;;
1492     esac
1493     ;;
1494 Darwin)
1495     case "${target_cpu}" in
1496     powerpc*)
1497         OS_TEST=ppc
1498         ;;
1499     i*86*)
1500         OS_TEST=i386 
1501         ;;
1502     x86_64)
1503         OS_TEST=x86_64
1504         ;;
1505     *)
1506         if test -z "$CROSS_COMPILE" ; then
1507             OS_TEST=`uname -p`
1508         fi
1509         ;;
1510     esac
1511     ;;
1512 esac
1514 if test "$OS_ARCH" = "NCR"; then
1515     changequote(,)
1516     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1517     changequote([,])
1520 # Only set CPU_ARCH if we recognize the value of OS_TEST
1522 case "$OS_TEST" in
1523 *86 | i86pc)
1524     CPU_ARCH=x86
1525     ;;
1527 powerpc64 | ppc64)
1528     CPU_ARCH=ppc64
1529     ;;
1531 powerpc | ppc | rs6000)
1532     CPU_ARCH=ppc
1533     ;;
1535 Alpha | alpha | ALPHA)
1536     CPU_ARCH=Alpha
1537     ;;
1539 s390)
1540     CPU_ARCH=s390
1541     ;;
1543 s390x)
1544     CPU_ARCH=s390x
1545     ;;
1547 hppa* | parisc)
1548     CPU_ARCH=hppa
1549     ;;
1551 sun4u | sparc*)
1552     CPU_ARCH=sparc
1553     ;;
1555 x86_64 | ia64)
1556     CPU_ARCH="$OS_TEST"
1557     ;;
1559 arm*)
1560     CPU_ARCH=arm
1561     ;;
1563 mips|mipsel)
1564     CPU_ARCH="mips"
1565     ;;
1566 esac
1568 if test -z "$OS_TARGET"; then
1569     OS_TARGET=$OS_ARCH
1571 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1573 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1574 dnl ===============================================================
1575 INTEL_ARCHITECTURE=
1576 case "$OS_TEST" in
1577     x86_64|i?86)
1578       INTEL_ARCHITECTURE=1
1579 esac
1581 dnl ========================================================
1582 dnl GNU specific defaults
1583 dnl ========================================================
1584 if test "$GNU_CC"; then
1585     # FIXME: Let us build with strict aliasing. bug 414641.
1586     CFLAGS="$CFLAGS -fno-strict-aliasing"
1587     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1588     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1589     DSO_LDOPTS='-shared'
1590     if test "$GCC_USE_GNU_LD"; then
1591         # Don't allow undefined symbols in libraries
1592         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1593     fi
1594     WARNINGS_AS_ERRORS='-Werror'
1595     DSO_CFLAGS=''
1596     DSO_PIC_CFLAGS='-fPIC'
1597     ASFLAGS="$ASFLAGS -fPIC"
1598     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1599     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1600     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1601     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1603     # Turn on GNU specific features
1604     # -Wall - turn on all warnings
1605     # -pedantic - make compiler warn about non-ANSI stuff, and
1606     #             be a little bit stricter
1607     # Warnings slamm took out for now (these were giving more noise than help):
1608     # -Wbad-function-cast - warns when casting a function to a new return type
1609     # -Wshadow - removed because it generates more noise than help --pete
1610     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1611     if test -z "$INTEL_CC"; then
1612        # Don't use -Wcast-align with ICC
1613        case "$CPU_ARCH" in
1614            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1615            hppa | ia64 | sparc | arm)
1616            ;;
1617            *)
1618         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1619            ;;
1620        esac
1621     fi
1623     dnl Turn pedantic on but disable the warnings for long long
1624     _PEDANTIC=1
1626     if test -z "$INTEL_CC"; then
1627       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1628     fi
1630     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1631     _USE_CPP_INCLUDE_FLAG=1
1632 elif test "$SOLARIS_SUNPRO_CC"; then
1633     DSO_CFLAGS=''
1634     if test "$CPU_ARCH" = "sparc"; then
1635         # for Sun Studio on Solaris/SPARC
1636         DSO_PIC_CFLAGS='-xcode=pic32'
1637     else
1638         DSO_PIC_CFLAGS='-KPIC'
1639     fi
1640     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1641 else
1642     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1643     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1645     DSO_LDOPTS='-shared'
1646     if test "$GNU_LD"; then
1647         # Don't allow undefined symbols in libraries
1648         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1649     fi
1651     DSO_CFLAGS=''
1652     DSO_PIC_CFLAGS='-KPIC'
1653     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1656 if test "$GNU_CXX"; then
1657     # FIXME: Let us build with strict aliasing. bug 414641.
1658     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1659     # Turn on GNU specific features
1660     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1661     if test -z "$INTEL_CC"; then
1662        # Don't use -Wcast-align with ICC
1663        case "$CPU_ARCH" in
1664            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1665            hppa | ia64 | sparc | arm)
1666            ;;
1667            *)
1668         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1669            ;;
1670        esac
1671     fi
1673     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1674     _USE_CPP_INCLUDE_FLAG=1
1676     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1677                    ac_has_wno_invalid_offsetof,
1678         [
1679             AC_LANG_SAVE
1680             AC_LANG_CPLUSPLUS
1681             _SAVE_CXXFLAGS="$CXXFLAGS"
1682             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1683             AC_TRY_COMPILE([],
1684                            [return(0);],
1685                            ac_has_wno_invalid_offsetof="yes",
1686                            ac_has_wno_invalid_offsetof="no")
1687             CXXFLAGS="$_SAVE_CXXFLAGS"
1688             AC_LANG_RESTORE
1689         ])
1690     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1691         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1692     fi
1694     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1695                    ac_has_wno_variadic_macros,
1696         [
1697             AC_LANG_SAVE
1698             AC_LANG_CPLUSPLUS
1699             _SAVE_CXXFLAGS="$CXXFLAGS"
1700             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1701             AC_TRY_COMPILE([],
1702                            [return(0);],
1703                            ac_has_wno_variadic_macros="yes",
1704                            ac_has_wno_variadic_macros="no")
1705             CXXFLAGS="$_SAVE_CXXFLAGS"
1706             AC_LANG_RESTORE
1707         ])
1708     if test "$ac_has_wno_variadic_macros" = "yes"; then
1709         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1710     fi
1712     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1713                    ac_has_werror_return_type,
1714         [
1715             AC_LANG_SAVE
1716             AC_LANG_CPLUSPLUS
1717             _SAVE_CXXFLAGS="$CXXFLAGS"
1718             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1719             AC_TRY_COMPILE([],
1720                            [return(0);],
1721                            ac_has_werror_return_type="yes",
1722                            ac_has_werror_return_type="no")
1723             CXXFLAGS="$_SAVE_CXXFLAGS"
1724             AC_LANG_RESTORE
1725         ])
1726     if test "$ac_has_werror_return_type" = "yes"; then
1727         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1728     fi
1730 else
1731     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1734 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1735 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1736 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1737 dnl normal behavior.
1738 dnl ========================================================
1739 MKSHLIB_FORCE_ALL=
1740 MKSHLIB_UNFORCE_ALL=
1742 if test "$COMPILE_ENVIRONMENT"; then
1743 if test "$GNU_CC"; then
1744   AC_MSG_CHECKING(whether ld has archive extraction flags)
1745   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1746    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1747     ac_cv_mkshlib_force_and_unforce="no"
1748     exec 3<&0 <<LOOP_INPUT
1749         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1750         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1751         force="-Wl,-all";              unforce="-Wl,-none"
1752 LOOP_INPUT
1753     while read line
1754     do
1755       eval $line
1756       LDFLAGS=$force
1757       LIBS=$unforce
1758       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1759     done
1760     exec 0<&3 3<&-
1761     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1762    ])
1763   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1764     AC_MSG_RESULT(no)
1765   else
1766     AC_MSG_RESULT(yes)
1767     eval $ac_cv_mkshlib_force_and_unforce
1768     MKSHLIB_FORCE_ALL=$force
1769     MKSHLIB_UNFORCE_ALL=$unforce
1770   fi
1771 fi # GNU_CC
1772 fi # COMPILE_ENVIRONMENT
1774 dnl =================================================================
1775 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1776 dnl which is bad when cross compiling.
1777 dnl =================================================================
1778 if test "$COMPILE_ENVIRONMENT"; then
1779 configure_static_assert_macros='
1780 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1781 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1782 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1785 dnl test that the macros actually work:
1786 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1787 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1788  [AC_LANG_SAVE
1789   AC_LANG_C
1790   ac_cv_static_assertion_macros_work="yes"
1791   AC_TRY_COMPILE([$configure_static_assert_macros],
1792                  [CONFIGURE_STATIC_ASSERT(1)],
1793                  ,
1794                  ac_cv_static_assertion_macros_work="no")
1795   AC_TRY_COMPILE([$configure_static_assert_macros],
1796                  [CONFIGURE_STATIC_ASSERT(0)],
1797                  ac_cv_static_assertion_macros_work="no",
1798                  )
1799   AC_LANG_CPLUSPLUS
1800   AC_TRY_COMPILE([$configure_static_assert_macros],
1801                  [CONFIGURE_STATIC_ASSERT(1)],
1802                  ,
1803                  ac_cv_static_assertion_macros_work="no")
1804   AC_TRY_COMPILE([$configure_static_assert_macros],
1805                  [CONFIGURE_STATIC_ASSERT(0)],
1806                  ac_cv_static_assertion_macros_work="no",
1807                  )
1808   AC_LANG_RESTORE
1809  ])
1810 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1811 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1812     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1814 fi # COMPILE_ENVIRONMENT
1816 dnl ========================================================
1817 dnl Checking for 64-bit OS
1818 dnl ========================================================
1819 if test "$COMPILE_ENVIRONMENT"; then
1820 AC_LANG_SAVE
1821 AC_LANG_C
1822 AC_MSG_CHECKING(for 64-bit OS)
1823 AC_TRY_COMPILE([$configure_static_assert_macros],
1824                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1825                result="yes", result="no")
1826 AC_MSG_RESULT("$result")
1827 if test "$result" = "yes"; then
1828     AC_DEFINE(HAVE_64BIT_OS)
1829     HAVE_64BIT_OS=1
1831 AC_SUBST(HAVE_64BIT_OS)
1832 AC_LANG_RESTORE
1833 fi # COMPILE_ENVIRONMENT
1835 dnl ========================================================
1836 dnl Enable high-memory support on OS/2 by default.
1837 dnl ========================================================
1838 MOZ_OS2_HIGH_MEMORY=1
1839 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1840 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1841     MOZ_OS2_HIGH_MEMORY=,
1842     MOZ_OS2_HIGH_MEMORY=1 )
1843 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1845 dnl ========================================================
1846 dnl = Use profiling compile flags
1847 dnl ========================================================
1848 MOZ_ARG_ENABLE_BOOL(profiling,
1849 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1850     MOZ_PROFILING=1,
1851     MOZ_PROFILING= )
1853 dnl ========================================================
1854 dnl = Use Valgrind
1855 dnl ========================================================
1856 MOZ_ARG_ENABLE_BOOL(valgrind,
1857 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
1858     MOZ_VALGRIND=1,
1859     MOZ_VALGRIND= )
1860 if test -n "$MOZ_VALGRIND"; then
1861     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1862         AC_MSG_ERROR(
1863             [--enable-valgrind specified but Valgrind is not installed]))
1864     AC_DEFINE(MOZ_VALGRIND)
1867 dnl ========================================================
1868 dnl jprof
1869 dnl ========================================================
1870 MOZ_ARG_ENABLE_BOOL(jprof,
1871 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1872     MOZ_JPROF=1,
1873     MOZ_JPROF= )
1874 if test -n "$MOZ_JPROF"; then
1875     MOZ_PROFILING=1
1876     AC_DEFINE(MOZ_JPROF)
1879 dnl ========================================================
1880 dnl shark
1881 dnl ========================================================
1882 MOZ_ARG_ENABLE_BOOL(shark,
1883 [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
1884     MOZ_SHARK=1,
1885     MOZ_SHARK= )
1886 if test -n "$MOZ_SHARK"; then
1887     MOZ_PROFILING=1
1888     AC_DEFINE(MOZ_SHARK)
1891 dnl ========================================================
1892 dnl callgrind
1893 dnl ========================================================
1894 MOZ_ARG_ENABLE_BOOL(callgrind,
1895 [  --enable-callgrind      Enable callgrind profiling],
1896     MOZ_CALLGRIND=1,
1897     MOZ_CALLGRIND= )
1898 if test -n "$MOZ_CALLGRIND"; then
1899     AC_DEFINE(MOZ_CALLGRIND)
1902 dnl ========================================================
1903 dnl vtune
1904 dnl ========================================================
1905 MOZ_ARG_ENABLE_BOOL(vtune,
1906 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
1907     MOZ_VTUNE=1,
1908     MOZ_VTUNE= )
1909 if test -n "$MOZ_VTUNE"; then
1910     MOZ_PROFILING=1
1911     AC_DEFINE(MOZ_VTUNE)
1914 dnl ========================================================
1915 dnl Profiling
1916 dnl ========================================================
1917 if test -n "$MOZ_PROFILING"; then
1918     AC_DEFINE(MOZ_PROFILING)
1921 dnl ========================================================
1922 dnl System overrides of the defaults for host
1923 dnl ========================================================
1924 case "$host" in
1925 *mingw*|*wince|*winmo)
1926     if test -n "$_WIN32_MSVC"; then
1927         HOST_AR=lib
1928         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1929         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1930         HOST_RANLIB='echo ranlib'
1931     else
1932         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1933     fi
1934     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1935     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1936     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1937     HOST_BIN_SUFFIX=.exe
1938     case "$host" in
1939     *mingw*)
1940         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1941         ;;
1942     esac
1944     case "${host_cpu}" in
1945     x86_64)
1946         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1947         ;;
1948     esac
1949     ;;
1951 *-darwin*)
1952     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1953     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1954     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1955     ;;
1957 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1958     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1959     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1960     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1961     ;;
1963 *os2*)
1964     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1965     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1966     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1967     HOST_BIN_SUFFIX=.exe
1968     MOZ_FIX_LINK_PATHS=
1969     ;;
1971 *-osf*)
1972     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1973     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1974     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1975     ;;
1978     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1979     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1980     ;;
1981 esac
1983 dnl We require version 2.5 or newer of Python to build.
1984 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1985 changequote(,)
1986 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1987 _python_res=$?
1988 changequote([,])
1989 if test "$_python_res" != 0; then
1990     AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1992 AC_MSG_RESULT([yes])
1994 dnl Get mozilla version from central milestone file
1995 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1997 dnl Get version of various core apps from the version files.
1998 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
2000 if test -z "$FIREFOX_VERSION"; then
2001     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
2004 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
2005 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
2007 dnl ========================================================
2008 dnl System overrides of the defaults for target
2009 dnl ========================================================
2011 case "$target" in
2012 *-aix*)
2013     AC_DEFINE(AIX)
2014     if test ! "$GNU_CC"; then
2015         if test ! "$HAVE_64BIT_OS"; then
2016             # Compiling with Visual Age C++ object model compat is the
2017             # default. To compile with object model ibm, add 
2018             # AIX_OBJMODEL=ibm to .mozconfig.
2019             if test "$AIX_OBJMODEL" = "ibm"; then
2020                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
2021             else
2022                 AIX_OBJMODEL=compat
2023             fi
2024         else
2025             AIX_OBJMODEL=compat
2026         fi
2027         AC_SUBST(AIX_OBJMODEL)
2028         DSO_LDOPTS='-qmkshrobj=1'
2029         DSO_CFLAGS='-qflag=w:w'
2030         DSO_PIC_CFLAGS=
2031         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
2032         MOZ_FIX_LINK_PATHS=
2033         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2034         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2035         if test "$COMPILE_ENVIRONMENT"; then
2036             AC_LANG_SAVE
2037             AC_LANG_CPLUSPLUS
2038             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
2039             AC_TRY_COMPILE([],
2040                 [#if (__IBMCPP__ < 900)
2041                  #error "Bad compiler"
2042                  #endif],
2043                 _BAD_COMPILER=,_BAD_COMPILER=1)
2044             if test -n "$_BAD_COMPILER"; then
2045                 AC_MSG_RESULT([no])    
2046                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
2047             else
2048                 AC_MSG_RESULT([yes])    
2049             fi
2050             AC_LANG_RESTORE
2051             TARGET_COMPILER_ABI="ibmc"
2052             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
2053             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
2054         fi
2055     fi
2056     case "${target_os}" in
2057     aix4.1*)
2058         DLL_SUFFIX='_shr.a'
2059         ;;
2060     esac
2061     if test "$COMPILE_ENVIRONMENT"; then
2062         MOZ_CHECK_HEADERS(sys/inttypes.h)
2063     fi
2064     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2065     ;;
2067 *-bsdi*)
2068     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2069     _PEDANTIC=
2070     case $OS_RELEASE in
2071         4.*|5.*)
2072             STRIP="$STRIP -d"
2073             ;;
2074         *)
2075             DSO_CFLAGS=''
2076             DSO_LDOPTS='-r'
2077             _WARNINGS_CFLAGS="-Wall"
2078             _WARNINGS_CXXFLAGS="-Wall"
2079             # The test above doesn't work properly, at least on 3.1.
2080             MKSHLIB_FORCE_ALL=''
2081             MKSHLIB_UNFORCE_ALL=''
2082         ;;
2083     esac
2084     ;;
2086 *-darwin*) 
2087     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2088     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2089     # If we're building with --enable-profiling, we need a frame pointer.
2090     if test -z "$MOZ_PROFILING"; then
2091         MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2092     else
2093         MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2094     fi
2095     _PEDANTIC=
2096     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2097     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2098     DLL_SUFFIX=".dylib"
2099     DSO_LDOPTS=''
2100     STRIP="$STRIP -x -S"
2101     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2102     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2103     # The ExceptionHandling framework is needed for Objective-C exception
2104     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2105     # builds.
2106     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2108     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2109     dnl ===================================================================
2110     if test "x$enable_dtrace" = "xyes"; then
2111         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2112     else
2113         dnl check for the presence of the -dead_strip linker flag
2114         AC_MSG_CHECKING([for -dead_strip option to ld])
2115         _SAVE_LDFLAGS=$LDFLAGS
2116         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2117         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2118         if test -n "$_HAVE_DEAD_STRIP" ; then
2119             AC_MSG_RESULT([yes])
2120             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2121         else
2122             AC_MSG_RESULT([no])
2123         fi
2124         
2125         LDFLAGS=$_SAVE_LDFLAGS
2126     fi
2127     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2128     ;;
2130 *-freebsd*)
2131     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2132         DLL_SUFFIX=".so.1.0"
2133         DSO_LDOPTS="-shared"
2134     fi
2135     if test ! "$GNU_CC"; then
2136         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2137     fi
2138     ;; 
2140 ia64*-hpux*)
2141     DLL_SUFFIX=".so"
2142     if test ! "$GNU_CC"; then
2143        DSO_LDOPTS='-b'
2144        DSO_CFLAGS=""
2145        DSO_PIC_CFLAGS=
2146        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2147        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2148        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2149     else
2150        DSO_LDOPTS='-b -E'
2151        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2152        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2153     fi
2154     MOZ_FIX_LINK_PATHS=
2155     SYSTEM_MAKEDEPEND=
2156     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2157     AC_DEFINE(_LARGEFILE64_SOURCE)
2158     ;;
2160 *-hpux*)
2161     DLL_SUFFIX=".sl"
2162     if test ! "$GNU_CC"; then
2163         DSO_LDOPTS='-b -Wl,+s'
2164         DSO_CFLAGS=""
2165         DSO_PIC_CFLAGS="+Z"
2166         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2167         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2168         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2169     else
2170         DSO_LDOPTS='-b -E +s'
2171         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2172         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2173     fi
2174     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2175     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2176     ;;
2178 *-irix5*)
2179     AC_DEFINE(IRIX)
2180     DSO_LDOPTS='-elf -shared'
2182     if test "$GNU_CC"; then
2183        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2184        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2185        MKSHLIB_FORCE_ALL='-Wl,-all'
2186        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2187        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2188     else
2189        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2190        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2191        MKSHLIB_FORCE_ALL='-all'
2192        MKSHLIB_UNFORCE_ALL='-none'
2193     fi
2194     ;;
2196 *-irix6*)
2197     AC_DEFINE(IRIX)
2198     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2199     dnl compile and link using -n32
2200     USE_N32=1
2201     TARGET_COMPILER_ABI=n32
2202     DSO_LDOPTS='-elf -shared'
2203     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2204     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2205     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2206     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2207     if test "$GNU_CC"; then
2208        MKSHLIB_FORCE_ALL='-Wl,-all'
2209        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2210        _WARNINGS_CFLAGS="-Wall"
2211        _WARNINGS_CXXFLAGS="-Wall"
2212        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2213     else
2214        MKSHLIB_FORCE_ALL='-all'
2215        MKSHLIB_UNFORCE_ALL='-none'
2216            AR_LIST="$AR t"
2217            AR_EXTRACT="$AR x"
2218            AR_DELETE="$AR d"
2219            AR='$(CXX) -ar'
2220            AR_FLAGS='-o $@'
2221        CFLAGS="$CFLAGS -woff 3262 -G 4"
2222        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2223        if test -n "$USE_N32"; then
2224            ASFLAGS="$ASFLAGS -n32"
2225            CFLAGS="$CFLAGS -n32"
2226            CXXFLAGS="$CXXFLAGS -n32"
2227            LDFLAGS="$LDFLAGS -n32"
2228        fi
2229        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2230        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2231        MOZ_FIX_LINK_PATHS=
2232     fi
2233     if test -z "$GNU_CXX"; then
2234       MIPSPRO_CXX=1
2235     fi
2236     ;;
2238 *-*linux*)
2239     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2240     # Similarly for GNU_CXX and INTEL_CXX.
2241     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2242         # -Os has been broken on Intel's C/C++ compilers for quite a
2243         # while; Intel recommends against using it.
2244         MOZ_OPTIMIZE_FLAGS="-O2"
2245         MOZ_DEBUG_FLAGS="-g"
2246     elif test "$GNU_CC" -o "$GNU_CXX"; then
2247         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2248         case $GCC_VERSION in
2249         4.1.*|4.2.*|4.5.*)
2250             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2251             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2252         esac
2253         # If we're building with --enable-profiling, we need a frame pointer.
2254         if test -z "$MOZ_PROFILING"; then
2255             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2256         else
2257             MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2258         fi
2259         MOZ_DEBUG_FLAGS="-g"
2260     fi
2262     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2264     MOZ_MEMORY=1
2266     case "${target_cpu}" in
2267     alpha*)
2268         CFLAGS="$CFLAGS -mieee"
2269         CXXFLAGS="$CXXFLAGS -mieee"
2270     ;;
2271     i*86)
2272         USE_ELF_DYNSTR_GC=1
2273     ;;
2274     mips*)
2275         MOZ_DEBUG_FLAGS="-g" # We want inlining
2276     ;;
2277     esac
2278     ;;
2280 *-wince*|*-winmo*)
2281     TARGET_COMPILER_ABI=msvc
2282     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2283     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2284     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2285     AR_LIST="$AR -list"
2286     AR_EXTRACT=
2287     AR_DELETE="$AR d"
2288     AR_FLAGS='-OUT:"$@"'
2289     MOZ_MEMORY=1
2290     NSS_DISABLE_DBM=1
2291     MOZ_OGG=
2292     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2294     if test "$AS_BIN"; then
2295         AS="$AS_BIN"
2296     fi
2297     DSO_CFLAGS=
2298     DSO_PIC_CFLAGS=
2299     DLL_SUFFIX=.dll
2300     BIN_SUFFIX='.exe'
2301     if test -z "$RC"; then 
2302         RC=rc.exe  
2303     fi
2304     # certain versions of cygwin's makedepend barf on the 
2305     # #include <string> vs -I./dist/include/string issue so don't use it
2306     SYSTEM_MAKEDEPEND=
2308     HOST_CC=cl
2309     HOST_CXX=cl
2310     HOST_LD=link
2311     HOST_AR='lib'
2312     HOST_AR_FLAGS='-OUT:$@'
2313     HOST_RANLIB='echo ranlib'
2314     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2315         
2316         
2317     WARNINGS_AS_ERRORS='-WX'
2318     MOZ_OPTIMIZE_FLAGS='-Ox'
2319     AR_FLAGS='-NOLOGO -OUT:"$@"'
2320     ASM_SUFFIX=asm
2321     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2322     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2323     DLL_PREFIX=
2324     DOXYGEN=:
2325     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2326     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2327     GARBAGE=
2328     IMPORT_LIB_SUFFIX=lib
2329     dnl Need to force-link against mozalloc because it's used in the shunt
2330     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2331     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2332     LIB_PREFIX=
2333     LIB_SUFFIX=lib 
2334     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2335     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2336     MKSHLIB_FORCE_ALL=
2337     MKSHLIB_UNFORCE_ALL=
2338     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2339     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2340     MOZ_DEBUG_FLAGS='-Zi'
2341     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2342     MOZ_FIX_LINK_PATHS=
2343     OBJ_SUFFIX=obj
2344     RANLIB='echo not_ranlib'
2345     STRIP='echo not_strip'
2346     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2347     UNZIP=unzip
2348     XARGS=xargs
2349     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2350     ZIP=zip
2351     MOZ_TREE_FREETYPE=1
2353     AC_DEFINE(HAVE_SNPRINTF)
2354     AC_DEFINE(_WINDOWS)
2355     AC_DEFINE(WIN32)
2356     AC_DEFINE(XP_WIN)
2357     AC_DEFINE(XP_WIN32)
2358     AC_DEFINE(HW_THREADS)
2359     AC_DEFINE(STDC_HEADERS)
2360     AC_DEFINE(NEW_H, <new>)
2361     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2362     AC_DEFINE(HAVE_LOCALTIME_R)
2364     TARGET_MD_ARCH=win32
2365     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2366     BIN_SUFFIX='.exe'
2367     MOZ_USER_DIR="Mozilla"
2369     MOZ_GFX_OPTIMIZE_MOBILE=1
2371     # Sanity check for WINCE_WINDOWS_MOBILE
2372     # XXX disabled until we can fix the mobile tinderbox
2373     ##if test "$WINCE_WINDOWS_MOBILE"; then
2374     ##   MOZ_CHECK_HEADER(tpcshell.h, [],
2375     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2376     ##fi
2379 *-mingw*)
2380     DSO_CFLAGS=
2381     DSO_PIC_CFLAGS=
2382     DLL_SUFFIX=.dll
2383     RC=rc.exe
2384     # certain versions of cygwin's makedepend barf on the 
2385     # #include <string> vs -I./dist/include/string issue so don't use it
2386     SYSTEM_MAKEDEPEND=
2387     if test -n "$GNU_CC"; then
2388         CC="$CC -mno-cygwin"
2389         CXX="$CXX -mno-cygwin"
2390         CPP="$CPP -mno-cygwin"
2391         CFLAGS="$CFLAGS -mms-bitfields"
2392         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2393         DSO_LDOPTS='-shared'
2394         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2395         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2396         RC='$(WINDRES)'
2397         # Use temp file for windres (bug 213281)
2398         RCFLAGS='-O coff --use-temp-file'
2399         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2400         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2401         MOZ_FIX_LINK_PATHS=
2402         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2403         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2404         DLL_PREFIX=
2405         IMPORT_LIB_SUFFIX=dll.a
2406         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2407     else
2408         TARGET_COMPILER_ABI=msvc
2409         HOST_CC='$(CC)'
2410         HOST_CXX='$(CXX)'
2411         HOST_LD='$(LD)'
2412         if test "$AS_BIN"; then
2413             AS="$(basename "$AS_BIN")"
2414         fi
2415         AR='lib'
2416         AR_FLAGS='-NOLOGO -OUT:"$@"'
2417         AR_EXTRACT=
2418         RANLIB='echo not_ranlib'
2419         STRIP='echo not_strip'
2420         PKG_SKIP_STRIP=1
2421         XARGS=xargs
2422         ZIP=zip
2423         UNZIP=unzip
2424         DOXYGEN=:
2425         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2426         ASM_SUFFIX=asm
2427         OBJ_SUFFIX=obj
2428         LIB_SUFFIX=lib
2429         DLL_PREFIX=
2430         LIB_PREFIX=
2431         IMPORT_LIB_SUFFIX=lib
2432         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2433         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2434         MKSHLIB_FORCE_ALL=
2435         MKSHLIB_UNFORCE_ALL=
2436         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2437         _USE_CPP_INCLUDE_FLAG=1
2438         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2439         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2440         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2441         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2442         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2443         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2444         MOZ_DEBUG_FLAGS='-Zi'
2445         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2446         WARNINGS_AS_ERRORS='-WX'
2447         # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2448         if test -z "$MOZ_PROFILING"; then
2449             MOZ_OPTIMIZE_FLAGS='-O1'
2450         else
2451             MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2452         fi
2453         MOZ_FIX_LINK_PATHS=
2454         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2455         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2456         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2457         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2458         if test $_MSC_VER -ge 1400; then
2459             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2460             dnl For profile-guided optimization
2461             PROFILE_GEN_CFLAGS="-GL"
2462             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2463             dnl XXX: PGO builds can fail with warnings treated as errors,
2464             dnl specifically "no profile data available" appears to be
2465             dnl treated as an error sometimes. This might be a consequence
2466             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2467             dnl with the linker doing most of the work in the whole-program
2468             dnl optimization/PGO case. I think it's probably a compiler bug,
2469             dnl but we work around it here.
2470             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2471             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2472             dnl Probably also a compiler bug, but what can you do?
2473             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2474             LDFLAGS="$LDFLAGS -DYNAMICBASE"
2475         fi
2476     fi
2477     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2478     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2479     AC_DEFINE(HAVE_SNPRINTF)
2480     AC_DEFINE(_WINDOWS)
2481     AC_DEFINE(WIN32)
2482     AC_DEFINE(XP_WIN)
2483     AC_DEFINE(XP_WIN32)
2484     AC_DEFINE(HW_THREADS)
2485     AC_DEFINE(STDC_HEADERS)
2486     AC_DEFINE(NEW_H, <new>)
2487     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2488     TARGET_MD_ARCH=win32
2489     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2490     BIN_SUFFIX='.exe'
2491     MOZ_USER_DIR="Mozilla"
2493     dnl Hardcode to win95 for now - cls
2494     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2496     dnl set NO_X11 defines here as the general check is skipped on win32
2497     no_x=yes
2498     AC_DEFINE(NO_X11)
2500     case "$host" in
2501     *-mingw*)
2502         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2503         ;;
2504     esac
2506     case "$host" in
2507     *-mingw*)
2508         if test -z "$MOZ_TOOLS"; then
2509             AC_MSG_ERROR([MOZ_TOOLS is not set])
2510         fi
2511         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2512         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2513             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2514         fi
2515         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2516         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2517             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2518         fi
2519         ;;
2520     esac 
2522     case "$host_os" in
2523     cygwin*|msvc*|mks*)
2524         AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
2525         ;;
2526     *)
2527         AC_CHECK_HEADERS(oleacc.idl)
2528         AC_LANG_SAVE
2529         AC_LANG_CPLUSPLUS
2530         MOZ_CHECK_HEADERS(atlbase.h)
2531         AC_LANG_RESTORE
2532         ;;
2533     esac
2535     case "$target" in
2536     i*86-*)
2537         if test "$HAVE_64BIT_OS"; then
2538             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2539         fi
2541         if test $_MSC_VER -ge 1400; then
2542             LDFLAGS="$LDFLAGS -SAFESEH"
2543         fi
2545         if test -n "$GNU_CC"; then
2546             CFLAGS="$CFLAGS -mstackrealign"
2547             CXXFLAGS="$CXXFLAGS -mstackrealign"
2548         fi
2550         MOZ_CHECK_HEADERS(mmintrin.h)
2551         AC_DEFINE(_X86_)
2552         ;;
2553     x86_64-*)
2554         AC_DEFINE(_AMD64_)
2555         ;;
2556     *)
2557         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2558         ;;
2559     esac
2561     if test "$HAVE_64BIT_OS"; then
2562         AC_DEFINE(_WIN64)
2563     fi
2564     ;;
2566 *-netbsd*)
2567     DSO_CFLAGS=''
2568     CFLAGS="$CFLAGS -Dunix"
2569     CXXFLAGS="$CXXFLAGS -Dunix"
2570     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2571         DLL_SUFFIX=".so"
2572         DSO_PIC_CFLAGS='-fPIC -DPIC'
2573         DSO_LDOPTS='-shared'
2574         BIN_FLAGS='-Wl,--export-dynamic'
2575     else
2576         DSO_PIC_CFLAGS='-fPIC -DPIC'
2577         DLL_SUFFIX=".so.1.0"
2578         DSO_LDOPTS='-shared'
2579     fi
2580     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2581     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2582     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2583     if test "$LIBRUNPATH"; then
2584         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2585     fi
2586     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2587     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2588     ;;
2590 *-nto*) 
2591         AC_DEFINE(NTO)  
2592         AC_DEFINE(_QNX_SOURCE)
2593         AC_DEFINE(_i386)
2594         OS_TARGET=NTO
2595         WARNINGS_AS_ERRORS=''
2596         MOZ_OPTIMIZE_FLAGS="-O"
2597         MOZ_DEBUG_FLAGS="-gstabs"
2598         USE_PTHREADS=1
2599         _PEDANTIC=
2600         LIBS="$LIBS -lsocket -lstdc++"
2601         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2602         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2603         if test "$with_x" != "yes"
2604         then
2605                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2606             TK_CFLAGS='-I/usr/include/photon'
2607                 TK_LIBS='-lph'
2608         fi
2609         case "${target_cpu}" in
2610         ppc*)
2611         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2612         ;;
2613         esac
2614         case "${host_cpu}" in
2615         i*86)
2616         USE_ELF_DYNSTR_GC=1
2617         ;;
2618         esac
2619         ;;
2621 *-openbsd*)
2622     DLL_SUFFIX=".so.1.0"
2623     DSO_CFLAGS=''
2624     DSO_PIC_CFLAGS='-fPIC'
2625     DSO_LDOPTS='-shared -fPIC'
2626     if test "$LIBRUNPATH"; then
2627         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2628     fi
2629     ;;
2631 *-os2*)
2632     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2633     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2634     AC_DEFINE(OS2)
2635     AC_DEFINE(XP_OS2)
2636     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2637     AC_DEFINE(TCPV40HDRS)
2638     DLL_PREFIX=
2639     LIB_PREFIX=
2640     LIB_SUFFIX=lib
2641     BIN_SUFFIX=".exe"
2642     DLL_SUFFIX=".dll"
2643     IMPORT_LIB_SUFFIX=lib
2644     DSO_PIC_CFLAGS=
2645     AR=emxomfar
2646     AR_FLAGS='r $@'
2647     CFLAGS="$CFLAGS -Zomf"
2648     CXXFLAGS="$CXXFLAGS -Zomf"
2649     DSO_LDOPTS='-Zdll'
2650     BIN_FLAGS='-Zlinker /ST:0x100000'
2651     IMPLIB='emximp -o'
2652     FILTER='true'
2653     LDFLAGS='-Zmap'
2654     WARNINGS_AS_ERRORS='-Werror'
2655     MOZ_DEBUG_FLAGS="-g -fno-inline"
2656     MOZ_OPTIMIZE_FLAGS="-O2"
2657     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2658     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2659     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2660     TARGET_MD_ARCH=os2
2661     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2662     RC=rc.exe
2663     RCFLAGS='-n'
2664     MOZ_USER_DIR="Mozilla"
2666     if test "$MOZTOOLS"; then
2667         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2668     else
2669         AC_MSG_ERROR([MOZTOOLS is not set])
2670     fi
2671     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2672         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2673         LDFLAGS="$LDFLAGS -Zhigh-mem"
2674         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2675         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2676     fi
2678     # GCC for OS/2 currently predefines these, but we don't want them
2679     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2680     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2682     AC_CACHE_CHECK(for __declspec(dllexport),
2683         ac_os2_declspec,
2684         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2685                         [return 0;],
2686                         ac_os2_declspec="yes",
2687                         ac_os2_declspec="no")])
2688     if test "$ac_os2_declspec" != "yes"; then
2689         AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2690     fi
2691     ;;
2693 alpha*-*-osf*)
2694     if test "$GNU_CC"; then
2695       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2696       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2698     else
2699         MOZ_DEBUG_FLAGS='-g'
2700         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2701         CFLAGS="$CFLAGS -ieee"
2702         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2703         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2704         DSO_CFLAGS=
2705         DSO_PIC_CFLAGS=
2706         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2707         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2708         MKSHLIB_FORCE_ALL='-all'
2709         MKSHLIB_UNFORCE_ALL='-none'
2710         dnl Might fix the libxpcom.so breakage on this platform as well....
2711         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2712         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2713     fi
2714     if test -z "$GNU_CXX"; then
2715       COMPAQ_CXX=1
2716     fi
2717     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2718     ;;
2720 *-qnx*) 
2721     DIRENT_INO=d_stat.st_ino
2722     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2723     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2724     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2725     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2726     AC_DEFINE(STDC_HEADERS)
2727     if test "$no_x" = "yes"; then
2728             _PLATFORM_DEFAULT_TOOLKIT='photon'
2729             TK_CFLAGS='-I/usr/nto/include/photon'
2730             TK_LIBS='-lphoton -lphrender'
2731     fi
2732     ;;
2734 *-sco*) 
2735     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2736     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2737     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2738     if test ! "$GNU_CC"; then
2739        DSO_LDOPTS='-G'
2740     fi
2741     ;;
2743 *-solaris*) 
2744     AC_DEFINE(SOLARIS)
2745     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2746     SYSTEM_MAKEDEPEND=
2747     MOZ_FIX_LINK_PATHS=
2748     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2749     # libraries one level up (e.g. libnspr4.so)
2750     if test "$SOLARIS_SUNPRO_CC"; then
2751        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2752        LIBS="-lCrun -lCstd -lc $LIBS"
2753        NS_USE_NATIVE=1
2754        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2755        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2756        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2757        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2758        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2759        LDFLAGS="-xildoff $LDFLAGS"
2760        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2761            _SAVE_LDFLAGS=$LDFLAGS
2762            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2763            AC_TRY_LINK([#include <stdio.h>],
2764                        [printf("Hello World\n");],
2765                        ,
2766                        [LDFLAGS=$_SAVE_LDFLAGS])
2767        fi
2768        WARNINGS_AS_ERRORS='-Werror'
2769        MOZ_OPTIMIZE_FLAGS="-xO4"
2770        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2771        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2772        MKSHLIB_FORCE_ALL='-z allextract'
2773        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2774        DSO_LDOPTS='-G'
2775        AR_LIST="$AR t"
2776        AR_EXTRACT="$AR x"
2777        AR_DELETE="$AR d"
2778        AR='$(CXX) -xar'
2779        AR_FLAGS='-o $@'
2780        AS='/usr/ccs/bin/as'
2781        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2782        AS_DASH_C_FLAG=''
2783        TARGET_COMPILER_ABI="sunc"
2784        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2785        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2786        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2787        AC_LANG_SAVE
2788        AC_LANG_CPLUSPLUS
2789        AC_TRY_COMPILE([],
2790            [#if (__SUNPRO_CC < 0x590)
2791            #error "Denied"
2792            #endif],
2793            _BAD_COMPILER=,_BAD_COMPILER=1)
2794        if test -n "$_BAD_COMPILER"; then
2795            _res="no"
2796            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2797        else
2798            _res="yes"
2799        fi
2800        AC_TRY_COMPILE([],
2801            [#if (__SUNPRO_CC >= 0x5100)
2802            #error "Sun C++ 5.10 or above"
2803            #endif],
2804            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2805        if test "$_ABOVE_SS12U1"; then
2806            # disable xannotate
2807            CXXFLAGS="$CXXFLAGS -xannotate=no"
2808        fi
2809        AC_MSG_RESULT([$_res])
2810        AC_LANG_RESTORE
2811     else
2812        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2813        LIBS="-lc $LIBS"
2814        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2815        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2816        ASFLAGS="$ASFLAGS -fPIC"
2817        DSO_LDOPTS='-shared'
2818        _WARNINGS_CFLAGS=''
2819        _WARNINGS_CXXFLAGS=''
2820        if test "$OS_RELEASE" = "5.3"; then
2821            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2822        fi
2823     fi
2824     if test "$OS_RELEASE" = "5.5.1"; then
2825         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2826     fi
2827     ;;
2829 *-sunos*) 
2830     DSO_LDOPTS='-Bdynamic'
2831     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2832     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2833     AC_DEFINE(SUNOS4)
2834     AC_DEFINE(SPRINTF_RETURNS_STRING)
2835     case "$(target_os)" in
2836     sunos4.1*)
2837         DLL_SUFFIX='.so.1.0'
2838         ;;
2839     esac
2840     ;;
2842 *-sysv4.2uw7*) 
2843         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2844     ;;
2846 *-os2*)
2847     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2848     ;;
2850 *-android*)
2851     AC_DEFINE(NO_PW_GECOS)
2852     no_x=yes
2853     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2854     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2856     MOZ_GFX_OPTIMIZE_MOBILE=1
2857     # If we're building with --enable-profiling, we need a frame pointer.
2858     if test -z "$MOZ_PROFILING"; then
2859         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2860     else
2861         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2862     fi
2863     # The Maemo builders don't know about this flag
2864     MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
2865     ;;
2867 esac
2869 dnl Only one oddball right now (QNX), but this gives us flexibility
2870 dnl if any other platforms need to override this in the future.
2871 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2873 dnl ========================================================
2874 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2875 dnl by now will not have any way to link most binaries (tests
2876 dnl as well as viewer, apprunner, etc.), because some symbols
2877 dnl will be left out of the "composite" .so's by ld as unneeded.
2878 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2879 dnl they can link in the static libs that provide the missing
2880 dnl symbols.
2881 dnl ========================================================
2882 NO_LD_ARCHIVE_FLAGS=
2883 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2884     NO_LD_ARCHIVE_FLAGS=1
2886 case "$target" in
2887 *-os2*)
2888     NO_LD_ARCHIVE_FLAGS=
2889     ;;
2890 *-aix4.3*|*-aix5*)
2891     NO_LD_ARCHIVE_FLAGS=
2892     ;;
2893 *-mingw*|*-wince|*-winmo)
2894     if test -z "$GNU_CC"; then
2895         NO_LD_ARCHIVE_FLAGS=
2896     fi
2897     ;;
2898 esac
2899 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2901 dnl ========================================================
2902 dnl = Flags to strip unused symbols from .so components and
2903 dnl = to export jemalloc symbols when linking a program
2904 dnl ========================================================
2905 case "$target" in
2906     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2907         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2908         MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS='-rdynamic -Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/jemalloc-standalone-linkage-version-script'
2909         ;;
2910     *-solaris*)
2911         if test -z "$GNU_CC"; then
2912          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2913         else
2914          if test -z "$GCC_USE_GNU_LD"; then
2915           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2916          else
2917           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2918          fi
2919         fi
2920         ;;
2921     *-nto*) 
2922         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2923         ;;
2924     *-darwin*)
2925         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2926         ;;
2927     *-mingw*|*-wince|*-winmo)
2928         if test -n "$GNU_CC"; then
2929            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2930         fi
2931         ;;
2932 esac
2934 if test -z "$COMPILE_ENVIRONMENT"; then
2935     SKIP_COMPILER_CHECKS=1
2936     SKIP_LIBRARY_CHECKS=1
2939 if test -z "$SKIP_COMPILER_CHECKS"; then
2940 dnl Checks for typedefs, structures, and compiler characteristics.
2941 dnl ========================================================
2942 AC_HEADER_STDC
2943 AC_C_CONST
2944 AC_TYPE_MODE_T
2945 AC_TYPE_OFF_T
2946 AC_TYPE_PID_T
2947 AC_TYPE_SIZE_T
2948 AC_LANG_CPLUSPLUS
2949 AC_MSG_CHECKING(for __stdcall)
2950 AC_CACHE_VAL(ac_cv___stdcall,
2951  [AC_TRY_COMPILE([template <typename Method> struct foo;
2952                   template <> struct foo<void (*)()> {};
2953                   template <> struct foo<void (__stdcall*)()> {};],
2954                  [],
2955                  [ac_cv___stdcall=true],
2956                  [ac_cv___stdcall=false])])
2957 if test "$ac_cv___stdcall" = true ; then
2958   AC_DEFINE(HAVE_STDCALL)
2959   AC_MSG_RESULT(yes)
2960 else
2961   AC_MSG_RESULT(no)
2963 AC_LANG_C
2964 AC_MSG_CHECKING(for ssize_t)
2965 AC_CACHE_VAL(ac_cv_type_ssize_t,
2966  [AC_TRY_COMPILE([#include <stdio.h>
2967                   #include <sys/types.h>],
2968                  [ssize_t foo = 0;],
2969                  [ac_cv_type_ssize_t=true],
2970                  [ac_cv_type_ssize_t=false])])
2971 if test "$ac_cv_type_ssize_t" = true ; then
2972   AC_DEFINE(HAVE_SSIZE_T)
2973   AC_MSG_RESULT(yes)
2974 else
2975   AC_MSG_RESULT(no)
2977 AC_STRUCT_ST_BLKSIZE
2978 AC_MSG_CHECKING(for siginfo_t)
2979 AC_CACHE_VAL(ac_cv_siginfo_t,
2980  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2981                   #include <signal.h>],
2982                  [siginfo_t* info;],
2983                  [ac_cv_siginfo_t=true],
2984                  [ac_cv_siginfo_t=false])])
2985 if test "$ac_cv_siginfo_t" = true ; then
2986   AC_DEFINE(HAVE_SIGINFO_T)
2987   AC_MSG_RESULT(yes)
2988 else
2989   AC_MSG_RESULT(no)
2992 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2993 dnl ========================================================
2994 AC_MSG_CHECKING(for int16_t)
2995 AC_CACHE_VAL(ac_cv_int16_t,
2996  [AC_TRY_COMPILE([#include <stdio.h>
2997                   #include <sys/types.h>],
2998                  [int16_t foo = 0;],
2999                  [ac_cv_int16_t=true],
3000                  [ac_cv_int16_t=false])])
3001 if test "$ac_cv_int16_t" = true ; then
3002   AC_DEFINE(HAVE_INT16_T)
3003   AC_MSG_RESULT(yes)
3004 else
3005   AC_MSG_RESULT(no)
3007 AC_MSG_CHECKING(for int32_t)
3008 AC_CACHE_VAL(ac_cv_int32_t,
3009  [AC_TRY_COMPILE([#include <stdio.h>
3010                   #include <sys/types.h>],
3011                  [int32_t foo = 0;],
3012                  [ac_cv_int32_t=true],
3013                  [ac_cv_int32_t=false])])
3014 if test "$ac_cv_int32_t" = true ; then
3015   AC_DEFINE(HAVE_INT32_T)
3016   AC_MSG_RESULT(yes)
3017 else
3018   AC_MSG_RESULT(no)
3020 AC_MSG_CHECKING(for int64_t)
3021 AC_CACHE_VAL(ac_cv_int64_t,
3022  [AC_TRY_COMPILE([#include <stdio.h>
3023                   #include <sys/types.h>],
3024                  [int64_t foo = 0;],
3025                  [ac_cv_int64_t=true],
3026                  [ac_cv_int64_t=false])])
3027 if test "$ac_cv_int64_t" = true ; then
3028   AC_DEFINE(HAVE_INT64_T)
3029   AC_MSG_RESULT(yes)
3030 else
3031   AC_MSG_RESULT(no)
3033 AC_MSG_CHECKING(for int64)
3034 AC_CACHE_VAL(ac_cv_int64,
3035  [AC_TRY_COMPILE([#include <stdio.h>
3036                   #include <sys/types.h>],
3037                  [int64 foo = 0;],
3038                  [ac_cv_int64=true],
3039                  [ac_cv_int64=false])])
3040 if test "$ac_cv_int64" = true ; then
3041   AC_DEFINE(HAVE_INT64)
3042   AC_MSG_RESULT(yes)
3043 else
3044   AC_MSG_RESULT(no)
3046 AC_MSG_CHECKING(for uint)
3047 AC_CACHE_VAL(ac_cv_uint,
3048  [AC_TRY_COMPILE([#include <stdio.h>
3049                   #include <sys/types.h>],
3050                  [uint foo = 0;],
3051                  [ac_cv_uint=true],
3052                  [ac_cv_uint=false])])
3053 if test "$ac_cv_uint" = true ; then
3054   AC_DEFINE(HAVE_UINT)
3055   AC_MSG_RESULT(yes)
3056 else
3057   AC_MSG_RESULT(no)
3059 AC_MSG_CHECKING(for uint_t)
3060 AC_CACHE_VAL(ac_cv_uint_t,
3061  [AC_TRY_COMPILE([#include <stdio.h>
3062                   #include <sys/types.h>],
3063                  [uint_t foo = 0;],
3064                  [ac_cv_uint_t=true],
3065                  [ac_cv_uint_t=false])])
3066 if test "$ac_cv_uint_t" = true ; then
3067   AC_DEFINE(HAVE_UINT_T)
3068   AC_MSG_RESULT(yes)
3069 else
3070   AC_MSG_RESULT(no)
3072 AC_MSG_CHECKING(for uint16_t)
3073 AC_CACHE_VAL(ac_cv_uint16_t,
3074  [AC_TRY_COMPILE([#include <stdio.h>
3075                   #include <sys/types.h>],
3076                  [uint16_t foo = 0;],
3077                  [ac_cv_uint16_t=true],
3078                  [ac_cv_uint16_t=false])])
3079 if test "$ac_cv_uint16_t" = true ; then
3080   AC_DEFINE(HAVE_UINT16_T)
3081   AC_MSG_RESULT(yes)
3082 else
3083   AC_MSG_RESULT(no)
3086 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3087 dnl are defined when compiling C++ but not C.  Since the result of this
3088 dnl test is used only in C++, do it in C++.
3089 AC_LANG_CPLUSPLUS
3091 AC_MSG_CHECKING(for uname.domainname)
3092 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3093     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3094         [ struct utsname *res; char *domain; 
3095             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3096         [ac_cv_have_uname_domainname_field=true],
3097         [ac_cv_have_uname_domainname_field=false])])
3099 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3100     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3101     AC_MSG_RESULT(yes)
3102 else
3103     AC_MSG_RESULT(no)
3106 AC_MSG_CHECKING(for uname.__domainname)
3107 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3108     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3109         [ struct utsname *res; char *domain; 
3110             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3111         [ac_cv_have_uname_us_domainname_field=true],
3112         [ac_cv_have_uname_us_domainname_field=false])])
3114 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3115     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3116     AC_MSG_RESULT(yes)
3117 else
3118     AC_MSG_RESULT(no)
3121 AC_LANG_CPLUSPLUS
3123 dnl Check for usable char16_t (2 bytes, unsigned)
3124 dnl (we might not need the unsignedness check anymore)
3125 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3126     ac_cv_have_usable_char16_t,
3127     [AC_TRY_COMPILE([$configure_static_assert_macros],
3128                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3129                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3130                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3131                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3132                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3133                     ac_cv_have_usable_char16_t="yes",
3134                     ac_cv_have_usable_char16_t="no")])
3135 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3136     AC_DEFINE(HAVE_CPP_CHAR16_T)
3137     HAVE_CPP_CHAR16_T=1
3140 dnl Check for usable wchar_t (2 bytes, unsigned)
3141 dnl (we really don't need the unsignedness check anymore)
3142 dnl ========================================================
3144 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3145     ac_cv_have_usable_wchar_v2,
3146     [AC_TRY_COMPILE([#include <stddef.h>
3147                      $configure_static_assert_macros],
3148                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3149                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3150                     ac_cv_have_usable_wchar_v2="yes",
3151                     ac_cv_have_usable_wchar_v2="no")])
3152 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3153     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3154     HAVE_CPP_2BYTE_WCHAR_T=1
3155 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3156 dnl This is really gcc-only
3157 dnl Do this test using CXX only since some versions of gcc
3158 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3159 dnl only have short-wchar support for c++.
3160 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3162     _SAVE_CXXFLAGS=$CXXFLAGS
3163     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3165     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3166         ac_cv_have_usable_wchar_option_v2,
3167         [AC_TRY_LINK([#include <stddef.h>
3168                       $configure_static_assert_macros],
3169                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3170                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3171                      ac_cv_have_usable_wchar_option_v2="yes",
3172                      ac_cv_have_usable_wchar_option_v2="no")])
3174     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3175         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3176         HAVE_CPP_2BYTE_WCHAR_T=1
3177         if test "$OS_TARGET" = Android; then
3178             WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3179             CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3180             CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3181             DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3182         else
3183             WCHAR_CFLAGS="-fshort-wchar"
3184         fi
3185     else    
3186         CXXFLAGS=$_SAVE_CXXFLAGS
3187     fi
3190 AC_LANG_C
3192 dnl Check for .hidden assembler directive and visibility attribute.
3193 dnl Borrowed from glibc configure.in
3194 dnl ===============================================================
3195 if test "$GNU_CC"; then
3196   AC_CACHE_CHECK(for visibility(hidden) attribute,
3197                  ac_cv_visibility_hidden,
3198                  [cat > conftest.c <<EOF
3199                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3201                   ac_cv_visibility_hidden=no
3202                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3203                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3204                       ac_cv_visibility_hidden=yes
3205                     fi
3206                   fi
3207                   rm -f conftest.[cs]
3208                  ])
3209   if test "$ac_cv_visibility_hidden" = "yes"; then
3210     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3212     AC_CACHE_CHECK(for visibility(default) attribute,
3213                    ac_cv_visibility_default,
3214                    [cat > conftest.c <<EOF
3215                     int foo __attribute__ ((visibility ("default"))) = 1;
3217                     ac_cv_visibility_default=no
3218                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3219                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3220                         ac_cv_visibility_default=yes
3221                       fi
3222                     fi
3223                     rm -f conftest.[cs]
3224                    ])
3225     if test "$ac_cv_visibility_default" = "yes"; then
3226       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3228       AC_CACHE_CHECK(for visibility pragma support,
3229                      ac_cv_visibility_pragma,
3230                      [cat > conftest.c <<EOF
3231 #pragma GCC visibility push(hidden)
3232                       int foo_hidden = 1;
3233 #pragma GCC visibility push(default)
3234                       int foo_default = 1;
3236                       ac_cv_visibility_pragma=no
3237                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3238                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3239                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3240                             ac_cv_visibility_pragma=yes
3241                           fi
3242                         fi
3243                       fi
3244                       rm -f conftest.[cs]
3245                     ])
3246       if test "$ac_cv_visibility_pragma" = "yes"; then
3247         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3248                        ac_cv_have_visibility_class_bug,
3249                        [cat > conftest.c <<EOF
3250 #pragma GCC visibility push(hidden)
3251 struct __attribute__ ((visibility ("default"))) TestStruct {
3252   static void Init();
3254 __attribute__ ((visibility ("default"))) void TestFunc() {
3255   TestStruct::Init();
3258                        ac_cv_have_visibility_class_bug=no
3259                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3260                          ac_cv_have_visibility_class_bug=yes
3261                        else
3262                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3263                            ac_cv_have_visibility_class_bug=yes
3264                          fi
3265                        fi
3266                        rm -rf conftest.{c,S}
3267                        ])
3269         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3270                        ac_cv_have_visibility_builtin_bug,
3271                        [cat > conftest.c <<EOF
3272 #pragma GCC visibility push(hidden)
3273 #pragma GCC visibility push(default)
3274 #include <string.h>
3275 #pragma GCC visibility pop
3277 __attribute__ ((visibility ("default"))) void Func() {
3278   char c[[100]];
3279   memset(c, 0, sizeof(c));
3282                        ac_cv_have_visibility_builtin_bug=no
3283                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3284                          ac_cv_have_visibility_builtin_bug=yes
3285                        else
3286                          if test `grep -c "@PLT" conftest.S` = 0; then
3287                            ac_cv_visibility_builtin_bug=yes
3288                          fi
3289                        fi
3290                        rm -f conftest.{c,S}
3291                        ])
3292         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3293                 "$ac_cv_have_visibility_class_bug" = "no"; then
3294           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3295           WRAP_SYSTEM_INCLUDES=1
3296           STL_FLAGS='-I$(DIST)/stl_wrappers'
3297           WRAP_STL_INCLUDES=1
3298         else
3299           VISIBILITY_FLAGS='-fvisibility=hidden'
3300         fi # have visibility pragma bug
3301       fi   # have visibility pragma
3302     fi     # have visibility(default) attribute
3303   fi       # have visibility(hidden) attribute
3304 fi         # GNU_CC
3306 # visibility hidden flag for Sun Studio on Solaris
3307 if test "$SOLARIS_SUNPRO_CC"; then
3308 VISIBILITY_FLAGS='-xldscope=hidden'
3309 fi         # Sun Studio on Solaris
3311 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3312 AC_SUBST(VISIBILITY_FLAGS)
3314 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3315 dnl ========================================================
3316 if test "$GNU_CC"; then
3317   CFLAGS_save="${CFLAGS}"
3318   CFLAGS="${CFLAGS} -Werror"
3319   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3320                  ac_cv_force_align_arg_pointer,
3321                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3322                                  [],
3323                                  ac_cv_force_align_arg_pointer="yes",
3324                                  ac_cv_force_align_arg_pointer="no")])
3325   CFLAGS="${CFLAGS_save}"
3326   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3327     HAVE_GCC_ALIGN_ARG_POINTER=1
3328   else
3329     HAVE_GCC_ALIGN_ARG_POINTER=
3330   fi
3332 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3334 dnl Checks for header files.
3335 dnl ========================================================
3336 AC_HEADER_DIRENT
3337 case "$target_os" in
3338 freebsd*)
3339 # for stuff like -lXshm
3340     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3341     ;;
3342 esac
3343 MOZ_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3344 MOZ_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3345 MOZ_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3346 MOZ_CHECK_HEADERS(malloc.h)
3347 MOZ_CHECK_HEADERS(X11/XKBlib.h)
3348 MOZ_CHECK_HEADERS(io.h)
3350 dnl These are all the places some variant of statfs can be hiding.
3351 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3353 dnl Quota support
3354 MOZ_CHECK_HEADERS(sys/quota.h)
3355 MOZ_CHECK_HEADERS(linux/quota.h)
3357 dnl Try for MMX support
3358 dnl NB - later gcc versions require -mmmx for this header to be successfully
3359 dnl included (or another option which implies it, such as -march=pentium-mmx)
3360 MOZ_CHECK_HEADERS(mmintrin.h)
3362 dnl Check whether the compiler supports the new-style C++ standard
3363 dnl library headers (i.e. <new>) or needs the old "new.h"
3364 AC_LANG_CPLUSPLUS
3365 NEW_H=new.h
3366 MOZ_CHECK_HEADER(new, [NEW_H=new])
3367 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3368 AC_LANG_C
3370 AC_ARG_ENABLE(dtrace,
3371               [  --enable-dtrace         build with dtrace support if available (default=no)],
3372               [enable_dtrace="yes"],)
3373 if test "x$enable_dtrace" = "xyes"; then
3374   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3375   if test -n "$HAVE_DTRACE"; then
3376       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3377   else
3378       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3379   fi
3381 AC_SUBST(HAVE_DTRACE)
3383 case $target in
3384 *-aix4.3*|*-aix5*)
3385         ;;
3387         MOZ_CHECK_HEADERS(sys/cdefs.h)
3388         ;;
3389 esac
3391 dnl Checks for libraries.
3392 dnl ========================================================
3393 case $target in
3394 *-hpux11.*)
3395         ;;
3397         AC_CHECK_LIB(c_r, gethostbyname_r)
3398         ;;
3399 esac
3401 dnl We don't want to link with libdl even if it's present on OS X, since
3402 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3403 dnl in libc.
3404 dnl We don't want to link against libm or libpthread on Darwin since
3405 dnl they both are just symlinks to libSystem and explicitly linking
3406 dnl against libSystem causes issues when debugging (see bug 299601).
3407 case $target in
3408 *-darwin*)
3409     ;;
3410 *-os2*)
3411     ;;
3413     AC_SEARCH_LIBS(dlopen, dl, 
3414         MOZ_CHECK_HEADER(dlfcn.h, 
3415         AC_DEFINE(HAVE_DLOPEN)))
3416     ;;
3417 esac
3419 _SAVE_CFLAGS="$CFLAGS"
3420 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3421 AC_CHECK_FUNCS(dladdr)
3422 CFLAGS="$_SAVE_CFLAGS"
3424 if test ! "$GNU_CXX"; then
3426     case $target in
3427     *-aix*)
3428         AC_CHECK_LIB(C_r, demangle)
3429         ;;
3430      *)
3431         AC_CHECK_LIB(C, demangle)
3432         ;;
3433      esac
3436 dnl OS/2 has socket in libc.
3437 case $target in
3438 *-os2*)
3439     ;;
3441     AC_CHECK_LIB(socket, socket)
3442 esac
3444 dnl ========================================================
3445 dnl Check whether we can compile code for Core Text
3446 dnl (available on Mac OS X 10.5 or later)
3447 dnl ========================================================
3448 case "$target" in
3449 *-darwin*)
3450   AC_MSG_CHECKING([for Core Text])
3451   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3452                  [CTLineRef lineRef;],
3453                   ac_cv_have_core_text="yes",
3454                   ac_cv_have_core_text="no")
3455   AC_MSG_RESULT([$ac_cv_have_core_text])
3457   if test "$ac_cv_have_core_text" = "no"; then
3458     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3459   fi
3460   ;;
3461 esac
3463 XLDFLAGS="$X_LIBS"
3464 XLIBS="$X_EXTRA_LIBS"
3466 dnl ========================================================
3467 dnl Checks for X libraries.
3468 dnl Ordering is important.
3469 dnl Xt is dependent upon SM as of X11R6
3470 dnl ========================================================
3471 if test "$no_x" = "yes"; then
3472     AC_DEFINE(NO_X11)
3473 else
3474     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3475         XLIBS="-lX11 $XLIBS"
3476         _SAVE_LDFLAGS="$LDFLAGS"
3477         LDFLAGS="$XLDFLAGS $LDFLAGS"
3478         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3479                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3480         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3481                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3482      
3483         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3484         unset ac_cv_lib_Xt_XtFree
3485             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3486             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3487         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3488                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3489         ])
3491     # AIX needs the motif library linked before libXt to prevent
3492     # crashes in plugins linked against Motif - Bug #98892
3493     case "${target_os}" in
3494     aix*)
3495         XT_LIBS="-lXm $XT_LIBS"
3496         ;;
3497     esac
3499     dnl ========================================================
3500     dnl = Check for XShm
3501     dnl ========================================================
3502     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3503         $XLIBS $XEXT_LIBS)
3504     MOZ_CHECK_HEADER(X11/extensions/XShm.h)
3505     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3506         test -n "$_HAVE_XSHM_XEXT"; then
3507         AC_DEFINE(HAVE_XSHM)
3508     fi
3510     dnl ========================================================
3511     dnl = Check for Xss
3512     dnl ========================================================
3513     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3514         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3515             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3516              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3518     dnl ========================================================
3519     dnl = Check for XIE
3520     dnl ========================================================
3521     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3522         $XLIBS $XEXT_LIBS)
3523     MOZ_CHECK_HEADER(X11/extensions/XIElib.h)
3525     if test "$MOZ_XIE_LIBS"; then
3526         dnl ====================================================
3527         dnl = If XIE is present and is desired, turn it on
3528         dnl ====================================================
3529         case $target in
3530             *-hpux*)
3531                 ;;
3532             *)
3533                 HAVE_XIE=1
3534                 ;;
3535         esac
3536     fi
3538         LDFLAGS="$_SAVE_LDFLAGS"
3540     dnl ========================================================
3541     dnl = Check for freetype2 and its functionality
3542     dnl ========================================================
3543     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3545     if test "$_HAVE_FREETYPE2"; then
3546         _SAVE_LIBS="$LIBS"
3547         _SAVE_CFLAGS="$CFLAGS"
3548         LIBS="$LIBS $FT2_LIBS"
3549         CFLAGS="$CFLAGS $FT2_CFLAGS"
3551         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3552             ac_cv_member_FT_Bitmap_Size_y_ppem,
3553             [AC_TRY_COMPILE([#include <ft2build.h>
3554                              #include FT_FREETYPE_H],
3555                             [FT_Bitmap_Size s;
3556                              if (sizeof s.y_ppem) return 0;
3557                              return 1],
3558                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3559                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3560         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3561             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3562         else
3563             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3564         fi
3565         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3566                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3567                            [FT_Bitmap_Size structure includes y_ppem field])
3569         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3571         LIBS="$_SAVE_LIBS"
3572         CFLAGS="$_SAVE_CFLAGS"
3573     fi
3575 fi # $no_x
3577 AC_SUBST(XCFLAGS)
3578 AC_SUBST(XLDFLAGS)
3579 AC_SUBST(XLIBS)
3580 AC_SUBST(XEXT_LIBS)
3581 AC_SUBST(XT_LIBS)
3582 AC_SUBST(XSS_LIBS)
3584 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3585 # We try to link so that this also fails when
3586 # building with LTO.
3587 AC_TRY_LINK([],
3588                [asm("uqadd8 r1, r1, r2");],
3589                result="yes", result="no")
3590 AC_MSG_RESULT("$result")
3591 if test "$result" = "yes"; then
3592     AC_DEFINE(HAVE_ARM_SIMD)
3593     HAVE_ARM_SIMD=1
3595 AC_SUBST(HAVE_ARM_SIMD)
3597 AC_MSG_CHECKING(for ARM NEON support in compiler)
3598 _SAVE_CFLAGS="$CFLAGS"
3599 if test "$GNU_CC"; then
3600   # gcc needs -mfpu=neon to recognize NEON instructions
3601   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3603 # We try to link so that this also fails when
3604 # building with LTO.
3605 AC_TRY_LINK([],
3606                [asm("vadd.i8 d0, d0, d0");],
3607                result="yes", result="no")
3608 AC_MSG_RESULT("$result")
3609 if test "$result" = "yes"; then
3610     AC_DEFINE(HAVE_ARM_NEON)
3611     HAVE_ARM_NEON=1
3613 CFLAGS="$_SAVE_CFLAGS"
3614 AC_SUBST(HAVE_ARM_NEON)
3616 dnl ========================================================
3617 dnl = pthread support
3618 dnl = Start by checking whether the system support pthreads
3619 dnl ========================================================
3620 case "$target_os" in
3621 darwin*)
3622     USE_PTHREADS=1
3623     ;;
3625     MOZ_CHECK_PTHREADS(pthreads,
3626         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3627         MOZ_CHECK_PTHREADS(pthread,
3628             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3629             MOZ_CHECK_PTHREADS(c_r,
3630                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3631                 MOZ_CHECK_PTHREADS(c,
3632                     USE_PTHREADS=1
3633                 )
3634             )
3635         )
3636     )
3637     ;;
3638 esac
3640 dnl ========================================================
3641 dnl Check the command line for --with-pthreads 
3642 dnl ========================================================
3643 MOZ_ARG_WITH_BOOL(pthreads,
3644 [  --with-pthreads         Force use of system pthread library with NSPR ],
3645 [ if test "$USE_PTHREADS"x = x; then
3646     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3647 fi],
3648     USE_PTHREADS=
3649     _PTHREAD_LDFLAGS=
3652 dnl ========================================================
3653 dnl Do the platform specific pthread hackery
3654 dnl ========================================================
3655 if test "$USE_PTHREADS"x != x
3656 then
3657         dnl
3658         dnl See if -pthread is supported.
3659         dnl
3660         rm -f conftest*
3661         ac_cv_have_dash_pthread=no
3662         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3663         echo 'int main() { return 0; }' | cat > conftest.c
3664         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3665         if test $? -eq 0; then
3666                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3667                         ac_cv_have_dash_pthread=yes
3668                 case "$target_os" in
3669                 freebsd*)
3670 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3671                 ;;
3672                 *)
3673                             CFLAGS="$CFLAGS -pthread"
3674                             CXXFLAGS="$CXXFLAGS -pthread"
3675                 ;;
3676                 esac
3677                 fi
3678         fi
3679         rm -f conftest*
3680     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3682         dnl
3683         dnl See if -pthreads is supported.
3684         dnl
3685     ac_cv_have_dash_pthreads=no
3686     if test "$ac_cv_have_dash_pthread" = "no"; then
3687             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3688         echo 'int main() { return 0; }' | cat > conftest.c
3689             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3690         if test $? -eq 0; then
3691                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3692                             ac_cv_have_dash_pthreads=yes
3693                             CFLAGS="$CFLAGS -pthreads"
3694                             CXXFLAGS="$CXXFLAGS -pthreads"
3695                     fi
3696             fi
3697             rm -f conftest*
3698         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3699     fi
3701         case "$target" in
3702             *-*-freebsd*)
3703                         AC_DEFINE(_REENTRANT)
3704                         AC_DEFINE(_THREAD_SAFE)
3705                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3706                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3707                                 _PTHREAD_LDFLAGS="-pthread"
3708                         else
3709                                 _PTHREAD_LDFLAGS="-lc_r"
3710                         fi
3711                         ;;
3713             *-*-openbsd*|*-*-bsdi*)
3714                         AC_DEFINE(_REENTRANT)
3715                         AC_DEFINE(_THREAD_SAFE)
3716                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3717                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3718                 _PTHREAD_LDFLAGS="-pthread"
3719                         fi
3720                         ;;
3722             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3723                         AC_DEFINE(_REENTRANT) 
3724                         ;;
3726             *-*-nto*) 
3727                         AC_DEFINE(_REENTRANT) 
3728                         ;;
3730             *-aix4.3*|*-aix5*)
3731                         AC_DEFINE(_REENTRANT) 
3732                         ;;
3734             *-hpux11.*)
3735                         AC_DEFINE(_REENTRANT) 
3736                         ;;
3738             alpha*-*-osf*)
3739                         AC_DEFINE(_REENTRANT)
3740                         ;;
3742             *-*-solaris*) 
3743                         AC_DEFINE(_REENTRANT)
3744                         if test "$SOLARIS_SUNPRO_CC"; then
3745                                 CFLAGS="$CFLAGS -mt" 
3746                                 CXXFLAGS="$CXXFLAGS -mt" 
3747                         fi
3748                         ;;
3749         esac
3750     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3753 dnl ========================================================
3754 dnl See if mmap sees writes
3755 dnl For cross compiling, just define it as no, which is a safe default
3756 dnl ========================================================
3757 AC_MSG_CHECKING(whether mmap() sees write()s)
3759 changequote(,)
3760 mmap_test_prog='
3761     #include <stdlib.h>
3762     #include <unistd.h>
3763     #include <sys/mman.h>
3764     #include <sys/types.h>
3765     #include <sys/stat.h>
3766     #include <fcntl.h>
3768     char fname[] = "conftest.file";
3769     char zbuff[1024]; /* Fractional page is probably worst case */
3771     int main() {
3772         char *map;
3773         int fd;
3774         int i;
3775         unlink(fname);
3776         fd = open(fname, O_RDWR | O_CREAT, 0660);
3777         if(fd<0) return 1;
3778         unlink(fname);
3779         write(fd, zbuff, sizeof(zbuff));
3780         lseek(fd, 0, SEEK_SET);
3781         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3782         if(map==(char*)-1) return 2;
3783         for(i=0; fname[i]; i++) {
3784             int rc = write(fd, &fname[i], 1);
3785             if(map[i]!=fname[i]) return 4;
3786         }
3787         return 0;
3788     }
3790 changequote([,])
3792 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3794 AC_MSG_RESULT("$result")
3796 if test "$result" = "no"; then
3797     AC_DEFINE(MMAP_MISSES_WRITES)
3801 dnl Checks for library functions.
3802 dnl ========================================================
3803 AC_PROG_GCC_TRADITIONAL
3804 AC_FUNC_MEMCMP
3805 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3806 AC_CHECK_FUNCS(flockfile getpagesize)
3807 AC_CHECK_FUNCS(localtime_r strtok_r)
3809 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3810 _SAVE_LDFLAGS=$LDFLAGS
3811 LDFLAGS="$LDFLAGS -lrt"
3812 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3813                ac_cv_have_clock_monotonic,
3814                [AC_TRY_LINK([#include <time.h>],
3815                             [ struct timespec ts;
3816                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3817                             ac_cv_have_clock_monotonic=yes,
3818                             ac_cv_have_clock_monotonic=no)])
3819 LDFLAGS=$_SAVE_LDFLAGS
3820 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3821     HAVE_CLOCK_MONOTONIC=1
3822     REALTIME_LIBS=-lrt
3823     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3824     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3825     AC_SUBST(REALTIME_LIBS)
3828 dnl check for wcrtomb/mbrtowc
3829 dnl =======================================================================
3830 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3831 AC_LANG_SAVE
3832 AC_LANG_CPLUSPLUS
3833 AC_CACHE_CHECK(for wcrtomb,
3834     ac_cv_have_wcrtomb,
3835     [AC_TRY_LINK([#include <wchar.h>],
3836                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3837                  ac_cv_have_wcrtomb="yes",
3838                  ac_cv_have_wcrtomb="no")])
3839 if test "$ac_cv_have_wcrtomb" = "yes"; then
3840     AC_DEFINE(HAVE_WCRTOMB)
3842 AC_CACHE_CHECK(for mbrtowc,
3843     ac_cv_have_mbrtowc,
3844     [AC_TRY_LINK([#include <wchar.h>],
3845                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3846                  ac_cv_have_mbrtowc="yes",
3847                  ac_cv_have_mbrtowc="no")])
3848 if test "$ac_cv_have_mbrtowc" = "yes"; then
3849     AC_DEFINE(HAVE_MBRTOWC)
3851 AC_LANG_RESTORE
3854 AC_CACHE_CHECK(
3855     [for res_ninit()],
3856     ac_cv_func_res_ninit,
3857     [AC_TRY_LINK([
3858         #ifdef linux
3859         #define _BSD_SOURCE 1
3860         #endif
3861         #include <resolv.h>
3862         ],
3863         [int foo = res_ninit(&_res);],
3864         [ac_cv_func_res_ninit=yes],
3865         [ac_cv_func_res_ninit=no])
3866     ])
3868 if test "$ac_cv_func_res_ninit" = "yes"; then
3869     AC_DEFINE(HAVE_RES_NINIT)
3870 dnl must add the link line we do something as foolish as this... dougt
3871 dnl else
3872 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3873 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3876 AC_LANG_CPLUSPLUS
3877 AC_CACHE_CHECK(
3878     [for gnu_get_libc_version()],
3879     ac_cv_func_gnu_get_libc_version,
3880     [AC_TRY_LINK([
3881         #ifdef HAVE_GNU_LIBC_VERSION_H
3882         #include <gnu/libc-version.h>
3883         #endif
3884         ],
3885         [const char *glibc_version = gnu_get_libc_version();],
3886         [ac_cv_func_gnu_get_libc_version=yes],
3887         [ac_cv_func_gnu_get_libc_version=no] 
3888         )]
3889     )
3891 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3892     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3895 case $target_os in
3896     darwin*|mingw*|os2*|wince*|winmo*)
3897         ;;
3898     *)
3899     
3900 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3901     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3902         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3903 _SAVE_LIBS=$LIBS
3904 LIBS="$LIBS $_ICONV_LIBS"
3905 AC_CACHE_CHECK(
3906     [for iconv()],
3907     ac_cv_func_iconv,
3908     [AC_TRY_LINK([
3909         #include <stdlib.h>
3910         #include <iconv.h>
3911         ],
3912         [
3913             iconv_t h = iconv_open("", "");
3914             iconv(h, NULL, NULL, NULL, NULL);
3915             iconv_close(h);
3916         ],
3917         [ac_cv_func_iconv=yes],
3918         [ac_cv_func_iconv=no] 
3919         )]
3920     )
3921 if test "$ac_cv_func_iconv" = "yes"; then
3922     AC_DEFINE(HAVE_ICONV)
3923     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3924     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3925     LIBICONV="$_ICONV_LIBS"
3926     AC_CACHE_CHECK(
3927         [for iconv() with const input],
3928         ac_cv_func_const_iconv,
3929         [AC_TRY_COMPILE([
3930             #include <stdlib.h>
3931             #include <iconv.h>
3932             ],
3933             [
3934                 const char *input = "testing";
3935                 iconv_t h = iconv_open("", "");
3936                 iconv(h, &input, NULL, NULL, NULL);
3937                 iconv_close(h);
3938             ],
3939             [ac_cv_func_const_iconv=yes],
3940             [ac_cv_func_const_iconv=no] 
3941             )]
3942         )
3943     if test "$ac_cv_func_const_iconv" = "yes"; then
3944         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3945     fi
3947 LIBS=$_SAVE_LIBS
3949     ;;
3950 esac
3952 AM_LANGINFO_CODESET
3954 AC_LANG_C
3956 dnl **********************
3957 dnl *** va_copy checks ***
3958 dnl **********************
3959 dnl we currently check for all three va_copy possibilities, so we get
3960 dnl all results in config.log for bug reports.
3961 AC_MSG_CHECKING(for an implementation of va_copy())
3962 AC_CACHE_VAL(ac_cv_va_copy,[
3963     AC_TRY_RUN([
3964         #include <stdarg.h>
3965         void f (int i, ...) {
3966             va_list args1, args2;
3967             va_start (args1, i);
3968             va_copy (args2, args1);
3969             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3970                 exit (1);
3971             va_end (args1); va_end (args2);
3972         }
3973         int main() { f (0, 42); return 0; }],
3974         ac_cv_va_copy=yes,
3975         ac_cv_va_copy=no,
3976         ac_cv_va_copy=no
3977     )
3979 AC_MSG_RESULT($ac_cv_va_copy)
3980 AC_MSG_CHECKING(for an implementation of __va_copy())
3981 AC_CACHE_VAL(ac_cv___va_copy,[
3982     AC_TRY_RUN([
3983         #include <stdarg.h>
3984         void f (int i, ...) {
3985             va_list args1, args2;
3986             va_start (args1, i);
3987             __va_copy (args2, args1);
3988             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3989                 exit (1);
3990             va_end (args1); va_end (args2);
3991         }
3992         int main() { f (0, 42); return 0; }],
3993         ac_cv___va_copy=yes,
3994         ac_cv___va_copy=no,
3995         ac_cv___va_copy=no
3996     )
3998 AC_MSG_RESULT($ac_cv___va_copy)
3999 AC_MSG_CHECKING(whether va_lists can be copied by value)
4000 AC_CACHE_VAL(ac_cv_va_val_copy,[
4001     AC_TRY_RUN([
4002         #include <stdarg.h>
4003         void f (int i, ...) {
4004             va_list args1, args2;
4005             va_start (args1, i);
4006             args2 = args1;
4007             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
4008                 exit (1);
4009             va_end (args1); va_end (args2);
4010         }
4011         int main() { f (0, 42); return 0; }],
4012         ac_cv_va_val_copy=yes,
4013         ac_cv_va_val_copy=no,
4014         ac_cv_va_val_copy=yes
4015     )
4017 if test "x$ac_cv_va_copy" = "xyes"; then
4018     AC_DEFINE(VA_COPY, va_copy)
4019     AC_DEFINE(HAVE_VA_COPY)
4020 elif test "x$ac_cv___va_copy" = "xyes"; then
4021     AC_DEFINE(VA_COPY, __va_copy)
4022     AC_DEFINE(HAVE_VA_COPY)
4025 if test "x$ac_cv_va_val_copy" = "xno"; then
4026    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
4028 AC_MSG_RESULT($ac_cv_va_val_copy)
4030 dnl Check for dll-challenged libc's.
4031 dnl This check is apparently only needed for Linux.
4032 case "$target" in
4033         *-linux*)
4034             dnl ===================================================================
4035             _curdir=`pwd`
4036             export _curdir
4037             rm -rf conftest* _conftest
4038             mkdir _conftest
4039             cat >> conftest.C <<\EOF
4040 #include <stdio.h>
4041 #include <link.h>
4042 #include <dlfcn.h>
4043 #ifdef _dl_loaded
4044 void __dump_link_map(void) {
4045   struct link_map *map = _dl_loaded;
4046   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4048 int main() {
4049   dlopen("./conftest1.so",RTLD_LAZY);
4050   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4051   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4052   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4053   __dump_link_map();
4055 #else
4056 /* _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).*/
4057 int main() { printf("./conftest1.so\n"); }
4058 #endif
4061             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4063             cat >> conftest1.C <<\EOF
4064 #include <stdio.h>
4065 void foo(void) {printf("foo in dll called\n");}
4067             ${CXX-g++} -fPIC -c -g conftest1.C
4068             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4069             ${CXX-g++} -g conftest.C -o conftest -ldl
4070             cp -f conftest1.so conftest _conftest
4071             cd _conftest
4072             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4073             then
4074                 echo
4075                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4076                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4077                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4078                 echo "*** will be excessive memory usage at runtime."
4079                 echo
4080             fi
4081             cd ${_curdir}
4082             rm -rf conftest* _conftest
4083             dnl ===================================================================
4084             ;;
4085 esac
4087 dnl ===================================================================
4088 dnl ========================================================
4089 dnl Put your C++ language/feature checks below
4090 dnl ========================================================
4091 AC_LANG_CPLUSPLUS
4093 ARM_ABI_PREFIX=
4094 HAVE_GCC3_ABI=
4095 if test "$GNU_CC"; then
4096   if test "$CPU_ARCH" = "arm" ; then
4097     AC_CACHE_CHECK(for ARM EABI,
4098         ac_cv_gcc_arm_eabi,
4099         [AC_TRY_COMPILE([],
4100                         [
4101 #if defined(__ARM_EABI__)
4102   return 0;
4103 #else
4104 #error Not ARM EABI.
4105 #endif
4106                         ],
4107                         ac_cv_gcc_arm_eabi="yes",
4108                         ac_cv_gcc_arm_eabi="no")])
4109     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4110         HAVE_ARM_EABI=1
4111         ARM_ABI_PREFIX=eabi-
4112     else
4113         ARM_ABI_PREFIX=oabi-
4114     fi
4115   fi
4117   AC_CACHE_CHECK(for gcc 3.0 ABI,
4118       ac_cv_gcc_three_abi,
4119       [AC_TRY_COMPILE([],
4120                       [
4121 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4122   return 0;
4123 #else
4124 #error Not gcc3.
4125 #endif
4126                       ],
4127                       ac_cv_gcc_three_abi="yes",
4128                       ac_cv_gcc_three_abi="no")])
4129   if test "$ac_cv_gcc_three_abi" = "yes"; then
4130       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4131       HAVE_GCC3_ABI=1
4132   else
4133       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4134   fi
4136 AC_SUBST(HAVE_GCC3_ABI)
4139 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4140                ac_cv_cpp_explicit,
4141                [AC_TRY_COMPILE(class X {
4142                                public: explicit X(int i) : i_(i) {}
4143                                private: int i_;
4144                                };,
4145                                X x(3);,
4146                                ac_cv_cpp_explicit=yes,
4147                                ac_cv_cpp_explicit=no)])
4148 if test "$ac_cv_cpp_explicit" = yes ; then
4149    AC_DEFINE(HAVE_CPP_EXPLICIT)
4152 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4153                ac_cv_cpp_typename,
4154                [AC_TRY_COMPILE(class param {
4155                                public:
4156                                    typedef unsigned long num_type;
4157                                };
4159                                template <class T> class tplt {
4160                                public:
4161                                    typedef typename T::num_type t_num_type;
4162                                    t_num_type foo(typename T::num_type num) {
4163                                        return num;
4164                                    }
4165                                };,
4166                                tplt<param> A;
4167                                A.foo(0);,
4168                                ac_cv_cpp_typename=yes,
4169                                ac_cv_cpp_typename=no)])
4170 if test "$ac_cv_cpp_typename" = yes ; then
4171    AC_DEFINE(HAVE_CPP_TYPENAME)
4174 dnl Check for support of modern template specialization syntax
4175 dnl Test code and requirement from scc@netscape.com.
4176 dnl Autoconf cut-and-paste job by waterson@netscape.com
4177 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4178                ac_cv_cpp_modern_specialize_template_syntax,
4179                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4180                                class Y {};
4181                                template <> struct X<Y> { double a; };,
4182                                X<int> int_x;
4183                                X<Y> y_x;,
4184                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4185                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4186 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4187   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4191 dnl Some compilers support only full specialization, and some don't.
4192 AC_CACHE_CHECK(whether partial template specialization works,
4193                ac_cv_cpp_partial_specialization,
4194                [AC_TRY_COMPILE(template <class T> class Foo {};
4195                                template <class T> class Foo<T*> {};,
4196                                return 0;,
4197                                ac_cv_cpp_partial_specialization=yes,
4198                                ac_cv_cpp_partial_specialization=no)])
4199 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4200   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4203 dnl Some compilers have limited support for operators with templates;
4204 dnl specifically, it is necessary to define derived operators when a base
4205 dnl class's operator declaration should suffice.
4206 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4207                ac_cv_need_derived_template_operators,
4208                [AC_TRY_COMPILE([template <class T> class Base { };
4209                                 template <class T>
4210                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4211                                 template <class T> class Derived : public Base<T> { };],
4212                                [Derived<char> a, b;
4213                                 Base<char> c = a + b;
4214                                 return 0;],
4215                                ac_cv_need_derived_template_operators=no,
4216                                ac_cv_need_derived_template_operators=yes)])
4217 if test "$ac_cv_need_derived_template_operators" = yes ; then
4218   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4222 dnl Some compilers have trouble detecting that a template class
4223 dnl that derives from another template is actually an instance
4224 dnl of the base class. This test checks for that.
4225 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4226                ac_cv_need_cpp_template_cast_to_base,
4227                [AC_TRY_COMPILE([template <class T> class Base { };
4228                                 template <class T> class Derived : public Base<T> { };
4229                                 template <class T> int foo(const Base<T>&) { return 0; }],
4230                                [Derived<char> bar; return foo(bar);],
4231                                ac_cv_need_cpp_template_cast_to_base=no,
4232                                ac_cv_need_cpp_template_cast_to_base=yes)])
4233 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4234   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4237 dnl Some compilers have trouble resolving the ambiguity between two
4238 dnl functions whose arguments differ only by cv-qualifications.
4239 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4240                ac_cv_can_resolve_const_ambiguity,
4241                [AC_TRY_COMPILE([
4242                                 template <class T> class ptrClass {
4243                                   public: T* ptr;
4244                                 };
4246                                 template <class T> T* a(ptrClass<T> *arg) {
4247                                   return arg->ptr;
4248                                 }
4250                                 template <class T>
4251                                 const T* a(const ptrClass<T> *arg) {
4252                                   return arg->ptr;
4253                                 }
4254                                ],
4255                                [ ptrClass<int> i;
4256                                  a(&i); ],
4257                                ac_cv_can_resolve_const_ambiguity=yes,
4258                                ac_cv_can_resolve_const_ambiguity=no)])
4259 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4260   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4264 dnl We don't do exceptions on unix.  The only reason this used to be here
4265 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4266 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4267 dnl So im commenting this out until someone writes some artificial 
4268 dnl intelligence to detect not only if the compiler has exceptions, but if 
4269 dnl they are enabled as well.
4270 dnl 
4271 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4272 dnl                ac_cv_cpp_exceptions,
4273 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4274 dnl                                static void F() { throw X(); },
4275 dnl                                try { F(); } catch(X & e) { },
4276 dnl                                ac_cv_cpp_exceptions=yes,
4277 dnl                                ac_cv_cpp_exceptions=no)])
4278 dnl if test $ac_cv_cpp_exceptions = yes ; then
4279 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4280 dnl fi
4282 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4283 dnl supports it well enough to allow us to use it to change access, but not
4284 dnl to resolve ambiguity. The next two tests determine how well the |using|
4285 dnl keyword is supported.
4287 dnl Check to see if we can change access with |using|.  Test both a
4288 dnl legal and an illegal example.
4289 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4290                ac_cv_cpp_access_changing_using2,
4291                [AC_TRY_COMPILE(
4292                    class A { protected: int foo() { return 0; } };
4293                    class B : public A { public: using A::foo; };,
4294                    B b; return b.foo();,
4295                    [AC_TRY_COMPILE(
4296                        class A { public: int foo() { return 1; } };
4297                        class B : public A { private: using A::foo; };,
4298                        B b; return b.foo();,
4299                        ac_cv_cpp_access_changing_using2=no,
4300                        ac_cv_cpp_access_changing_using2=yes)],
4301                    ac_cv_cpp_access_changing_using2=no)])
4302 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4303    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4306 dnl Check to see if we can resolve ambiguity with |using|.
4307 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4308                ac_cv_cpp_ambiguity_resolving_using,
4309                [AC_TRY_COMPILE(class X { 
4310                                  public: int go(const X&) {return 3;}
4311                                          int jo(const X&) {return 3;}
4312                                };
4313                                class Y : public X {
4314                                  public:  int go(int) {return 2;}
4315                                           int jo(int) {return 2;}
4316                                           using X::jo;
4317                                  private: using X::go;
4318                                };,
4319                                X x; Y y; y.jo(x);,
4320                                ac_cv_cpp_ambiguity_resolving_using=yes,
4321                                ac_cv_cpp_ambiguity_resolving_using=no)])
4322 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4323    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4326 dnl Check to see if the |std| namespace is supported. If so, we'll want
4327 dnl to qualify any standard library calls with "std::" to ensure that
4328 dnl those functions can be resolved.
4329 AC_CACHE_CHECK(for \"std::\" namespace,
4330                ac_cv_cpp_namespace_std,
4331                [AC_TRY_COMPILE([#include <algorithm>],
4332                                [return std::min(0, 1);],
4333                                ac_cv_cpp_namespace_std=yes,
4334                                ac_cv_cpp_namespace_std=no)])
4335 if test "$ac_cv_cpp_namespace_std" = yes ; then
4336    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4339 dnl Older compilers are overly ambitious with respect to using the standard
4340 dnl template library's |operator!=()| when |operator==()| is defined. In
4341 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4342 dnl ambiguity at compile-time. This test checks for that case.
4343 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4344                ac_cv_cpp_unambiguous_std_notequal,
4345                [AC_TRY_COMPILE([#include <algorithm>
4346                                 struct T1 {};
4347                                 int operator==(const T1&, const T1&) { return 0; }
4348                                 int operator!=(const T1&, const T1&) { return 0; }],
4349                                [T1 a,b; return a != b;],
4350                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4351                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4352 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4353   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4357 AC_CACHE_CHECK(for C++ reinterpret_cast,
4358                ac_cv_cpp_reinterpret_cast,
4359                [AC_TRY_COMPILE(struct X { int i; };
4360                                struct Y { int i; };,
4361                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4362                                ac_cv_cpp_reinterpret_cast=yes,
4363                                ac_cv_cpp_reinterpret_cast=no)])
4364 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4365    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4368 dnl See if a dynamic_cast to void* gives the most derived object.
4369 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4370                ac_cv_cpp_dynamic_cast_void_ptr,
4371                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4372                             class Y { int j; public: virtual ~Y() { } };
4373                             class Z : public X, public Y { int k; };
4375                             int main() {
4376                                  Z mdo;
4377                                  X *subx = (X*)&mdo;
4378                                  Y *suby = (Y*)&mdo;
4379                                  return !((((void*)&mdo != (void*)subx) &&
4380                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4381                                           (((void*)&mdo != (void*)suby) &&
4382                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4383                             }],
4384                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4385                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4386                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4387 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4388    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4392 dnl note that this one is reversed - if the test fails, then
4393 dnl we require implementations of unused virtual methods. Which
4394 dnl really blows because it means we'll have useless vtable
4395 dnl bloat.
4396 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4397                ac_cv_cpp_unused_required,
4398                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4399                                X x;,
4400                                ac_cv_cpp_unused_required=no,
4401                                ac_cv_cpp_unused_required=yes)])
4402 if test "$ac_cv_cpp_unused_required" = yes ; then
4403    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4407 dnl Some compilers have trouble comparing a constant reference to a templatized
4408 dnl class to zero, and require an explicit operator==() to be defined that takes
4409 dnl an int. This test separates the strong from the weak.
4411 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4412                ac_cv_trouble_comparing_to_zero,
4413                [AC_TRY_COMPILE([#include <algorithm>
4414                                 template <class T> class Foo {};
4415                                 class T2;
4416                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4417                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4418                                [Foo<int> f; return (0 != f);],
4419                                ac_cv_trouble_comparing_to_zero=no,
4420                                ac_cv_trouble_comparing_to_zero=yes)])
4421 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4422   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4425 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4426 _SAVE_LDFLAGS=$LDFLAGS
4427 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4428 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4429                ac_cv_thread_keyword,
4430                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4431                             [return tlsIsMainThread;],
4432                             ac_cv_thread_keyword=yes,
4433                             ac_cv_thread_keyword=no)])
4434 LDFLAGS=$_SAVE_LDFLAGS
4435 if test "$ac_cv_thread_keyword" = yes; then
4436   # mips builds fail with TLS variables because of a binutils bug.
4437   # See bug 528687
4438   case "${target}" in
4439     mips*-*)
4440       :
4441       ;;
4442     *-android*)
4443       :
4444       ;;
4445     *)
4446       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4447       ;;
4448   esac
4451 dnl Check for the existence of various allocation headers/functions
4453 MALLOC_H=
4454 MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4455 if test "$MALLOC_H" = ""; then
4456   MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4457   if test "$MALLOC_H" = ""; then
4458     MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4459   fi
4461 if test "$MALLOC_H" != ""; then
4462    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4465 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4466 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4468 dnl See if compiler supports some gcc-style attributes
4470 AC_CACHE_CHECK(for __attribute__((always_inline)),
4471                ac_cv_attribute_always_inline,
4472                [AC_TRY_COMPILE([],
4473                                [inline void f(void) __attribute__((always_inline));],
4474                                ac_cv_attribute_always_inline=yes,
4475                                ac_cv_attribute_always_inline=no)])
4477 AC_CACHE_CHECK(for __attribute__((malloc)),
4478                ac_cv_attribute_malloc,
4479                [AC_TRY_COMPILE([],
4480                                [void* f(int) __attribute__((malloc));],
4481                                ac_cv_attribute_malloc=yes,
4482                                ac_cv_attribute_malloc=no)])
4484 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4485                ac_cv_attribute_warn_unused,
4486                [AC_TRY_COMPILE([],
4487                                [int f(void) __attribute__((warn_unused_result));],
4488                                ac_cv_attribute_warn_unused=yes,
4489                                ac_cv_attribute_warn_unused=no)])
4491 AC_CACHE_CHECK(for __attribute__((noreturn)),
4492                ac_cv_attribute_noreturn,
4493                [AC_TRY_COMPILE([],
4494                                [void f(void) __attribute__((noreturn));],
4495                                ac_cv_attribute_noreturn=yes,
4496                                ac_cv_attribute_noreturn=no)])
4498 dnl End of C++ language/feature checks
4499 AC_LANG_C
4501 dnl ========================================================
4502 dnl =  Internationalization checks
4503 dnl ========================================================
4505 dnl Internationalization and Locale support is different
4506 dnl on various UNIX platforms.  Checks for specific i18n
4507 dnl features go here.
4509 dnl check for LC_MESSAGES
4510 AC_CACHE_CHECK(for LC_MESSAGES,
4511                 ac_cv_i18n_lc_messages,
4512                 [AC_TRY_COMPILE([#include <locale.h>],
4513                                 [int category = LC_MESSAGES;],
4514                                 ac_cv_i18n_lc_messages=yes,
4515                                 ac_cv_i18n_lc_messages=no)])
4516 if test "$ac_cv_i18n_lc_messages" = yes; then
4517    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4520 AC_HAVE_FUNCS(localeconv)
4522 fi # SKIP_COMPILER_CHECKS
4524 TARGET_XPCOM_ABI=
4525 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4526     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4529 dnl Mozilla specific options
4530 dnl ========================================================
4531 dnl The macros used for command line options
4532 dnl are defined in build/autoconf/altoptions.m4.
4534 dnl If the compiler supports these attributes, define them as
4535 dnl convenience macros.
4536 if test "$ac_cv_attribute_always_inline" = yes ; then
4537   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4538 else
4539   AC_DEFINE(NS_ALWAYS_INLINE,)
4542 if test "$ac_cv_attribute_malloc" = yes ; then
4543   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4544 else
4545   AC_DEFINE(NS_ATTR_MALLOC,)
4548 if test "$ac_cv_attribute_warn_unused" = yes ; then
4549   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4550 else
4551   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4554 if test "$ac_cv_attribute_noreturn" = yes ; then
4555   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4556 else
4557   AC_DEFINE(NS_NORETURN,)
4560 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4561 dnl features that Windows actually does support.
4563 if test -n "$SKIP_COMPILER_CHECKS"; then
4564    dnl Windows has malloc.h
4565    AC_DEFINE(MALLOC_H, [<malloc.h>])
4566    AC_DEFINE(HAVE_FORCEINLINE)
4567    AC_DEFINE(HAVE_LOCALECONV)
4568 fi # SKIP_COMPILER_CHECKS
4570 dnl ========================================================
4571 dnl =
4572 dnl = Check for external package dependencies
4573 dnl =
4574 dnl ========================================================
4575 MOZ_ARG_HEADER(External Packages)
4577 MOZ_ENABLE_LIBXUL=1
4579 MOZ_ARG_WITH_STRING(libxul-sdk,
4580 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4581   LIBXUL_SDK_DIR=$withval)
4583 if test "$LIBXUL_SDK_DIR" = "yes"; then
4584     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4585 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4586     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4588     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4589         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4590     fi
4592     MOZ_ENABLE_LIBXUL=1
4594 AC_SUBST(LIBXUL_SDK)
4596 if test -n "$LIBXUL_SDK"; then
4597     LIBXUL_DIST="$LIBXUL_SDK"
4598 else
4599     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4601 AC_SUBST(LIBXUL_DIST)
4603 SYSTEM_LIBXUL=
4605 MOZ_ARG_WITH_BOOL(system-libxul,
4606 [  --with-system-libxul    Use system installed libxul SDK],
4607     SYSTEM_LIBXUL=1)
4609 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4610     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4613 dnl ========================================================
4614 dnl = If NSPR was not detected in the system, 
4615 dnl = use the one in the source tree (mozilla/nsprpub)
4616 dnl ========================================================
4617 MOZ_ARG_WITH_BOOL(system-nspr,
4618 [  --with-system-nspr      Use system installed NSPR],
4619     _USE_SYSTEM_NSPR=1 )
4621 if test -n "$_USE_SYSTEM_NSPR"; then
4622     AM_PATH_NSPR(4.8.7, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
4625 if test -n "$MOZ_NATIVE_NSPR"; then
4626     _SAVE_CFLAGS=$CFLAGS
4627     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4628     AC_TRY_COMPILE([#include "prtypes.h"],
4629                 [#ifndef PR_STATIC_ASSERT
4630                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4631                  #endif],
4632                 [MOZ_NATIVE_NSPR=1],
4633                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4634     CFLAGS=$_SAVE_CFLAGS
4635 else
4636     if test "$OS_ARCH" = "WINCE"; then
4637         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4638         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4639     elif test "$OS_ARCH" = "WINNT"; then
4640         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4641         if test -n "$GNU_CC"; then
4642             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4643         else
4644             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4645         fi
4646     else
4647         NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4648         NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4649     fi
4652 dnl system libevent Support
4653 dnl ========================================================
4654 MOZ_ARG_WITH_STRING(system-libevent,
4655 [  --with-system-libevent=[PFX]
4656                           Use system libevent [installed at prefix PFX]],
4657     LIBEVENT_DIR=$withval)
4659 _SAVE_CFLAGS=$CFLAGS
4660 _SAVE_LDFLAGS=$LDFLAGS
4661 _SAVE_LIBS=$LIBS
4662 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4663     MOZ_NATIVE_LIBEVENT=
4664 else
4665     if test "${LIBEVENT_DIR}" = "yes"; then
4666         LIBEVENT_DIR=/usr
4667     fi
4668     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4669     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4670     MOZ_CHECK_HEADER(event.h,
4671         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4672              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4673          fi],
4674         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4675     AC_CHECK_LIB(event, event_init,
4676                  [MOZ_NATIVE_LIBEVENT=1
4677                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4678                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4679                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4681 CFLAGS=$_SAVE_CFLAGS
4682 LDFLAGS=$_SAVE_LDFLAGS
4683 LIBS=$_SAVE_LIBS
4685 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4686 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4687 AC_SUBST(MOZ_LIBEVENT_LIBS)
4689 dnl ========================================================
4690 dnl = If NSS was not detected in the system, 
4691 dnl = use the one in the source tree (mozilla/security/nss)
4692 dnl ========================================================
4694 MOZ_ARG_WITH_BOOL(system-nss,
4695 [  --with-system-nss       Use system installed NSS],
4696     _USE_SYSTEM_NSS=1 )
4698 if test -n "$_USE_SYSTEM_NSS"; then
4699     AM_PATH_NSS(3.12.9, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4702 if test -n "$MOZ_NATIVE_NSS"; then
4703    NSS_LIBS="$NSS_LIBS -lcrmf"
4704 else
4705    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4706    NSS_DEP_LIBS="\
4707         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4708         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4709         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4710         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4711         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4713    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4714        NSS_LIBS="\
4715         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4716         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4717         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4718         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4719         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4720    else
4721        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4722    fi
4725 dnl ======================
4726 dnl Detect yasm
4727 dnl ======================
4729 AC_MSG_CHECKING([for YASM assembler])
4730 AC_CHECK_PROGS(YASM, yasm, "")
4732 if test -n "$YASM"; then
4733   dnl Pull out yasm's version string
4734   changequote(,)
4735   _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
4736   changequote([,])
4738   YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4739   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4740   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4741   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4742   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4745 if test -z "$SKIP_LIBRARY_CHECKS"; then
4746 dnl system JPEG support
4747 dnl ========================================================
4748 MOZ_ARG_WITH_STRING(system-jpeg,
4749 [  --with-system-jpeg[=PFX]
4750                           Use system libjpeg [installed at prefix PFX]],
4751     JPEG_DIR=$withval)
4753 _SAVE_CFLAGS=$CFLAGS
4754 _SAVE_LDFLAGS=$LDFLAGS
4755 _SAVE_LIBS=$LIBS
4756 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4757     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4758     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4760 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4761     SYSTEM_JPEG=
4762 else
4763     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4766 if test "$SYSTEM_JPEG" = 1; then
4767     LIBS="$JPEG_LIBS $LIBS"
4768     AC_TRY_COMPILE([ #include <stdio.h>
4769                      #include <sys/types.h>
4770                      #include <jpeglib.h> ],
4771                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4772                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4773                      #endif ],
4774                    SYSTEM_JPEG=1,
4775                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4776 fi 
4777 CFLAGS=$_SAVE_CFLAGS
4778 LDFLAGS=$_SAVE_LDFLAGS
4779 LIBS=$_SAVE_LIBS
4781 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4782     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4783     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4786 dnl system ZLIB support
4787 dnl ========================================================
4788 MOZ_ARG_WITH_STRING(system-zlib,
4789 [  --with-system-zlib[=PFX]
4790                           Use system libz [installed at prefix PFX]],
4791     ZLIB_DIR=$withval)
4793 _SAVE_CFLAGS=$CFLAGS
4794 _SAVE_LDFLAGS=$LDFLAGS
4795 _SAVE_LIBS=$LIBS
4796 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4797     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4798     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4800 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4801     SYSTEM_ZLIB=
4802 else
4803     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4804         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4806 if test "$SYSTEM_ZLIB" = 1; then
4807     LIBS="$ZLIB_LIBS $LIBS"
4808     AC_TRY_COMPILE([ #include <stdio.h>
4809                      #include <string.h>
4810                      #include <zlib.h> ],
4811                    [ #if ZLIB_VERNUM < $MOZZLIB 
4812                      #error "Insufficient zlib version ($MOZZLIB required)."
4813                      #endif ],
4814                    SYSTEM_ZLIB=1,
4815                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4817 CFLAGS=$_SAVE_CFLAGS
4818 LDFLAGS=$_SAVE_LDFLAGS
4819 LIBS=$_SAVE_LIBS
4821 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4822     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4823     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4826 dnl system BZIP2 Support
4827 dnl ========================================================
4828 MOZ_ARG_WITH_STRING(system-bz2,
4829 [  --with-system-bz2[=PFX]
4830                           Use system libbz2 [installed at prefix PFX]],
4831     BZ2_DIR=$withval)
4833 _SAVE_CFLAGS=$CFLAGS
4834 _SAVE_LDFLAGS=$LDFLAGS
4835 _SAVE_LIBS=$LIBS
4836 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4837     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4838     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4840 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4841     SYSTEM_BZ2=
4842 else
4843     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4844         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4846 CFLAGS=$_SAVE_CFLAGS
4847 LDFLAGS=$_SAVE_LDFLAGS
4848 LIBS=$_SAVE_LIBS
4850 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4851     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4852     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4855 dnl system PNG Support
4856 dnl ========================================================
4857 MOZ_ARG_WITH_STRING(system-png, 
4858 [  --with-system-png[=PFX]
4859                           Use system libpng [installed at prefix PFX]],
4860     PNG_DIR=$withval)
4862 _SAVE_CFLAGS=$CFLAGS
4863 _SAVE_LDFLAGS=$LDFLAGS
4864 _SAVE_LIBS=$LIBS
4865 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4866 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4867 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4868     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4869     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4871 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4872     SYSTEM_PNG=
4873 else
4874     _SAVE_PNG_LIBS=$PNG_LIBS
4875     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4876                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4877                  $PNG_LIBS)
4878     AC_CHECK_LIB(png, png_get_acTL, ,
4879                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4880                  $_SAVE_PNG_LIBS)
4882 if test "$SYSTEM_PNG" = 1; then
4883     LIBS="$PNG_LIBS $LIBS"
4884     AC_TRY_COMPILE([ #include <stdio.h>
4885                      #include <sys/types.h>
4886                      #include <png.h> ],
4887                    [ #if PNG_LIBPNG_VER < $MOZPNG
4888                      #error "Insufficient libpng version ($MOZPNG required)."
4889                      #endif
4890                      #ifndef PNG_UINT_31_MAX
4891                      #error "Insufficient libpng version."
4892                      #endif ],
4893                    SYSTEM_PNG=1,
4894                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4896 CFLAGS=$_SAVE_CFLAGS
4897 LDFLAGS=$_SAVE_LDFLAGS
4898 LIBS=$_SAVE_LIBS
4900 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4901     PNG_CFLAGS="-I${PNG_DIR}/include"
4902     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4905 fi # SKIP_LIBRARY_CHECKS
4907 dnl system HunSpell Support
4908 dnl ========================================================
4909 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4910 [  --enable-system-hunspell
4911                           Use system hunspell (located with pkgconfig)],
4912     SYSTEM_HUNSPELL=1 )
4914 if test -n "$SYSTEM_HUNSPELL"; then
4915     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4918 AC_SUBST(SYSTEM_HUNSPELL)
4920 dnl ========================================================
4921 dnl Java SDK support
4922 dnl ========================================================
4923 JAVA_INCLUDE_PATH=
4924 MOZ_ARG_WITH_STRING(java-include-path,
4925 [  --with-java-include-path=dir
4926                           Location of Java SDK headers],
4927     JAVA_INCLUDE_PATH=$withval)
4929 JAVA_BIN_PATH=
4930 MOZ_ARG_WITH_STRING(java-bin-path,
4931 [  --with-java-bin-path=dir
4932                           Location of Java binaries (java, javac, jar)],
4933     JAVA_BIN_PATH=$withval)
4935 dnl ========================================================
4936 dnl =
4937 dnl = Application
4938 dnl =
4939 dnl ========================================================
4941 MOZ_ARG_HEADER(Application)
4943 BUILD_STATIC_LIBS=
4944 ENABLE_TESTS=1
4945 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4946 MOZ_BRANDING_DIRECTORY=
4947 MOZ_OFFICIAL_BRANDING=
4948 MOZ_FEEDS=1
4949 MOZ_INSTALLER=1
4950 MOZ_IPC=1
4951 MOZ_JAVAXPCOM=
4952 MOZ_JSDEBUGGER=1
4953 MOZ_MATHML=1
4954 MOZ_MORK=
4955 MOZ_MORKREADER=1
4956 MOZ_AUTH_EXTENSION=1
4957 MOZ_NO_ACTIVEX_SUPPORT=1
4958 MOZ_NO_FAST_LOAD=
4959 MOZ_OGG=1
4960 MOZ_RAW=
4961 MOZ_SYDNEYAUDIO=
4962 MOZ_VORBIS=
4963 MOZ_TREMOR=
4964 MOZ_WAVE=1
4965 MOZ_MEDIA=
4966 MOZ_WEBM=1
4967 VPX_AS=
4968 VPX_ASFLAGS=
4969 VPX_AS_DASH_C_FLAG=
4970 VPX_AS_CONVERSION=
4971 VPX_ASM_SUFFIX=
4972 VPX_X86_ASM=
4973 VPX_ARM_ASM=
4974 LIBJPEG_TURBO_AS=
4975 LIBJPEG_TURBO_ASFLAGS=
4976 LIBJPEG_TURBO_X86_ASM=
4977 LIBJPEG_TURBO_X64_ASM=
4978 MOZ_PANGO=1
4979 MOZ_PERMISSIONS=1
4980 MOZ_PLACES=1
4981 MOZ_PLUGINS=1
4982 MOZ_PREF_EXTENSIONS=1
4983 MOZ_PROFILELOCKING=1
4984 MOZ_PSM=1
4985 MOZ_RDF=1
4986 MOZ_REFLOW_PERF=
4987 MOZ_SAFE_BROWSING=
4988 MOZ_FASTSTART=
4989 MOZ_HELP_VIEWER=
4990 MOZ_SPELLCHECK=1
4991 MOZ_SPLASHSCREEN=
4992 MOZ_STORAGE=1
4993 MOZ_SVG=1
4994 MOZ_THUMB2=
4995 MOZ_TIMELINE=
4996 MOZ_TOOLKIT_SEARCH=1
4997 MOZ_UI_LOCALE=en-US
4998 MOZ_UNIVERSALCHARDET=1
4999 MOZ_URL_CLASSIFIER=
5000 MOZ_USE_NATIVE_UCONV=
5001 MOZ_XSLT_STANDALONE=
5002 MOZ_XTF=1
5003 MOZ_XUL=1
5004 MOZ_ZIPWRITER=1
5005 NS_PRINTING=1
5006 MOZ_PDF_PRINTING=
5007 MOZ_DISABLE_DOMCRYPTO=
5008 NSS_DISABLE_DBM=
5009 NECKO_WIFI=1
5010 NECKO_COOKIES=1
5011 NECKO_DISK_CACHE=1
5012 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource wyciwyg"
5013 USE_ARM_KUSER=
5014 BUILD_CTYPES=1
5015 XPC_IDISPATCH_SUPPORT=
5018 case "${target}" in
5019 *android*|*darwin*|*wince*|*winmo*)
5020     ACCESSIBILITY=
5021     ;;
5023     ACCESSIBILITY=1
5024     ;;
5025 esac
5027 case "$target_os" in
5028     mingw*)
5029         NS_ENABLE_TSF=1
5030         if test -z "$GNU_CC"; then 
5031             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
5032                 NS_ENABLE_TSF=
5033             fi
5034         fi
5035         if test -n "$NS_ENABLE_TSF"; then
5036             AC_DEFINE(NS_ENABLE_TSF)
5037         fi
5038         ;;
5039 esac
5041 case "${target}" in
5042     arm-android-eabi)
5043         NSS_DISABLE_DBM=1
5044         USE_ARM_KUSER=1
5045         MOZ_INSTALLER=
5046         NECKO_WIFI=
5047         MOZ_THUMB2=1
5048         MOZ_THEME_FASTSTRIPE=1
5049         MOZ_TREE_FREETYPE=1
5050         MOZ_MEMORY=1
5051         ;;
5052 esac
5054 MOZ_ARG_ENABLE_STRING(application,
5055 [  --enable-application=APP
5056                           Options include:
5057                             browser (Firefox)
5058                             xulrunner
5059                             content/xslt (Standalone Transformiix XSLT)
5060                             netwerk (Standalone Necko)
5061                             tools/update-packaging (AUS-related packaging tools)
5062                             standalone (use this for standalone
5063                               xpcom/xpconnect or to manually drive a build)],
5064 [ MOZ_BUILD_APP=$enableval ] )
5066 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5067 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
5068   XULRUNNER_STUB_NAME=$withval)
5070 if test -z "$XULRUNNER_STUB_NAME"; then
5071   case "$target_os" in
5072   darwin*)
5073     XULRUNNER_STUB_NAME=xulrunner
5074     ;;
5075   *)
5076     XULRUNNER_STUB_NAME=xulrunner-stub
5077   esac
5079 AC_SUBST(XULRUNNER_STUB_NAME)
5081 AC_MSG_CHECKING([for application to build])
5082 if test -z "$MOZ_BUILD_APP"; then
5083   AC_MSG_RESULT([browser])
5084   MOZ_BUILD_APP=browser
5085 else
5086   # We have a valid application only if it has a build.mk file in its top
5087   # directory.
5088   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5089     AC_MSG_RESULT([none])
5090     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5091   else
5092     AC_MSG_RESULT([$MOZ_BUILD_APP])
5093   fi
5096 # Allow the application to influence configure with a confvars.sh script.
5098 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5099 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5100   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5101   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5102 else
5103   AC_MSG_RESULT([no])
5106 # Now is a good time to test for logic errors, define mismatches, etc.
5107 case "$MOZ_BUILD_APP" in
5108 xulrunner)
5109   if test "$LIBXUL_SDK"; then
5110     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5111   fi
5112   ;;
5113 esac
5115 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5116 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5117 # MOZ_BUILD_APP.
5118 case "$MOZ_BUILD_APP" in
5119 browser)
5120   AC_DEFINE(MOZ_PHOENIX)
5121   ;;
5123 xulrunner)
5124   AC_DEFINE(MOZ_XULRUNNER)
5125   ;;
5127 content/xslt)
5128   AC_DEFINE(TX_EXE)
5129   ;;
5131 standalone) 
5132   MOZ_APP_NAME=mozilla
5133   MOZ_APP_DISPLAYNAME=Mozilla
5134   MOZ_APP_VERSION=$MOZILLA_VERSION
5135   ;;
5137 esac
5139 AC_SUBST(MOZ_BUILD_APP)
5140 AC_SUBST(MOZ_PHOENIX)
5141 AC_SUBST(MOZ_XULRUNNER)
5143 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5145 dnl ========================================================
5146 dnl = 
5147 dnl = Toolkit Options
5148 dnl = 
5149 dnl ========================================================
5150 MOZ_ARG_HEADER(Toolkit Options)
5152     dnl ========================================================
5153     dnl = Select the default toolkit
5154     dnl ========================================================
5155         MOZ_ARG_ENABLE_STRING(default-toolkit,
5156         [  --enable-default-toolkit=TK
5157                           Select default toolkit
5158                           Platform specific defaults:
5159                             Mac OS X - cairo-cocoa
5160                             Neutrino/QNX - photon
5161                             OS/2 - cairo-os2
5162                             Win32/WinCE - cairo-windows
5163                             Gtk2 with DirectFB - cairo-gtk2-dfb
5164                             * - cairo-gtk2
5165                             * - cairo-qt],
5166     [ _DEFAULT_TOOLKIT=$enableval ],
5167     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5169     if test "$_DEFAULT_TOOLKIT" = "photon" \
5170         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5171         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5172         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5173         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5174         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5175         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5176         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5177         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5178     then
5179         dnl nglayout only supports building with one toolkit,
5180         dnl so ignore everything after the first comma (",").
5181         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5182     else
5183         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5184     fi
5186 dnl ========================================================
5187 dnl = Enable the toolkit as needed                         =
5188 dnl ========================================================
5190 case "$MOZ_WIDGET_TOOLKIT" in
5191 photon)
5192         MOZ_ENABLE_PHOTON=1
5193         AC_DEFINE(MOZ_WIDGET_PHOTON)
5194     ;;
5196 cairo-windows)
5197     MOZ_WIDGET_TOOLKIT=windows
5198     MOZ_WEBGL=1
5199     case "${target}" in
5200     *-wince*)
5201         NS_PRINTING=
5202         ;;
5203     esac
5204     MOZ_PDF_PRINTING=1
5205     ;;
5207 cairo-gtk2|cairo-gtk2-x11)
5208     MOZ_WIDGET_TOOLKIT=gtk2
5209     MOZ_ENABLE_GTK2=1
5210     MOZ_ENABLE_XREMOTE=1
5211     MOZ_WEBGL=1
5212     MOZ_WEBGL_GLX=1
5214     AC_DEFINE(MOZ_X11)
5215     MOZ_X11=1
5216     USE_FC_FREETYPE=1
5218     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5219     TK_LIBS='$(MOZ_GTK2_LIBS)'
5220     AC_DEFINE(MOZ_WIDGET_GTK2)
5221     MOZ_PDF_PRINTING=1
5222     ;;
5224 cairo-gtk2-dfb)
5225     MOZ_WIDGET_TOOLKIT=gtk2
5226     MOZ_ENABLE_GTK2=1
5227     MOZ_WEBGL=
5229     AC_DEFINE(MOZ_DFB)
5230     MOZ_DFB=1
5232     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5233     TK_LIBS='$(MOZ_GTK2_LIBS)'
5234     AC_DEFINE(MOZ_WIDGET_GTK2)
5235     if test "$no_x" != "yes"; then
5236         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5237         no_x=yes
5238     fi
5239     MOZ_PDF_PRINTING=1
5240     ;;
5242 cairo-qt)
5243     MOZ_WIDGET_TOOLKIT=qt
5244     MOZ_ENABLE_QT=1
5245     MOZ_ENABLE_XREMOTE=1
5246     MOZ_WEBGL=1
5247     MOZ_WEBGL_GLX=1
5248     USE_ELF_DYNSTR_GC=
5250     AC_DEFINE(MOZ_X11)
5251     MOZ_X11=1
5252     USE_FC_FREETYPE=1
5254     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5255     TK_LIBS='$(MOZ_QT_LIBS)'
5256     AC_DEFINE(MOZ_WIDGET_QT)
5257     MOZ_PDF_PRINTING=1
5258     ;;
5260 cairo-os2)
5261     MOZ_WIDGET_TOOLKIT=os2
5262     USE_FC_FREETYPE=1
5263     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5264     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5265     MOZ_PDF_PRINTING=1
5266     ;;
5268 cairo-cocoa)
5269     MOZ_WIDGET_TOOLKIT=cocoa
5270     AC_DEFINE(MOZ_WIDGET_COCOA)
5271     MOZ_USER_DIR="Mozilla"
5272     AC_DEFINE(XP_MACOSX)
5273     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5274     TK_CFLAGS="-DNO_X11"
5275     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5276     CFLAGS="$CFLAGS $TK_CFLAGS"
5277     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5278     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5279     MOZ_FS_LAYOUT=bundle
5280     MOZ_WEBGL=1
5281     ;;
5283 cairo-android)
5284     AC_DEFINE(MOZ_WIDGET_ANDROID)
5285     MOZ_WIDGET_TOOLKIT=android
5286     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5287     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5288     MOZ_WEBGL=1
5289     MOZ_PDF_PRINTING=1
5290     ;;
5292 esac
5294 AC_SUBST(MOZ_PDF_PRINTING)
5295 if test "$MOZ_PDF_PRINTING"; then
5296    PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
5297    AC_DEFINE(MOZ_PDF_PRINTING)
5300 if test "$MOZ_ENABLE_XREMOTE"; then
5301     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5304 if test "$COMPILE_ENVIRONMENT"; then
5305   if test "$MOZ_ENABLE_GTK2"; then
5306     if test "$MOZ_X11"; then
5307       GDK_PACKAGES=gdk-x11-2.0
5308     elif test "$MOZ_DFB"; then
5309       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5310       GDK_PACKAGES=directfb
5311     fi
5313     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5314   fi
5316 fi # COMPILE_ENVIRONMENT
5318 AC_SUBST(MOZ_FS_LAYOUT)
5320 dnl ========================================================
5321 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5322 dnl their usage and use them in spidermonkey.
5323 dnl ========================================================
5324 MOZ_ARG_WITH_BOOL(arm-kuser,
5325 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5326     USE_ARM_KUSER=1,)
5327 if test -n "$USE_ARM_KUSER"; then
5328    AC_DEFINE(USE_ARM_KUSER)
5331 dnl ========================================================
5332 dnl = startup-notification support module
5333 dnl ========================================================
5335 if test "$MOZ_ENABLE_GTK2"
5336 then
5337     MOZ_ENABLE_STARTUP_NOTIFICATION=
5339     MOZ_ARG_ENABLE_BOOL(startup-notification,
5340     [  --enable-startup-notification
5341                           Enable startup-notification support (default: disabled) ],
5342         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5343         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5344     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5345     then
5346         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5347                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5348         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5349             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5350             then
5351                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5352             fi
5353             MOZ_ENABLE_STARTUP_NOTIFICATION=
5354         ])
5355     fi
5357     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5358         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5359     fi
5361     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5363 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5364 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5365 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5367 dnl ========================================================
5368 dnl = QT support
5369 dnl ========================================================
5370 if test "$MOZ_ENABLE_QT"
5371 then
5372     MOZ_ARG_WITH_STRING(qtdir,
5373     [  --with-qtdir=\$dir       Specify Qt directory ],
5374     [ QTDIR=$withval])
5376     if test -z "$QTDIR"; then
5377         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5378         AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5379     else
5380         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5382         MOZ_QT_CFLAGS="-DQT_SHARED"
5383         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5384         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5385         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5386         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5387         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5388         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5389         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5390         HOST_MOC="$QTDIR/bin/moc"
5391     fi
5392     if test -z "$HOST_MOC"; then
5393         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5394 incorrect])
5395     fi
5396     MOC=$HOST_MOC
5398     MOZ_ENABLE_QTNETWORK=
5399     PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5400                       MOZ_ENABLE_QTNETWORK=1,
5401                       MOZ_ENABLE_QTNETWORK=)
5403     if test "$MOZ_ENABLE_QTNETWORK"; then
5404       MOZ_ENABLE_QTNETWORK=1
5405       AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5406     fi
5408     MOZ_ENABLE_QTMOBILITY=
5409     PKG_CHECK_MODULES(_QTMOBILITY, QtSensors,
5410                       MOZ_ENABLE_QTMOBILITY=1,
5411                       MOZ_ENABLE_QTMOBILITY=)
5412     if test "$MOZ_ENABLE_QTMOBILITY"; then
5413        MOZ_ENABLE_QTMOBILITY=1
5414        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
5415        MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
5416     else
5417        AC_CHECK_LIB(QtSensors, main, [
5418           MOZ_ENABLE_QTMOBILITY=1
5419           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtMobility"
5420           MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtSensors"
5421           MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors"
5422        ])
5423     fi
5424     if test "$MOZ_ENABLE_QTMOBILITY"; then
5425        AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
5426     fi
5429 AC_SUBST(GTK_CONFIG)
5430 AC_SUBST(TK_CFLAGS)
5431 AC_SUBST(TK_LIBS)
5433 AC_SUBST(MOZ_ENABLE_GTK2)
5434 AC_SUBST(MOZ_ENABLE_PHOTON)
5435 AC_SUBST(MOZ_ENABLE_QT)
5436 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5437 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
5438 AC_SUBST(MOZ_ENABLE_XREMOTE)
5439 AC_SUBST(MOZ_GTK2_CFLAGS)
5440 AC_SUBST(MOZ_GTK2_LIBS)
5441 AC_SUBST(MOZ_QT_CFLAGS)
5442 AC_SUBST(MOZ_QT_LIBS)
5444 AC_SUBST(MOC)
5446 AC_SUBST(MOZ_DFB)
5447 AC_SUBST(MOZ_X11)
5449 dnl ========================================================
5450 dnl =
5451 dnl = Components & Features
5452 dnl = 
5453 dnl ========================================================
5454 MOZ_ARG_HEADER(Components and Features)
5456 dnl ========================================================
5457 dnl = Localization
5458 dnl ========================================================
5459 MOZ_ARG_ENABLE_STRING(ui-locale,
5460 [  --enable-ui-locale=ab-CD
5461                           Select the user interface locale (default: en-US)],
5462     MOZ_UI_LOCALE=$enableval )
5463 AC_SUBST(MOZ_UI_LOCALE)
5465 dnl ========================================================
5466 dnl = Trademarked Branding 
5467 dnl ========================================================
5468 MOZ_ARG_ENABLE_BOOL(official-branding,
5469 [  --enable-official-branding
5470                           Enable Official mozilla.org Branding
5471                           Do not distribute builds with
5472                           --enable-official-branding unless you have
5473                           permission to use trademarks per
5474                           http://www.mozilla.org/foundation/trademarks/ .],
5476   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5477     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5478   else
5479     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5480     MOZ_OFFICIAL_BRANDING=1
5481   fi
5482 ], MOZ_OFFICIAL_BRANDING=)
5484 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5485 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5486   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5489 MOZ_ARG_WITH_STRING(branding,
5490 [  --with-branding=dir     Use branding from the specified directory.],
5491     MOZ_BRANDING_DIRECTORY=$withval)
5493 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5494 if test -z "$REAL_BRANDING_DIRECTORY"; then
5495   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5498 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5499   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5502 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5504 dnl ========================================================
5505 dnl = Distribution ID
5506 dnl ========================================================
5507 MOZ_ARG_WITH_STRING(distribution-id,
5508 [  --with-distribution-id=ID
5509                           Set distribution-specific id (default=org.mozilla)],
5510 [ val=`echo $withval`
5511     MOZ_DISTRIBUTION_ID="$val"])
5513 if test -z "$MOZ_DISTRIBUTION_ID"; then
5514    MOZ_DISTRIBUTION_ID="org.mozilla"
5517 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5518 AC_SUBST(MOZ_DISTRIBUTION_ID)
5521 dnl ========================================================
5522 dnl complex text support off by default
5523 dnl ========================================================
5524 MOZ_ARG_DISABLE_BOOL(pango,
5525 [  --disable-pango         Disable usage of Pango ],
5526     MOZ_PANGO=,
5527     MOZ_PANGO=1)
5529 dnl ========================================================
5530 dnl = Pango
5531 dnl ========================================================
5532 if test "$MOZ_ENABLE_GTK2"
5533 then
5534     AC_SUBST(MOZ_PANGO)
5536     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5538     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5539     AC_SUBST(MOZ_PANGO_CFLAGS)
5540     AC_SUBST(MOZ_PANGO_LIBS)
5541     if test "$MOZ_PANGO"
5542     then
5543         AC_DEFINE(MOZ_PANGO)
5544     else
5545         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5546         AC_SUBST(FT2_CFLAGS)
5547         AC_SUBST(FT2_LIBS)
5548     fi
5551 if test "$MOZ_ENABLE_QT"
5552 then
5553     if test "$MOZ_PANGO"
5554     then
5555         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5556         [
5557             AC_SUBST(MOZ_PANGO_CFLAGS)
5558             AC_SUBST(MOZ_PANGO_LIBS)
5559             AC_DEFINE(MOZ_PANGO)
5560         ],
5561         [
5562             echo "Pango library not found, will use FT2 font engine"
5563             MOZ_PANGO=
5564         ])
5565     fi
5566     AC_SUBST(MOZ_PANGO)
5569 dnl ========================================================
5570 dnl = GnomeVFS, GIO and GConf support module
5571 dnl ========================================================
5573 if test "$MOZ_X11"
5574 then
5575     dnl build the gnomevfs extension by default only when the
5576     dnl GTK2 toolkit is in use.
5577     if test "$MOZ_ENABLE_GTK2"
5578     then
5579         MOZ_ENABLE_GNOMEVFS=1
5580         MOZ_ENABLE_GCONF=1
5581     fi
5583     dnl ========================================================
5584     dnl = GnomeVFS support module
5585     dnl ========================================================
5586     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5587     [  --disable-gnomevfs      Disable GnomeVFS support ],
5588         MOZ_ENABLE_GNOMEVFS=,
5589         MOZ_ENABLE_GNOMEVFS=force)
5591     if test "$MOZ_ENABLE_GNOMEVFS"
5592     then
5593         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5594             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5595             MOZ_ENABLE_GNOMEVFS=1
5596             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5597         ],[
5598             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5599             then
5600                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5601             fi
5602             MOZ_ENABLE_GNOMEVFS=
5603         ])
5604     else
5605         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5606             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5607               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5608             ])
5609         fi
5610     fi
5612     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5613     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5614     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5616     dnl ========================================================
5617     dnl = GIO support module
5618     dnl ========================================================
5619     MOZ_ARG_ENABLE_BOOL(gio,
5620     [  --enable-gio            Enable GIO support (default: disabled)],
5621         MOZ_ENABLE_GIO=force,
5622         MOZ_ENABLE_GIO=)
5624     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5625     then
5626         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5627             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5628             MOZ_ENABLE_GIO=1
5629             AC_DEFINE(MOZ_ENABLE_GIO)
5630         ],[
5631             if test "$MOZ_ENABLE_GIO" = "force"
5632             then
5633                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5634             fi
5635             MOZ_ENABLE_GIO=
5636         ])
5637     fi
5639     AC_SUBST(MOZ_ENABLE_GIO)
5640     AC_SUBST(MOZ_GIO_CFLAGS)
5641     AC_SUBST(MOZ_GIO_LIBS)
5642    
5643     dnl ========================================================
5644     dnl = GConf support module
5645     dnl ========================================================
5646     if test "$MOZ_ENABLE_GCONF"
5647     then
5648         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5649             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5650             MOZ_ENABLE_GCONF=1
5651         ],[
5652             if test "$MOZ_ENABLE_GCONF" = "force"
5653             then
5654                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5655             fi
5656             MOZ_ENABLE_GCONF=
5657         ])
5658     fi
5660     if test "$MOZ_ENABLE_GCONF"; then
5661         AC_DEFINE(MOZ_ENABLE_GCONF)
5662     fi
5664     AC_SUBST(MOZ_ENABLE_GCONF)
5665     AC_SUBST(MOZ_GCONF_CFLAGS)
5666     AC_SUBST(MOZ_GCONF_LIBS)
5669 dnl ========================================================
5670 dnl = libproxy support
5671 dnl ========================================================
5673 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5674 then
5675     MOZ_ENABLE_LIBPROXY=
5677     MOZ_ARG_ENABLE_BOOL(libproxy,
5678     [  --enable-libproxy         Enable libproxy support ],
5679     MOZ_ENABLE_LIBPROXY=1,
5680     MOZ_ENABLE_LIBPROXY=)
5682     if test "$MOZ_ENABLE_LIBPROXY"
5683     then
5684         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5685         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5686     fi
5688 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5689 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5690 AC_SUBST(MOZ_LIBPROXY_LIBS)
5692 dnl ========================================================
5693 dnl = libnotify support
5694 dnl ========================================================
5696 if test "$MOZ_ENABLE_GTK2"
5697 then
5698     MOZ_ENABLE_LIBNOTIFY=1
5700     MOZ_ARG_DISABLE_BOOL(libnotify,
5701     [  --disable-libnotify     Disable libnotify support ],
5702     MOZ_ENABLE_LIBNOTIFY=,
5703     MOZ_ENABLE_LIBNOTIFY=1)
5705     if test "$MOZ_ENABLE_LIBNOTIFY"
5706     then
5707         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5708     fi
5711 if test -z "$SKIP_LIBRARY_CHECKS"
5712 then
5713     if test "$MOZ_ENABLE_GTK2"
5714     then
5715         if test "$MOZ_ENABLE_LIBNOTIFY"
5716         then
5717             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5718         fi
5719     fi
5721 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5722 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5723 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5725 dnl ========================================================
5726 dnl = GNOME component (mozgnome)
5727 dnl ========================================================
5729 # The GNOME component is built if one of 
5730 # gnome-vfs, gio, gconf or libnotify is available.
5731 if test "$MOZ_ENABLE_GCONF" -o \
5732    "$MOZ_ENABLE_GNOMEVFS" -o \
5733    "$MOZ_ENABLE_GIO" -o \
5734    "$MOZ_ENABLE_LIBNOTIFY"; then
5735     MOZ_ENABLE_GNOME_COMPONENT=1
5736 else
5737     MOZ_ENABLE_GNOME_COMPONENT=
5739 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5741 dnl ========================================================
5742 dnl = libgnomeui support module
5743 dnl ========================================================
5745 if test "$MOZ_ENABLE_GTK2"
5746 then
5747     MOZ_ENABLE_GNOMEUI=1
5749     MOZ_ARG_DISABLE_BOOL(gnomeui,
5750     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5751         MOZ_ENABLE_GNOMEUI=,
5752         MOZ_ENABLE_GNOMEUI=force)
5754     if test "$MOZ_ENABLE_GNOMEUI"
5755     then
5756         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5757         [
5758             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5759             MOZ_ENABLE_GNOMEUI=1
5760         ],[
5761             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5762             then
5763                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5764             fi
5765             MOZ_ENABLE_GNOMEUI=
5766         ])
5767     fi
5769     if test "$MOZ_ENABLE_GNOMEUI"; then
5770         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5771     fi
5774 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5775 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5776 AC_SUBST(MOZ_GNOMEUI_LIBS)
5778 dnl ========================================================
5779 dnl = dbus support
5780 dnl ========================================================
5782 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5783 then
5784     MOZ_ENABLE_DBUS=1
5786     MOZ_ARG_DISABLE_BOOL(dbus,
5787     [  --disable-dbus          Disable dbus support ],
5788         MOZ_ENABLE_DBUS=,
5789         MOZ_ENABLE_DBUS=1)
5791     if test "$MOZ_ENABLE_DBUS"
5792     then
5793         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5794         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5795         AC_DEFINE(MOZ_ENABLE_DBUS)
5796     fi
5798 AC_SUBST(MOZ_ENABLE_DBUS)
5799 AC_SUBST(MOZ_DBUS_CFLAGS)
5800 AC_SUBST(MOZ_DBUS_LIBS)
5801 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5802 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5804 dnl ========================================================
5805 dnl = Build Personal Security Manager
5806 dnl ========================================================
5807 MOZ_ARG_DISABLE_BOOL(crypto,
5808 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5809     MOZ_PSM=,
5810     MOZ_PSM=1 )
5812 dnl ========================================================
5813 dnl = JS Debugger XPCOM component (js/jsd)
5814 dnl ========================================================
5815 MOZ_ARG_DISABLE_BOOL(jsd,
5816 [  --disable-jsd           Disable JavaScript debug library],
5817     MOZ_JSDEBUGGER=,
5818     MOZ_JSDEBUGGER=1)
5821 dnl ========================================================
5822 dnl = Disable IPC support for tabs and plugins
5823 dnl ========================================================
5824 MOZ_ARG_DISABLE_BOOL(ipc,
5825 [  --disable-ipc           Disable IPC for tabs and plugins (not supported)],
5826     MOZ_IPC=,
5827     MOZ_IPC=1)
5829 if test -z "$MOZ_IPC"; then
5830   AC_MSG_ERROR([--disable-ipc is no longer supported.])
5833 AC_DEFINE(MOZ_IPC)
5834 AC_SUBST(MOZ_IPC)
5836 dnl ========================================================
5837 dnl = Enable IPDL's "expensive" unit tests
5838 dnl ========================================================
5839 MOZ_IPDL_TESTS=
5841 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5842 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5843     MOZ_IPDL_TESTS=1,
5844     MOZ_IPDL_TESTS=)
5846 if test -n "$MOZ_IPDL_TESTS"; then
5847     AC_DEFINE(MOZ_IPDL_TESTS)
5850 AC_SUBST(MOZ_IPDL_TESTS)
5852 dnl ========================================================
5853 dnl = Disable plugin support
5854 dnl ========================================================
5855 MOZ_ARG_DISABLE_BOOL(plugins,
5856 [  --disable-plugins       Disable plugins support],
5857     MOZ_PLUGINS=,
5858     MOZ_PLUGINS=1)
5860 dnl ========================================================
5861 dnl = Disable building dbm
5862 dnl ========================================================
5863 MOZ_ARG_DISABLE_BOOL(dbm,
5864 [  --disable-dbm           Disable building dbm],
5865     NSS_DISABLE_DBM=1,
5866     NSS_DISABLE_DBM=)
5868 dnl bi-directional support always on
5869 IBMBIDI=1
5870 AC_DEFINE(IBMBIDI)
5872 dnl ========================================================
5873 dnl accessibility support on by default on all platforms 
5874 dnl except OS X.
5875 dnl ========================================================
5876 MOZ_ARG_DISABLE_BOOL(accessibility,
5877 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5878     ACCESSIBILITY=,
5879     ACCESSIBILITY=1 )
5880 if test "$ACCESSIBILITY"; then
5881     AC_DEFINE(ACCESSIBILITY)
5884 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5885 case "$target" in
5886 *-mingw*)
5887     if test "$ac_cv_header_atlbase_h" = "no"; then
5888         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.])
5889     fi
5890     if test "$ac_cv_header_oleacc_idl" = "no"; then
5891         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.])
5892     fi
5893     ;;
5894 esac
5897 dnl ========================================================
5898 dnl Disable printing
5899 dnl ========================================================
5900 MOZ_ARG_DISABLE_BOOL(printing,
5901 [  --disable-printing      Disable printing support],
5902     NS_PRINTING=,
5903     NS_PRINTING=1)
5905 if test "$NS_PRINTING"; then
5906     AC_DEFINE(NS_PRINTING)
5907     AC_DEFINE(NS_PRINT_PREVIEW)
5909 dnl ========================================================
5910 dnl use native unicode converters
5911 dnl ========================================================
5912 MOZ_ARG_ENABLE_BOOL(native-uconv,
5913 [  --enable-native-uconv   Enable iconv support],
5914     MOZ_USE_NATIVE_UCONV=1,
5915     MOZ_USE_NATIVE_UCONV= )
5916 if test "$MOZ_USE_NATIVE_UCONV"; then
5917     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5919 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5920     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5924 dnl ========================================================
5925 dnl = Disable Fast Load
5926 dnl ========================================================
5927 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5928 [  --disable-xpcom-fastload
5929                           Disable XPCOM fastload support],
5930     MOZ_NO_FAST_LOAD=1,
5931     MOZ_NO_FAST_LOAD=)
5933 AC_SUBST(MOZ_NO_FAST_LOAD)
5935 if test -n "$MOZ_NO_FAST_LOAD"; then
5936     AC_DEFINE(MOZ_NO_FAST_LOAD)
5939 dnl ========================================================
5940 dnl = Enable Raw Codecs
5941 dnl ========================================================
5942 MOZ_ARG_ENABLE_BOOL(raw,
5943 [  --enable-raw           Enable support for RAW media],
5944     MOZ_RAW=1,
5945     MOZ_RAW=)
5947 if test -n "$MOZ_RAW"; then
5948     AC_DEFINE(MOZ_RAW)
5949     MOZ_MEDIA=1
5952 AC_SUBST(MOZ_RAW)
5954 dnl ========================================================
5955 dnl = Disable Ogg Codecs
5956 dnl ========================================================
5957 MOZ_ARG_DISABLE_BOOL(ogg,
5958 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5959     MOZ_OGG=,
5960     MOZ_OGG=1)
5962 if test -n "$MOZ_OGG"; then
5963     AC_DEFINE(MOZ_OGG)
5964     MOZ_SYDNEYAUDIO=1
5965     MOZ_MEDIA=1
5966     case "$target_cpu" in
5967     arm*)
5968         MOZ_TREMOR=1
5969     ;;
5970     *)
5971         MOZ_VORBIS=1
5972     ;;
5973     esac
5975     dnl Checks for __attribute__(aligned()) directive
5976     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5977         [ac_cv_c_attribute_aligned],
5978         [ac_cv_c_attribute_aligned=0
5979          CFLAGS_save="${CFLAGS}"
5980          CFLAGS="${CFLAGS} -Werror"
5981          for ac_cv_c_attr_align_try in 64 32 16 8; do
5982            echo "trying $ac_cv_c_attr_align_try"
5983            AC_TRY_COMPILE([],
5984                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5985                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5986            if test "$ac_cv_c_attribute_aligned" != 0; then
5987              break;
5988            fi
5989          done
5990            CFLAGS="${CFLAGS_save}"])
5991     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5992       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5993                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5994     fi
5997 dnl ========================================================
5998 dnl = Disable VP8 decoder support
5999 dnl ========================================================
6000 MOZ_ARG_DISABLE_BOOL(webm,
6001 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
6002     MOZ_WEBM=,
6003     MOZ_WEBM=1)
6005 dnl system libvpx Support
6006 dnl ========================================================
6007 MOZ_ARG_WITH_STRING(system-libvpx,
6008 [  --with-system-libvpx=[PFX]
6009                           Use system libvpx [installed at prefix PFX]],
6010     LIBVPX_DIR=$withval)
6012 MOZ_NATIVE_LIBVPX=
6013 MOZ_LIBVPX_INCLUDES=
6014 MOZ_LIBVPX_LIBS=
6016 if test -n "$MOZ_WEBM"; then
6017     AC_DEFINE(MOZ_WEBM)
6019     if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
6020         _SAVE_CFLAGS=$CFLAGS
6021         _SAVE_LDFLAGS=$LDFLAGS
6022         _SAVE_LIBS=$LIBS
6023         if test "${LIBVPX_DIR}" = "yes"; then
6024             LIBVPX_DIR=/usr
6025         fi
6026         CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
6027         LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
6028         MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
6029             [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
6030              AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
6031             fi],
6032             AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
6033         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
6034                      [MOZ_NATIVE_LIBVPX=1
6035                       MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
6036                       MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
6037                      ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
6038         CFLAGS=$_SAVE_CFLAGS
6039         LDFLAGS=$_SAVE_LDFLAGS
6040         LIBS=$_SAVE_LIBS
6041     fi
6044 AC_SUBST(MOZ_NATIVE_LIBVPX)
6045 AC_SUBST(MOZ_LIBVPX_INCLUDES)
6046 AC_SUBST(MOZ_LIBVPX_LIBS)
6048 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
6049     MOZ_SYDNEYAUDIO=1
6050     MOZ_MEDIA=1
6051     case "$target_cpu" in
6052     arm*)
6053         MOZ_TREMOR=1
6054     ;;
6055     *)
6056         MOZ_VORBIS=1
6057     ;;
6058     esac
6061     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
6062     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
6063     dnl We currently require gcc on all arm platforms.
6064     VPX_AS=$YASM
6065     VPX_ASM_SUFFIX=asm
6067     dnl See if we have assembly on this platform.  
6068     case "$OS_ARCH:$CPU_ARCH" in
6069     Linux:x86)
6070       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6071       VPX_X86_ASM=1
6072     ;;
6073     Linux:x86_64)
6074       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6075       VPX_X86_ASM=1
6076     ;;
6077     SunOS:x86)
6078       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6079       VPX_X86_ASM=1
6080     ;;
6081     SunOS:x86_64)
6082       VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6083       VPX_X86_ASM=1
6084     ;;
6085     Darwin:x86)
6086       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
6087       VPX_X86_ASM=1
6088     ;;
6089     Darwin:x86_64)
6090       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
6091       VPX_X86_ASM=1
6092     ;;
6093     WINNT:x86_64)
6094       if test -z "$GNU_CC"; then
6095         VPX_ASFLAGS="-f x64 -rnasm -pnasm"
6096         VPX_X86_ASM=1
6097       fi
6098     ;;
6099     WINNT:x86)
6100       if test -z "$GNU_CC"; then
6101         dnl Check for yasm 1.1 or greater.
6102         if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
6103           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.])
6104         elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6105           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.])
6106         else
6107           VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
6108           VPX_X86_ASM=1
6109         fi
6110       fi
6111     ;;
6112     *:arm*)
6113       if test -n "$GNU_AS" ; then
6114         VPX_AS=$AS
6115         dnl These flags are a lie; they're just used to enable the requisite
6116         dnl opcodes; actual arch detection is done at runtime.
6117         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
6118         VPX_DASH_C_FLAG="-c"
6119         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
6120         VPX_ASM_SUFFIX="$ASM_SUFFIX"
6121         VPX_ARM_ASM=1
6122       fi
6123     esac
6125     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
6126       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.])
6127     fi
6129     if test -n "$VPX_X86_ASM"; then
6130       AC_DEFINE(VPX_X86_ASM)
6131     elif test -n "$VPX_ARM_ASM"; then
6132       AC_DEFINE(VPX_ARM_ASM)
6133     else
6134       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
6135     fi
6138 dnl ========================================================
6139 dnl = Disable Wave decoder support
6140 dnl ========================================================
6141 MOZ_ARG_DISABLE_BOOL(wave,
6142 [  --disable-wave          Disable Wave decoder support],
6143     MOZ_WAVE=,
6144     MOZ_WAVE=1)
6146 if test -n "$MOZ_WAVE"; then
6147     AC_DEFINE(MOZ_WAVE)
6148     MOZ_SYDNEYAUDIO=1
6149     MOZ_MEDIA=1
6152 dnl ========================================================
6153 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
6154 dnl ========================================================
6156 if test -n "$MOZ_SYDNEYAUDIO"; then
6157     AC_DEFINE(MOZ_SYDNEYAUDIO)
6160 if test -n "$MOZ_MEDIA"; then
6161     AC_DEFINE(MOZ_MEDIA)
6164 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
6165     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/])
6168 if test -n "$MOZ_VORBIS"; then
6169     AC_DEFINE(MOZ_VORBIS)
6172 if test -n "$MOZ_TREMOR"; then
6173     AC_DEFINE(MOZ_TREMOR)
6176 dnl ========================================================
6177 dnl = Check alsa availability on Linux if using sydneyaudio
6178 dnl ========================================================
6180 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6181 if test -n "$MOZ_SYDNEYAUDIO"; then
6182    case "$target_os" in
6183 linux*)
6184       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6185          [echo "$MOZ_ALSA_PKG_ERRORS"
6186           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.)])])
6187       ;;
6188    esac
6191 dnl ========================================================
6192 dnl Splashscreen
6193 dnl ========================================================
6194 AC_ARG_ENABLE(splashscreen,
6195               [  --enable-splashscreen   display splashscreen while loading (default=no)],
6196               [enable_splash="yes"],[enable_splash=""])
6197 if test "x$enable_splash" = "xyes"; then
6198   MOZ_SPLASHSCREEN=1
6199   AC_DEFINE(MOZ_SPLASHSCREEN)
6201 AC_SUBST(MOZ_SPLASHSCREEN)
6203 dnl ========================================================
6204 dnl Permissions System
6205 dnl ========================================================
6206 MOZ_ARG_DISABLE_BOOL(permissions,
6207 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6208     MOZ_PERMISSIONS=,
6209     MOZ_PERMISSIONS=1
6212 dnl ========================================================
6213 dnl NegotiateAuth
6214 dnl ========================================================
6215 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6216 [  --disable-negotiateauth Disable GSS-API negotiation ],
6217     MOZ_AUTH_EXTENSION=,
6218     MOZ_AUTH_EXTENSION=1 )
6220 dnl ========================================================
6221 dnl XTF
6222 dnl ========================================================
6223 MOZ_ARG_DISABLE_BOOL(xtf,
6224 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6225     MOZ_XTF=,
6226     MOZ_XTF=1 )
6227 if test "$MOZ_XTF"; then
6228   AC_DEFINE(MOZ_XTF)
6231 dnl ========================================================
6232 dnl Pref extensions (autoconfig and system-pref)
6233 dnl ========================================================
6234 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6235 [  --disable-pref-extensions
6236                           Disable pref extensions such as autoconfig and
6237                           system-pref],
6238   MOZ_PREF_EXTENSIONS=,
6239   MOZ_PREF_EXTENSIONS=1 )
6241 dnl ========================================================
6242 dnl = Universalchardet
6243 dnl ========================================================
6244 MOZ_ARG_DISABLE_BOOL(universalchardet,
6245 [  --disable-universalchardet
6246                           Disable universal encoding detection],
6247   MOZ_UNIVERSALCHARDET=,
6248   MOZ_UNIVERSALCHARDET=1 )
6250 dnl ========================================================
6251 dnl JavaXPCOM
6252 dnl ========================================================
6253 case "${target}" in
6254 *-wince*)
6255     MOZ_JAVAXPCOM=
6256     ;;
6257 esac
6259 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6260 [  --enable-javaxpcom
6261                           Enable Java-XPCOM bridge],
6262     MOZ_JAVAXPCOM=1,
6263     MOZ_JAVAXPCOM=)
6265 case "$host_os" in
6266   *mingw*)
6267     if test -n "$JAVA_HOME"; then
6268       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6269     fi
6270     ;;
6271 esac
6273 if test -n "${JAVA_BIN_PATH}"; then
6274   dnl Look for javac and jar in the specified path.
6275   JAVA_PATH="$JAVA_BIN_PATH"
6276 else
6277   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6278   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6281 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6282 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6283 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6285 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6286   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6287     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}])
6288   fi
6291 if test -n "${MOZ_JAVAXPCOM}"; then
6292   if test -n "${JAVA_INCLUDE_PATH}"; then
6293     dnl Make sure jni.h exists in the given include path.
6294     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6295       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6296     fi
6297   else
6298     case "$target_os" in
6299       darwin*)
6300         dnl Default to java system location
6301         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6302         ;;
6303       *)
6304         dnl Try $JAVA_HOME
6305         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6306         ;;
6307     esac
6308     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6309       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.])
6310     fi
6311   fi
6314 dnl ========================================================
6315 dnl = ANGLE OpenGL->D3D translator for WebGL
6316 dnl = * only applies to win32
6317 dnl = * enabled by default (shipping build); requires explicit --disable to disable
6318 dnl ========================================================
6319 MOZ_ANGLE=
6320 MOZ_DIRECTX_SDK_PATH=
6321 MOZ_DIRECTX_SDK_CPU_SUFFIX=
6322 MOZ_D3DX9_VERSION=
6323 MOZ_D3DX9_CAB=
6324 MOZ_D3DCOMPILER_CAB=
6325 MOZ_D3DX9_DLL=
6326 MOZ_D3DCOMPILER_DLL=
6327 case "$target_os" in
6328 *mingw*)
6329     MOZ_ANGLE=1
6330     ;;
6331 esac
6333 # The DirectX SDK libraries are split into x86 and x64 sub-directories
6334 case "${target_cpu}" in
6335 i*86)
6336   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
6337   ;;
6338 x86_64)
6339   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
6340   # currently we disable ANGLE in 64bit builds
6341   MOZ_ANGLE=
6342   ;;
6343 esac
6345 if test -n "$MOZ_ANGLE"; then
6346 MOZ_ARG_DISABLE_BOOL(angle,
6347 [  --disable-angle     Disable building of ANGLE for WebGL->D3D translation],
6348     MOZ_ANGLE=,
6349     MOZ_ANGLE=1)
6351 if test -n "$MOZ_ANGLE"; then
6352   if test -z "$_WIN32_MSVC"; then
6353     AC_MSG_ERROR([Building ANGLE requires MSVC.  To build without ANGLE, reconfigure with --disable-angle.])
6354   fi
6356   # Get the SDK path from the registry.
6357   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
6358   MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's,  *, ,g' | cut -d' ' -f4-`
6360   MOZ_ANGLE=
6362   if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6363     if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
6364       AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
6365       MOZ_ANGLE=1
6366     fi
6367   fi
6369   if test -z "$MOZ_ANGLE" ; then
6370     AC_MSG_WARN([Couldn't find the DirectX SDK, needed for ANGLE. Please install it (February 2010 or newer). To explicitly build without ANGLE, reconfigure with --disable-angle.])
6371     AC_MSG_WARN([This will become an error in the future.])
6372   fi
6374   if test -n "$MOZ_ANGLE" ; then
6375     # Get the SDK numeric version (e.g. 42 or 43) by looking at the dependencies of d3dx9.lib
6376     MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
6378     if test -z "$MOZ_D3DX9_VERSION" ; then
6379       MOZ_ANGLE=
6380       AC_MSG_WARN([Couldn't determine the D3DX9 version! Disabling ANGLE.])
6381       AC_MSG_WARN([This will become an error in the future.])
6382     fi
6384     if test -n "$MOZ_ANGLE" ; then
6385       MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6386       MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6388       MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
6389       MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
6390     fi
6391   fi
6395 dnl ========================================================
6396 dnl = Breakpad crash reporting (on by default on supported platforms)
6397 dnl ========================================================
6399 case $target in
6400 i?86-*-mingw*|x86_64-*-mingw*)
6401   MOZ_CRASHREPORTER=1
6402   ;;
6403 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6404   MOZ_CRASHREPORTER=1
6405   ;;
6406 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6407   if test "$MOZ_ENABLE_GTK2"; then
6408     MOZ_CRASHREPORTER=1
6409   fi
6410   ;;
6411 arm-android-eabi)
6412   MOZ_CRASHREPORTER=1
6413   ;;
6414 *solaris*)
6415   MOZ_CRASHREPORTER=1
6416   ;;
6417 esac
6419 MOZ_ARG_DISABLE_BOOL(crashreporter,
6420 [  --disable-crashreporter Disable breakpad crash reporting],
6421     MOZ_CRASHREPORTER=,
6422     MOZ_CRASHREPORTER=1)
6424 if test -n "$MOZ_CRASHREPORTER"; then
6425    AC_DEFINE(MOZ_CRASHREPORTER)
6427   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6428     test -z "$SKIP_LIBRARY_CHECKS"; then
6429     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6430     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6431     AC_SUBST(MOZ_GTHREAD_LIBS)
6433     MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
6434   fi
6437 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6438 [  --with-crashreporter-enable-percent=NN
6439                           Enable sending crash reports by default on NN% of users. (default=100)],
6440 [ val=`echo $withval | sed 's/[^0-9]//g'`
6441     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6443 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6444    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6446 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6448 dnl ========================================================
6449 dnl = libjpeg-turbo configuration
6450 dnl ========================================================
6452 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6453 dnl files.
6454 AC_MSG_CHECKING([for YASM assembler])
6455 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6457 dnl XXX jlebar -- need a yasm version check here.
6459 if test -n "LIBJPEG_TURBO_AS"; then
6461   LIBJPEG_TURBO_AS="yasm"
6463   dnl We have YASM; see if we support it on this platform.
6464   case "$OS_ARCH:$OS_TEST" in
6465   Linux:x86|Linux:i?86)
6466     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6467     LIBJPEG_TURBO_X86_ASM=1
6468   ;;
6469   Linux:x86_64)
6470     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6471     LIBJPEG_TURBO_X64_ASM=1
6472   ;;
6473   SunOS:i?86)
6474     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6475     LIBJPEG_TURBO_X86_ASM=1
6476   ;;
6477   SunOS:x86_64)
6478     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6479     LIBJPEG_TURBO_X64_ASM=1
6480   ;;
6481   Darwin:i?86)
6482     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6483     LIBJPEG_TURBO_X86_ASM=1
6484   ;;
6485   Darwin:x86_64)
6486     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6487     LIBJPEG_TURBO_X64_ASM=1
6488   ;;
6489   WINNT:x86|WINNT:i?86)
6490     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6491     LIBJPEG_TURBO_X86_ASM=1
6492   ;;
6493   WINNT:x86_64)
6494     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64"
6495     LIBJPEG_TURBO_X64_ASM=1
6496   ;;
6497   esac
6499 fi # end have YASM
6501 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6502   AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6503 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6504   AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6505 else
6506   AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
6509 dnl ========================================================
6510 dnl = Enable compilation of specific extension modules
6511 dnl ========================================================
6513 MOZ_ARG_ENABLE_STRING(extensions,
6514 [  --enable-extensions     Enable extensions],
6515 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6516     if test "$option" = "yes" -o "$option" = "all"; then
6517         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6518     elif test "$option" = "no" -o "$option" = "none"; then
6519         MOZ_EXTENSIONS=""
6520     elif test "$option" = "default"; then
6521         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6522     elif test `echo "$option" | grep -c \^-` != 0; then
6523         option=`echo $option | sed 's/^-//'`
6524         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6525     else
6526         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6527     fi
6528 done],
6529     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6531 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6532     # Suppress warning on non-X11 platforms
6533     if test -n "$MOZ_X11"; then
6534         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6535     fi
6536     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6539 dnl Do not build gnomevfs with libxul based apps
6540 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6541     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6544 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6545     # Suppress warning on non-X11 platforms
6546     if test -n "$MOZ_X11"; then
6547         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6548     fi
6549     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6552 dnl Do not build gio with libxul based apps
6553 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6554     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6557 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6558     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6559     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6562 dnl This might be temporary: build tridentprofile only on Windows
6563 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6564     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6565     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6568 dnl cookie must be built before tridentprofile. put it at list's end.
6569 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6570   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6571   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6574 dnl xforms requires xtf
6575 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6576     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6577     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6580 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6581     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6582     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6585 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6586     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6587     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6590 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6591     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6592     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6595 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6596     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6597     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6600 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6601     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6602     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6605 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6606     AC_MSG_WARN([spellcheck is no longer an extension.])
6607     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6610 dnl Remove dupes
6611 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6613 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6614 dnl when trying to build a nonexistent extension.
6615 for extension in $MOZ_EXTENSIONS; do
6616     if test ! -d "${srcdir}/extensions/${extension}"; then
6617         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6618     fi
6619 done
6621 dnl ========================================================
6622 dnl MathML on by default
6623 dnl ========================================================
6624 MOZ_ARG_DISABLE_BOOL(mathml,
6625 [  --disable-mathml        Disable MathML support],
6626     MOZ_MATHML=,
6627     MOZ_MATHML=1 )
6628 if test "$MOZ_MATHML"; then
6629   AC_DEFINE(MOZ_MATHML)
6632 dnl ========================================================
6633 dnl Keeping AC_DEFINE(MOZ_SVG) for the moment in case of something needs it.
6634 dnl ========================================================
6635 AC_DEFINE(MOZ_SVG)
6637 dnl ========================================================
6638 dnl SMIL
6639 dnl ========================================================
6640 MOZ_SMIL=1
6641 MOZ_ARG_DISABLE_BOOL(smil,
6642 [  --disable-smil          Disable SMIL animation support],
6643     MOZ_SMIL=,
6644     MOZ_SMIL=1 )
6645 if test -n "$MOZ_SMIL"; then
6646   AC_DEFINE(MOZ_SMIL)
6649 dnl ========================================================
6650 dnl Build Freetype in the tree
6651 dnl ========================================================
6652 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6653 [  --enable-tree-freetype  Enable Tree FreeType],
6654     MOZ_TREE_FREETYPE=1,
6655     MOZ_TREE_FREETYPE= )
6656 if test -n "$MOZ_TREE_FREETYPE"; then
6657    if test -n "$_WIN32_MSVC"; then
6658       AC_ERROR("building with in-tree freetype is not supported on MSVC")
6659    fi
6660    AC_DEFINE(MOZ_TREE_FREETYPE)
6661    AC_SUBST(MOZ_TREE_FREETYPE)
6662    MOZ_ENABLE_CAIRO_FT=1       
6663    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6664    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6665    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6666    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6667    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6668    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6669    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6670    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6671    AC_SUBST(CAIRO_FT_CFLAGS)
6674 dnl ========================================================
6675 dnl Installer
6676 dnl ========================================================
6677 case "$target_os" in
6678     aix*|solaris*|linux*|mingw*|os2*|wince*|winmo*)
6679         MOZ_INSTALLER=1
6680         ;;
6681 esac
6683 MOZ_ARG_DISABLE_BOOL(installer,
6684 [  --disable-installer     Disable building of installer],
6685     MOZ_INSTALLER=,
6686     MOZ_INSTALLER=1)
6687 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6688     # Disable installer for Windows builds that use the new toolkit if the
6689     # required major version and minimum minor version of Unicode NSIS isn't in
6690     # the path.
6691     REQ_NSIS_MAJOR_VER=2
6692     MIN_NSIS_MINOR_VER=33
6693     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6694     if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6695         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.])
6696     fi
6697     changequote(,)
6698     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6699     changequote([,])
6700     if test ! "$MAKENSISU_VER" = ""; then
6701         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6702         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6703     fi
6704     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6705     if test "$MAKENSISU_VER" = "" ||
6706        test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6707             ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6708         AC_MSG_RESULT([no])
6709         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.])
6710     fi
6711     AC_MSG_RESULT([yes])
6714 AC_SUBST(MOZ_INSTALLER)
6716 AC_MSG_CHECKING([for tar archiver])
6717 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6718 if test -z "$TAR"; then
6719     AC_MSG_ERROR([no tar archiver found in \$PATH])
6721 AC_MSG_RESULT([$TAR])
6722 AC_SUBST(TAR)
6724 AC_MSG_CHECKING([for wget])
6725 AC_CHECK_PROGS(WGET, wget, "")
6726 AC_MSG_RESULT([$WGET])
6727 AC_SUBST(WGET)
6729 dnl ========================================================
6730 dnl Updater
6731 dnl ========================================================
6733 MOZ_ARG_DISABLE_BOOL(updater,
6734 [  --disable-updater       Disable building of updater],
6735     MOZ_UPDATER=,
6736     MOZ_UPDATER=1 )
6738 if test -n "$MOZ_UPDATER"; then
6739     AC_DEFINE(MOZ_UPDATER)
6742 # app update channel is 'default' when not supplied.
6743 MOZ_ARG_ENABLE_STRING([update-channel],
6744 [  --enable-update-channel=CHANNEL
6745                           Select application update channel (default=default)],
6746     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6748 if test -z "$MOZ_UPDATE_CHANNEL"; then
6749     MOZ_UPDATE_CHANNEL=default
6751 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6752 AC_SUBST(MOZ_UPDATE_CHANNEL)
6754 # tools/update-packaging is not checked out by default.
6755 MOZ_ARG_ENABLE_BOOL(update-packaging,
6756 [  --enable-update-packaging
6757                           Enable tools/update-packaging],
6758     MOZ_UPDATE_PACKAGING=1,
6759     MOZ_UPDATE_PACKAGING= )
6760 AC_SUBST(MOZ_UPDATE_PACKAGING)
6762 dnl ========================================================
6763 dnl ActiveX
6764 dnl ========================================================
6766 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6767 [  --disable-xpconnect-idispatch
6768                           Disable building of xpconnect support for IDispatch
6769                           (win32 only)],
6770     XPC_IDISPATCH_SUPPORT=,
6771     XPC_IDISPATCH_SUPPORT=1)
6772 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6774 MOZ_ARG_DISABLE_BOOL(activex,
6775 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6776     MOZ_NO_ACTIVEX_SUPPORT=1,
6777     MOZ_NO_ACTIVEX_SUPPORT= )
6778 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6780 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6781 [  --enable-activex-scripting
6782                           Enable building of ActiveX scripting support (win32)],
6783     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6784     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6785 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6787 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6788 then
6789     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6792 if test "$COMPILE_ENVIRONMENT" = "1"; then
6793 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6794 case "$target" in
6795 *-mingw*)
6796     if test "$ac_cv_header_atlbase_h" = "no"; then
6797         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.])
6798     fi
6799     ;;
6800 esac
6804 dnl ========================================================
6805 dnl leaky
6806 dnl ========================================================
6807 MOZ_ARG_ENABLE_BOOL(leaky,
6808 [  --enable-leaky          Build leaky memory tool],
6809     MOZ_LEAKY=1,
6810     MOZ_LEAKY=)
6813 dnl ========================================================
6814 dnl build the tests by default
6815 dnl ========================================================
6816 MOZ_ARG_DISABLE_BOOL(tests,
6817 [  --disable-tests         Do not build test libraries & programs],
6818     ENABLE_TESTS=,
6819     ENABLE_TESTS=1 )
6821 dnl ========================================================
6822 dnl parental controls (for Windows Vista)
6823 dnl ========================================================
6824 MOZ_ARG_DISABLE_BOOL(parental-controls,
6825 [  --disable-parental-controls
6826                           Do not build parental controls],
6827    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6828    MOZ_DISABLE_PARENTAL_CONTROLS=)
6829 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6830     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6833 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6835 dnl ========================================================
6836 dnl = Disable DOMCrypto
6837 dnl ========================================================
6838 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6839     AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6842 dnl ========================================================
6843 dnl =
6844 dnl = Module specific options
6845 dnl =
6846 dnl ========================================================
6847 MOZ_ARG_HEADER(Individual module options)
6849 dnl ========================================================
6850 dnl = Disable feed handling components
6851 dnl ========================================================
6852 MOZ_ARG_DISABLE_BOOL(feeds,
6853 [  --disable-feeds         Disable feed handling and processing components],
6854     MOZ_FEEDS=,
6855     MOZ_FEEDS=1 )
6856 if test -n "$MOZ_FEEDS"; then
6857     AC_DEFINE(MOZ_FEEDS)
6858 else
6859     if test "$MOZ_BUILD_APP" = "browser"; then
6860         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6861     fi
6864 dnl ========================================================
6865 dnl = Enable mozStorage
6866 dnl ========================================================
6867 dnl Implicitly enabled by default if building calendar or places
6868 MOZ_ARG_ENABLE_BOOL(storage,
6869 [  --enable-storage        Enable mozStorage module and related components],
6870     MOZ_STORAGE=1,
6871     MOZ_STORAGE= )
6872 if test -n "$MOZ_STORAGE"; then
6873     AC_DEFINE(MOZ_STORAGE)
6876 dnl ========================================================
6877 dnl Check for sqlite
6878 dnl ========================================================
6880 MOZ_NATIVE_SQLITE=
6881 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6882 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6883 MOZ_NATIVE_SQLITE=1,
6884 MOZ_NATIVE_SQLITE= )
6886 if test -z "$MOZ_NATIVE_SQLITE"
6887 then
6888     SQLITE_CFLAGS=
6889     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6890 else
6891     dnl ============================
6892     dnl === SQLite Version check ===
6893     dnl ============================
6894     dnl Check to see if the system SQLite package is new enough.
6895     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6897     dnl ==================================
6898     dnl === SQLITE_SECURE_DELETE check ===
6899     dnl ==================================
6900     dnl Check to see if the system SQLite package is compiled with
6901     dnl SQLITE_SECURE_DELETE enabled.
6902     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6903     _SAVE_CFLAGS="$CFLAGS"
6904     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6905     _SAVE_LIBS="$LIBS"
6906     LIBS="$LIBS $SQLITE_LIBS"
6907     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6908         AC_TRY_RUN([
6909             #include "sqlite3.h"
6911             int main(int argc, char **argv){
6912               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6913             }],
6914             ac_cv_sqlite_secure_delete=yes,
6915             ac_cv_sqlite_secure_delete=no,
6916             ac_cv_sqlite_secure_delete=no
6917         )
6918     ])
6919     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6920     CFLAGS="$_SAVE_CFLAGS"
6921     LIBS="$_SAVE_LIBS"
6922     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6923         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6924     fi
6926     dnl ===============================
6927     dnl === SQLITE_THREADSAFE check ===
6928     dnl ===============================
6929     dnl Check to see if the system SQLite package is compiled with
6930     dnl SQLITE_THREADSAFE enabled.
6931     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6932     _SAVE_CFLAGS="$CFLAGS"
6933     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6934     _SAVE_LIBS="$LIBS"
6935     LIBS="$LIBS $SQLITE_LIBS"
6936     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6937         AC_TRY_RUN([
6938             #include "sqlite3.h"
6940             int main(int argc, char **argv){
6941               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6942             }],
6943             ac_cv_sqlite_threadsafe=yes,
6944             ac_cv_sqlite_threadsafe=no,
6945             ac_cv_sqlite_threadsafe=no
6946         )
6947     ])
6948     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6949     CFLAGS="$_SAVE_CFLAGS"
6950     LIBS="$_SAVE_LIBS"
6951     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6952         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6953     fi
6955     dnl ================================
6956     dnl === SQLITE_ENABLE_FTS3 check ===
6957     dnl ================================
6958     dnl check to see if the system SQLite package is compiled with
6959     dnl SQLITE_ENABLE_FTS3 enabled.
6960     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6961     _SAVE_CFLAGS="$CFLAGS"
6962     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6963     _SAVE_LIBS="$LIBS"
6964     LIBS="$LIBS $SQLITE_LIBS"
6965     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6966         AC_TRY_RUN([
6967             #include "sqlite3.h"
6969             int main(int argc, char **argv){
6970               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6971             }],
6972             ac_cv_sqlite_enable_fts3=yes,
6973             ac_cv_sqlite_enable_fts3=no,
6974             ac_cv_sqlite_enable_fts3=no
6975         )
6976     ])
6977     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6978     CFLAGS="$_SAVE_CFLAGS"
6979     LIBS="$_SAVE_LIBS"
6980     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6981         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6982     fi
6984     dnl =========================================
6985     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6986     dnl =========================================
6987     dnl check to see if the system SQLite package is compiled with
6988     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6989     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6990     _SAVE_CFLAGS="$CFLAGS"
6991     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6992     _SAVE_LIBS="$LIBS"
6993     LIBS="$LIBS $SQLITE_LIBS"
6994     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6995         AC_TRY_RUN([
6996             #include "sqlite3.h"
6998             int main(int argc, char **argv){
6999               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
7000             }],
7001             ac_cv_sqlite_enable_unlock_notify=yes,
7002             ac_cv_sqlite_enable_unlock_notify=no,
7003             ac_cv_sqlite_enable_unlock_notify=no
7004         )
7005     ])
7006     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
7007     CFLAGS="$_SAVE_CFLAGS"
7008     LIBS="$_SAVE_LIBS"
7009     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
7010         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
7011     fi
7014 AC_SUBST(MOZ_NATIVE_SQLITE)
7016 dnl ========================================================
7017 dnl = Enable help viewer (off by default)
7018 dnl ========================================================
7019 if test -n "$MOZ_HELP_VIEWER"; then
7020      dnl Do this if defined in confvars.sh
7021      AC_DEFINE(MOZ_HELP_VIEWER)
7024 dnl ========================================================
7025 dnl = Enable safe browsing (anti-phishing)
7026 dnl ========================================================
7027 MOZ_ARG_ENABLE_BOOL(safe-browsing,
7028 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
7029     MOZ_SAFE_BROWSING=1,
7030     MOZ_SAFE_BROWSING= )
7031 if test -n "$MOZ_SAFE_BROWSING"; then
7032     AC_DEFINE(MOZ_SAFE_BROWSING)
7034 AC_SUBST(MOZ_SAFE_BROWSING)
7036 dnl ========================================================
7037 dnl = Enable faststart component
7038 dnl ========================================================
7039 MOZ_ARG_ENABLE_BOOL(faststart,
7040 [  --enable-faststart      Enable the faststart component],
7041     MOZ_FASTSTART=1,
7042     MOZ_FASTSTART= )
7043 if test -n "$MOZ_FASTSTART"; then
7044     AC_DEFINE(MOZ_FASTSTART)
7046 AC_SUBST(MOZ_FASTSTART)
7048 dnl ========================================================
7049 dnl = Enable url-classifier
7050 dnl ========================================================
7051 dnl Implicitly enabled by default if building with safe-browsing
7052 if test -n "$MOZ_SAFE_BROWSING"; then
7053     MOZ_URL_CLASSIFIER=1
7055 MOZ_ARG_ENABLE_BOOL(url-classifier,
7056 [  --enable-url-classifier Enable url classifier module],
7057     MOZ_URL_CLASSIFIER=1,
7058     MOZ_URL_CLASSIFIER= )
7059 if test -n "$MOZ_URL_CLASSIFIER"; then
7060     AC_DEFINE(MOZ_URL_CLASSIFIER)
7062 AC_SUBST(MOZ_URL_CLASSIFIER)
7064 dnl ========================================================
7065 dnl = Disable zipwriter
7066 dnl ========================================================
7067 MOZ_ARG_DISABLE_BOOL(zipwriter,
7068 [  --disable-zipwriter     Disable zipwriter component],
7069     MOZ_ZIPWRITER=,
7070     MOZ_ZIPWRITER=1 )
7071 AC_SUBST(MOZ_ZIPWRITER)
7073 dnl ========================================================
7074 dnl = libconic
7075 dnl ========================================================
7076 dnl superseded by QtNetwork starting from 4.7
7077 MOZ_ENABLE_LIBCONIC=1
7079 if test -n "$MOZ_ENABLE_QT"; then
7080   if test "$MOZ_ENABLE_QTNETWORK"; then
7081     MOZ_ENABLE_LIBCONIC=
7082   fi
7085 MOZ_ARG_DISABLE_BOOL(libconic,
7086 [  --disable-libconic      Disable libconic],
7087     MOZ_ENABLE_LIBCONIC=,
7088     MOZ_ENABLE_LIBCONIC=1 )
7090 if test -n "$MOZ_ENABLE_LIBCONIC"; then
7091     PKG_CHECK_MODULES(LIBCONIC, conic,
7092                       MOZ_ENABLE_LIBCONIC=1,
7093                       MOZ_ENABLE_LIBCONIC=)
7095 if test "$MOZ_ENABLE_LIBCONIC"; then
7096     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
7099 AC_SUBST(MOZ_ENABLE_LIBCONIC)
7100 AC_SUBST(LIBCONIC_CFLAGS)
7101 AC_SUBST(LIBCONIC_LIBS)
7103 dnl ========================================================
7104 dnl = Maemo checks
7105 dnl ========================================================
7107 MAEMO_SDK_TARGET_VER=-1
7109 MOZ_ARG_WITH_STRING(maemo-version,
7110 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
7111                           Maemo SDK Version],
7112   MAEMO_SDK_TARGET_VER=$withval)
7114 case "$MAEMO_SDK_TARGET_VER" in
7116     MOZ_PLATFORM_MAEMO=5
7117     ;;
7120     MOZ_PLATFORM_MAEMO=6
7121     ;;
7124     dnl We aren't compiling for Maemo, move on.
7125     ;;
7127     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
7128     ;;
7129 esac
7131 if test $MOZ_PLATFORM_MAEMO; then
7132    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
7134    if test -z "$MOZ_ENABLE_DBUS"; then
7135        AC_MSG_ERROR([DBus is required when building for Maemo])
7136    fi
7138    MOZ_GFX_OPTIMIZE_MOBILE=1
7139    MOZ_WEBGL_GLX=
7140    MOZ_MAEMO_LIBLOCATION=
7142    if test $MOZ_PLATFORM_MAEMO = 5; then
7143       dnl if we have Xcomposite we should also have Xdamage and Xfixes
7144       MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
7145           [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
7146       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
7147                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
7149       AC_SUBST(XCOMPOSITE_LIBS)
7151       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
7152       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
7153       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
7154       if test -z "$_LIB_FOUND"; then
7155          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
7156       fi
7159       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
7160       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
7161       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
7162       if test -z "$_LIB_FOUND"; then
7163          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
7164       fi
7166       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
7167       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
7168       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
7169       if test -z "$_LIB_FOUND"; then
7170          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
7171       fi
7173    fi
7174    if test $MOZ_PLATFORM_MAEMO = 6; then
7175       dnl ========================================================
7176       dnl = Enable meego libcontentaction
7177       dnl ========================================================
7178       MOZ_ARG_ENABLE_BOOL(meegocontentaction,
7179       [  --enable-meegocontentaction           Enable meegocontentaction support],
7180          MOZ_MEEGOCONTENTACTION=1,
7181          MOZ_MEEGOCONTENTACTION=)
7183       if test -n "$MOZ_MEEGOCONTENTACTION"; then
7185          PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
7186          if test "$_LIB_FOUND"; then
7187             MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
7188             MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
7189             MOZ_ENABLE_CONTENTACTION=1
7190             AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
7191             AC_SUBST(MOZ_ENABLE_CONTENTACTION)
7192          fi
7193       fi
7195       MOZ_THUMB2=1
7196    fi
7198    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
7199    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
7200    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
7201    if test "$_LIB_FOUND"; then
7202       MOZ_MAEMO_LIBLOCATION=1
7203       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
7204    else
7205       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
7206    fi
7207    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
7209    PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
7210    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
7211    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
7212    if test "$_LIB_FOUND"; then
7213       MOZ_ENABLE_MEEGOTOUCHSHARE=1
7214       AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
7215    else
7216       AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
7217    fi
7218    AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
7220    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
7221    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
7224 dnl Setup default CPU arch for arm target
7225 case "$target_cpu" in
7226   arm*)
7227     MOZ_ARM_ARCH=armv7
7228   ;;
7229 esac
7230 dnl ========================================================
7231 dnl = Enable building the Thumb2 instruction set
7232 dnl ========================================================
7233 MOZ_ARG_ENABLE_BOOL(thumb2,
7234  [  --enable-thumb2         Enable Thumb2 instruction set (implies ARMv7)],
7235     MOZ_THUMB2=1,
7236     MOZ_THUMB2=)
7237 if test -n "$MOZ_THUMB2"; then
7238   MOZ_ARM_ARCH=armv7
7241 dnl ========================================================
7242 dnl = Enable building for ARM specific CPU features
7243 dnl ========================================================
7244 MOZ_ARG_WITH_STRING(cpu-arch,
7245 [  --with-cpu-arch=arch      Use specific arm architecture CPU features, default armv7],
7246     MOZ_ARM_ARCH=$withval)
7248 if test -n "$MOZ_THUMB2"; then
7249   case "$target_cpu" in
7250     arm*)
7251       if test "$MOZ_ARM_ARCH" != "armv7"; then
7252         AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH])
7253       fi
7254       if test "$GNU_CC"; then
7255         AC_DEFINE(MOZ_THUMB2)
7256         AC_DEFINE(MOZ_ARM_ARCH)
7257         CFLAGS="$CFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7258         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7259         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7260       else
7261         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
7262       fi
7263     ;;
7264     *)
7265       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
7266     ;;
7267   esac
7268 elif test "$MOZ_ARM_ARCH" = "armv7"; then
7269   case "$target_cpu" in
7270     arm*)
7271       if test "$GNU_CC"; then
7272         AC_DEFINE(MOZ_ARM_ARCH)
7273         CFLAGS="$CFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7274         CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7275         ASFLAGS="$ASFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
7276       else
7277         AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains])
7278       fi
7279     ;;
7280     *)
7281       AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures])
7282     ;;
7283   esac
7284 else
7285   case "$target_cpu" in
7286     arm*)
7287       if test "$GNU_CC"; then
7288         CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float"
7289         CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -msoft-float"
7290         ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork -msoft-float"
7291       fi
7292       ;;
7293   esac
7296 AC_SUBST(MOZ_THUMB2)
7297 AC_SUBST(MOZ_ARM_ARCH)
7299 dnl ========================================================
7300 dnl = faststripe theme
7301 dnl ========================================================
7302 MOZ_ARG_ENABLE_BOOL(faststripe,
7303 [  --enable-faststripe     Use faststripe theme],
7304     MOZ_THEME_FASTSTRIPE=1,
7305     MOZ_THEME_FASTSTRIPE= )
7306 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7308 dnl ========================================================
7309 dnl =
7310 dnl = Feature options that require extra sources to be pulled
7311 dnl =
7312 dnl ========================================================
7313 dnl MOZ_ARG_HEADER(Features that require extra sources)
7315 dnl ========================================================
7316 dnl =
7317 dnl = Debugging Options
7318 dnl = 
7319 dnl ========================================================
7320 MOZ_ARG_HEADER(Debugging and Optimizations)
7322 dnl ========================================================
7323 dnl = Disable building with debug info.
7324 dnl = Debugging is OFF by default
7325 dnl ========================================================
7326 if test -z "$MOZ_DEBUG_FLAGS"; then
7327   MOZ_DEBUG_FLAGS="-g"
7330 MOZ_ARG_ENABLE_STRING(debug,
7331 [  --enable-debug[=DBG]    Enable building with developer debug info
7332                            (using compiler flags DBG)],
7333 [ if test "$enableval" != "no"; then
7334     MOZ_DEBUG=1
7335     if test -n "$enableval" -a "$enableval" != "yes"; then
7336         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7337         _MOZ_DEBUG_FLAGS_SET=1
7338     fi
7339   else
7340     MOZ_DEBUG=
7341   fi ],
7342   MOZ_DEBUG=)
7344 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7345 MOZ_ARG_WITH_STRING(debug-label,
7346 [  --with-debug-label=LABELS
7347                           Define DEBUG_<value> for each comma-separated
7348                           value given.],
7349 [ for option in `echo $withval | sed 's/,/ /g'`; do
7350     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7351 done])
7353 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7355 if test -n "$MOZ_DEBUG"; then
7356     AC_MSG_CHECKING([for valid debug flags])
7357     _SAVE_CFLAGS=$CFLAGS
7358     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7359     AC_TRY_COMPILE([#include <stdio.h>], 
7360         [printf("Hello World\n");],
7361         _results=yes,
7362         _results=no)
7363     AC_MSG_RESULT([$_results])
7364     if test "$_results" = "no"; then
7365         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7366     fi
7367     CFLAGS=$_SAVE_CFLAGS
7370 dnl ========================================================
7371 dnl enable mobile optimizations
7372 dnl ========================================================
7373 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7374 [  --enable-mobile-optimize
7375                           Enable mobile optimizations],
7376     MOZ_GFX_OPTIMIZE_MOBILE=1)
7378 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7380 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7381     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7384 dnl ========================================================
7385 dnl = Enable code optimization. ON by default.
7386 dnl ========================================================
7387 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7388         MOZ_OPTIMIZE_FLAGS="-O"
7391 MOZ_ARG_ENABLE_STRING(optimize,
7392 [  --disable-optimize      Disable compiler optimization
7393   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7394 [ if test "$enableval" != "no"; then
7395     MOZ_OPTIMIZE=1
7396     if test -n "$enableval" -a "$enableval" != "yes"; then
7397         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7398         MOZ_OPTIMIZE=2
7399     fi
7400 else
7401     MOZ_OPTIMIZE=
7402 fi ], MOZ_OPTIMIZE=1)
7404 if test "$COMPILE_ENVIRONMENT"; then
7405 if test -n "$MOZ_OPTIMIZE"; then
7406     AC_MSG_CHECKING([for valid optimization flags])
7407     _SAVE_CFLAGS=$CFLAGS
7408     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7409     AC_TRY_COMPILE([#include <stdio.h>], 
7410         [printf("Hello World\n");],
7411         _results=yes,
7412         _results=no)
7413     AC_MSG_RESULT([$_results])
7414     if test "$_results" = "no"; then
7415         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7416     fi
7417     CFLAGS=$_SAVE_CFLAGS
7419 fi # COMPILE_ENVIRONMENT
7421 AC_SUBST(MOZ_OPTIMIZE)
7422 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7423 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7424 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7426 dnl ========================================================
7427 dnl = Enable generation of debug symbols
7428 dnl ========================================================
7429 MOZ_ARG_ENABLE_STRING(debug-symbols,
7430 [  --enable-debug-symbols[=DBG]
7431                           Enable debugging symbols (using compiler flags DBG)],
7432 [ if test "$enableval" != "no"; then
7433       MOZ_DEBUG_SYMBOLS=1
7434       if test -n "$enableval" -a "$enableval" != "yes"; then
7435           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7436               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7437           else
7438               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7439           fi
7440       fi
7441   else
7442       MOZ_DEBUG_SYMBOLS=
7443   fi ],
7444   MOZ_DEBUG_SYMBOLS=1)
7446 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7447     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7448     export MOZ_DEBUG_SYMBOLS
7451 dnl ========================================================
7452 dnl = Disable any treating of compile warnings as errors
7453 dnl ========================================================
7454 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7455 [  --disable-warnings-as-errors
7456                           Disable treating of warnings as errors],
7457     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7458     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7459 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7460    WARNINGS_AS_ERRORS=''
7463 dnl ========================================================
7464 dnl = Disable runtime logging checks
7465 dnl ========================================================
7466 MOZ_ARG_DISABLE_BOOL(logging,
7467 [  --disable-logging       Disable logging facilities],
7468     NS_DISABLE_LOGGING=1,
7469     NS_DISABLE_LOGGING= )
7470 if test "$NS_DISABLE_LOGGING"; then
7471     AC_DEFINE(NS_DISABLE_LOGGING)
7472 else
7473     AC_DEFINE(MOZ_LOGGING)
7476 dnl ========================================================
7477 dnl = This will enable logging of addref, release, ctor, dtor.
7478 dnl ========================================================
7479 _ENABLE_LOGREFCNT=42
7480 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7481 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7482     _ENABLE_LOGREFCNT=1,
7483     _ENABLE_LOGREFCNT= )
7484 if test "$_ENABLE_LOGREFCNT" = "1"; then
7485     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7486 elif test -z "$_ENABLE_LOGREFCNT"; then
7487     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7490 dnl ========================================================
7491 dnl = Enable trace malloc
7492 dnl ========================================================
7493 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7494 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7495 [  --enable-trace-malloc   Enable malloc tracing],
7496     NS_TRACE_MALLOC=1,
7497     NS_TRACE_MALLOC= )
7498 if test "$NS_TRACE_MALLOC"; then
7499   # Please, Mr. Linker Man, don't take away our symbol names
7500   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7501   USE_ELF_DYNSTR_GC=
7502   AC_DEFINE(NS_TRACE_MALLOC)
7504 AC_SUBST(NS_TRACE_MALLOC)
7506 dnl ========================================================
7507 dnl = Enable jemalloc
7508 dnl ========================================================
7509 MOZ_ARG_ENABLE_BOOL(jemalloc,
7510 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7511     MOZ_MEMORY=1,
7512     MOZ_MEMORY=)
7514 if test "$NS_TRACE_MALLOC"; then
7515     MOZ_MEMORY=
7518 if test "$MOZ_MEMORY"; then
7520   dnl Don't try to run compiler tests on Windows  
7521   if test "$OS_ARCH" = "WINNT"; then
7522     if test -z "$HAVE_64BIT_OS"; then
7523       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7524     else
7525       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7526     fi
7527   else
7528     AC_CHECK_SIZEOF([int *], [4])
7529     case "${ac_cv_sizeof_int_p}" in
7530     4)
7531       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7532       ;;
7533     8)
7534       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7535       ;;
7536     *)
7537       AC_MSG_ERROR([Unexpected pointer size])
7538       ;;
7539     esac
7540   fi
7542   AC_DEFINE(MOZ_MEMORY)
7543   if test "x$MOZ_DEBUG" = "x1"; then
7544     AC_DEFINE(MOZ_MEMORY_DEBUG)
7545   fi
7546   dnl The generic feature tests that determine how to compute ncpus are long and
7547   dnl complicated.  Therefore, simply define special cpp variables for the
7548   dnl platforms we have special knowledge of.
7549   case "${target}" in
7550   *-darwin*)
7551     AC_DEFINE(MOZ_MEMORY_DARWIN)
7552     ;;
7553   *-*freebsd*)
7554     AC_DEFINE(MOZ_MEMORY_BSD)
7555     ;;
7556   *-*linux*)
7557     AC_DEFINE(MOZ_MEMORY_LINUX)
7558     ;;
7559   *-netbsd*)
7560     AC_DEFINE(MOZ_MEMORY_BSD)
7561     ;;
7562   *-solaris*)
7563     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7564     ;;
7565   *-mingw*)
7566     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7567     dnl This is sort of awful. Will revisit if we add support for more versions
7568     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7569         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7570     fi
7571     if test -z "$WIN32_CRT_SRC_DIR"; then
7572       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7573         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).])
7574       else
7575         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7576       fi
7577     fi
7578     dnl cpu check
7579     case "${target_cpu}" in
7580     i*86)
7581       MOZ_CRT_CPU_ARCH=intel
7582       ;;
7583     x86_64)
7584       MOZ_CRT_CPU_ARCH=amd64
7585       ;;
7586     *)
7587       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7588       ;;
7589     esac
7591     AC_SUBST(MOZ_CRT_CPU_ARCH)
7593     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7594       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7595     fi
7596     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7597     _objdir_win=`pwd -W`
7598     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7599     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7600     dnl Also pass this to NSPR/NSS
7601     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7602     export DLLFLAGS
7603     ;;
7604   *-*wince)
7605     AC_DEFINE(MOZ_MEMORY_WINCE)
7606     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7607     if test -z "$WINCE_WINDOWS_MOBILE"; then
7608       AC_DEFINE(MOZ_MEMORY_WINCE6)
7609     fi
7610     ;;
7611   *-*winmo)
7612     AC_DEFINE(MOZ_MEMORY_WINCE)
7613     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7614     ;;
7615   *-android*)
7616     AC_DEFINE(MOZ_MEMORY_LINUX)
7617     AC_DEFINE(MOZ_MEMORY_ANDROID)
7618     _WRAP_MALLOC=1
7619     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7620     WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7621     ;;
7622   *)
7623     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7624     ;;
7625   esac
7627   if test "$OS_ARCH" != "Darwin"; then
7628     dnl NB: this must be kept in sync with jemalloc.h
7629     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7630     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7631     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7632   fi
7634 AC_SUBST(MOZ_MEMORY)
7635 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7636 AC_SUBST(WIN32_CRT_SRC_DIR)
7637 dnl Need to set this for make because NSS doesn't have configure
7638 AC_SUBST(DLLFLAGS)
7640 dnl ========================================================
7641 dnl = Use malloc wrapper lib
7642 dnl ========================================================
7643 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7644 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7645     _WRAP_MALLOC=1,
7646     _WRAP_MALLOC= )
7648 if test -n "$_WRAP_MALLOC"; then
7649     if test "$GNU_CC"; then
7650     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"
7651     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7652     MKCSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7653     fi
7656 dnl ========================================================
7657 dnl = Location of malloc wrapper lib
7658 dnl ========================================================
7659 MOZ_ARG_WITH_STRING(wrap-malloc,
7660 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7661     WRAP_MALLOC_LIB=$withval)
7663 dnl ========================================================
7664 dnl = Use JS Call tracing
7665 dnl ========================================================
7666 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7667 [  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
7668     MOZ_TRACE_JSCALLS=1,
7669     MOZ_TRACE_JSCALLS= )
7670 if test -n "$MOZ_TRACE_JSCALLS"; then
7671     AC_DEFINE(MOZ_TRACE_JSCALLS)
7674 dnl ========================================================
7675 dnl = Use TraceVis
7676 dnl ========================================================
7677 MOZ_ARG_ENABLE_BOOL(tracevis,
7678 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7679     MOZ_TRACEVIS=1,
7680     MOZ_TRACEVIS= )
7681 if test -n "$MOZ_TRACEVIS"; then
7682     AC_DEFINE(MOZ_TRACEVIS)
7685 dnl ========================================================
7686 dnl = Use GCTimer
7687 dnl ========================================================
7688 MOZ_ARG_ENABLE_BOOL(gctimer,
7689 [  --enable-gctimer        Enable GC timer (default=no)],
7690     MOZ_GCTIMER=1,
7691     MOZ_GCTIMER= )
7692 if test -n "$MOZ_GCTIMER"; then
7693     AC_DEFINE(MOZ_GCTIMER)
7696 dnl ========================================================
7697 dnl Zealous JavaScript GC
7698 dnl ========================================================
7699 MOZ_ARG_ENABLE_BOOL(gczeal,
7700 [  --enable-gczeal         Enable zealous JavaScript GCing],
7701     JS_GC_ZEAL=1,
7702     JS_GC_ZEAL= )
7703 if test -n "$JS_GC_ZEAL"; then
7704     AC_DEFINE(JS_GC_ZEAL)
7707 dnl ======================================================
7708 dnl = Enable compiling with ccache
7709 dnl ======================================================
7710 MOZ_ARG_WITH_STRING(ccache,
7711 [  --with-ccache[=path/to/ccache]
7712                           Enable compiling with ccache],
7713     CCACHE=$withval, CCACHE="no")
7715 if test "$CCACHE" != "no"; then
7716     if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7717         CCACHE=
7718     else
7719         if test ! -e "$CCACHE"; then
7720             AC_MSG_ERROR([$CCACHE not found])
7721         fi
7722     fi
7723     MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7724     if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7725         AC_MSG_ERROR([ccache not found])
7726     elif test -x "$CCACHE"; then
7727         CC="$CCACHE $CC"
7728         CXX="$CCACHE $CXX"
7729     else
7730         AC_MSG_ERROR([$CCACHE is not executable])
7731     fi
7734 dnl ========================================================
7735 dnl = Enable static checking using gcc-dehydra
7736 dnl ========================================================
7738 MOZ_ARG_WITH_STRING(static-checking,
7739 [  --with-static-checking=path/to/gcc_dehydra.so
7740                           Enable static checking of code using GCC-dehydra],
7741     DEHYDRA_PATH=$withval,
7742     DEHYDRA_PATH= )
7744 if test -n "$DEHYDRA_PATH"; then
7745     if test ! -f "$DEHYDRA_PATH"; then
7746         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7747     fi
7748     AC_DEFINE(NS_STATIC_CHECKING)
7750 AC_SUBST(DEHYDRA_PATH)
7752 dnl ========================================================
7753 dnl = Enable stripping of libs & executables
7754 dnl ========================================================
7755 MOZ_ARG_ENABLE_BOOL(strip,
7756 [  --enable-strip          Enable stripping of libs & executables ],
7757     ENABLE_STRIP=1,
7758     ENABLE_STRIP= )
7760 dnl ========================================================
7761 dnl = Enable stripping of libs & executables when packaging
7762 dnl ========================================================
7763 MOZ_ARG_ENABLE_BOOL(install-strip,
7764 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7765     PKG_SKIP_STRIP= ,
7766     PKG_SKIP_STRIP=1)
7768 dnl ========================================================
7769 dnl = --enable-elf-dynstr-gc
7770 dnl ========================================================
7771 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7772 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7773     USE_ELF_DYNSTR_GC=1,
7774     USE_ELF_DYNSTR_GC= )
7776 dnl ========================================================
7777 dnl = --disable-elf-hack
7778 dnl ========================================================
7780 USE_ELF_HACK=1
7781 MOZ_ARG_DISABLE_BOOL(elf-hack,
7782 [  --disable-elf-hack      Disable elf hacks],
7783     USE_ELF_HACK=,
7784     USE_ELF_HACK=1)
7786 # Only enable elfhack where supported
7787 if test "$USE_ELF_HACK" = 1; then
7788     case "${HOST_OS_ARCH},${OS_ARCH}" in
7789     Linux,Linux)
7790         case "${CPU_ARCH}" in
7791         arm | x86 | x86_64)
7792             USE_ELF_HACK=1
7793             ;;
7794         *)
7795             USE_ELF_HACK=
7796             ;;
7797         esac
7798         ;;
7799     *)
7800         USE_ELF_HACK=
7801         ;;
7802     esac
7805 dnl ========================================================
7806 dnl = 
7807 dnl = Profiling and Instrumenting
7808 dnl = 
7809 dnl ========================================================
7810 MOZ_ARG_HEADER(Profiling and Instrumenting)
7812 dnl ========================================================
7813 dnl = Enable timeline service, which provides lightweight
7814 dnl = instrumentation of mozilla for performance measurement.
7815 dnl = Timeline is off by default.
7816 dnl ========================================================
7817 MOZ_ARG_ENABLE_BOOL(timeline,
7818 [  --enable-timeline       Enable timeline services ],
7819     MOZ_TIMELINE=1,
7820     MOZ_TIMELINE= )
7821 if test -n "$MOZ_TIMELINE"; then
7822     AC_DEFINE(MOZ_TIMELINE)
7825 dnl ========================================================
7826 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7827 dnl = timing for identifying code bottlenecks 
7828 dnl = NS_FUNCTION_TIMER is off by default.
7829 dnl ========================================================
7830 MOZ_ARG_ENABLE_BOOL(functiontimer,
7831 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7832     NS_FUNCTION_TIMER=1,
7833     NS_FUNCTION_TIMER= )
7834 if test -n "$NS_FUNCTION_TIMER"; then
7835     AC_DEFINE(NS_FUNCTION_TIMER)
7838 dnl ========================================================
7839 dnl Turn on reflow counting
7840 dnl ========================================================
7841 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7842 [  --enable-reflow-perf    Enable reflow performance tracing],
7843     MOZ_REFLOW_PERF=1,
7844     MOZ_REFLOW_PERF= )
7845 if test -n "$MOZ_REFLOW_PERF"; then
7846     AC_DEFINE(MOZ_REFLOW_PERF)
7849 dnl ========================================================
7850 dnl Enable code size metrics.
7851 dnl ========================================================
7852 MOZ_ARG_ENABLE_BOOL(codesighs,
7853 [  --enable-codesighs      Enable code size analysis tools],
7854     _ENABLE_CODESIGHS=1,
7855     _ENABLE_CODESIGHS= )
7856 if test -n "$_ENABLE_CODESIGHS"; then
7857     if test -d $srcdir/tools/codesighs; then 
7858         MOZ_MAPINFO=1
7859     else
7860         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7861     fi
7864 dnl ========================================================
7865 dnl = Support for Quantify (Windows)
7866 dnl ========================================================
7867 MOZ_ARG_ENABLE_BOOL(quantify,
7868 [  --enable-quantify       Enable Quantify support (Windows only) ],
7869     MOZ_QUANTIFY=1,
7870     MOZ_QUANTIFY= )
7872 dnl ========================================================
7873 dnl = Support for demangling undefined symbols
7874 dnl ========================================================
7875 if test -z "$SKIP_LIBRARY_CHECKS"; then
7876     AC_LANG_SAVE
7877     AC_LANG_CPLUSPLUS
7878     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7879     AC_LANG_RESTORE
7882 # Demangle only for debug or trace-malloc builds
7883 MOZ_DEMANGLE_SYMBOLS=
7884 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7885     MOZ_DEMANGLE_SYMBOLS=1
7886     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7888 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7890 dnl ========================================================
7891 dnl = Support for gcc stack unwinding (from gcc 3.3)
7892 dnl ========================================================
7893 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7894     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7897 dnl ========================================================
7898 dnl =
7899 dnl = Misc. Options
7900 dnl = 
7901 dnl ========================================================
7902 MOZ_ARG_HEADER(Misc. Options)
7904 dnl ========================================================
7905 dnl update xterm title
7906 dnl ========================================================
7907 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7908 [  --enable-xterm-updates  Update XTERM titles with current command.],
7909     MOZ_UPDATE_XTERM=1,
7910     MOZ_UPDATE_XTERM= )
7912 dnl =========================================================
7913 dnl = Chrome format
7914 dnl =========================================================
7915 MOZ_ARG_ENABLE_STRING([chrome-format],
7916 [  --enable-chrome-format=jar|flat|both|symlink|omni
7917                           Select FORMAT of chrome files (default=jar)],
7918     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7920 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7921     MOZ_CHROME_FILE_FORMAT=jar
7924 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7925     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7926     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7927     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7928     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7929     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7932 dnl =========================================================
7933 dnl Omnijar packaging (bug 552121)
7934 dnl =========================================================
7935 dnl Omnijar packaging is compatible with flat packaging.
7936 dnl In unpackaged builds, omnijar looks for files as if
7937 dnl things were flat packaged. After packaging, all files
7938 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7939 dnl is set to flat since putting files into jars is only
7940 dnl done during packaging with omnijar.
7941 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7942     MOZ_OMNIJAR=1
7943     AC_DEFINE(MOZ_OMNIJAR)
7944     MOZ_CHROME_FILE_FORMAT=flat
7945 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7946     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7949 AC_SUBST(MOZ_OMNIJAR)
7951 dnl ========================================================
7952 dnl = Define default location for MOZILLA_FIVE_HOME
7953 dnl ========================================================
7954 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7955 [  --with-default-mozilla-five-home
7956                           Set the default value for MOZILLA_FIVE_HOME],
7957 [ val=`echo $withval`
7958   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7960 dnl ========================================================
7961 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7962 dnl ========================================================
7963 MOZ_ARG_WITH_STRING(user-appdir,
7964 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7965 [ val=`echo $withval`
7966 if echo "$val" | grep "\/" >/dev/null; then
7967     AC_MSG_ERROR("Homedir must be single relative path.")
7968 else 
7969     MOZ_USER_DIR="$val"
7970 fi])
7972 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7974 dnl ========================================================
7975 dnl = Doxygen configuration
7976 dnl ========================================================
7977 dnl Use commas to specify multiple dirs to this arg
7978 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7979 MOZ_ARG_WITH_STRING(doc-input-dirs,
7980 [  --with-doc-input-dirs=DIRS
7981                           Header/idl dirs to create docs from],
7982 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7983 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7985 dnl Use commas to specify multiple dirs to this arg
7986 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7987 MOZ_ARG_WITH_STRING(doc-include-dirs,
7988 [  --with-doc-include-dirs=DIRS  
7989                           Include dirs to preprocess doc headers],
7990 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7991 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7993 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7994 MOZ_ARG_WITH_STRING(doc-output-dir,
7995 [  --with-doc-output-dir=DIR
7996                           Dir to generate docs into],
7997 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7998 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
8000 if test -z "$SKIP_COMPILER_CHECKS"; then
8001 dnl ========================================================
8002 dnl =
8003 dnl = Compiler Options
8004 dnl = 
8005 dnl ========================================================
8006 MOZ_ARG_HEADER(Compiler Options)
8008 dnl ========================================================
8009 dnl Check for gcc -pipe support
8010 dnl ========================================================
8011 AC_MSG_CHECKING([for gcc -pipe support])
8012 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
8013     echo '#include <stdio.h>' > dummy-hello.c
8014     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
8015     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
8016     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
8017     if test $? = 0; then
8018         _res_as_stdin="yes"
8019     else
8020         _res_as_stdin="no"
8021     fi
8022     if test "$_res_as_stdin" = "yes"; then
8023         _SAVE_CFLAGS=$CFLAGS
8024         CFLAGS="$CFLAGS -pipe"
8025         AC_TRY_COMPILE( [ #include <stdio.h> ],
8026             [printf("Hello World\n");],
8027             [_res_gcc_pipe="yes"],
8028             [_res_gcc_pipe="no"] )
8029         CFLAGS=$_SAVE_CFLAGS
8030     fi
8031     if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
8032         _res="yes";
8033         CFLAGS="$CFLAGS -pipe"
8034         CXXFLAGS="$CXXFLAGS -pipe"
8035     else
8036         _res="no"
8037     fi
8038     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
8039     AC_MSG_RESULT([$_res])
8040 else
8041     AC_MSG_RESULT([no])
8044 dnl ========================================================
8045 dnl Profile guided optimization
8046 dnl ========================================================
8047 dnl Test for profiling options
8048 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
8050 dnl Provide a switch to disable PGO even when called via profiledbuild.
8051 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
8052 [  --disable-profile-guided-optimization
8053                           Don't build with PGO even if called via make profiledbuild],
8054 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
8055 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
8057 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
8059 _SAVE_CFLAGS="$CFLAGS"
8060 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
8062 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
8063 AC_TRY_COMPILE([], [return 0;],
8064                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
8065                  result="yes" ], result="no")
8066 AC_MSG_RESULT([$result])
8068 if test $result = "yes"; then
8069   PROFILE_GEN_LDFLAGS="-fprofile-generate"
8070   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
8071   PROFILE_USE_LDFLAGS="-fprofile-use"
8074 CFLAGS="$_SAVE_CFLAGS"
8076 if test -n "$INTEL_CC"; then
8077   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
8078   PROFILE_GEN_LDFLAGS=
8079   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
8080   PROFILE_USE_LDFLAGS=
8083 dnl Sun Studio on Solaris
8084 if test "$SOLARIS_SUNPRO_CC"; then
8085   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
8086   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
8087   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
8088   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
8091 AC_SUBST(PROFILE_GEN_CFLAGS)
8092 AC_SUBST(PROFILE_GEN_LDFLAGS)
8093 AC_SUBST(PROFILE_USE_CFLAGS)
8094 AC_SUBST(PROFILE_USE_LDFLAGS)
8096 AC_LANG_CPLUSPLUS
8098 dnl ========================================================
8099 dnl Test for -pedantic bustage
8100 dnl ========================================================
8101 MOZ_ARG_DISABLE_BOOL(pedantic,
8102 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
8103 _PEDANTIC= )
8104 if test "$_PEDANTIC"; then
8105     _SAVE_CXXFLAGS=$CXXFLAGS
8106     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8107     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
8108     AC_TRY_COMPILE([$configure_static_assert_macros],
8109                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
8110                    result="no", result="yes" )
8111     AC_MSG_RESULT([$result])
8112     CXXFLAGS="$_SAVE_CXXFLAGS"
8114     case "$result" in
8115     no)
8116         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8117         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8118         ;;
8119     yes)
8120         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
8121         ;;
8122     esac
8125 dnl ========================================================
8126 dnl Test for correct temporary object destruction order
8127 dnl ========================================================
8128 dnl We want to make sure the compiler follows the C++ spec here as 
8129 dnl xpcom and the string classes depend on it (bug 235381).
8130 AC_MSG_CHECKING([for correct temporary object destruction order])
8131 AC_TRY_RUN([ class A {
8132              public:  A(int& x) : mValue(x) {}
8133                       ~A() { mValue--; }
8134                       operator char**() { return 0; }
8135              private:  int& mValue;
8136              };
8137              void func(char **arg) {}
8138              int m=2;
8139              void test() {
8140                   func(A(m));
8141                   if (m==1) m = 0;
8142              }
8143              int main() {
8144                  test();
8145                  return(m);
8146              }
8147              ],
8148      result="yes", result="no", result="maybe")
8149 AC_MSG_RESULT([$result])
8151 if test "$result" = "no"; then
8152     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
8155 dnl ========================================================
8156 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
8157 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8158 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
8159 dnl ========================================================
8160 _SAVE_CXXFLAGS=$CXXFLAGS
8161 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8162 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8163     ac_nscap_nonconst_opeq_bug,
8164     [AC_TRY_COMPILE([
8165                       template <class T>
8166                       class Pointer
8167                         {
8168                         public:
8169                           T* myPtr;
8170                         };
8171                       
8172                       template <class T, class U>
8173                       int operator==(const Pointer<T>& rhs, U* lhs)
8174                         {
8175                           return rhs.myPtr == lhs;
8176                         }
8177                       
8178                       template <class T, class U>
8179                       int operator==(const Pointer<T>& rhs, const U* lhs)
8180                         {
8181                           return rhs.myPtr == lhs;
8182                         }
8183                     ],
8184                     [
8185                       Pointer<int> foo;
8186                       const int* bar;
8187                       return foo == bar;
8188                     ],
8189                     ac_nscap_nonconst_opeq_bug="no",
8190                     ac_nscap_nonconst_opeq_bug="yes")])
8191 CXXFLAGS="$_SAVE_CXXFLAGS"
8193 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8194     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8196 fi # SKIP_COMPILER_CHECKS
8198 dnl ========================================================
8199 dnl C++ rtti
8200 dnl Should be smarter and check that the compiler does indeed have rtti
8201 dnl ========================================================
8203 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
8204 [  --enable-cpp-rtti       Enable C++ RTTI ],
8205 [ _MOZ_USE_RTTI=1 ],
8206 [ _MOZ_USE_RTTI= ])
8208 if test "$_MOZ_USE_RTTI"; then
8209    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
8210 else
8211    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
8214 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
8216 dnl ========================================================
8217 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8218 dnl Should be smarter and check that the compiler does indeed have exceptions
8219 dnl ========================================================
8220 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8221 [  --enable-cpp-exceptions Enable C++ exceptions ],
8222 [ _MOZ_CPP_EXCEPTIONS=1 ],
8223 [ _MOZ_CPP_EXCEPTIONS= ])
8225 if test "$_MOZ_CPP_EXCEPTIONS"; then
8226     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8227     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8228 else
8229     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8232 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8234 # Irix & OSF native compilers do not like exception declarations 
8235 # when exceptions are disabled
8236 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8237     AC_DEFINE(CPP_THROW_NEW, [])
8238 else
8239     AC_DEFINE(CPP_THROW_NEW, [throw()])
8241 AC_LANG_C
8243 dnl ========================================================
8244 dnl =
8245 dnl = Check what kind of list files are supported by the
8246 dnl = linker
8247 dnl =
8248 dnl ========================================================
8250 AC_CACHE_CHECK(what kind of list files are supported by the linker,
8251     EXPAND_LIBS_LIST_STYLE,
8252     [echo "int main() {return 0;}" > conftest.${ac_ext}
8253      if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&2) && test -s conftest.${OBJ_SUFFIX}; then
8254          echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list
8255          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
8256              EXPAND_LIBS_LIST_STYLE=linkerscript
8257          else
8258              echo "conftest.${OBJ_SUFFIX}" > conftest.list
8259              if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS @conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
8260                  EXPAND_LIBS_LIST_STYLE=list
8261              else
8262                  EXPAND_LIBS_LIST_STYLE=none
8263              fi
8264          fi
8265      else
8266          dnl We really don't expect to get here, but just in case
8267          AC_ERROR([couldn't compile a simple C file])
8268      fi
8269      rm -rf conftest*])
8271 LIBS_DESC_SUFFIX=desc
8272 AC_SUBST(LIBS_DESC_SUFFIX)
8273 AC_SUBST(EXPAND_LIBS_LIST_STYLE)
8275 dnl ========================================================
8276 dnl =
8277 dnl = Build depencency options
8278 dnl =
8279 dnl ========================================================
8280 MOZ_ARG_HEADER(Build dependencies)
8282 dnl ========================================================
8283 dnl = Do not auto generate dependency info
8284 dnl ========================================================
8285 MOZ_AUTO_DEPS=1
8286 MOZ_ARG_DISABLE_BOOL(auto-deps,
8287 [  --disable-auto-deps     Do not automatically generate dependency info],
8288     MOZ_AUTO_DEPS=,
8289     MOZ_AUTO_DEPS=1)
8291 if test -n "$MOZ_AUTO_DEPS"; then
8292 dnl ========================================================
8293 dnl = Use mkdepend instead of $CC -MD for dependency generation
8294 dnl ========================================================
8295 _cpp_md_flag=
8296 MOZ_ARG_DISABLE_BOOL(md,
8297 [  --disable-md            Do not use compiler-based dependencies ],
8298   [_cpp_md_flag=],
8299   [_cpp_md_flag=1],
8300   [dnl Default is to turn on -MD if using GNU-compatible compilers
8301    if test "$GNU_CC" -a "$GNU_CXX"; then
8302      _cpp_md_flag=1
8303    fi
8304   dnl Default is to use -xM if using Sun Studio on Solaris
8305    if test "$SOLARIS_SUNPRO_CC"; then
8306      _cpp_md_flag=1
8307    fi])
8308 if test "$_cpp_md_flag"; then
8309   COMPILER_DEPEND=1
8310   _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8311   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8312   if test "$SOLARIS_SUNPRO_CC"; then
8313     _DEPEND_CFLAGS=
8314   fi
8315 else
8316   COMPILER_DEPEND=
8317   dnl Don't override this for MSVC
8318   if test -z "$_WIN32_MSVC"; then
8319     _USE_CPP_INCLUDE_FLAG=
8320     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8321     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8322   else
8323     echo '#include <stdio.h>' > dummy-hello.c
8324     changequote(,)
8325     CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8326     changequote([,])
8327     if test -z "$CL_INCLUDES_PREFIX"; then
8328         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8329     fi
8330     AC_SUBST(CL_INCLUDES_PREFIX)
8331     rm -f dummy-hello.c
8332     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8333     dnl cl.py provides dependency generation for MSVC
8334     CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8335     CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8336     COMPILER_DEPEND=1
8337   fi
8339 fi # MOZ_AUTO_DEPS
8340 MDDEPDIR='.deps'
8341 AC_SUBST(MOZ_AUTO_DEPS)
8342 AC_SUBST(COMPILER_DEPEND)
8343 AC_SUBST(MDDEPDIR)
8344 AC_SUBST(CC_WRAPPER)
8345 AC_SUBST(CXX_WRAPPER)
8348 dnl ========================================================
8349 dnl =
8350 dnl = Static Build Options
8351 dnl =
8352 dnl ========================================================
8353 MOZ_ARG_HEADER(Static build options)
8355 MOZ_ARG_ENABLE_BOOL(static,
8356 [  --enable-static         Enable building internal static libs],
8357     BUILD_STATIC_LIBS=1,
8358     BUILD_STATIC_LIBS=)
8360 MOZ_ENABLE_LIBXUL=1
8362 MOZ_ARG_DISABLE_BOOL(libxul,
8363 [  --disable-libxul        Disable building libxul (not supported)],
8364     MOZ_ENABLE_LIBXUL=,
8365     MOZ_ENABLE_LIBXUL=1)
8367 if test -z "$MOZ_ENABLE_LIBXUL"; then
8368   AC_MSG_ERROR([--disable-libxul is no longer supported.])
8371 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8372 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
8373   ENABLE_SHARED_JS=1
8376 MOZ_ARG_ENABLE_BOOL(shared-js,
8377 [  --enable-shared-js
8378                           Create a shared JavaScript library.],
8379     ENABLE_SHARED_JS=1,
8380     ENABLE_SHARED_JS=)
8382 if test -n "$ENABLE_SHARED_JS"; then
8383   JS_SHARED_LIBRARY=1
8384   MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8385 else
8386   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8387   AC_DEFINE(MOZ_STATIC_JS)
8389 AC_SUBST(JS_SHARED_LIBRARY)
8391 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8392   AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME.])
8395 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8396   AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8399 AC_SUBST(LIBXUL_LIBS)
8400 XPCOM_LIBS="$LIBXUL_LIBS"
8401 AC_DEFINE(MOZ_ENABLE_LIBXUL)
8403 dnl ========================================================
8404 dnl =
8405 dnl = Standalone module options
8406 dnl = 
8407 dnl ========================================================
8408 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8410 dnl Check for GLib and libIDL.
8411 dnl ========================================================
8412 SKIP_IDL_CHECK="no"
8414 if test -z "$COMPILE_ENVIRONMENT"; then
8415     SKIP_IDL_CHECK="yes"
8418 dnl = Allow users to disable libIDL checking for standalone modules
8419 MOZ_ARG_WITHOUT_BOOL(libIDL,
8420 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8421         SKIP_IDL_CHECK="yes")
8423 if test -z "$CROSS_COMPILE"; then
8424     if test -z "$HOST_LIBIDL_CONFIG"; then
8425         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8426     fi
8427     if test -z "$HOST_LIBIDL_PREFIX"; then
8428         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8429     fi
8432 if test "$SKIP_IDL_CHECK" = "no"
8433 then
8434     _LIBIDL_FOUND=
8435     case "$host" in
8436     *-mingw*)
8437         if test -n "$GLIB_PREFIX"; then
8438             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8439             if test "$?" = "0"; then
8440                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8441                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8442                 fi
8443             else
8444                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8445             fi
8446         else
8447             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8448         fi
8449         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8450             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8451         fi
8452         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8453         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8454             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8455         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8456             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8457         else
8458             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8459         fi
8461         if test -n "$HOST_LIBIDL_PREFIX"; then
8462             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8463             if test "$?" = "0"; then
8464                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8465                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8466                 fi
8467             else
8468                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8469             fi
8470         else
8471             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8472         fi        
8473         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8474             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8475         fi
8476         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8477         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8478             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8479             STATIC_LIBIDL=1
8480         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8481             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8482         else
8483             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8484         fi
8485         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8486         _LIBIDL_FOUND=1
8487         ;;
8488     esac
8490     if test -z "$_LIBIDL_FOUND"; then
8491         if test "$MACOS_SDK_DIR"; then 
8492             dnl xpidl, and therefore libIDL, is only needed on the build host.
8493             dnl Don't build it against the SDK, as that causes problems.
8494             _MACSAVE_CFLAGS="$CFLAGS"
8495             _MACSAVE_LIBS="$LIBS"
8496             _MACSAVE_LDFLAGS="$LDFLAGS"
8497             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8498           changequote(,)
8499           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"`
8500           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8501           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8502           changequote([,])
8503           unset NEXT_ROOT
8504         fi
8506         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8507     fi
8509     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8510     dnl to either libIDL1 or libIDL2.
8511     if test -z "$_LIBIDL_FOUND"; then
8512         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8513         if test -z "$_LIBIDL_FOUND"; then
8514             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8515         fi
8516     fi
8517     dnl
8518     dnl If we don't have a libIDL config program & not cross-compiling, 
8519     dnl     look for orbit-config instead.
8520     dnl
8521     if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8522         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8523         if test -n "$ORBIT_CONFIG"; then
8524             AC_MSG_CHECKING([for ORBit libIDL usability])
8525                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8526             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8527             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8528             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8529             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8530             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8531             HOST_LIBIDL_CONFIG=
8532             _SAVE_CFLAGS="$CFLAGS"
8533             _SAVE_LIBS="$LIBS"
8534             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8535             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8536             AC_TRY_RUN([
8537 #include <stdlib.h>
8538 #include <libIDL/IDL.h>
8539 int main() {
8540   char *s;
8541   s=strdup(IDL_get_libver_string());
8542   if(s==NULL) {
8543     exit(1);
8544   }
8545   exit(0);
8547             ], [_LIBIDL_FOUND=1
8548                 result="yes"],
8549                [HOST_LIBIDL_CFLAGS=
8550                 HOST_LIBIDL_LIBS=
8551                 result="no"],
8552                [_LIBIDL_FOUND=1
8553                 result="maybe"] )
8554             AC_MSG_RESULT($result)
8555             CFLAGS="$_SAVE_CFLAGS"
8556             LIBS="$_SAVE_LIBS"
8557         fi
8558     fi
8559     if test -z "$_LIBIDL_FOUND"; then
8560         AC_MSG_ERROR([libIDL not found.
8561         libIDL $LIBIDL_VERSION or higher is required.])
8562     fi
8563     if test "$MACOS_SDK_DIR"; then
8564       CFLAGS="$_MACSAVE_CFLAGS"
8565       LIBS="$_MACSAVE_LIBS"
8566       LDFLAGS="$_MACSAVE_LDFLAGS"
8567       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8568         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8569       fi
8570     fi
8573 if test -n "$CROSS_COMPILE"; then
8574     case "$target" in
8575     *-mingw*)
8576         if test -n "$GLIB_PREFIX"; then
8577             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8578             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8579                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8580             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8581                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8582             else
8583                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8584             fi
8585         fi
8587         if test -n "$LIBIDL_PREFIX"; then
8588             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8589             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8590                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8591                 STATIC_LIBIDL=1
8592             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8593                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8594             else
8595                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8596             fi
8597         fi
8598         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8599         ;;
8600     *)
8601         if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8602             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8603             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8604         fi
8605         ;;
8606     esac
8607 else
8608     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8609     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8612 if test -z "$SKIP_PATH_CHECKS"; then
8613 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8614     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8615         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8616     else
8617         AM_PATH_GLIB(${GLIB_VERSION})
8618     fi
8622 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8623     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8626 AC_SUBST(LIBIDL_CFLAGS)
8627 AC_SUBST(LIBIDL_LIBS)
8628 AC_SUBST(STATIC_LIBIDL)
8629 AC_SUBST(GLIB_CFLAGS)
8630 AC_SUBST(GLIB_LIBS)
8631 AC_SUBST(GLIB_GMODULE_LIBS)
8632 AC_SUBST(HOST_LIBIDL_CONFIG)
8633 AC_SUBST(HOST_LIBIDL_CFLAGS)
8634 AC_SUBST(HOST_LIBIDL_LIBS)
8636 dnl ========================================================
8637 dnl Check for cairo
8638 dnl ========================================================
8639 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8641 MOZ_TREE_CAIRO=1
8642 MOZ_ARG_ENABLE_BOOL(system-cairo,
8643 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8644 MOZ_TREE_CAIRO=,
8645 MOZ_TREE_CAIRO=1 )
8647 MOZ_TREE_PIXMAN=1
8648 MOZ_ARG_ENABLE_BOOL(system-pixman,
8649 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8650 MOZ_TREE_PIXMAN=,
8651 MOZ_TREE_PIXMAN=1 )
8653 # Check for headers defining standard int types.
8654 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8656 if test "$MOZ_TREE_CAIRO"; then
8657     AC_DEFINE(MOZ_TREE_CAIRO)
8659     # For now we assume that we will have a uint64_t available through
8660     # one of the above headers or mozstdint.h.
8661     AC_DEFINE(HAVE_UINT64_T)
8663     # Define macros for cairo-features.h
8664     if test "$MOZ_X11"; then
8665         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8666         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8667         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8668         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8669         MOZ_ENABLE_CAIRO_FT=1
8670         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8671     fi
8672     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8673         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8674     fi
8675     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8676         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8677         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8678         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8679     fi
8680     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8681         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8682         if test -z "$WINCE"; then
8683             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8684             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8685                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8686                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8687                 MOZ_ENABLE_D2D_SURFACE=1
8688                 MOZ_ENABLE_DWRITE_FONT=1
8689             else
8690                 WIN32_DWRITE_FONT_FEATURE=
8691                 WIN32_D2D_SURFACE_FEATURE=
8692             fi
8693         else
8694             WIN32_FONT_FEATURE=
8695             WIN32_DWRITE_FONT_FEATURE=
8696             WIN32_D2D_SURFACE_FEATURE=
8697         fi
8699         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8701         dnl D3D10 Layers depend on D2D Surfaces.
8702         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8703           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8704         fi
8706     fi
8707     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8708         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8709         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8710         MOZ_ENABLE_CAIRO_FT=1
8711         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8712         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8713     fi
8714     if test "$USE_FC_FREETYPE"; then
8715         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8716     fi
8717     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8718     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8719     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8720     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8721     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8722     AC_SUBST(CAIRO_FT_CFLAGS)
8723     AC_SUBST(HAS_OGLES)
8725     if test "$MOZ_DEBUG"; then
8726       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8727     else
8728       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8729     fi
8731     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8733     AC_SUBST(PS_SURFACE_FEATURE)
8734     AC_SUBST(PDF_SURFACE_FEATURE)
8735     AC_SUBST(SVG_SURFACE_FEATURE)
8736     AC_SUBST(XLIB_SURFACE_FEATURE)
8737     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8738     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8739     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8740     AC_SUBST(XCB_SURFACE_FEATURE)
8741     AC_SUBST(WIN32_SURFACE_FEATURE)
8742     AC_SUBST(OS2_SURFACE_FEATURE)
8743     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8744     AC_SUBST(FT_FONT_FEATURE)
8745     AC_SUBST(FC_FONT_FEATURE)
8746     AC_SUBST(WIN32_FONT_FEATURE)
8747     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8748     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8749     AC_SUBST(QUARTZ_FONT_FEATURE)
8750     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8751     AC_SUBST(QT_SURFACE_FEATURE)
8753     MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8755     if test "$MOZ_TREE_PIXMAN"; then
8756         AC_DEFINE(MOZ_TREE_PIXMAN)
8757         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8758     else
8759         PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8760         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8761         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8762     fi
8764     if test "$MOZ_X11"; then
8765         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8766     fi
8768     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8769     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8771 else
8772    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8773    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8774    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8775    PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8776    if test "$MOZ_X11"; then
8777         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8778         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8779         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8780    fi
8783 AC_SUBST(MOZ_TREE_CAIRO)
8784 AC_SUBST(MOZ_CAIRO_CFLAGS)
8785 AC_SUBST(MOZ_CAIRO_LIBS)
8786 AC_SUBST(MOZ_TREE_PIXMAN)
8788 dnl ========================================================
8789 dnl qcms
8790 dnl ========================================================
8792 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8793 AC_SUBST(QCMS_LIBS)
8795 dnl ========================================================
8796 dnl HarfBuzz
8797 dnl ========================================================
8798 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8799 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8801 dnl ========================================================
8802 dnl OTS
8803 dnl ========================================================
8804 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8805 AC_SUBST(MOZ_OTS_LIBS)
8807 dnl ========================================================
8808 dnl disable xul
8809 dnl ========================================================
8810 MOZ_ARG_DISABLE_BOOL(xul,
8811 [  --disable-xul           Disable XUL],
8812     MOZ_XUL= )
8813 if test "$MOZ_XUL"; then
8814   AC_DEFINE(MOZ_XUL)
8815 else
8816   dnl remove extensions that require XUL
8817   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8820 AC_SUBST(MOZ_XUL)
8822 dnl ========================================================
8823 dnl disable profile locking
8824 dnl   do no use this in applications that can have more than
8825 dnl   one process accessing the profile directory.
8826 dnl ========================================================
8827 MOZ_ARG_DISABLE_BOOL(profilelocking,
8828 [  --disable-profilelocking
8829                           Disable profile locking],
8830     MOZ_PROFILELOCKING=,
8831     MOZ_PROFILELOCKING=1 )
8832 if test "$MOZ_PROFILELOCKING"; then
8833   AC_DEFINE(MOZ_PROFILELOCKING)
8836 dnl ========================================================
8837 dnl disable rdf services
8838 dnl ========================================================
8839 MOZ_ARG_DISABLE_BOOL(rdf,
8840 [  --disable-rdf           Disable RDF],
8841     MOZ_RDF= )
8842 if test "$MOZ_RDF"; then
8843   AC_DEFINE(MOZ_RDF)
8846 AC_SUBST(MOZ_RDF)
8848 dnl ========================================================
8849 dnl necko configuration options
8850 dnl ========================================================
8853 dnl option to disable various necko protocols
8855 MOZ_ARG_ENABLE_STRING(necko-protocols,
8856 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8857                           Enable/disable specific protocol handlers],
8858 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8859     if test "$option" = "yes" -o "$option" = "all"; then
8860         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8861     elif test "$option" = "no" -o "$option" = "none"; then
8862         NECKO_PROTOCOLS=""
8863     elif test "$option" = "default"; then
8864         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8865     elif test `echo "$option" | grep -c \^-` != 0; then
8866         option=`echo $option | sed 's/^-//'`
8867         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8868     else
8869         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8870     fi
8871 done],
8872     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8873 dnl Remove dupes
8874 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8875 AC_SUBST(NECKO_PROTOCOLS)
8876 for p in $NECKO_PROTOCOLS; do
8877     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8878 done
8881 dnl option to disable necko's disk cache
8883 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8884 [  --disable-necko-disk-cache
8885                           Disable necko disk cache],
8886     NECKO_DISK_CACHE=,
8887     NECKO_DISK_CACHE=1)
8888 AC_SUBST(NECKO_DISK_CACHE)
8889 if test "$NECKO_DISK_CACHE"; then
8890     AC_DEFINE(NECKO_DISK_CACHE)
8894 dnl option to disable necko's wifi scanner
8896 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8897 [  --disable-necko-wifi    Disable necko wifi scanner],
8898     NECKO_WIFI=,
8899     NECKO_WIFI=1)
8901 if test "$OS_ARCH" = "OS2"; then
8902   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8903   NECKO_WIFI=
8905 if test "$NECKO_WIFI" -a \
8906         "$OS_ARCH" != "Linux" -a \
8907         "$OS_ARCH" != "Darwin" -a \
8908         "$OS_ARCH" != "SunOS" -a \
8909         "$OS_ARCH" != "WINNT" -a \
8910         "$OS_ARCH" != "WINCE"; then
8911   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8914 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8915 then
8916   MOZ_CHECK_HEADER([iwlib.h])
8917   if test "$ac_cv_header_iwlib_h" != "yes"; then
8918     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])
8919   fi
8922 if test "$NECKO_WIFI"; then
8923   AC_DEFINE(NECKO_WIFI)
8925 AC_SUBST(NECKO_WIFI)
8928 dnl option to disable cookies
8930 MOZ_ARG_DISABLE_BOOL(cookies,
8931 [  --disable-cookies       Disable cookie support],
8932     NECKO_COOKIES=,
8933     NECKO_COOKIES=1)
8934 AC_SUBST(NECKO_COOKIES)
8935 if test "$NECKO_COOKIES"; then
8936     AC_DEFINE(NECKO_COOKIES)
8940 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8942 MOZ_ARG_DISABLE_BOOL(ctypes,
8943 [  --disable-ctypes        Disable js-ctypes],
8944     BUILD_CTYPES=,
8945     BUILD_CTYPES=1)
8946 AC_SUBST(BUILD_CTYPES)
8947 if test "$BUILD_CTYPES"; then
8948   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8949     # Disable ctypes for arm/wince.
8950     BUILD_CTYPES=
8951   else
8952     AC_DEFINE(BUILD_CTYPES)
8953   fi
8956 dnl NECKO_ configuration options are not global
8957 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8959 dnl Only build Mork if it's required
8960 AC_SUBST(MOZ_MORK)
8961 if test "$MOZ_MORK"; then
8962   AC_DEFINE(MOZ_MORK)
8965 dnl Build the lightweight Mork reader if required
8966 AC_SUBST(MOZ_MORKREADER)
8967 if test "$MOZ_MORKREADER"; then
8968   AC_DEFINE(MOZ_MORKREADER)
8971 dnl Build Places if required
8972 if test "$MOZ_PLACES"; then
8973   AC_DEFINE(MOZ_PLACES)
8976 dnl Build Sync Services if required
8977 AC_SUBST(MOZ_SERVICES_SYNC)
8978 if test -n "$MOZ_SERVICES_SYNC"; then
8979   AC_DEFINE(MOZ_SERVICES_SYNC)
8982 dnl ========================================================
8983 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8984     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8987 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8988   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8991 dnl ========================================================
8992 dnl =
8993 dnl = Maintainer debug option (no --enable equivalent)
8994 dnl =
8995 dnl ========================================================
8997 AC_SUBST(AR)
8998 AC_SUBST(AR_FLAGS)
8999 AC_SUBST(AR_LIST)
9000 AC_SUBST(AR_EXTRACT)
9001 AC_SUBST(AR_DELETE)
9002 AC_SUBST(AS)
9003 AC_SUBST(ASFLAGS)
9004 AC_SUBST(AS_DASH_C_FLAG)
9005 AC_SUBST(LD)
9006 AC_SUBST(RC)
9007 AC_SUBST(RCFLAGS)
9008 AC_SUBST(WINDRES)
9009 AC_SUBST(IMPLIB)
9010 AC_SUBST(FILTER)
9011 AC_SUBST(BIN_FLAGS)
9012 AC_SUBST(NS_USE_NATIVE)
9013 AC_SUBST(MOZ_WIDGET_TOOLKIT)
9014 AC_SUBST(MOZ_UPDATE_XTERM)
9015 AC_SUBST(MINIMO)
9016 AC_SUBST(MOZ_PLATFORM_MAEMO)
9017 AC_SUBST(MOZ_AUTH_EXTENSION)
9018 AC_SUBST(MOZ_MATHML)
9019 AC_SUBST(MOZ_PERMISSIONS)
9020 AC_SUBST(MOZ_XTF)
9021 AC_SUBST(MOZ_PREF_EXTENSIONS)
9022 AC_SUBST(MOZ_SVG)
9023 AC_SUBST(MOZ_SMIL)
9024 AC_SUBST(MOZ_XSLT_STANDALONE)
9025 AC_SUBST(MOZ_JS_LIBS)
9026 AC_SUBST(MOZ_PSM)
9027 AC_SUBST(MOZ_DEBUG)
9028 AC_SUBST(MOZ_DEBUG_SYMBOLS)
9029 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
9030 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
9031 AC_SUBST(MOZ_DEBUG_FLAGS)
9032 AC_SUBST(MOZ_DEBUG_LDFLAGS)
9033 AC_SUBST(WARNINGS_AS_ERRORS)
9034 AC_SUBST(MOZ_EXTENSIONS)
9035 AC_SUBST(MOZ_JSDEBUGGER)
9036 AC_SUBST(MOZ_PLUGINS)
9037 AC_SUBST(MOZ_LOG_REFCNT)
9038 AC_SUBST(MOZ_LEAKY)
9039 AC_SUBST(MOZ_JPROF)
9040 AC_SUBST(MOZ_SHARK)
9041 AC_SUBST(MOZ_CALLGRIND)
9042 AC_SUBST(MOZ_VTUNE)
9043 AC_SUBST(MOZ_PROFILING)
9044 AC_SUBST(MOZ_USE_NATIVE_UCONV)
9045 AC_SUBST(MOZ_QUANTIFY)
9046 AC_SUBST(LIBICONV)
9047 AC_SUBST(MOZ_PLACES)
9048 AC_SUBST(MOZ_PLACES_BOOKMARKS)
9049 AC_SUBST(MOZ_STORAGE)
9050 AC_SUBST(MOZ_TOOLKIT_SEARCH)
9051 AC_SUBST(MOZ_FEEDS)
9052 AC_SUBST(NS_PRINTING)
9053 AC_SUBST(MOZ_WEBGL)
9054 AC_SUBST(MOZ_HELP_VIEWER)
9056 AC_SUBST(MOZ_JAVAXPCOM)
9057 AC_SUBST(JAVA_INCLUDE_PATH)
9058 AC_SUBST(JAVA)
9059 AC_SUBST(JAVAC)
9060 AC_SUBST(JAR)
9062 AC_SUBST(MOZ_PROFILELOCKING)
9064 AC_SUBST(HAVE_XIE)
9065 AC_SUBST(MOZ_XIE_LIBS)
9067 AC_SUBST(BUILD_STATIC_LIBS)
9068 AC_SUBST(MOZ_ENABLE_LIBXUL)
9069 AC_SUBST(ENABLE_TESTS)
9070 AC_SUBST(IBMBIDI)
9071 AC_SUBST(MOZ_UNIVERSALCHARDET)
9072 AC_SUBST(ACCESSIBILITY)
9073 AC_SUBST(MOZ_SPELLCHECK)
9074 AC_SUBST(MOZ_USER_DIR)
9075 AC_SUBST(MOZ_CRASHREPORTER)
9076 AC_SUBST(MOZ_UPDATER)
9077 AC_SUBST(MOZ_ANGLE)
9078 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
9079 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
9080 AC_SUBST(MOZ_D3DX9_VERSION)
9081 AC_SUBST(MOZ_D3DX9_CAB)
9082 AC_SUBST(MOZ_D3DCOMPILER_CAB)
9083 AC_SUBST(MOZ_D3DX9_DLL)
9084 AC_SUBST(MOZ_D3DCOMPILER_DLL)
9086 AC_SUBST(ENABLE_STRIP)
9087 AC_SUBST(PKG_SKIP_STRIP)
9088 AC_SUBST(USE_ELF_DYNSTR_GC)
9089 AC_SUBST(USE_ELF_HACK)
9090 AC_SUBST(INCREMENTAL_LINKER)
9091 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
9092 AC_SUBST(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
9093 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
9095 AC_SUBST(MOZ_FIX_LINK_PATHS)
9096 AC_SUBST(XPCOM_LIBS)
9097 AC_SUBST(XPCOM_FROZEN_LDOPTS)
9098 AC_SUBST(XPCOM_GLUE_LDOPTS)
9099 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
9101 AC_SUBST(USE_DEPENDENT_LIBS)
9103 AC_SUBST(MOZ_BUILD_ROOT)
9104 AC_SUBST(MOZ_OS2_TOOLS)
9106 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
9107 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
9108 AC_SUBST(MOZ_TIMELINE)
9109 AC_SUBST(OGLES_SDK_DIR)
9111 AC_SUBST(MOZ_APP_NAME)
9112 AC_SUBST(MOZ_APP_DISPLAYNAME)
9113 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
9114 AC_SUBST(MOZ_APP_UA_NAME)
9115 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
9116 AC_SUBST(MOZ_APP_VERSION)
9117 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
9118 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
9119 AC_SUBST(FIREFOX_VERSION)
9120 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
9121 AC_SUBST(MOZ_UA_BUILDID)
9123 AC_SUBST(MOZ_PKG_SPECIAL)
9125 AC_SUBST(MOZILLA_OFFICIAL)
9127 dnl win32 options
9128 AC_SUBST(MOZ_MAPINFO)
9129 AC_SUBST(MOZ_BROWSE_INFO)
9130 AC_SUBST(MOZ_TOOLS_DIR)
9131 AC_SUBST(WIN32_REDIST_DIR)
9132 AC_SUBST(PYTHON)
9133 AC_SUBST(MAKENSISU)
9135 AC_SUBST(WINCE)
9136 AC_SUBST(WINCE_SDK_DIR)
9137 AC_SUBST(WINCE_WINDOWS_MOBILE)
9139 dnl Echo the CFLAGS to remove extra whitespace.
9140 CFLAGS=`echo \
9141         $_WARNINGS_CFLAGS \
9142         $CFLAGS`
9144 CXXFLAGS=`echo \
9145         $_MOZ_RTTI_FLAGS \
9146         $_MOZ_EXCEPTIONS_FLAGS \
9147         $_WARNINGS_CXXFLAGS \
9148         $CXXFLAGS`
9150 COMPILE_CFLAGS=`echo \
9151     $_DEFINES_CFLAGS \
9152         $_DEPEND_CFLAGS \
9153     $COMPILE_CFLAGS`
9155 COMPILE_CXXFLAGS=`echo \
9156     $_DEFINES_CXXFLAGS \
9157         $_DEPEND_CFLAGS \
9158     $COMPILE_CXXFLAGS`
9160 AC_SUBST(SYSTEM_MAKEDEPEND)
9161 AC_SUBST(SYSTEM_LIBXUL)
9162 AC_SUBST(SYSTEM_JPEG)
9163 AC_SUBST(SYSTEM_PNG)
9164 AC_SUBST(SYSTEM_ZLIB)
9165 AC_SUBST(SYSTEM_BZ2)
9167 AC_SUBST(JPEG_CFLAGS)
9168 AC_SUBST(JPEG_LIBS)
9169 AC_SUBST(ZLIB_CFLAGS)
9170 AC_SUBST(ZLIB_LIBS)
9171 AC_SUBST(BZ2_CFLAGS)
9172 AC_SUBST(BZ2_LIBS)
9173 AC_SUBST(PNG_CFLAGS)
9174 AC_SUBST(PNG_LIBS)
9176 AC_SUBST(MOZ_JPEG_CFLAGS)
9177 AC_SUBST(MOZ_JPEG_LIBS)
9178 AC_SUBST(MOZ_ZLIB_CFLAGS)
9179 AC_SUBST(MOZ_ZLIB_LIBS)
9180 AC_SUBST(MOZ_BZ2_CFLAGS)
9181 AC_SUBST(MOZ_BZ2_LIBS)
9182 AC_SUBST(MOZ_PNG_CFLAGS)
9183 AC_SUBST(MOZ_PNG_LIBS)
9185 AC_SUBST(NSPR_CFLAGS)
9186 AC_SUBST(NSPR_LIBS)
9187 AC_SUBST(MOZ_NATIVE_NSPR)
9189 AC_SUBST(NSS_CFLAGS)
9190 AC_SUBST(NSS_LIBS)
9191 AC_SUBST(NSS_DEP_LIBS)
9192 AC_SUBST(MOZ_NATIVE_NSS)
9193 AC_SUBST(NSS_DISABLE_DBM)
9195 AC_SUBST(CFLAGS)
9196 AC_SUBST(CXXFLAGS)
9197 AC_SUBST(CPPFLAGS)
9198 AC_SUBST(COMPILE_CFLAGS)
9199 AC_SUBST(COMPILE_CXXFLAGS)
9200 AC_SUBST(LDFLAGS)
9201 AC_SUBST(LIBS)
9202 AC_SUBST(CROSS_COMPILE)
9203 AC_SUBST(WCHAR_CFLAGS)
9205 AC_SUBST(HOST_CC)
9206 AC_SUBST(HOST_CXX)
9207 AC_SUBST(HOST_CFLAGS)
9208 AC_SUBST(HOST_CXXFLAGS)
9209 AC_SUBST(HOST_LDFLAGS)
9210 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9211 AC_SUBST(HOST_AR)
9212 AC_SUBST(HOST_AR_FLAGS)
9213 AC_SUBST(HOST_LD)
9214 AC_SUBST(HOST_RANLIB)
9215 AC_SUBST(HOST_NSPR_MDCPUCFG)
9216 AC_SUBST(HOST_BIN_SUFFIX)
9217 AC_SUBST(HOST_OS_ARCH)
9219 AC_SUBST(TARGET_CPU)
9220 AC_SUBST(TARGET_VENDOR)
9221 AC_SUBST(TARGET_OS)
9222 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9223 AC_SUBST(TARGET_MD_ARCH)
9224 AC_SUBST(TARGET_XPCOM_ABI)
9225 AC_SUBST(OS_TARGET)
9226 AC_SUBST(OS_ARCH)
9227 AC_SUBST(OS_RELEASE)
9228 AC_SUBST(OS_TEST)
9229 AC_SUBST(CPU_ARCH)
9230 AC_SUBST(INTEL_ARCHITECTURE)
9232 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9233 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9235 AC_SUBST(WRAP_MALLOC_CFLAGS)
9236 AC_SUBST(WRAP_MALLOC_LIB)
9237 AC_SUBST(MKSHLIB)
9238 AC_SUBST(MKCSHLIB)
9239 AC_SUBST(MKSHLIB_FORCE_ALL)
9240 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9241 AC_SUBST(DSO_CFLAGS)
9242 AC_SUBST(DSO_PIC_CFLAGS)
9243 AC_SUBST(DSO_LDOPTS)
9244 AC_SUBST(LIB_PREFIX)
9245 AC_SUBST(DLL_PREFIX)
9246 AC_SUBST(DLL_SUFFIX)
9247 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9248 AC_SUBST(LIB_SUFFIX)
9249 AC_SUBST(OBJ_SUFFIX)
9250 AC_SUBST(BIN_SUFFIX)
9251 AC_SUBST(ASM_SUFFIX)
9252 AC_SUBST(IMPORT_LIB_SUFFIX)
9253 AC_SUBST(USE_N32)
9254 AC_SUBST(CC_VERSION)
9255 AC_SUBST(CXX_VERSION)
9256 AC_SUBST(MSMANIFEST_TOOL)
9257 AC_SUBST(NS_ENABLE_TSF)
9258 AC_SUBST(MOZ_NSS_PATCH)
9259 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9260 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9262 AC_SUBST(MOZ_MEDIA)
9263 AC_SUBST(MOZ_SYDNEYAUDIO)
9264 AC_SUBST(MOZ_WAVE)
9265 AC_SUBST(MOZ_VORBIS)
9266 AC_SUBST(MOZ_TREMOR)
9267 AC_SUBST(MOZ_WEBM)
9268 AC_SUBST(MOZ_OGG)
9269 AC_SUBST(MOZ_ALSA_LIBS)
9270 AC_SUBST(VPX_AS)
9271 AC_SUBST(VPX_ASFLAGS)
9272 AC_SUBST(VPX_DASH_C_FLAG)
9273 AC_SUBST(VPX_AS_CONVERSION)
9274 AC_SUBST(VPX_ASM_SUFFIX)
9275 AC_SUBST(VPX_X86_ASM)
9276 AC_SUBST(VPX_ARM_ASM)
9277 AC_SUBST(LIBJPEG_TURBO_AS)
9278 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
9279 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
9280 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
9282 if test "$USING_HCC"; then
9283    CC='${topsrcdir}/build/hcc'
9284    CC="$CC '$_OLDCC'"
9285    CXX='${topsrcdir}/build/hcpp'
9286    CXX="$CXX '$_OLDCXX'"
9287    AC_SUBST(CC)
9288    AC_SUBST(CXX)
9291 AC_MSG_CHECKING([for posix_fallocate])       
9292 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9293   #include <fcntl.h>],
9294                  [posix_fallocate(0, 0, 0);],
9295                  [ac_cv___posix_fallocate=true],
9296                  [ac_cv___posix_fallocate=false])
9298 if test "$ac_cv___posix_fallocate" = true ; then
9299   AC_DEFINE(HAVE_POSIX_FALLOCATE)
9300   AC_MSG_RESULT(yes)
9301 else
9302   AC_MSG_RESULT(no)
9305 dnl Check for missing components
9306 if test "$COMPILE_ENVIRONMENT"; then
9307 if test "$MOZ_X11"; then
9308     dnl ====================================================
9309     dnl = Check if X headers exist
9310     dnl ====================================================
9311     _SAVE_CFLAGS=$CFLAGS
9312     CFLAGS="$CFLAGS $XCFLAGS"
9313     AC_TRY_COMPILE([
9314         #include <stdio.h>
9315         #include <stdlib.h>
9316         #include <X11/Xlib.h>
9317         #include <X11/Intrinsic.h>
9318     ],
9319     [
9320         Display *dpy = 0;
9321         if ((dpy = XOpenDisplay(NULL)) == NULL) {
9322             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9323             exit(1);
9324         }
9325     ], [], 
9326     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9327     CFLAGS="$_SAVE_CFLAGS"
9329     if test ! -z "$MISSING_X"; then
9330         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9331     fi
9333 fi # MOZ_X11
9335 dnl Check for headers, etc. needed by WebGL.
9336 if test -n "$MOZ_WEBGL_GLX"; then
9337     MOZ_CHECK_HEADER(GL/glx.h)
9338     if test "$ac_cv_header_GL_glx_h" != "yes"; then
9339         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
9340     fi
9341 fi # MOZ_WEBGL_GLX
9342 fi # COMPILE_ENVIRONMENT
9344 if test "$USE_FC_FREETYPE"; then
9345     if test "$COMPILE_ENVIRONMENT"; then
9346         _SAVE_CPPFLAGS="$CPPFLAGS"
9347         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9348         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
9349             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9350         CPPFLAGS="$_SAVE_CPPFLAGS"
9351     else
9352         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9353     fi
9356 dnl Set various defines and substitutions
9357 dnl ========================================================
9359 if test "$OS_ARCH" = "Darwin"; then
9360   AC_DEFINE(XP_UNIX)
9361   AC_DEFINE(UNIX_ASYNC_DNS)
9362 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9363   AC_DEFINE(XP_UNIX)
9364   AC_DEFINE(UNIX_ASYNC_DNS)
9367 if test "$MOZ_DEBUG"; then
9368     AC_DEFINE(MOZ_REFLOW_PERF)
9369     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9372 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9373     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9374     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9375     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9376     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9377     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9378     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9379     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9380     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9383 case "$host_os" in
9384 mingw*)
9385     WIN_TOP_SRC=`cd $srcdir; pwd -W`
9386     ;;
9387 esac
9389 AC_SUBST(WIN_TOP_SRC)
9391 AC_SUBST(MOZILLA_VERSION)
9393 AC_SUBST(ac_configure_args)
9395 dnl Spit out some output
9396 dnl ========================================================
9398 dnl The following defines are used by xpcom
9399 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9400 CPP_THROW_NEW
9401 HAVE_CPP_2BYTE_WCHAR_T
9402 HAVE_CPP_ACCESS_CHANGING_USING
9403 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9404 HAVE_CPP_BOOL
9405 HAVE_CPP_CHAR16_T
9406 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9407 HAVE_CPP_EXPLICIT
9408 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9409 HAVE_CPP_NAMESPACE_STD
9410 HAVE_CPP_NEW_CASTS
9411 HAVE_CPP_PARTIAL_SPECIALIZATION
9412 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9413 HAVE_CPP_TYPENAME
9414 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9415 HAVE_STATVFS
9416 NEED_CPP_UNUSED_IMPLEMENTATIONS
9417 NEW_H
9418 HAVE_GETPAGESIZE
9419 HAVE_ICONV
9420 HAVE_ICONV_WITH_CONST_INPUT
9421 HAVE_MBRTOWC
9422 HAVE_SYS_MOUNT_H
9423 HAVE_SYS_VFS_H
9424 HAVE_WCRTOMB
9427 AC_CONFIG_HEADER(
9428 netwerk/necko-config.h
9429 xpcom/xpcom-config.h
9430 xpcom/xpcom-private.h
9433 # Save the defines header file before autoconf removes it.
9434 # (Do not add AC_DEFINE calls after this line.)
9435   _CONFIG_TMP=confdefs-tmp.h
9436   _CONFIG_DEFS_H=mozilla-config.h
9438   cat > $_CONFIG_TMP <<\EOF
9439 /* List of defines generated by configure. Included with preprocessor flag,
9440  * -include, to avoid long list of -D defines on the compile command-line.
9441  * Do not edit.
9442  */
9444 #ifndef _MOZILLA_CONFIG_H_
9445 #define _MOZILLA_CONFIG_H_
9448 _EGREP_PATTERN='^#define ('
9449 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9450     for f in $_NON_GLOBAL_ACDEFINES; do
9451         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9452     done
9454 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9456   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9458   cat >> $_CONFIG_TMP <<\EOF
9460 #endif /* _MOZILLA_CONFIG_H_ */
9464   # Only write mozilla-config.h when something changes (or it doesn't exist)
9465   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9466     rm $_CONFIG_TMP
9467   else
9468     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9469     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9471     echo ==== $_CONFIG_DEFS_H =================================
9472     cat $_CONFIG_DEFS_H
9473   fi
9475 dnl Probably shouldn't call this manually but we always want the output of DEFS
9476 rm -f confdefs.h.save
9477 mv confdefs.h confdefs.h.save
9478 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9479 AC_OUTPUT_MAKE_DEFS()
9480 MOZ_DEFINES=$DEFS
9481 AC_SUBST(MOZ_DEFINES)
9482 rm -f confdefs.h
9483 mv confdefs.h.save confdefs.h
9485 dnl Load the list of Makefiles to generate.
9486 dnl   To add new Makefiles, edit allmakefiles.sh.
9487 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9488 . ${srcdir}/allmakefiles.sh
9489 dnl 
9490 dnl Run a perl script to quickly create the makefiles.
9491 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9492 dnl   for the files it cannot handle correctly. This way, config.status
9493 dnl   will handle these files.
9494 dnl If it fails, nothing is set and config.status will run as usual.
9496 dnl This does not change the $MAKEFILES variable.
9498 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9499 . ./conftest.sh
9500 rm conftest.sh
9502 echo $MAKEFILES > unallmakefiles
9504 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9506 AC_OUTPUT($MAKEFILES)
9508 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9509 if test "$CAIRO_FEATURES_H"; then
9510   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9511     echo "$CAIRO_FEATURES_H is unchanged"
9512     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9513   else
9514     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9515   fi
9518 # Run freetype configure script
9520 if test "$MOZ_TREE_FREETYPE"; then
9521    export CFLAGS="$CFLAGS -std=c99"
9522    export CPPFLAGS="$CPPFLAGS"
9523    export CXXFLAGS="$CXXFLAGS"
9524    export LDFLAGS="$LDFLAGS"
9525    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9526    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9527    AC_OUTPUT_SUBDIRS(modules/freetype2)
9530 dnl ========================================================
9531 dnl = Setup a nice relatively clean build environment for
9532 dnl = sub-configures.
9533 dnl ========================================================
9534 CC="$_SUBDIR_CC" 
9535 CXX="$_SUBDIR_CXX" 
9536 CFLAGS="$_SUBDIR_CFLAGS" 
9537 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9538 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9539 LDFLAGS="$_SUBDIR_LDFLAGS"
9540 HOST_CC="$_SUBDIR_HOST_CC" 
9541 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9542 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9545 unset MAKEFILES
9546 unset CONFIG_FILES
9548 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9549 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9551 if test -n "$MOZ_THUMB2"; then
9552   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9554 if test -n "$MOZ_ARM_ARCH"; then
9555   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --with-cpu-arch=$MOZ_ARM_ARCH"
9557 if test -n "$_WRAP_MALLOC"; then
9558   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9561 if test -z "$MOZ_NATIVE_NSPR"; then
9562     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9563     if test -z "$MOZ_DEBUG"; then
9564         ac_configure_args="$ac_configure_args --disable-debug"
9565     fi
9566     if test "$MOZ_OPTIMIZE" = "1"; then
9567         ac_configure_args="$ac_configure_args --enable-optimize"
9568     fi
9569     if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9570        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9571     fi
9572     if test -n "$HAVE_64BIT_OS"; then
9573         ac_configure_args="$ac_configure_args --enable-64bit"
9574     fi
9575     if test -n "$USE_ARM_KUSER"; then
9576         ac_configure_args="$ac_configure_args --with-arm-kuser"
9577     fi
9578     AC_OUTPUT_SUBDIRS(nsprpub)
9579     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9582 if test -z "$MOZ_NATIVE_NSPR"; then
9583     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9584     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9585     if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9586        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9587        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9588        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9589        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9590     fi
9591     rm -f config/autoconf.mk.bak
9594 # Run the SpiderMonkey 'configure' script.
9595 dist=$MOZ_BUILD_ROOT/dist
9596 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9597 ac_configure_args="$ac_configure_args --enable-threadsafe"
9598 if test "$BUILD_CTYPES"; then
9599     # Build js-ctypes on the platforms we can.
9600     ac_configure_args="$ac_configure_args --enable-ctypes"
9602 if test -z "$JS_SHARED_LIBRARY" ; then
9603     ac_configure_args="$ac_configure_args --disable-shared-js"
9605 if test -z "$MOZ_NATIVE_NSPR"; then
9606     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9607     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9609 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9610 ac_configure_args="$ac_configure_args --prefix=$dist"
9611 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9612 if test "$MOZ_MEMORY"; then
9613    ac_configure_args="$ac_configure_args --enable-jemalloc"
9614    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9615      export MOZ_MEMORY_LDFLAGS
9616    fi
9618 export MOZ_APP_NAME
9619 AC_OUTPUT_SUBDIRS(js/src)
9620 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9622 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9624 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9625 dnl Needs to be at the end to respect possible changes from NSPR configure
9626 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9627   echo "config/autoconf.mk is unchanged"
9628   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9629 else
9630   rm -f config/autoconf.mk.orig 2> /dev/null