Bug 530657 - Simply code which gets an nsIDOMDocument and QIs to an nsIDocument....
[gecko.git] / configure.in
blob658f24a27dd335accbfc733d7d7615e2056ddd8a
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}"
74 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
75 AC_SUBST(MOZ_DEB_TIMESTAMP)
78 dnl ========================================================
79 dnl =
80 dnl = Don't change the following two lines.  Doing so breaks:
81 dnl =
82 dnl = CFLAGS="-foo" ./configure
83 dnl =
84 dnl ========================================================
85 CFLAGS="${CFLAGS=}"
86 CPPFLAGS="${CPPFLAGS=}"
87 CXXFLAGS="${CXXFLAGS=}"
88 LDFLAGS="${LDFLAGS=}"
89 HOST_CFLAGS="${HOST_CFLAGS=}"
90 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
91 HOST_LDFLAGS="${HOST_LDFLAGS=}"
93 dnl ========================================================
94 dnl = Preserve certain environment flags passed to configure
95 dnl = We want sub projects to receive the same flags
96 dnl = untainted by this configure script
97 dnl ========================================================
98 _SUBDIR_CC="$CC"
99 _SUBDIR_CXX="$CXX"
100 _SUBDIR_CFLAGS="$CFLAGS"
101 _SUBDIR_CPPFLAGS="$CPPFLAGS"
102 _SUBDIR_CXXFLAGS="$CXXFLAGS"
103 _SUBDIR_LDFLAGS="$LDFLAGS"
104 _SUBDIR_HOST_CC="$HOST_CC"
105 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
106 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
107 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
108 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
110 dnl Set the version number of the libs included with mozilla
111 dnl ========================================================
112 MOZJPEG=62
113 MOZPNG=10401
114 MOZZLIB=0x1230
115 NSPR_VERSION=4
116 NSS_VERSION=3
118 dnl Set the minimum version of toolkit libs used by mozilla
119 dnl ========================================================
120 GLIB_VERSION=1.2.0
121 LIBIDL_VERSION=0.6.3
122 PERL_VERSION=5.006
123 PYTHON_VERSION=2.4
124 CAIRO_VERSION=1.8.8
125 PANGO_VERSION=1.14.0
126 GTK2_VERSION=2.10.0
127 WINDRES_VERSION=2.14.90
128 W32API_VERSION=3.8
129 GNOMEVFS_VERSION=2.0
130 GNOMEUI_VERSION=2.2.0
131 GCONF_VERSION=1.2.1
132 GIO_VERSION=2.0
133 STARTUP_NOTIFICATION_VERSION=0.8
134 DBUS_VERSION=0.60
135 SQLITE_VERSION=3.6.23.1
136 LIBNOTIFY_VERSION=0.4
138 MSMANIFEST_TOOL=
140 dnl Set various checks
141 dnl ========================================================
142 MISSING_X=
143 AC_PROG_AWK
145 dnl Initialize the Pthread test variables early so they can be
146 dnl  overridden by each platform.
147 dnl ========================================================
148 USE_PTHREADS=
149 _PTHREAD_LDFLAGS=""
151 dnl Do not allow a separate objdir build if a srcdir build exists.
152 dnl ==============================================================
153 _topsrcdir=`cd \`dirname $0\`; pwd`
154 _objdir=`pwd`
156 if test "$_topsrcdir" != "$_objdir"
157 then
158   # Check for a couple representative files in the source tree
159   _conflict_files=
160   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
161     if test -f $file; then
162       _conflict_files="$_conflict_files $file"
163     fi
164   done
165   if test "$_conflict_files"; then
166     echo "***"
167     echo "*   Your source tree contains these files:"
168     for file in $_conflict_files; do
169       echo "*         $file"
170     done
171     cat 1>&2 <<-EOF
172         *   This indicates that you previously built in the source tree.
173         *   A source tree build can confuse the separate objdir build.
174         *
175         *   To clean up the source tree:
176         *     1. cd $_topsrcdir
177         *     2. gmake distclean
178         ***
179         EOF
180     exit 1
181     break
182   fi
184 MOZ_BUILD_ROOT=`pwd`
186 dnl Default to MSVC for win32 and gcc-4.2 for darwin
187 dnl ==============================================================
188 if test -z "$CROSS_COMPILE"; then
189 case "$target" in
190 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
191     if test -z "$CC"; then CC=cl; fi
192     if test -z "$CXX"; then CXX=cl; fi
193     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
194     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
195     if test -z "$LD"; then LD=link; fi
196     if test -z "$AS"; then
197         case "${target_cpu}" in
198         i*86)
199             AS=ml;
200             ;;
201         x86_64)
202             AS=ml64;
203             ;;
204         esac
205     fi
206     if test -z "$MIDL"; then MIDL=midl; fi
207     ;;
208 *-darwin*)
209     if test -z "$CC"; then CC=gcc-4.2; fi
210     if test -z "$CXX"; then CXX=g++-4.2; fi
211     ;;
212 esac
215 COMPILE_ENVIRONMENT=1
216 MOZ_ARG_DISABLE_BOOL(compile-environment,
217 [  --disable-compile-environment
218                           Disable compiler/library checks.],
219     COMPILE_ENVIRONMENT= )
220 AC_SUBST(COMPILE_ENVIRONMENT)
222 MOZ_ARG_WITH_STRING(l10n-base,
223 [  --with-l10n-base=DIR    path to l10n repositories],
224     L10NBASEDIR=$withval)
225 if test ! -z "$L10NBASEDIR"; then
226     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
227         AC_MSG_ERROR([--with-l10n-base must specify a path])
228     elif test -d "$L10NBASEDIR"; then
229         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
230     else
231         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
232     fi
234 AC_SUBST(L10NBASEDIR)
236 dnl Check for Perl first -- needed for win32 SDK checks
237 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
238 if test -z "$PERL" -o "$PERL" = ":"; then
239     AC_MSG_ERROR([perl not found in \$PATH])
242 dnl ========================================================
243 dnl = Android uses a very custom (hacky) toolchain; we need to do this
244 dnl = here, so that the compiler checks can succeed
245 dnl ========================================================
247 MOZ_ARG_WITH_STRING(android-ndk,
248 [  --with-android-ndk=DIR
249                           location where the Android NDK can be found],
250     android_ndk=$withval)
252 MOZ_ARG_WITH_STRING(android-toolchain,
253 [  --with-android-toolchain=DIR
254                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
255     android_toolchain=$withval)
258 MOZ_ARG_WITH_STRING(android-version,
259 [  --with-android-version=VER
260                           android platform version, default 5],
261     android_version=$withval,
262     android_version=5)
264 MOZ_ARG_WITH_STRING(android-sdk,
265 [  --with-android-sdk=DIR
266                           location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
267     android_sdk=$withval)
269 MOZ_ARG_WITH_STRING(android-tools,
270 [  --with-android-tools=DIR
271                           location where the Android Tools can be found (base directory, e.g. .../android/tools)],
272     android_tools=$withval)
274 if test "$target" = "arm-android-eabi" ; then
275     if test -z "$android_ndk" ; then
276         AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
277     fi
279     if test -z "$android_sdk" ; then
280         AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
281     fi
283     if test -z "$android_tools" ; then
284         AC_MSG_ERROR([You must specify --with-android-tools=/path/to/sdk/tools when targeting Android.])
285     fi
287     if test -z "$android_toolchain" ; then
288         android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
289     fi
291     if test -z "$android_platform" ; then
292        android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
293     fi
295     dnl set up compilers
296     AS="$android_toolchain"/bin/arm-eabi-as
297     CC="$android_toolchain"/bin/arm-eabi-gcc
298     CXX="$android_toolchain"/bin/arm-eabi-g++
299     CPP="$android_toolchain"/bin/arm-eabi-cpp
300     LD="$android_toolchain"/bin/arm-eabi-ld
301     AR="$android_toolchain"/bin/arm-eabi-ar
302     RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
303     STRIP="$android_toolchain"/bin/arm-eabi-strip
305     CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
306     CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS"
307     CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CXXFLAGS"
309     dnl Add -llog by default, since we use it all over the place.
310     dnl Add --allow-shlib-undefined, because libGLESv2 links to an
311     dnl undefined symbol (present on the hardware, just not in the
312     dnl NDK.)
313     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
315     dnl prevent cross compile section from using these flags as host flags
316     if test -z "$HOST_CPPFLAGS" ; then
317         HOST_CPPFLAGS=" "
318     fi
319     if test -z "$HOST_CFLAGS" ; then
320         HOST_CFLAGS=" "
321     fi
322     if test -z "$HOST_CXXFLAGS" ; then
323         HOST_CXXFLAGS=" "
324     fi
325     if test -z "$HOST_LDFLAGS" ; then
326         HOST_LDFLAGS=" "
327     fi
329     ANDROID_NDK="${android_ndk}"
330     ANDROID_TOOLCHAIN="{android_toolchain}"
331     ANDROID_PLATFORM="{android_platform}"
332     ANDROID_SDK="${android_sdk}"
333     ANDROID_TOOLS="${android_tools}"
334     ANDROID_VERSION="${android_version}"
336     AC_DEFINE(ANDROID)
337     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
338     AC_SUBST(ANDROID_VERSION)
339     CROSS_COMPILE=1
340     MOZ_CHROME_FILE_FORMAT=omni
343 AC_SUBST(ANDROID_NDK)
344 AC_SUBST(ANDROID_TOOLCHAIN)
345 AC_SUBST(ANDROID_PLATFORM)
346 AC_SUBST(ANDROID_SDK)
347 AC_SUBST(ANDROID_TOOLS)
349 dnl ========================================================
350 dnl Checks for compilers.
351 dnl ========================================================
352 dnl Set CROSS_COMPILE in the environment when running configure
353 dnl to use the cross-compile setup for now
354 dnl ========================================================
356 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
357 AR_FLAGS='cr $@'
359 if test "$COMPILE_ENVIRONMENT"; then
361 dnl Do some special WinCE toolchain stuff
362 case "$target" in
363 *wince|*winmo)
365     MOZ_ARG_WITH_STRING(wince-sdk,
366     [  --with-wince-sdk=WINCE_SDK_DIR
367                           The path to the Windows CE SDK],
368     WINCE_SDK_DIR=$withval)
370     MOZ_ARG_WITH_STRING(ogles-sdk,
371     [  --with-ogles-sdk=OGLES_SDK_DIR
372                           The path to the OGLES SDK],
373     OGLES_SDK_DIR=$withval)
375     AC_DEFINE(WINCE)
376     
377     export WINCE=1
379     echo -----------------------------------------------------------------------------
380     echo Building Windows CE Shunt Library and Tool Chain
381     echo Using SDK in:
382     echo $WINCE_SDK_DIR
384     ac_exeext=.exe
386     _pwd=`pwd -W`
387     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
388     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
389     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
390     -C $srcdir/build/wince/tools
392     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
393     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
394     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
395     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
396     LD="$_pwd/dist/sdk/bin/$target-link.exe"
397     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
398     AS="$_pwd/dist/sdk/bin/$target-as.exe"
399     RC="$_pwd/dist/sdk/bin/$target-res.exe"
402     echo -----------------------------------------------------------------------------
404     ;;
405 esac
407 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
408     echo "cross compiling from $host to $target"
409     cross_compiling=yes
411     _SAVE_CC="$CC"
412     _SAVE_CFLAGS="$CFLAGS"
413     _SAVE_LDFLAGS="$LDFLAGS"
415     AC_MSG_CHECKING([for host c compiler])
416     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
417     if test -z "$HOST_CC"; then
418         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
419     fi
420     AC_MSG_RESULT([$HOST_CC])
421     AC_MSG_CHECKING([for host c++ compiler])
422     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
423     if test -z "$HOST_CXX"; then
424         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
425     fi
426     AC_MSG_RESULT([$HOST_CXX])
428     if test -z "$HOST_CFLAGS"; then
429         HOST_CFLAGS="$CFLAGS"
430     fi
431     if test -z "$HOST_CXXFLAGS"; then
432         HOST_CXXFLAGS="$CXXFLAGS"
433     fi
434     if test -z "$HOST_LDFLAGS"; then
435         HOST_LDFLAGS="$LDFLAGS"
436     fi
437     if test -z "$HOST_AR_FLAGS"; then
438         HOST_AR_FLAGS="$AR_FLAGS"
439     fi
440     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
441     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
442     CC="$HOST_CC"
443     CFLAGS="$HOST_CFLAGS"
444     LDFLAGS="$HOST_LDFLAGS"
446     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
447     AC_TRY_COMPILE([], [return(0);], 
448         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
449         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
451     CC="$HOST_CXX"
452     CFLAGS="$HOST_CXXFLAGS"
454     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
455     AC_TRY_COMPILE([], [return(0);], 
456         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
457         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
458     
459     CC=$_SAVE_CC
460     CFLAGS=$_SAVE_CFLAGS
461     LDFLAGS=$_SAVE_LDFLAGS
463     case "$build:$target" in
464       powerpc-apple-darwin8*:i?86-apple-darwin*)
465         dnl The Darwin cross compiler doesn't necessarily point itself at a
466         dnl root that has libraries for the proper architecture, it defaults
467         dnl to the system root.  The libraries in the system root on current
468         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
469         dnl checks will fail.  Fake a working SDK in that case.
470         _SAVE_CFLAGS=$CFLAGS
471         _SAVE_CXXFLAGS=$CXXLAGS
472         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
473         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
474         ;;
475     esac
477     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
478     unset ac_cv_prog_CC
479     AC_PROG_CC
480     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
481     unset ac_cv_prog_CXX
482     AC_PROG_CXX
484     case "$build:$target" in
485       powerpc-apple-darwin8*:i?86-apple-darwin*)
486         dnl Revert the changes made above.  From this point on, the target
487         dnl compiler will never be used without applying the SDK to CFLAGS
488         dnl (see --with-macos-sdk below).
489         CFLAGS=$_SAVE_CFLAGS
490         CXXFLAGS=$_SAVE_CXXFLAGS
491         ;;
492     esac
494     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
495     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
496     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
497     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
498     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
499     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
500     AC_DEFINE(CROSS_COMPILE)
501 else
502     AC_PROG_CC
503     AC_PROG_CXX
504     AC_PROG_RANLIB
505     MOZ_PATH_PROGS(AS, $AS as, $CC)
506     AC_CHECK_PROGS(AR, ar, :)
507     AC_CHECK_PROGS(LD, ld, :)
508     AC_CHECK_PROGS(STRIP, strip, :)
509     AC_CHECK_PROGS(WINDRES, windres, :)
510     if test -z "$HOST_CC"; then
511         HOST_CC='$(CC)'
512     fi
513     if test -z "$HOST_CFLAGS"; then
514         HOST_CFLAGS='$(CFLAGS)'
515     fi
516     if test -z "$HOST_CXX"; then
517         HOST_CXX='$(CXX)'
518     fi
519     if test -z "$HOST_CXXFLAGS"; then
520         HOST_CXXFLAGS='$(CXXFLAGS)'
521     fi
522     if test -z "$HOST_LDFLAGS"; then
523         HOST_LDFLAGS='$(LDFLAGS)'
524     fi
525     if test -z "$HOST_RANLIB"; then
526         HOST_RANLIB='$(RANLIB)'
527     fi
528     if test -z "$HOST_AR"; then
529         HOST_AR='$(AR)'
530     fi
531     if test -z "$HOST_AR_FLAGS"; then
532         HOST_AR_FLAGS='$(AR_FLAGS)'
533     fi
536 GNU_AS=
537 GNU_LD=
538 GNU_CC=
539 GNU_CXX=
540 CC_VERSION='N/A'
541 CXX_VERSION='N/A'
542 if test "$GCC" = "yes"; then
543     GNU_CC=1
544     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
546 if test "$GXX" = "yes"; then
547     GNU_CXX=1
548     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
550 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
551     GNU_AS=1
553 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
554     GNU_LD=1
556 if test "$GNU_CC"; then
557     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
558         GCC_USE_GNU_LD=1
559     fi
562 INTEL_CC=
563 INTEL_CXX=
564 if test "$GCC" = yes; then
565    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
566      INTEL_CC=1
567    fi
570 if test "$GXX" = yes; then
571    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
572      INTEL_CXX=1
573    fi
576 dnl Special win32 checks
577 dnl ========================================================
578 case "$target" in
579 *-wince|*-winmo)
580     WINVER=500
581     WINSDK_TARGETVER=502
582     ;;
584     WINVER=502
585     dnl Target the Windows 7 SDK by default
586     WINSDK_TARGETVER=601
587     ;;
588 esac
590 MOZ_ARG_WITH_STRING(windows-version,
591 [  --with-windows-version=WINSDK_TARGETVER
592                           Highest Windows version to target using this SDK
593                               502: Windows Server 2003
594                               600: Windows Vista
595                               601: Windows 7],
596   WINSDK_TARGETVER=$withval)
598 case "$WINSDK_TARGETVER" in
599 502|600|601)
600     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
601     ;;
604     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
605     ;;
607 esac
609 if test -n "$COMPILE_ENVIRONMENT"; then
610 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
611     # We can't build parental controls either
612     MOZ_DISABLE_PARENTAL_CONTROLS=1
616 case "$target" in
617 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
618     if test "$GCC" != "yes"; then
619         # Check to see if we are really running in a msvc environemnt
620         _WIN32_MSVC=1
621         AC_CHECK_PROGS(MIDL, midl)
623         # Make sure compilers are valid
624         CFLAGS="$CFLAGS -TC -nologo"
625         CXXFLAGS="$CXXFLAGS -TP -nologo"
626         AC_LANG_SAVE
627         AC_LANG_C
628         AC_TRY_COMPILE([#include <stdio.h>],
629             [ printf("Hello World\n"); ],,
630             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
632         AC_LANG_CPLUSPLUS
633         AC_TRY_COMPILE([#include <new.h>],
634             [ unsigned *test = new unsigned(42); ],,
635             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
636         AC_LANG_RESTORE
637         
638         changequote(,)
639         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
640         changequote([,])
641         
642         # Determine compiler version
643         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
644         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
645         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
646         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
647         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
648         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
650         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
651         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
653         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
654             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
655         fi
656         if test "$_CC_MAJOR_VERSION" = "13"; then
657             _CC_SUITE=7
658         elif test "$_CC_MAJOR_VERSION" = "14"; then
659             _CC_SUITE=8
660             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
661             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
662             dnl so be very specific here!
663             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
664             if test $_CC_RELEASE -gt 50727; then
665                _USE_DYNAMICBASE=1
666             elif test $_CC_BUILD -ge 762; then
667                _USE_DYNAMICBASE=1
668             fi
669             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
670             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
671         elif test "$_CC_MAJOR_VERSION" = "15"; then
672             _CC_SUITE=9
673             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
674             _USE_DYNAMICBASE=1
675             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
676             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
677         elif test "$_CC_MAJOR_VERSION" = "16"; then
678             _CC_SUITE=10
679             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
680             _USE_DYNAMICBASE=1
681             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
682             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
683         else
684             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
685         fi
687         _MOZ_RTTI_FLAGS_ON='-GR'
688         _MOZ_RTTI_FLAGS_OFF='-GR-'
689         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
690         _MOZ_EXCEPTIONS_FLAGS_OFF=''
692         if test -n "$WIN32_REDIST_DIR"; then
693             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
694         fi
695         
696         # bug #249782
697         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
698         if test "$_CC_SUITE" -ge "8"; then
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([,])
703                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
704                 if test -n "$MSMT_TOOL"; then
705                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
706                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
707                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
708                         fi
709                         MSMANIFEST_TOOL=1
710                         unset MSMT_TOOL
711                 else
712                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
713                 fi
714         fi
716         # Check linker version
717         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
718         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
719         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
720             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
721         fi
722         INCREMENTAL_LINKER=1
724         # Check midl version
725         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
726         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
727         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
728         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
729         # Add flags if necessary
730         AC_MSG_CHECKING([for midl flags])
731         case "$target" in
732         i*86-*)
733             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
734                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
735                 # MIDL version 7.00.0500 or later has no problem.
736                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
737                 AC_MSG_RESULT([need -env win32])
738             else
739                 AC_MSG_RESULT([none needed])
740             fi
741             ;;
742         x86_64-*)
743             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
744             ;;
745         *)
746             AC_MSG_RESULT([none needed])
747             ;;
748         esac
750         # Identify which version of the SDK we're building with
751         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
752         # from there
753         AC_CHECK_HEADERS([winsdkver.h])
754         if test "$ac_cv_header_winsdkver_h" = "yes"; then
755             # Get the highest _WIN32_WINNT and NTDDI versions supported
756             # Take the higher of the two
757             # This is done because the Windows 7 beta SDK reports its
758             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
759             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
760                            ac_cv_winsdk_maxver,
761                            [cat > conftest.h <<EOF
762 #include <winsdkver.h>
763 #include <sdkddkver.h>
765 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
766 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
767 #else
768 #define WINSDK_MAXVER NTDDI_MAXVER
769 #endif
771 WINSDK_MAXVER
773                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
774                             rm -f conftest.h
775                            ])
776             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
777         else
778             # The Vista SDK is the only one to have sdkddkver.h but not
779             # WinSDKVer.h
780             AC_CHECK_HEADERS([sdkddkver.h])
781             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
782                 MOZ_WINSDK_MAXVER=0x06000000
783             else
784                 # Assume the Server 2003 Platform SDK
785                 MOZ_WINSDK_MAXVER=0x05020000
786             fi
787         fi
789         unset _MSVC_VER_FILTER
791         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
792             [
793                 AC_LANG_SAVE
794                 AC_LANG_CPLUSPLUS
795                 _SAVE_CXXFLAGS="$CXXFLAGS"
796                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
797                 AC_TRY_COMPILE([#include <exception>],
798                             [std::_Throw(std::exception()); return 0;],
799                             ac_cv_have_std__Throw="yes",
800                             ac_cv_have_std__Throw="no")
801                 CXXFLAGS="$_SAVE_CXXFLAGS"
802                 AC_LANG_RESTORE
803             ])
805         if test "$ac_cv_have_std__Throw" == "yes"; then
806             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
807                            ac_cv_have_dllimport_exception_bug,
808                 [
809                     AC_LANG_SAVE
810                     AC_LANG_CPLUSPLUS
811                     _SAVE_CXXFLAGS="$CXXFLAGS"
812                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
813                     AC_TRY_LINK([#include <vector>],
814                                 [std::vector<int> v; return v.at(1);],
815                                 ac_cv_have_dllimport_exception_bug="no",
816                                 ac_cv_have_dllimport_exception_bug="yes")
817                     CXXFLAGS="$_SAVE_CXXFLAGS"
818                     AC_LANG_RESTORE
819                 ])
820             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
821                 WRAP_STL_INCLUDES=1
822                 MOZ_MSVC_STL_WRAP__Throw=1
823                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
824             fi
825         else
826             AC_CACHE_CHECK(for overridable _RAISE,
827                            ac_cv_have__RAISE,
828                 [
829                     AC_LANG_SAVE
830                     AC_LANG_CPLUSPLUS
831                     _SAVE_CXXFLAGS="$CXXFLAGS"
832                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
833                     AC_TRY_COMPILE([#include <xstddef>
834                                     #undef _RAISE
835                                     #define _RAISE(x) externallyDefinedFunction((x).what())
836                                     #include <vector>
837                                    ],
838                                    [std::vector<int> v; return v.at(1);],
839                                    ac_cv_have__RAISE="no",
840                                    ac_cv_have__RAISE="yes")
841                     CXXFLAGS="$_SAVE_CXXFLAGS"
842                     AC_LANG_RESTORE
843                 ])
844             if test "$ac_cv_have__RAISE" = "yes"; then
845                 WRAP_STL_INCLUDES=1
846                 MOZ_MSVC_STL_WRAP__RAISE=1
847                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
848             else
849                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
850             fi
851         fi
853         if test "$WRAP_STL_INCLUDES" = "1"; then
854             STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
855         fi
856     else
857         # Check w32api version
858         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
859         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
860         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
861         AC_TRY_COMPILE([#include <w32api.h>],
862             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
863                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
864                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
865                 #error "test failed."
866             #endif
867             , [ res=yes ], [ res=no ])
868         AC_MSG_RESULT([$res])
869         if test "$res" != "yes"; then
870             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
871         fi
872         # Check windres version
873         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
874         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
875         AC_MSG_RESULT([$_WINDRES_VERSION])
876         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
877         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
878         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
879         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
880         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
881         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
882         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
883                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
884                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
885                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
886                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
887                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
888         then
889             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
890         fi
892         # Server 2003 is the highest version supported
893         MOZ_WINSDK_MAXVER=0x05020000
894     fi # !GNU_CC
896     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
897     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
898     # Require OS features provided by IE 5.0
899     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
901     # If the maximum version supported by this SDK is lower than the target
902     # version, error out
903     AC_MSG_CHECKING([for Windows SDK being recent enough])
904     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
905         AC_MSG_RESULT("yes")
906     else
907         AC_MSG_RESULT("no")
908         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.])
909     fi
911     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
912     # Definitions matching sdkddkver.h
913     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
914     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
915     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
916     ;;
917 esac
919 dnl Test breaks icc on OS/2 && MSVC
920 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
921     AC_PROG_CC_C_O
922     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
923         USING_HCC=1
924         _OLDCC=$CC
925         _OLDCXX=$CXX
926         CC="${srcdir}/build/hcc '$CC'"
927         CXX="${srcdir}/build/hcpp '$CXX'"
928     fi
931 AC_PROG_CPP
932 AC_PROG_CXXCPP
934 if test -n "$_WIN32_MSVC"; then
935     SKIP_PATH_CHECKS=1
936     SKIP_COMPILER_CHECKS=1
937     SKIP_LIBRARY_CHECKS=1
939     # Since we're skipping compiler and library checks, hard-code
940     # some facts here.
941     case "$target" in
942     *-wince|*-winmo)
943         ;;
944     *)
945         AC_DEFINE(HAVE_IO_H)
946         AC_DEFINE(HAVE_SETBUF)
947         AC_DEFINE(HAVE_ISATTY)
948         ;;
949     esac
952 fi # COMPILE_ENVIRONMENT
954 AC_SUBST(MIDL_FLAGS)
955 AC_SUBST(_MSC_VER)
957 AC_SUBST(GNU_AS)
958 AC_SUBST(GNU_LD)
959 AC_SUBST(GNU_CC)
960 AC_SUBST(GNU_CXX)
961 AC_SUBST(INTEL_CC)
962 AC_SUBST(INTEL_CXX)
964 AC_SUBST(STL_FLAGS)
965 AC_SUBST(WRAP_STL_INCLUDES)
966 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
967 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
969 dnl ========================================================
970 dnl Checks for programs.
971 dnl ========================================================
972 AC_PROG_INSTALL
973 AC_PROG_LN_S
975 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
976 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
977 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
978 _perl_res=$?
979 AC_MSG_RESULT([$_perl_version])
981 if test "$_perl_res" != 0; then
982     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
986 AC_MSG_CHECKING([for full perl installation])
987 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
988 _perl_res=$?
989 if test "$_perl_res" != 0; then
990     AC_MSG_RESULT([no])
991     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
992 else
993     AC_MSG_RESULT([yes])    
996 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.6 python2.5 python2.4 python)
997 if test -z "$PYTHON"; then
998     AC_MSG_ERROR([python was not found in \$PATH])
1001 if test -z "$COMPILE_ENVIRONMENT"; then
1002     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1004 AC_SUBST(NSINSTALL_BIN)
1006 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1007 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1008 MOZ_PATH_PROG(UNZIP, unzip, :)
1009 MOZ_PATH_PROGS(ZIP, zip)
1010 if test -z "$ZIP" -o "$ZIP" = ":"; then
1011     AC_MSG_ERROR([zip not found in \$PATH])
1013 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1014 MOZ_PATH_PROG(XARGS, xargs)
1015 if test -z "$XARGS" -o "$XARGS" = ":"; then
1016     AC_MSG_ERROR([xargs not found in \$PATH .])
1019 if test "$COMPILE_ENVIRONMENT"; then
1021 dnl ========================================================
1022 dnl = Mac OS X toolchain support
1023 dnl ========================================================
1025 case "$target_os" in
1026 darwin*)
1027     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1028     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1029     dnl the environment and includedir purposes (when using an SDK, below),
1030     dnl but remember the full version number for the libdir (SDK).
1031     changequote(,)
1032     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1033     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1034     changequote([,])
1035     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1036         dnl Bug 280479, but this keeps popping up in bug 292530 too because
1037         dnl 4.0.0/4061 is the default compiler in Tiger.
1038         changequote(,)
1039         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1040         changequote([,])
1041         if test "$GCC_BUILD" = "4061" ; then
1042             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1043 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1044 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1045         fi
1046     fi
1048     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1049     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1050     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1051     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1053     case "$PBBUILD" in
1054       *xcodebuild*)
1055         changequote(,)
1056         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1057         changequote([,])
1058         if test -n "$XCODEBUILD_VERSION" -a "$XCODEBUILD_VERSION" -ge 620 ; then
1059           HAS_XCODE_2_1=1;
1060         fi
1061       ;;
1062     esac
1064     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1065     dnl it has moved into /usr/bin.
1066     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1067     ;;
1068 esac
1070 AC_SUBST(GCC_VERSION)
1071 AC_SUBST(XCODEBUILD_VERSION)
1072 AC_SUBST(HAS_XCODE_2_1)
1074 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1075 dnl that a universal binary is being produced.
1076 AC_SUBST(UNIVERSAL_BINARY)
1078 dnl ========================================================
1079 dnl Check for MacOS deployment target version
1080 dnl ========================================================
1082 MOZ_ARG_ENABLE_STRING(macos-target,
1083                       [  --enable-macos-target=VER (default=10.5)
1084                           Set the minimum MacOS version needed at runtime],
1085                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1087 case "$target" in
1088 *-darwin*)
1089     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1090         dnl Use the specified value
1091         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1092         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1093     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
1094         dnl No value specified on the command line or in the environment,
1095         dnl use architecture minimum.
1096         export MACOSX_DEPLOYMENT_TARGET=10.5
1097     fi
1098     ;;
1099 esac
1101 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1103 dnl ========================================================
1104 dnl = Mac OS X SDK support
1105 dnl ========================================================
1106 MACOS_SDK_DIR=
1107 NEXT_ROOT=
1108 MOZ_ARG_WITH_STRING(macos-sdk,
1109 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1110     MACOS_SDK_DIR=$withval)
1112 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1113 dnl NEXT_ROOT will be set and exported only if it's needed.
1114 AC_SUBST(MACOS_SDK_DIR)
1115 AC_SUBST(NEXT_ROOT)
1117 if test "$MACOS_SDK_DIR"; then
1118   dnl Sync this section with the ones in NSPR and NSS.
1119   dnl Changes to the cross environment here need to be accounted for in
1120   dnl the libIDL checks (below) and xpidl build.
1122   if test ! -d "$MACOS_SDK_DIR"; then
1123     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1124 specify a valid SDK.  SDKs are installed when the optional cross-development
1125 tools are selected during the Xcode/Developer Tools installation.])
1126   fi
1128   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1129   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1130     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1131   else
1132     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1133     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1135     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1136     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1137     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1139     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1140       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1141       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1142       dnl be ignored and cause warnings when -syslibroot is specified.
1143       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1144       dnl the -isysroot it receives, so this is only needed with 4.0.0.
1145       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1146     fi
1147   fi
1149   AC_LANG_SAVE
1150   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1151   AC_LANG_CPLUSPLUS
1152   AC_TRY_COMPILE([#include <new>
1153                  int main() { return 0; }],
1154    result=yes,
1155    result=no)
1156   AC_LANG_RESTORE
1157   AC_MSG_RESULT($result)
1159   if test "$result" = "no" ; then
1160     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1161   fi
1164 fi # COMPILE_ENVIRONMENT
1166 if test -n "$MAKE"; then
1167   if test `echo $MAKE | grep -c make.py` != 1; then
1168      NOT_PYMAKE=$MAKE
1169   fi
1172 case "$host_os" in
1173 cygwin*|mingw*|mks*|msvc*)
1174     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1175     ;;
1177     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1178     ;;
1179 esac
1180 if test "$GMAKE" = ":"; then
1181    AC_MSG_ERROR([GNU make not found])
1183 AC_SUBST(GMAKE)
1185 if test "$COMPILE_ENVIRONMENT"; then
1187 AC_PATH_XTRA
1189 XCFLAGS="$X_CFLAGS"
1191 fi # COMPILE_ENVIRONMENT
1193 dnl ========================================================
1194 dnl set the defaults first
1195 dnl ========================================================
1196 AS_BIN=$AS
1197 AR_LIST='$(AR) t'
1198 AR_EXTRACT='$(AR) x'
1199 AR_DELETE='$(AR) d'
1200 AS='$(CC)'
1201 AS_DASH_C_FLAG='-c'
1202 DLL_PREFIX=lib
1203 LIB_PREFIX=lib
1204 DLL_SUFFIX=.so
1205 OBJ_SUFFIX=o
1206 LIB_SUFFIX=a
1207 ASM_SUFFIX=s
1208 IMPORT_LIB_SUFFIX=
1209 TARGET_MD_ARCH=unix
1210 DIRENT_INO=d_ino
1211 CYGWIN_WRAPPER=
1212 WIN_TOP_SRC=
1213 MOZ_USER_DIR=".mozilla"
1215 MOZ_JPEG_CFLAGS=
1216 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1217 MOZ_ZLIB_CFLAGS=
1218 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1219 MOZ_BZ2_CFLAGS=
1220 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1221 MOZ_PNG_CFLAGS=
1222 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1224 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1225 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1226 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1227 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1228 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1229 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1230 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1232 MOZ_FS_LAYOUT=unix
1234 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1236 USE_DEPENDENT_LIBS=1
1238 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1240 if test -n "$CROSS_COMPILE"; then
1241     OS_TARGET="${target_os}"
1242     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1243     OS_RELEASE=
1244     case "${target_os}" in
1245         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1246         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1247         gnu*)         OS_ARCH=GNU ;;
1248         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1249         mingw*)       OS_ARCH=WINNT ;;
1250         wince*)       OS_ARCH=WINCE ;;
1251         winmo*)       OS_ARCH=WINCE ;;
1252         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1253     esac
1254     case "${target}" in
1255         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1256     esac
1257 else
1258     OS_TARGET=`uname -s`
1259     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1260     OS_RELEASE=`uname -r`
1263 # Before this used `uname -m` when not cross compiling
1264 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1265 OS_TEST="${target_cpu}"
1267 _COMPILER_PREFIX=
1269 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1271 #######################################################################
1272 # Master "Core Components" macros for getting the OS target           #
1273 #######################################################################
1276 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1277 # cross-compilation.
1281 # Define and override various archtecture-specific variables, including
1282 # HOST_OS_ARCH
1283 # OS_ARCH
1284 # OS_TEST
1285 # OS_TARGET
1286 # OS_RELEASE
1287 # OS_MINOR_RELEASE
1290 case "$HOST_OS_ARCH" in
1291 cygwin*|mingw*|mks*|msvc*)
1292     HOST_OS_ARCH=WINNT
1293     ;;
1294 darwin*)
1295     HOST_OS_ARCH=Darwin
1296     ;;
1297 linux*)
1298     HOST_OS_ARCH=Linux
1299     ;;
1300 solaris*)
1301     HOST_OS_ARCH=SunOS
1302     SOLARIS_SUNPRO_CC=
1303     SOLARIS_SUNPRO_CXX=
1304     if test -z "$GNU_CC"; then
1305         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1306             SOLARIS_SUNPRO_CC=1
1307        fi
1308     fi
1310     if test -z "$GNU_CXX"; then
1311        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1312            SOLARIS_SUNPRO_CXX=1
1313        fi
1314     fi
1315     AC_SUBST(SOLARIS_SUNPRO_CC)
1316     AC_SUBST(SOLARIS_SUNPRO_CXX)
1317     ;;
1318 BSD_386)
1319     HOST_OS_ARCH=BSD
1320     ;;
1321 dgux)
1322     HOST_OS_ARCH=DGUX
1323     ;;
1324 IRIX64)
1325     HOST_OS_ARCH=IRIX
1326     ;;
1327 UNIX_SV)
1328     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1329         HOST_OS_ARCH=NCR
1330     else
1331         HOST_OS_ARCH=UNIXWARE
1332     fi
1333     ;;
1334 ncr)
1335     HOST_OS_ARCH=NCR
1336     ;;
1337 UNIX_SYSTEM_V)
1338     HOST_OS_ARCH=NEC
1339     ;;
1340 OSF1)
1341     ;;
1342 *OpenVMS*)
1343     HOST_OS_ARCH=OpenVMS
1344     ;;
1345 OS_2)
1346     HOST_OS_ARCH=OS2
1347     ;;
1348 QNX)
1349     ;;
1350 SCO_SV)
1351     HOST_OS_ARCH=SCOOS
1352     ;;
1353 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1354     HOST_OS_ARCH=SINIX
1355     ;;
1356 UnixWare)
1357     HOST_OS_ARCH=UNIXWARE
1358     ;;
1359 esac
1361 case "$OS_ARCH" in
1362 WINNT)
1363     if test -z "$CROSS_COMPILE" ; then
1364         OS_TEST=`uname -p`
1365     fi
1366     ;;
1367 Windows_NT)
1369 # If uname -s returns "Windows_NT", we assume that we are using
1370 # the uname.exe in MKS toolkit.
1372 # The -r option of MKS uname only returns the major version number.
1373 # So we need to use its -v option to get the minor version number.
1374 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1376     OS_ARCH=WINNT
1377     OS_TARGET=WINNT
1378     OS_MINOR_RELEASE=`uname -v`
1379     if test "$OS_MINOR_RELEASE" = "00"; then
1380         OS_MINOR_RELEASE=0
1381     fi
1382     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1383     ;;
1384 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1386 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1387 # the uname.exe in the Cygwin tools.
1388 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1389 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1390 # the uname.exe in the GNU-Win32 tools.
1391 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1392 # the uname.exe in the MSYS tools.
1394     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1395     OS_ARCH=WINNT
1396     OS_TARGET=WINNT
1397     ;;
1398 AIX)
1399     OS_RELEASE=`uname -v`.`uname -r`
1400     OS_TEST=${target_cpu}
1401     ;;
1402 BSD_386)
1403     OS_ARCH=BSD
1404     ;;
1405 dgux)
1406     OS_ARCH=DGUX
1407     ;;
1408 IRIX64)
1409     OS_ARCH=IRIX
1410     ;;
1411 UNIX_SV)
1412     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1413         OS_ARCH=NCR
1414     else
1415         OS_ARCH=UNIXWARE
1416         OS_RELEASE=`uname -v`
1417     fi
1418     ;;
1419 ncr)
1420     OS_ARCH=NCR
1421     ;;
1422 UNIX_SYSTEM_V)
1423     OS_ARCH=NEC
1424     ;;
1425 OSF1)
1426     case `uname -v` in
1427     148)
1428         OS_RELEASE=V3.2C
1429         ;;
1430     564)
1431         OS_RELEASE=V4.0B
1432         ;;
1433     878)
1434         OS_RELEASE=V4.0D
1435         ;;
1436     esac
1437     ;;
1438 *OpenVMS*)
1439     OS_ARCH=OpenVMS
1440     OS_RELEASE=`uname -v`
1441     OS_TEST=`uname -p`
1442     ;;
1443 OS_2)
1444     OS_ARCH=OS2
1445     OS_TARGET=OS2
1446     OS_RELEASE=`uname -v`
1447     ;;
1448 QNX)
1449     if test "$OS_TARGET" != "NTO"; then
1450         changequote(,)
1451         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1452         changequote([,])
1453     fi
1454     OS_TEST=x86
1455     ;;
1456 SCO_SV)
1457     OS_ARCH=SCOOS
1458     OS_RELEASE=5.0
1459     ;;
1460 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1461     OS_ARCH=SINIX
1462     OS_TEST=`uname -p`
1463     ;;
1464 UnixWare)
1465     OS_ARCH=UNIXWARE
1466     OS_RELEASE=`uname -v`
1467     ;;
1468 WINCE)
1469     OS_ARCH=WINCE
1470     case "${target_os}" in
1471     *winmo)
1472         OS_TARGET=WINMO
1473         WINCE_WINDOWS_MOBILE=1
1474         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1475         ;;
1476     *)
1477         OS_TARGET=WINCE
1478         ;;
1479     esac
1480     ;;
1481 Darwin)
1482     case "${target_cpu}" in
1483     powerpc*)
1484         OS_TEST=ppc
1485         ;;
1486     i*86*)
1487         OS_TEST=i386 
1488         ;;
1489     x86_64)
1490         OS_TEST=x86_64
1491         ;;
1492     *)
1493         if test -z "$CROSS_COMPILE" ; then
1494             OS_TEST=`uname -p`
1495         fi
1496         ;;
1497     esac
1498     ;;
1499 esac
1501 if test "$OS_ARCH" = "NCR"; then
1502     changequote(,)
1503     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1504     changequote([,])
1507 # Only set CPU_ARCH if we recognize the value of OS_TEST
1509 case "$OS_TEST" in
1510 *86 | i86pc)
1511     CPU_ARCH=x86
1512     ;;
1514 powerpc64 | ppc64)
1515     CPU_ARCH=ppc64
1516     ;;
1518 powerpc | ppc | rs6000)
1519     CPU_ARCH=ppc
1520     ;;
1522 Alpha | alpha | ALPHA)
1523     CPU_ARCH=Alpha
1524     ;;
1526 s390)
1527     CPU_ARCH=s390
1528     ;;
1530 s390x)
1531     CPU_ARCH=s390x
1532     ;;
1534 hppa* | parisc)
1535     CPU_ARCH=hppa
1536     ;;
1538 sun4u | sparc*)
1539     CPU_ARCH=sparc
1540     ;;
1542 x86_64 | ia64)
1543     CPU_ARCH="$OS_TEST"
1544     ;;
1546 arm*)
1547     CPU_ARCH=arm
1548     ;;
1549 esac
1551 if test -z "$OS_TARGET"; then
1552     OS_TARGET=$OS_ARCH
1554 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1556 dnl ========================================================
1557 dnl GNU specific defaults
1558 dnl ========================================================
1559 if test "$GNU_CC"; then
1560     # FIXME: Let us build with strict aliasing. bug 414641.
1561     CFLAGS="$CFLAGS -fno-strict-aliasing"
1562     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1563     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1564     DSO_LDOPTS='-shared'
1565     if test "$GCC_USE_GNU_LD"; then
1566         # Don't allow undefined symbols in libraries
1567         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1568     fi
1569     WARNINGS_AS_ERRORS='-Werror'
1570     DSO_CFLAGS=''
1571     DSO_PIC_CFLAGS='-fPIC'
1572     ASFLAGS="$ASFLAGS -fPIC"
1573     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1574     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1575     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1576     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1578     # Turn on GNU specific features
1579     # -Wall - turn on all warnings
1580     # -pedantic - make compiler warn about non-ANSI stuff, and
1581     #             be a little bit stricter
1582     # Warnings slamm took out for now (these were giving more noise than help):
1583     # -Wbad-function-cast - warns when casting a function to a new return type
1584     # -Wshadow - removed because it generates more noise than help --pete
1585     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1586     if test -z "$INTEL_CC"; then
1587        # Don't use -Wcast-align with ICC
1588        case "$CPU_ARCH" in
1589            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1590            hppa | ia64 | sparc | arm)
1591            ;;
1592            *)
1593         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1594            ;;
1595        esac
1596     fi
1598     dnl Turn pedantic on but disable the warnings for long long
1599     _PEDANTIC=1
1601     if test -z "$INTEL_CC"; then
1602       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1603     fi
1605     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1606     _USE_CPP_INCLUDE_FLAG=1
1607 elif test "$SOLARIS_SUNPRO_CC"; then
1608     DSO_CFLAGS=''
1609     if test "$CPU_ARCH" = "sparc"; then
1610         # for Sun Studio on Solaris/SPARC
1611         DSO_PIC_CFLAGS='-xcode=pic32'
1612     else
1613         DSO_PIC_CFLAGS='-KPIC'
1614     fi
1615     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1616 else
1617     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1618     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1620     DSO_LDOPTS='-shared'
1621     if test "$GNU_LD"; then
1622         # Don't allow undefined symbols in libraries
1623         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1624     fi
1626     DSO_CFLAGS=''
1627     DSO_PIC_CFLAGS='-KPIC'
1628     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1631 if test "$GNU_CXX"; then
1632     # FIXME: Let us build with strict aliasing. bug 414641.
1633     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1634     # Turn on GNU specific features
1635     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1636     if test -z "$INTEL_CC"; then
1637        # Don't use -Wcast-align with ICC
1638        case "$CPU_ARCH" in
1639            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1640            hppa | ia64 | sparc | arm)
1641            ;;
1642            *)
1643         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1644            ;;
1645        esac
1646     fi
1648     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1649     _USE_CPP_INCLUDE_FLAG=1
1651     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1652                    ac_has_wno_invalid_offsetof,
1653         [
1654             AC_LANG_SAVE
1655             AC_LANG_CPLUSPLUS
1656             _SAVE_CXXFLAGS="$CXXFLAGS"
1657             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1658             AC_TRY_COMPILE([],
1659                            [return(0);],
1660                            ac_has_wno_invalid_offsetof="yes",
1661                            ac_has_wno_invalid_offsetof="no")
1662             CXXFLAGS="$_SAVE_CXXFLAGS"
1663             AC_LANG_RESTORE
1664         ])
1665     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1666         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1667     fi
1669     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1670                    ac_has_wno_variadic_macros,
1671         [
1672             AC_LANG_SAVE
1673             AC_LANG_CPLUSPLUS
1674             _SAVE_CXXFLAGS="$CXXFLAGS"
1675             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1676             AC_TRY_COMPILE([],
1677                            [return(0);],
1678                            ac_has_wno_variadic_macros="yes",
1679                            ac_has_wno_variadic_macros="no")
1680             CXXFLAGS="$_SAVE_CXXFLAGS"
1681             AC_LANG_RESTORE
1682         ])
1683     if test "$ac_has_wno_variadic_macros" = "yes"; then
1684         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1685     fi
1687     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1688                    ac_has_werror_return_type,
1689         [
1690             AC_LANG_SAVE
1691             AC_LANG_CPLUSPLUS
1692             _SAVE_CXXFLAGS="$CXXFLAGS"
1693             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1694             AC_TRY_COMPILE([],
1695                            [return(0);],
1696                            ac_has_werror_return_type="yes",
1697                            ac_has_werror_return_type="no")
1698             CXXFLAGS="$_SAVE_CXXFLAGS"
1699             AC_LANG_RESTORE
1700         ])
1701     if test "$ac_has_werror_return_type" = "yes"; then
1702         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1703     fi
1705 else
1706     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1709 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1710 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1711 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1712 dnl normal behavior.
1713 dnl ========================================================
1714 MKSHLIB_FORCE_ALL=
1715 MKSHLIB_UNFORCE_ALL=
1717 if test "$COMPILE_ENVIRONMENT"; then
1718 if test "$GNU_CC"; then
1719   AC_MSG_CHECKING(whether ld has archive extraction flags)
1720   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1721    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1722     ac_cv_mkshlib_force_and_unforce="no"
1723     exec 3<&0 <<LOOP_INPUT
1724         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1725         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1726         force="-Wl,-all";              unforce="-Wl,-none"
1727 LOOP_INPUT
1728     while read line
1729     do
1730       eval $line
1731       LDFLAGS=$force
1732       LIBS=$unforce
1733       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1734     done
1735     exec 0<&3 3<&-
1736     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1737    ])
1738   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1739     AC_MSG_RESULT(no)
1740   else
1741     AC_MSG_RESULT(yes)
1742     eval $ac_cv_mkshlib_force_and_unforce
1743     MKSHLIB_FORCE_ALL=$force
1744     MKSHLIB_UNFORCE_ALL=$unforce
1745   fi
1746 fi # GNU_CC
1747 fi # COMPILE_ENVIRONMENT
1749 dnl =================================================================
1750 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1751 dnl which is bad when cross compiling.
1752 dnl =================================================================
1753 if test "$COMPILE_ENVIRONMENT"; then
1754 configure_static_assert_macros='
1755 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1756 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1757 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1760 dnl test that the macros actually work:
1761 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1762 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1763  [AC_LANG_SAVE
1764   AC_LANG_C
1765   ac_cv_static_assertion_macros_work="yes"
1766   AC_TRY_COMPILE([$configure_static_assert_macros],
1767                  [CONFIGURE_STATIC_ASSERT(1)],
1768                  ,
1769                  ac_cv_static_assertion_macros_work="no")
1770   AC_TRY_COMPILE([$configure_static_assert_macros],
1771                  [CONFIGURE_STATIC_ASSERT(0)],
1772                  ac_cv_static_assertion_macros_work="no",
1773                  )
1774   AC_LANG_CPLUSPLUS
1775   AC_TRY_COMPILE([$configure_static_assert_macros],
1776                  [CONFIGURE_STATIC_ASSERT(1)],
1777                  ,
1778                  ac_cv_static_assertion_macros_work="no")
1779   AC_TRY_COMPILE([$configure_static_assert_macros],
1780                  [CONFIGURE_STATIC_ASSERT(0)],
1781                  ac_cv_static_assertion_macros_work="no",
1782                  )
1783   AC_LANG_RESTORE
1784  ])
1785 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1786 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1787     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1789 fi # COMPILE_ENVIRONMENT
1791 dnl ========================================================
1792 dnl Checking for 64-bit OS
1793 dnl ========================================================
1794 if test "$COMPILE_ENVIRONMENT"; then
1795 AC_LANG_SAVE
1796 AC_LANG_C
1797 AC_MSG_CHECKING(for 64-bit OS)
1798 AC_TRY_COMPILE([$configure_static_assert_macros],
1799                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1800                result="yes", result="no")
1801 AC_MSG_RESULT("$result")
1802 if test "$result" = "yes"; then
1803     AC_DEFINE(HAVE_64BIT_OS)
1804     HAVE_64BIT_OS=1
1806 AC_SUBST(HAVE_64BIT_OS)
1807 AC_LANG_RESTORE
1808 fi # COMPILE_ENVIRONMENT
1810 dnl ========================================================
1811 dnl Enable high-memory support on OS/2 by default.
1812 dnl ========================================================
1813 MOZ_OS2_HIGH_MEMORY=1
1814 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1815 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1816     MOZ_OS2_HIGH_MEMORY=,
1817     MOZ_OS2_HIGH_MEMORY=1 )
1818 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1820 dnl ========================================================
1821 dnl System overrides of the defaults for host
1822 dnl ========================================================
1823 case "$host" in
1824 *-beos*)
1825     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1826     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1827     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1828     ;;
1830 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1831     # we need Python 2.5 on Windows
1832     PYTHON_VERSION=2.5
1833     if test -n "$_WIN32_MSVC"; then
1834         HOST_AR=lib
1835         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1836         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1837         HOST_RANLIB='echo ranlib'
1838     else
1839         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1840     fi
1841     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1842     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1843     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1844     HOST_BIN_SUFFIX=.exe
1845     case "$host" in
1846     *mingw*)
1847     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1848         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1849         ;;
1850     *)
1851         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1852         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1853             _pwd=`pwd`
1854             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1855         fi
1856         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1857             AS_PERL=1
1858             PERL="${CYGWIN_WRAPPER} $PERL"
1859         fi
1861         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1862             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1863         fi
1864         ;;
1865     esac
1867     case "${host_cpu}" in
1868     x86_64)
1869         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1870         ;;
1871     esac
1872     ;;
1874 *-darwin*)
1875     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1876     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1877     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1878     ;;
1880 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1881     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1882     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1883     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1884     ;;
1886 *os2*)
1887     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1888     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1889     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1890     HOST_BIN_SUFFIX=.exe
1891     MOZ_FIX_LINK_PATHS=
1892     ;;
1894 *-osf*)
1895     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1896     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1897     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1898     ;;
1901     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1902     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1903     ;;
1904 esac
1906 dnl We require version 2.4 or newer of Python to build,
1907 dnl and 2.5 or newer on Windows.
1908 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1909 changequote(,)
1910 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1911 _python_res=$?
1912 changequote([,])
1913 if test "$_python_res" != 0; then
1914     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1916 AC_MSG_RESULT([yes])
1918 dnl Get mozilla version from central milestone file
1919 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1921 dnl Get version of various core apps from the version files.
1922 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1924 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1925 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1927 dnl ========================================================
1928 dnl System overrides of the defaults for target
1929 dnl ========================================================
1931 case "$target" in
1932 *-aix*)
1933     AC_DEFINE(AIX)
1934     if test ! "$GNU_CC"; then
1935         if test ! "$HAVE_64BIT_OS"; then
1936             # Compiling with Visual Age C++ object model compat is the
1937             # default. To compile with object model ibm, add 
1938             # AIX_OBJMODEL=ibm to .mozconfig.
1939             if test "$AIX_OBJMODEL" = "ibm"; then
1940                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1941             else
1942                 AIX_OBJMODEL=compat
1943             fi
1944         else
1945             AIX_OBJMODEL=compat
1946         fi
1947         AC_SUBST(AIX_OBJMODEL)
1948         DSO_LDOPTS='-qmkshrobj=1'
1949         DSO_CFLAGS='-qflag=w:w'
1950         DSO_PIC_CFLAGS=
1951         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1952         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1953         MOZ_FIX_LINK_PATHS=
1954         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1955         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1956         if test "$COMPILE_ENVIRONMENT"; then
1957             AC_LANG_SAVE
1958             AC_LANG_CPLUSPLUS
1959             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1960             AC_TRY_COMPILE([],
1961                 [#if (__IBMCPP__ < 600)
1962                  #error "Bad compiler"
1963                  #endif],
1964                 _BAD_COMPILER=,_BAD_COMPILER=1)
1965             if test -n "$_BAD_COMPILER"; then
1966                 AC_MSG_RESULT([no])    
1967                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1968             else
1969                 AC_MSG_RESULT([yes])    
1970             fi
1971             AC_LANG_RESTORE
1972             TARGET_COMPILER_ABI="ibmc"
1973             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1974             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1975         fi
1976     fi
1977     case "${target_os}" in
1978     aix4.1*)
1979         DLL_SUFFIX='_shr.a'
1980         ;;
1981     esac
1982     if test "$COMPILE_ENVIRONMENT"; then
1983         AC_CHECK_HEADERS(sys/inttypes.h)
1984     fi
1985     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1986     ;;
1988 *-beos*)
1989     no_x=yes
1990     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1991     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1992     DSO_LDOPTS='-nostart'
1993     TK_LIBS='-lbe -lroot'
1994     LIBS="$LIBS -lbe"
1995     if test "$COMPILE_ENVIRONMENT"; then
1996         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1997         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1998     fi
1999     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2000     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2001     _MOZ_USE_RTTI=1
2002     USE_DEPENDENT_LIBS=
2003     MOZ_USER_DIR="Mozilla"
2004     ;;
2006 *-bsdi*)
2007     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2008     _PEDANTIC=
2009     case $OS_RELEASE in
2010         4.*|5.*)
2011             STRIP="$STRIP -d"
2012             ;;
2013         *)
2014             DSO_CFLAGS=''
2015             DSO_LDOPTS='-r'
2016             _WARNINGS_CFLAGS="-Wall"
2017             _WARNINGS_CXXFLAGS="-Wall"
2018             # The test above doesn't work properly, at least on 3.1.
2019             MKSHLIB_FORCE_ALL=''
2020             MKSHLIB_UNFORCE_ALL=''
2021         ;;
2022     esac
2023     ;;
2025 *-darwin*) 
2026     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2027     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2028     MOZ_OPTIMIZE_FLAGS="-O3"
2029     _PEDANTIC=
2030     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2031     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2032     DLL_SUFFIX=".dylib"
2033     DSO_LDOPTS=''
2034     STRIP="$STRIP -x -S"
2035     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2036     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2037     # The ExceptionHandling framework is needed for Objective-C exception
2038     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2039     # builds.
2040     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2042     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2043     dnl ===================================================================
2044     if test "x$enable_dtrace" = "xyes"; then
2045         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2046     else
2047         dnl check for the presence of the -dead_strip linker flag
2048         AC_MSG_CHECKING([for -dead_strip option to ld])
2049         _SAVE_LDFLAGS=$LDFLAGS
2050         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2051         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2052         if test -n "$_HAVE_DEAD_STRIP" ; then
2053             AC_MSG_RESULT([yes])
2054             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2055         else
2056             AC_MSG_RESULT([no])
2057         fi
2058         
2059         LDFLAGS=$_SAVE_LDFLAGS
2060     fi
2061     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2062     ;;
2064 *-freebsd*)
2065     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2066         DLL_SUFFIX=".so.1.0"
2067         DSO_LDOPTS="-shared"
2068     fi
2069     if test ! "$GNU_CC"; then
2070         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2071     fi
2072     ;; 
2074 ia64*-hpux*)
2075     DLL_SUFFIX=".so"
2076     if test ! "$GNU_CC"; then
2077        DSO_LDOPTS='-b'
2078        DSO_CFLAGS=""
2079        DSO_PIC_CFLAGS=
2080        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2081        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2082        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2083     else
2084        DSO_LDOPTS='-b -E'
2085        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2086        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2087     fi
2088     MOZ_FIX_LINK_PATHS=
2089     SYSTEM_MAKEDEPEND=
2090     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2091     AC_DEFINE(_LARGEFILE64_SOURCE)
2092     ;;
2094 *-hpux*)
2095     DLL_SUFFIX=".sl"
2096     if test ! "$GNU_CC"; then
2097         DSO_LDOPTS='-b -Wl,+s'
2098         DSO_CFLAGS=""
2099         DSO_PIC_CFLAGS="+Z"
2100         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2101         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2102         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2103     else
2104         DSO_LDOPTS='-b -E +s'
2105         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2106         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2107     fi
2108     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2109     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2110     ;;
2112 *-irix5*)
2113     AC_DEFINE(IRIX)
2114     DSO_LDOPTS='-elf -shared'
2116     if test "$GNU_CC"; then
2117        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2118        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2119        MKSHLIB_FORCE_ALL='-Wl,-all'
2120        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2121        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2122     else
2123        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2124        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2125        MKSHLIB_FORCE_ALL='-all'
2126        MKSHLIB_UNFORCE_ALL='-none'
2127     fi
2128     ;;
2130 *-irix6*)
2131     AC_DEFINE(IRIX)
2132     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2133     dnl compile and link using -n32
2134     USE_N32=1
2135     TARGET_COMPILER_ABI=n32
2136     DSO_LDOPTS='-elf -shared'
2137     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2138     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2139     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2140     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2141     if test "$GNU_CC"; then
2142        MKSHLIB_FORCE_ALL='-Wl,-all'
2143        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2144        _WARNINGS_CFLAGS="-Wall"
2145        _WARNINGS_CXXFLAGS="-Wall"
2146        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2147     else
2148        MKSHLIB_FORCE_ALL='-all'
2149        MKSHLIB_UNFORCE_ALL='-none'
2150            AR_LIST="$AR t"
2151            AR_EXTRACT="$AR x"
2152            AR_DELETE="$AR d"
2153            AR='$(CXX) -ar'
2154            AR_FLAGS='-o $@'
2155        CFLAGS="$CFLAGS -woff 3262 -G 4"
2156        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2157        if test -n "$USE_N32"; then
2158            ASFLAGS="$ASFLAGS -n32"
2159            CFLAGS="$CFLAGS -n32"
2160            CXXFLAGS="$CXXFLAGS -n32"
2161            LDFLAGS="$LDFLAGS -n32"
2162        fi
2163        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2164        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2165        MOZ_FIX_LINK_PATHS=
2166     fi
2167     if test -z "$GNU_CXX"; then
2168       MIPSPRO_CXX=1
2169     fi
2170     ;;
2172 *-*linux*)
2173     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2174     # Similarly for GNU_CXX and INTEL_CXX.
2175     if test "$INTEL_CC" -o "$INTEL_CXX"; then
2176         # -Os has been broken on Intel's C/C++ compilers for quite a
2177         # while; Intel recommends against using it.
2178         MOZ_OPTIMIZE_FLAGS="-O2"
2179         MOZ_DEBUG_FLAGS="-g"
2180     elif test "$GNU_CC" -o "$GNU_CXX"; then
2181         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2182         case $GCC_VERSION in
2183         4.1.*|4.2.*|4.5.*)
2184             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2185             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2186         esac
2187         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2188         MOZ_DEBUG_FLAGS="-g"
2189     fi
2191     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2193     MOZ_MEMORY=1
2195     case "${target_cpu}" in
2196     alpha*)
2197         CFLAGS="$CFLAGS -mieee"
2198         CXXFLAGS="$CXXFLAGS -mieee"
2199     ;;
2200     i*86)
2201         USE_ELF_DYNSTR_GC=1
2202     ;;
2203     mips*)
2204         MOZ_DEBUG_FLAGS="-g" # We want inlining
2205     ;;
2206     esac
2207     ;;
2209 *-wince*|*-winmo*)
2210     TARGET_COMPILER_ABI=msvc
2211     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2212     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2213     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2214     AR_LIST="$AR -list"
2215     AR_EXTRACT="$AR -extract"
2216     AR_DELETE="$AR d"
2217     AR_FLAGS='-OUT:"$@"'
2218     MOZ_MEMORY=1
2219     NSS_DISABLE_DBM=1
2220     MOZ_OGG=
2221     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2223     if test "$AS_BIN"; then
2224         AS="$AS_BIN"
2225     fi
2226     DSO_CFLAGS=
2227     DSO_PIC_CFLAGS=
2228     DLL_SUFFIX=.dll
2229     BIN_SUFFIX='.exe'
2230     if test -z "$RC"; then 
2231         RC=rc.exe  
2232     fi
2233     # certain versions of cygwin's makedepend barf on the 
2234     # #include <string> vs -I./dist/include/string issue so don't use it
2235     SYSTEM_MAKEDEPEND=
2237     HOST_CC=cl
2238     HOST_CXX=cl
2239     HOST_LD=link
2240     HOST_AR='lib -OUT:$@'
2241     HOST_RANLIB='echo ranlib'
2242     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2243         
2244         
2245     WARNINGS_AS_ERRORS='-WX'
2246     MOZ_OPTIMIZE_FLAGS='-Ox'
2247     AR_FLAGS='-NOLOGO -OUT:"$@"'
2248     ASM_SUFFIX=asm
2249     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2250     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2251     DLL_PREFIX=
2252     DOXYGEN=:
2253     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2254     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2255     GARBAGE=
2256     IMPORT_LIB_SUFFIX=lib
2257     dnl Need to force-link against mozalloc because it's used in the shunt
2258     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2259     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2260     LIB_PREFIX=
2261     LIB_SUFFIX=lib 
2262     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2263     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2264     MKSHLIB_FORCE_ALL=
2265     MKSHLIB_UNFORCE_ALL=
2266     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2267     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2268     MOZ_DEBUG_FLAGS='-Zi'
2269     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2270     MOZ_FIX_LINK_PATHS=
2271     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2272     OBJ_SUFFIX=obj
2273     RANLIB='echo not_ranlib'
2274     STRIP='echo not_strip'
2275     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2276     UNZIP=unzip
2277     XARGS=xargs
2278     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2279     ZIP=zip
2280     MOZ_TREE_FREETYPE=1
2282     AC_DEFINE(HAVE_SNPRINTF)
2283     AC_DEFINE(_WINDOWS)
2284     AC_DEFINE(WIN32)
2285     AC_DEFINE(XP_WIN)
2286     AC_DEFINE(XP_WIN32)
2287     AC_DEFINE(HW_THREADS)
2288     AC_DEFINE(STDC_HEADERS)
2289     AC_DEFINE(NEW_H, <new>)
2290     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2291     AC_DEFINE(HAVE_LOCALTIME_R)
2293     TARGET_MD_ARCH=win32
2294     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2295     BIN_SUFFIX='.exe'
2296     MOZ_USER_DIR="Mozilla"
2298     MOZ_GFX_OPTIMIZE_MOBILE=1
2300     # Sanity check for WINCE_WINDOWS_MOBILE
2301     # XXX disabled until we can fix the mobile tinderbox
2302     ##if test "$WINCE_WINDOWS_MOBILE"; then
2303     ##   AC_CHECK_HEADER(tpcshell.h, [],
2304     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2305     ##fi
2309 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2310     DSO_CFLAGS=
2311     DSO_PIC_CFLAGS=
2312     DLL_SUFFIX=.dll
2313     RC=rc.exe
2314     # certain versions of cygwin's makedepend barf on the 
2315     # #include <string> vs -I./dist/include/string issue so don't use it
2316     SYSTEM_MAKEDEPEND=
2317     if test -n "$GNU_CC"; then
2318         CC="$CC -mno-cygwin"
2319         CXX="$CXX -mno-cygwin"
2320         CPP="$CPP -mno-cygwin"
2321         CFLAGS="$CFLAGS -mms-bitfields"
2322         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2323         DSO_LDOPTS='-shared'
2324         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2325         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2326         RC='$(WINDRES)'
2327         # Use temp file for windres (bug 213281)
2328         RCFLAGS='-O coff --use-temp-file'
2329         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2330         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2331         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2332         MOZ_FIX_LINK_PATHS=
2333         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2334         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2335         DLL_PREFIX=
2336         IMPORT_LIB_SUFFIX=dll.a
2337         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2338     else
2339         TARGET_COMPILER_ABI=msvc
2340         HOST_CC='$(CC)'
2341         HOST_CXX='$(CXX)'
2342         HOST_LD='$(LD)'
2343         if test "$AS_BIN"; then
2344             AS="$(basename "$AS_BIN")"
2345         fi
2346         AR='lib -NOLOGO -OUT:"$@"'
2347         AR_FLAGS=
2348         RANLIB='echo not_ranlib'
2349         STRIP='echo not_strip'
2350         XARGS=xargs
2351         ZIP=zip
2352         UNZIP=unzip
2353         DOXYGEN=:
2354         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2355         ASM_SUFFIX=asm
2356         OBJ_SUFFIX=obj
2357         LIB_SUFFIX=lib
2358         DLL_PREFIX=
2359         LIB_PREFIX=
2360         IMPORT_LIB_SUFFIX=lib
2361         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2362         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2363         MKSHLIB_FORCE_ALL=
2364         MKSHLIB_UNFORCE_ALL=
2365         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2366         _USE_CPP_INCLUDE_FLAG=1
2367         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2368         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2369         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2370         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2371         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2372         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2373         MOZ_DEBUG_FLAGS='-Zi'
2374         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2375         WARNINGS_AS_ERRORS='-WX'
2376         MOZ_OPTIMIZE_FLAGS='-O1'
2377         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2378         MOZ_FIX_LINK_PATHS=
2379         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2380         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2381         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2382         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2383         if test $_MSC_VER -ge 1400; then
2384             LDFLAGS="$LDFLAGS -NXCOMPAT"
2385             dnl For profile-guided optimization
2386             PROFILE_GEN_CFLAGS="-GL"
2387             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2388             dnl XXX: PGO builds can fail with warnings treated as errors,
2389             dnl specifically "no profile data available" appears to be
2390             dnl treated as an error sometimes. This might be a consequence
2391             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2392             dnl with the linker doing most of the work in the whole-program
2393             dnl optimization/PGO case. I think it's probably a compiler bug,
2394             dnl but we work around it here.
2395             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2396             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2397             dnl Probably also a compiler bug, but what can you do?
2398             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2399             if test -n "$_USE_DYNAMICBASE"; then
2400                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2401             fi
2402         fi
2403     fi
2404     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2405     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2406     AC_DEFINE(HAVE_SNPRINTF)
2407     AC_DEFINE(_WINDOWS)
2408     AC_DEFINE(WIN32)
2409     AC_DEFINE(XP_WIN)
2410     AC_DEFINE(XP_WIN32)
2411     AC_DEFINE(HW_THREADS)
2412     AC_DEFINE(STDC_HEADERS)
2413     AC_DEFINE(NEW_H, <new>)
2414     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2415     TARGET_MD_ARCH=win32
2416     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2417     BIN_SUFFIX='.exe'
2418     MOZ_USER_DIR="Mozilla"
2420     dnl Hardcode to win95 for now - cls
2421     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2423     dnl set NO_X11 defines here as the general check is skipped on win32
2424     no_x=yes
2425     AC_DEFINE(NO_X11)
2427     dnl MinGW/MSYS doesn't provide or need cygpath
2428     case "$host" in
2429     *-mingw*)
2430         CYGPATH_W=echo
2431         CYGPATH_S=cat
2432         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2433         ;;
2434     *-cygwin*|*-msvc*|*-mks*)
2435         CYGPATH_W="cygpath -a -w"
2436         CYGPATH_S="sed -e s|\\\\|/|g"
2437         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2438         ;;
2439     esac
2440     case "$host" in
2441     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2443     if test -z "$MOZ_TOOLS"; then
2444         AC_MSG_ERROR([MOZ_TOOLS is not set])
2445     fi
2447     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2448     if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2449         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2450     fi
2451     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2452     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2453         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2454     fi
2455     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2456     ;;
2457     esac 
2460     case "$host_os" in
2461     cygwin*|msvc*|mks*)
2462         AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites])
2463         ;;
2465     *)
2466         AC_CHECK_HEADERS(oleacc.idl)
2468         AC_LANG_SAVE
2469         AC_LANG_CPLUSPLUS
2470         AC_CHECK_HEADERS(atlbase.h)
2471         AC_LANG_RESTORE
2472         ;;
2473     esac
2475     case "$target" in
2476     i*86-*)
2477         if test "$HAVE_64BIT_OS"; then
2478             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2479         fi
2481         if test $_MSC_VER -ge 1400; then
2482             LDFLAGS="$LDFLAGS -SAFESEH"
2483         fi
2484         AC_CHECK_HEADERS(mmintrin.h)
2485         AC_DEFINE(_X86_)
2486         ;;
2487     alpha-*)
2488         AC_DEFINE(_ALPHA_)
2489         ;;
2490     mips-*)
2491         AC_DEFINE(_MIPS_)
2492         ;;
2493     x86_64-*)
2494         AC_DEFINE(_AMD64_)
2495         ;;
2496     *)
2497         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2498         ;;
2499     esac
2501     if test "$HAVE_64BIT_OS"; then
2502         AC_DEFINE(_WIN64)
2503     fi
2504     ;;
2506 *-netbsd*)
2507     DSO_CFLAGS=''
2508     CFLAGS="$CFLAGS -Dunix"
2509     CXXFLAGS="$CXXFLAGS -Dunix"
2510     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2511         DLL_SUFFIX=".so"
2512         DSO_PIC_CFLAGS='-fPIC -DPIC'
2513         DSO_LDOPTS='-shared'
2514         BIN_FLAGS='-Wl,--export-dynamic'
2515     else
2516         DSO_PIC_CFLAGS='-fPIC -DPIC'
2517         DLL_SUFFIX=".so.1.0"
2518         DSO_LDOPTS='-shared'
2519     fi
2520     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2521     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2522     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2523     if test "$LIBRUNPATH"; then
2524         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2525     fi
2526     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2527     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2528     ;;
2530 *-nto*) 
2531         AC_DEFINE(NTO)  
2532         AC_DEFINE(_QNX_SOURCE)
2533         AC_DEFINE(_i386)
2534         OS_TARGET=NTO
2535         WARNINGS_AS_ERRORS=''
2536         MOZ_OPTIMIZE_FLAGS="-O"
2537         MOZ_DEBUG_FLAGS="-gstabs"
2538         USE_PTHREADS=1
2539         _PEDANTIC=
2540         LIBS="$LIBS -lsocket -lstdc++"
2541         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2542         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2543         if test "$with_x" != "yes"
2544         then
2545                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2546             TK_CFLAGS='-I/usr/include/photon'
2547                 TK_LIBS='-lph'
2548         fi
2549         case "${target_cpu}" in
2550         ppc*)
2551         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2552         ;;
2553         esac
2554         case "${host_cpu}" in
2555         i*86)
2556         USE_ELF_DYNSTR_GC=1
2557         ;;
2558         esac
2559         ;;
2561 *-openbsd*)
2562     DLL_SUFFIX=".so.1.0"
2563     DSO_CFLAGS=''
2564     DSO_PIC_CFLAGS='-fPIC'
2565     DSO_LDOPTS='-shared -fPIC'
2566     if test "$LIBRUNPATH"; then
2567         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2568     fi
2569     ;;
2571 *-openvms*) 
2572     AC_DEFINE(NO_PW_GECOS)
2573     AC_DEFINE(NO_UDSOCK)
2574     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2575     USE_PTHREADS=1
2576     MKSHLIB_FORCE_ALL='-all'
2577     MKSHLIB_UNFORCE_ALL='-none'
2578     AS='as'
2579     AS_DASH_C_FLAG='-Wc/names=as_is'
2580     AR_FLAGS='c $@'
2581     DSO_LDOPTS='-shared -auto_symvec'
2582     DSO_PIC_CFLAGS=
2583     MOZ_DEBUG_LDFLAGS='-g'
2584     COMPAQ_CXX=1
2585     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2586     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2587     ;;
2590 *-os2*)
2591     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2592     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2593     AC_DEFINE(OS2)
2594     AC_DEFINE(XP_OS2)
2595     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2596     AC_DEFINE(TCPV40HDRS)
2597     DLL_PREFIX=
2598     LIB_PREFIX=
2599     LIB_SUFFIX=lib
2600     BIN_SUFFIX=".exe"
2601     DLL_SUFFIX=".dll"
2602     IMPORT_LIB_SUFFIX=lib
2603     DSO_PIC_CFLAGS=
2604     AR=emxomfar
2605     AR_FLAGS='r $@'
2606     CFLAGS="$CFLAGS -Zomf"
2607     CXXFLAGS="$CXXFLAGS -Zomf"
2608     DSO_LDOPTS='-Zdll'
2609     BIN_FLAGS='-Zlinker /ST:0x100000'
2610     IMPLIB='emximp -o'
2611     FILTER='emxexp -o'
2612     LDFLAGS='-Zmap'
2613     WARNINGS_AS_ERRORS='-Werror'
2614     MOZ_DEBUG_FLAGS="-g -fno-inline"
2615     MOZ_OPTIMIZE_FLAGS="-O2"
2616     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2617     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2618     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2619     TARGET_MD_ARCH=os2
2620     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2621     RC=rc.exe
2622     RCFLAGS='-n'
2623     MOZ_USER_DIR="Mozilla"
2625     if test "$MOZTOOLS"; then
2626         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2627     else
2628         AC_MSG_ERROR([MOZTOOLS is not set])
2629     fi
2630     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2631         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2632         LDFLAGS="$LDFLAGS -Zhigh-mem"
2633         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2634         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2635     fi
2637     # GCC for OS/2 currently predefines these, but we don't want them
2638     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2639     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2641     AC_CACHE_CHECK(for __declspec(dllexport),
2642         ac_os2_declspec,
2643         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2644                         [return 0;],
2645                         ac_os2_declspec="yes",
2646                         ac_os2_declspec="no")])
2647     if test "$ac_os2_declspec" = "yes"; then
2648         FILTER='true'
2649         MOZ_OS2_USE_DECLSPEC='1'
2650     fi
2651     ;;
2653 alpha*-*-osf*)
2654     if test "$GNU_CC"; then
2655       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2656       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2658     else
2659         MOZ_DEBUG_FLAGS='-g'
2660         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2661         CFLAGS="$CFLAGS -ieee"
2662         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2663         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2664         DSO_CFLAGS=
2665         DSO_PIC_CFLAGS=
2666         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2667         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2668         MKSHLIB_FORCE_ALL='-all'
2669         MKSHLIB_UNFORCE_ALL='-none'
2670         dnl Might fix the libxpcom.so breakage on this platform as well....
2671         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2672         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2673     fi
2674     if test -z "$GNU_CXX"; then
2675       COMPAQ_CXX=1
2676     fi
2677     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2678     ;;
2680 *-qnx*) 
2681     DIRENT_INO=d_stat.st_ino
2682     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2683     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2684     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2685     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2686     AC_DEFINE(STDC_HEADERS)
2687     if test "$no_x" = "yes"; then
2688             _PLATFORM_DEFAULT_TOOLKIT='photon'
2689             TK_CFLAGS='-I/usr/nto/include/photon'
2690             TK_LIBS='-lphoton -lphrender'
2691     fi
2692     ;;
2694 *-sco*) 
2695     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2696     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2697     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2698     if test ! "$GNU_CC"; then
2699        DSO_LDOPTS='-G'
2700     fi
2701     ;;
2703 *-solaris*) 
2704     AC_DEFINE(SOLARIS)
2705     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2706     SYSTEM_MAKEDEPEND=
2707     MOZ_FIX_LINK_PATHS=
2708     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2709     # libraries one level up (e.g. libnspr4.so)
2710     if test "$SOLARIS_SUNPRO_CC"; then
2711        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2712        LIBS="-lCrun -lCstd -lc $LIBS"
2713        NS_USE_NATIVE=1
2714        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2715        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2716        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__"
2717        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2718        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2719        LDFLAGS="-xildoff $LDFLAGS"
2720        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2721            _SAVE_LDFLAGS=$LDFLAGS
2722            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2723            AC_TRY_LINK([#include <stdio.h>],
2724                        [printf("Hello World\n");],
2725                        ,
2726                        [LDFLAGS=$_SAVE_LDFLAGS])
2727        fi
2728        WARNINGS_AS_ERRORS='-Werror'
2729        MOZ_OPTIMIZE_FLAGS="-xO4"
2730        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2731        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2732        MKSHLIB_FORCE_ALL='-z allextract'
2733        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2734        DSO_LDOPTS='-G'
2735        AR_LIST="$AR t"
2736        AR_EXTRACT="$AR x"
2737        AR_DELETE="$AR d"
2738        AR='$(CXX) -xar'
2739        AR_FLAGS='-o $@'
2740        AS='/usr/ccs/bin/as'
2741        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2742        AS_DASH_C_FLAG=''
2743        TARGET_COMPILER_ABI="sunc"
2744        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2745        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2746        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2747        AC_LANG_SAVE
2748        AC_LANG_CPLUSPLUS
2749        AC_TRY_COMPILE([],
2750            [#if (__SUNPRO_CC < 0x590)
2751            #error "Denied"
2752            #endif],
2753            _BAD_COMPILER=,_BAD_COMPILER=1)
2754        if test -n "$_BAD_COMPILER"; then
2755            _res="no"
2756            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2757        else
2758            _res="yes"
2759        fi
2760        AC_TRY_COMPILE([],
2761            [#if (__SUNPRO_CC >= 0x5100)
2762            #error "Sun C++ 5.10 or above"
2763            #endif],
2764            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2765        if test "$_ABOVE_SS12U1"; then
2766            # disable xannotate
2767            CXXFLAGS="$CXXFLAGS -xannotate=no"
2768        fi
2769        AC_MSG_RESULT([$_res])
2770        AC_LANG_RESTORE
2771     else
2772        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2773        LIBS="-lc $LIBS"
2774        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2775        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2776        ASFLAGS="$ASFLAGS -fPIC"
2777        DSO_LDOPTS='-shared'
2778        _WARNINGS_CFLAGS=''
2779        _WARNINGS_CXXFLAGS=''
2780        if test "$OS_RELEASE" = "5.3"; then
2781            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2782        fi
2783     fi
2784     if test "$OS_RELEASE" = "5.5.1"; then
2785         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2786     fi
2787     ;;
2789 *-sunos*) 
2790     DSO_LDOPTS='-Bdynamic'
2791     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2792     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2793     AC_DEFINE(SUNOS4)
2794     AC_DEFINE(SPRINTF_RETURNS_STRING)
2795     case "$(target_os)" in
2796     sunos4.1*)
2797         DLL_SUFFIX='.so.1.0'
2798         ;;
2799     esac
2800     ;;
2802 *-sysv4.2uw7*) 
2803         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2804     ;;
2806 *-os2*)
2807     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2808     ;;
2810 *-android*)
2811     AC_DEFINE(NO_PW_GECOS)
2812     no_x=yes
2813     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2814     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2816     MOZ_GFX_OPTIMIZE_MOBILE=1
2817     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2818     ;;
2820 esac
2822 dnl Only one oddball right now (QNX), but this gives us flexibility
2823 dnl if any other platforms need to override this in the future.
2824 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2826 dnl ========================================================
2827 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2828 dnl by now will not have any way to link most binaries (tests
2829 dnl as well as viewer, apprunner, etc.), because some symbols
2830 dnl will be left out of the "composite" .so's by ld as unneeded.
2831 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2832 dnl they can link in the static libs that provide the missing
2833 dnl symbols.
2834 dnl ========================================================
2835 NO_LD_ARCHIVE_FLAGS=
2836 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2837     NO_LD_ARCHIVE_FLAGS=1
2839 case "$target" in
2840 *-os2*)
2841     NO_LD_ARCHIVE_FLAGS=
2842     ;;
2843 *-aix4.3*|*-aix5*)
2844     NO_LD_ARCHIVE_FLAGS=
2845     ;;
2846 *-openvms*)
2847     NO_LD_ARCHIVE_FLAGS=
2848     ;;
2849 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2850     if test -z "$GNU_CC"; then
2851         NO_LD_ARCHIVE_FLAGS=
2852     fi
2853     ;;
2854 esac
2855 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2857 dnl ========================================================
2858 dnl = Flags to strip unused symbols from .so components
2859 dnl ========================================================
2860 case "$target" in
2861     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2862         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2863         ;;
2864     *-solaris*)
2865         if test -z "$GNU_CC"; then
2866          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2867         else
2868          if test -z "$GCC_USE_GNU_LD"; then
2869           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2870          else
2871           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2872          fi
2873         fi
2874         ;;
2875     *-nto*) 
2876         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2877         ;;
2878     *-darwin*)
2879         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2880         ;;
2881     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2882         if test -n "$GNU_CC"; then
2883            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2884         fi
2885         ;;
2886 esac
2888 if test -z "$COMPILE_ENVIRONMENT"; then
2889     SKIP_COMPILER_CHECKS=1
2890     SKIP_LIBRARY_CHECKS=1
2893 if test -z "$SKIP_COMPILER_CHECKS"; then
2894 dnl Checks for typedefs, structures, and compiler characteristics.
2895 dnl ========================================================
2896 AC_HEADER_STDC
2897 AC_C_CONST
2898 AC_TYPE_MODE_T
2899 AC_TYPE_OFF_T
2900 AC_TYPE_PID_T
2901 AC_TYPE_SIZE_T
2902 AC_LANG_CPLUSPLUS
2903 AC_MSG_CHECKING(for __stdcall)
2904 AC_CACHE_VAL(ac_cv___stdcall,
2905  [AC_TRY_COMPILE([template <typename Method> struct foo;
2906                   template <> struct foo<void (*)()> {};
2907                   template <> struct foo<void (__stdcall*)()> {};],
2908                  [],
2909                  [ac_cv___stdcall=true],
2910                  [ac_cv___stdcall=false])])
2911 if test "$ac_cv___stdcall" = true ; then
2912   AC_DEFINE(HAVE_STDCALL)
2913   AC_MSG_RESULT(yes)
2914 else
2915   AC_MSG_RESULT(no)
2917 AC_LANG_C
2918 AC_MSG_CHECKING(for ssize_t)
2919 AC_CACHE_VAL(ac_cv_type_ssize_t,
2920  [AC_TRY_COMPILE([#include <stdio.h>
2921                   #include <sys/types.h>],
2922                  [ssize_t foo = 0;],
2923                  [ac_cv_type_ssize_t=true],
2924                  [ac_cv_type_ssize_t=false])])
2925 if test "$ac_cv_type_ssize_t" = true ; then
2926   AC_DEFINE(HAVE_SSIZE_T)
2927   AC_MSG_RESULT(yes)
2928 else
2929   AC_MSG_RESULT(no)
2931 AC_STRUCT_ST_BLKSIZE
2932 AC_MSG_CHECKING(for siginfo_t)
2933 AC_CACHE_VAL(ac_cv_siginfo_t,
2934  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2935                   #include <signal.h>],
2936                  [siginfo_t* info;],
2937                  [ac_cv_siginfo_t=true],
2938                  [ac_cv_siginfo_t=false])])
2939 if test "$ac_cv_siginfo_t" = true ; then
2940   AC_DEFINE(HAVE_SIGINFO_T)
2941   AC_MSG_RESULT(yes)
2942 else
2943   AC_MSG_RESULT(no)
2946 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2947 dnl ========================================================
2948 AC_MSG_CHECKING(for int16_t)
2949 AC_CACHE_VAL(ac_cv_int16_t,
2950  [AC_TRY_COMPILE([#include <stdio.h>
2951                   #include <sys/types.h>],
2952                  [int16_t foo = 0;],
2953                  [ac_cv_int16_t=true],
2954                  [ac_cv_int16_t=false])])
2955 if test "$ac_cv_int16_t" = true ; then
2956   AC_DEFINE(HAVE_INT16_T)
2957   AC_MSG_RESULT(yes)
2958 else
2959   AC_MSG_RESULT(no)
2961 AC_MSG_CHECKING(for int32_t)
2962 AC_CACHE_VAL(ac_cv_int32_t,
2963  [AC_TRY_COMPILE([#include <stdio.h>
2964                   #include <sys/types.h>],
2965                  [int32_t foo = 0;],
2966                  [ac_cv_int32_t=true],
2967                  [ac_cv_int32_t=false])])
2968 if test "$ac_cv_int32_t" = true ; then
2969   AC_DEFINE(HAVE_INT32_T)
2970   AC_MSG_RESULT(yes)
2971 else
2972   AC_MSG_RESULT(no)
2974 AC_MSG_CHECKING(for int64_t)
2975 AC_CACHE_VAL(ac_cv_int64_t,
2976  [AC_TRY_COMPILE([#include <stdio.h>
2977                   #include <sys/types.h>],
2978                  [int64_t foo = 0;],
2979                  [ac_cv_int64_t=true],
2980                  [ac_cv_int64_t=false])])
2981 if test "$ac_cv_int64_t" = true ; then
2982   AC_DEFINE(HAVE_INT64_T)
2983   AC_MSG_RESULT(yes)
2984 else
2985   AC_MSG_RESULT(no)
2987 AC_MSG_CHECKING(for int64)
2988 AC_CACHE_VAL(ac_cv_int64,
2989  [AC_TRY_COMPILE([#include <stdio.h>
2990                   #include <sys/types.h>],
2991                  [int64 foo = 0;],
2992                  [ac_cv_int64=true],
2993                  [ac_cv_int64=false])])
2994 if test "$ac_cv_int64" = true ; then
2995   AC_DEFINE(HAVE_INT64)
2996   AC_MSG_RESULT(yes)
2997 else
2998   AC_MSG_RESULT(no)
3000 AC_MSG_CHECKING(for uint)
3001 AC_CACHE_VAL(ac_cv_uint,
3002  [AC_TRY_COMPILE([#include <stdio.h>
3003                   #include <sys/types.h>],
3004                  [uint foo = 0;],
3005                  [ac_cv_uint=true],
3006                  [ac_cv_uint=false])])
3007 if test "$ac_cv_uint" = true ; then
3008   AC_DEFINE(HAVE_UINT)
3009   AC_MSG_RESULT(yes)
3010 else
3011   AC_MSG_RESULT(no)
3013 AC_MSG_CHECKING(for uint_t)
3014 AC_CACHE_VAL(ac_cv_uint_t,
3015  [AC_TRY_COMPILE([#include <stdio.h>
3016                   #include <sys/types.h>],
3017                  [uint_t foo = 0;],
3018                  [ac_cv_uint_t=true],
3019                  [ac_cv_uint_t=false])])
3020 if test "$ac_cv_uint_t" = true ; then
3021   AC_DEFINE(HAVE_UINT_T)
3022   AC_MSG_RESULT(yes)
3023 else
3024   AC_MSG_RESULT(no)
3026 AC_MSG_CHECKING(for uint16_t)
3027 AC_CACHE_VAL(ac_cv_uint16_t,
3028  [AC_TRY_COMPILE([#include <stdio.h>
3029                   #include <sys/types.h>],
3030                  [uint16_t foo = 0;],
3031                  [ac_cv_uint16_t=true],
3032                  [ac_cv_uint16_t=false])])
3033 if test "$ac_cv_uint16_t" = true ; then
3034   AC_DEFINE(HAVE_UINT16_T)
3035   AC_MSG_RESULT(yes)
3036 else
3037   AC_MSG_RESULT(no)
3040 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3041 dnl are defined when compiling C++ but not C.  Since the result of this
3042 dnl test is used only in C++, do it in C++.
3043 AC_LANG_CPLUSPLUS
3045 AC_MSG_CHECKING(for uname.domainname)
3046 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3047     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3048         [ struct utsname *res; char *domain; 
3049             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3050         [ac_cv_have_uname_domainname_field=true],
3051         [ac_cv_have_uname_domainname_field=false])])
3053 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3054     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3055     AC_MSG_RESULT(yes)
3056 else
3057     AC_MSG_RESULT(no)
3060 AC_MSG_CHECKING(for uname.__domainname)
3061 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3062     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3063         [ struct utsname *res; char *domain; 
3064             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3065         [ac_cv_have_uname_us_domainname_field=true],
3066         [ac_cv_have_uname_us_domainname_field=false])])
3068 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3069     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3070     AC_MSG_RESULT(yes)
3071 else
3072     AC_MSG_RESULT(no)
3075 AC_LANG_CPLUSPLUS
3077 dnl Check for usable char16_t (2 bytes, unsigned)
3078 dnl (we might not need the unsignedness check anymore)
3079 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3080     ac_cv_have_usable_char16_t,
3081     [AC_TRY_COMPILE([$configure_static_assert_macros],
3082                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3083                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3084                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3085                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3086                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3087                     ac_cv_have_usable_char16_t="yes",
3088                     ac_cv_have_usable_char16_t="no")])
3089 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3090     AC_DEFINE(HAVE_CPP_CHAR16_T)
3091     HAVE_CPP_CHAR16_T=1
3094 dnl Check for usable wchar_t (2 bytes, unsigned)
3095 dnl (we really don't need the unsignedness check anymore)
3096 dnl ========================================================
3098 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3099     ac_cv_have_usable_wchar_v2,
3100     [AC_TRY_COMPILE([#include <stddef.h>
3101                      $configure_static_assert_macros],
3102                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3103                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3104                     ac_cv_have_usable_wchar_v2="yes",
3105                     ac_cv_have_usable_wchar_v2="no")])
3106 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3107     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3108     HAVE_CPP_2BYTE_WCHAR_T=1
3109 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3110 dnl This is really gcc-only
3111 dnl Do this test using CXX only since some versions of gcc
3112 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3113 dnl only have short-wchar support for c++.
3114 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3116     _SAVE_CXXFLAGS=$CXXFLAGS
3117     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3119     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3120         ac_cv_have_usable_wchar_option_v2,
3121         [AC_TRY_LINK([#include <stddef.h>
3122                       $configure_static_assert_macros],
3123                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3124                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3125                      ac_cv_have_usable_wchar_option_v2="yes",
3126                      ac_cv_have_usable_wchar_option_v2="no")])
3128     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3129         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3130         HAVE_CPP_2BYTE_WCHAR_T=1
3131         WCHAR_CFLAGS="-fshort-wchar"
3132     else    
3133         CXXFLAGS=$_SAVE_CXXFLAGS
3134     fi
3137 AC_LANG_C
3139 dnl Check for .hidden assembler directive and visibility attribute.
3140 dnl Borrowed from glibc configure.in
3141 dnl ===============================================================
3142 if test "$GNU_CC"; then
3143   AC_CACHE_CHECK(for visibility(hidden) attribute,
3144                  ac_cv_visibility_hidden,
3145                  [cat > conftest.c <<EOF
3146                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3148                   ac_cv_visibility_hidden=no
3149                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3150                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3151                       ac_cv_visibility_hidden=yes
3152                     fi
3153                   fi
3154                   rm -f conftest.[cs]
3155                  ])
3156   if test "$ac_cv_visibility_hidden" = "yes"; then
3157     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3159     AC_CACHE_CHECK(for visibility(default) attribute,
3160                    ac_cv_visibility_default,
3161                    [cat > conftest.c <<EOF
3162                     int foo __attribute__ ((visibility ("default"))) = 1;
3164                     ac_cv_visibility_default=no
3165                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3166                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3167                         ac_cv_visibility_default=yes
3168                       fi
3169                     fi
3170                     rm -f conftest.[cs]
3171                    ])
3172     if test "$ac_cv_visibility_default" = "yes"; then
3173       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3175       AC_CACHE_CHECK(for visibility pragma support,
3176                      ac_cv_visibility_pragma,
3177                      [cat > conftest.c <<EOF
3178 #pragma GCC visibility push(hidden)
3179                       int foo_hidden = 1;
3180 #pragma GCC visibility push(default)
3181                       int foo_default = 1;
3183                       ac_cv_visibility_pragma=no
3184                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3185                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3186                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3187                             ac_cv_visibility_pragma=yes
3188                           fi
3189                         fi
3190                       fi
3191                       rm -f conftest.[cs]
3192                     ])
3193       if test "$ac_cv_visibility_pragma" = "yes"; then
3194         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3195                        ac_cv_have_visibility_class_bug,
3196                        [cat > conftest.c <<EOF
3197 #pragma GCC visibility push(hidden)
3198 struct __attribute__ ((visibility ("default"))) TestStruct {
3199   static void Init();
3201 __attribute__ ((visibility ("default"))) void TestFunc() {
3202   TestStruct::Init();
3205                        ac_cv_have_visibility_class_bug=no
3206                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3207                          ac_cv_have_visibility_class_bug=yes
3208                        else
3209                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3210                            ac_cv_have_visibility_class_bug=yes
3211                          fi
3212                        fi
3213                        rm -rf conftest.{c,S}
3214                        ])
3216         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3217                        ac_cv_have_visibility_builtin_bug,
3218                        [cat > conftest.c <<EOF
3219 #pragma GCC visibility push(hidden)
3220 #pragma GCC visibility push(default)
3221 #include <string.h>
3222 #pragma GCC visibility pop
3224 __attribute__ ((visibility ("default"))) void Func() {
3225   char c[[100]];
3226   memset(c, 0, sizeof(c));
3229                        ac_cv_have_visibility_builtin_bug=no
3230                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3231                          ac_cv_have_visibility_builtin_bug=yes
3232                        else
3233                          if test `grep -c "@PLT" conftest.S` = 0; then
3234                            ac_cv_visibility_builtin_bug=yes
3235                          fi
3236                        fi
3237                        rm -f conftest.{c,S}
3238                        ])
3239         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3240                 "$ac_cv_have_visibility_class_bug" = "no"; then
3241           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3242           WRAP_SYSTEM_INCLUDES=1
3243           STL_FLAGS='-I$(DIST)/stl_wrappers'
3244           WRAP_STL_INCLUDES=1
3245         else
3246           VISIBILITY_FLAGS='-fvisibility=hidden'
3247         fi # have visibility pragma bug
3248       fi   # have visibility pragma
3249     fi     # have visibility(default) attribute
3250   fi       # have visibility(hidden) attribute
3251 fi         # GNU_CC
3253 # visibility hidden flag for Sun Studio on Solaris
3254 if test "$SOLARIS_SUNPRO_CC"; then
3255 VISIBILITY_FLAGS='-xldscope=hidden'
3256 fi         # Sun Studio on Solaris
3258 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3259 AC_SUBST(VISIBILITY_FLAGS)
3261 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3262 dnl ========================================================
3263 if test "$GNU_CC"; then
3264   CFLAGS_save="${CFLAGS}"
3265   CFLAGS="${CFLAGS} -Werror"
3266   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3267                  ac_cv_force_align_arg_pointer,
3268                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3269                                  [],
3270                                  ac_cv_force_align_arg_pointer="yes",
3271                                  ac_cv_force_align_arg_pointer="no")])
3272   CFLAGS="${CFLAGS_save}"
3273   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3274     HAVE_GCC_ALIGN_ARG_POINTER=1
3275   else
3276     HAVE_GCC_ALIGN_ARG_POINTER=
3277   fi
3279 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3281 dnl Checks for header files.
3282 dnl ========================================================
3283 AC_HEADER_DIRENT
3284 case "$target_os" in
3285 freebsd*)
3286 # for stuff like -lXshm
3287     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3288     ;;
3289 esac
3290 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3291 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3292 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3293 AC_CHECK_HEADERS(malloc.h)
3294 AC_CHECK_HEADERS(X11/XKBlib.h)
3295 AC_CHECK_HEADERS(io.h)
3297 dnl These are all the places some variant of statfs can be hiding.
3298 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3300 dnl Quota support
3301 AC_CHECK_HEADERS(sys/quota.h)
3302 AC_CHECK_HEADERS(linux/quota.h)
3304 dnl Try for MMX support
3305 dnl NB - later gcc versions require -mmmx for this header to be successfully
3306 dnl included (or another option which implies it, such as -march=pentium-mmx)
3307 AC_CHECK_HEADERS(mmintrin.h)
3309 dnl Check whether the compiler supports the new-style C++ standard
3310 dnl library headers (i.e. <new>) or needs the old "new.h"
3311 AC_LANG_CPLUSPLUS
3312 NEW_H=new.h
3313 AC_CHECK_HEADER(new, [NEW_H=new])
3314 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3315 AC_LANG_C
3317 AC_ARG_ENABLE(dtrace,
3318               [  --enable-dtrace         build with dtrace support if available (default=no)],
3319               [enable_dtrace="yes"],)
3320 if test "x$enable_dtrace" = "xyes"; then
3321   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3322   if test -n "$HAVE_DTRACE"; then
3323       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3324   else
3325       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3326   fi
3328 AC_SUBST(HAVE_DTRACE)
3330 case $target in
3331 *-aix4.3*|*-aix5*)
3332         ;;
3334         AC_CHECK_HEADERS(sys/cdefs.h)
3335         ;;
3336 esac
3338 dnl Checks for libraries.
3339 dnl ========================================================
3340 case $target in
3341 *-hpux11.*)
3342         ;;
3344         AC_CHECK_LIB(c_r, gethostbyname_r)
3345         ;;
3346 esac
3348 dnl We don't want to link with libdl even if it's present on OS X, since
3349 dnl it's not used and not part of the default installation.
3350 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3351 dnl We don't want to link against libm or libpthread on Darwin since
3352 dnl they both are just symlinks to libSystem and explicitly linking
3353 dnl against libSystem causes issues when debugging (see bug 299601).
3354 case $target in
3355 *-darwin*)
3356     ;;
3357 *-beos*)
3358     ;;
3359 *-os2*)
3360     ;;
3362     AC_CHECK_LIB(m, atan)
3363     AC_CHECK_LIB(dl, dlopen,
3364     AC_CHECK_HEADER(dlfcn.h, 
3365         LIBS="-ldl $LIBS"
3366         AC_DEFINE(HAVE_LIBDL)))
3367     ;;
3368 esac
3370 _SAVE_CFLAGS="$CFLAGS"
3371 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3372 AC_CHECK_FUNCS(dladdr)
3373 CFLAGS="$_SAVE_CFLAGS"
3375 if test ! "$GNU_CXX"; then
3377     case $target in
3378     *-aix*)
3379         AC_CHECK_LIB(C_r, demangle)
3380         ;;
3381      *)
3382         AC_CHECK_LIB(C, demangle)
3383         ;;
3384      esac
3387 dnl OS/2 has socket in libc.
3388 case $target in
3389 *-os2*)
3390     ;;
3392     AC_CHECK_LIB(socket, socket)
3393 esac
3395 dnl ========================================================
3396 dnl Check whether we can compile code for Core Text
3397 dnl (available on Mac OS X 10.5 or later)
3398 dnl ========================================================
3399 case "$target" in
3400 *-darwin*)
3401   AC_MSG_CHECKING([for Core Text])
3402   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3403                  [CTLineRef lineRef;],
3404                   ac_cv_have_core_text="yes",
3405                   ac_cv_have_core_text="no")
3406   AC_MSG_RESULT([$ac_cv_have_core_text])
3408   if test "$ac_cv_have_core_text" = "no"; then
3409     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3410   fi
3411   ;;
3412 esac
3414 XLDFLAGS="$X_LIBS"
3415 XLIBS="$X_EXTRA_LIBS"
3417 dnl ========================================================
3418 dnl Checks for X libraries.
3419 dnl Ordering is important.
3420 dnl Xt is dependent upon SM as of X11R6
3421 dnl ========================================================
3422 if test "$no_x" = "yes"; then
3423     AC_DEFINE(NO_X11)
3424 else
3425     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3426         XLIBS="-lX11 $XLIBS"
3427         _SAVE_LDFLAGS="$LDFLAGS"
3428         LDFLAGS="$XLDFLAGS $LDFLAGS"
3429         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3430                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3431         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3432                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3433      
3434         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3435         unset ac_cv_lib_Xt_XtFree
3436             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3437             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3438         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3439                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3440         ])
3442     # AIX needs the motif library linked before libXt to prevent
3443     # crashes in plugins linked against Motif - Bug #98892
3444     case "${target_os}" in
3445     aix*)
3446         XT_LIBS="-lXm $XT_LIBS"
3447         ;;
3448     esac
3450     dnl ========================================================
3451     dnl = Check for XShm
3452     dnl ========================================================
3453     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3454         $XLIBS $XEXT_LIBS)
3455     AC_CHECK_HEADER(X11/extensions/XShm.h)
3456     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3457         test -n "$_HAVE_XSHM_XEXT"; then
3458         AC_DEFINE(HAVE_XSHM)
3459     fi
3461     dnl ========================================================
3462     dnl = Check for XIE
3463     dnl ========================================================
3464     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3465         $XLIBS $XEXT_LIBS)
3466     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3468     if test "$MOZ_XIE_LIBS"; then
3469         dnl ====================================================
3470         dnl = If XIE is present and is desired, turn it on
3471         dnl ====================================================
3472         case $target in
3473             *-hpux*)
3474                 ;;
3475             *)
3476                 HAVE_XIE=1
3477                 ;;
3478         esac
3479     fi
3481         LDFLAGS="$_SAVE_LDFLAGS"
3483     dnl ========================================================
3484     dnl = Check for freetype2 and its functionality
3485     dnl ========================================================
3486     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3488     if test "$_HAVE_FREETYPE2"; then
3489         _SAVE_LIBS="$LIBS"
3490         _SAVE_CFLAGS="$CFLAGS"
3491         LIBS="$LIBS $FT2_LIBS"
3492         CFLAGS="$CFLAGS $FT2_CFLAGS"
3494         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3495             ac_cv_member_FT_Bitmap_Size_y_ppem,
3496             [AC_TRY_COMPILE([#include <ft2build.h>
3497                              #include FT_FREETYPE_H],
3498                             [FT_Bitmap_Size s;
3499                              if (sizeof s.y_ppem) return 0;
3500                              return 1],
3501                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3502                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3503         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3504             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3505         else
3506             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3507         fi
3508         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3509                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3510                            [FT_Bitmap_Size structure includes y_ppem field])
3512         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3514         LIBS="$_SAVE_LIBS"
3515         CFLAGS="$_SAVE_CFLAGS"
3516     fi
3518 fi # $no_x
3520 AC_SUBST(XCFLAGS)
3521 AC_SUBST(XLDFLAGS)
3522 AC_SUBST(XLIBS)
3523 AC_SUBST(XEXT_LIBS)
3524 AC_SUBST(XT_LIBS)
3526 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3527 AC_TRY_COMPILE([],
3528                [asm("uqadd8 r1, r1, r2");],
3529                result="yes", result="no")
3530 AC_MSG_RESULT("$result")
3531 if test "$result" = "yes"; then
3532     AC_DEFINE(HAVE_ARM_SIMD)
3533     HAVE_ARM_SIMD=1
3535 AC_SUBST(HAVE_ARM_SIMD)
3537 AC_MSG_CHECKING(for ARM NEON support in compiler)
3538 _SAVE_CFLAGS="$CFLAGS"
3539 if test "$GNU_CC"; then
3540   # gcc needs -mfpu=neon to recognize NEON instructions
3541   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3543 AC_TRY_COMPILE([],
3544                [asm("vadd.i8 d0, d0, d0");],
3545                result="yes", result="no")
3546 AC_MSG_RESULT("$result")
3547 if test "$result" = "yes"; then
3548     AC_DEFINE(HAVE_ARM_NEON)
3549     HAVE_ARM_NEON=1
3551 CFLAGS="$_SAVE_CFLAGS"
3552 AC_SUBST(HAVE_ARM_NEON)
3554 dnl ========================================================
3555 dnl = pthread support
3556 dnl = Start by checking whether the system support pthreads
3557 dnl ========================================================
3558 case "$target_os" in
3559 darwin*)
3560     USE_PTHREADS=1
3561     ;;
3563     MOZ_CHECK_PTHREADS(pthreads,
3564         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3565         MOZ_CHECK_PTHREADS(pthread,
3566             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3567             MOZ_CHECK_PTHREADS(c_r,
3568                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3569                 MOZ_CHECK_PTHREADS(c,
3570                     USE_PTHREADS=1
3571                 )
3572             )
3573         )
3574     )
3575     ;;
3576 esac
3578 dnl ========================================================
3579 dnl Check the command line for --with-pthreads 
3580 dnl ========================================================
3581 MOZ_ARG_WITH_BOOL(pthreads,
3582 [  --with-pthreads         Force use of system pthread library with NSPR ],
3583 [ if test "$USE_PTHREADS"x = x; then
3584     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3585 fi],
3586     USE_PTHREADS=
3587     _PTHREAD_LDFLAGS=
3590 dnl ========================================================
3591 dnl Do the platform specific pthread hackery
3592 dnl ========================================================
3593 if test "$USE_PTHREADS"x != x
3594 then
3595         dnl
3596         dnl See if -pthread is supported.
3597         dnl
3598         rm -f conftest*
3599         ac_cv_have_dash_pthread=no
3600         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3601         echo 'int main() { return 0; }' | cat > conftest.c
3602         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3603         if test $? -eq 0; then
3604                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3605                         ac_cv_have_dash_pthread=yes
3606                 case "$target_os" in
3607                 freebsd*)
3608 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3609                 ;;
3610                 *)
3611                             CFLAGS="$CFLAGS -pthread"
3612                             CXXFLAGS="$CXXFLAGS -pthread"
3613                 ;;
3614                 esac
3615                 fi
3616         fi
3617         rm -f conftest*
3618     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3620         dnl
3621         dnl See if -pthreads is supported.
3622         dnl
3623     ac_cv_have_dash_pthreads=no
3624     if test "$ac_cv_have_dash_pthread" = "no"; then
3625             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3626         echo 'int main() { return 0; }' | cat > conftest.c
3627             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3628         if test $? -eq 0; then
3629                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3630                             ac_cv_have_dash_pthreads=yes
3631                             CFLAGS="$CFLAGS -pthreads"
3632                             CXXFLAGS="$CXXFLAGS -pthreads"
3633                     fi
3634             fi
3635             rm -f conftest*
3636         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3637     fi
3639         case "$target" in
3640             *-*-freebsd*)
3641                         AC_DEFINE(_REENTRANT)
3642                         AC_DEFINE(_THREAD_SAFE)
3643                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3644                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3645                                 _PTHREAD_LDFLAGS="-pthread"
3646                         else
3647                                 _PTHREAD_LDFLAGS="-lc_r"
3648                         fi
3649                         ;;
3651             *-*-openbsd*|*-*-bsdi*)
3652                         AC_DEFINE(_REENTRANT)
3653                         AC_DEFINE(_THREAD_SAFE)
3654                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3655                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3656                 _PTHREAD_LDFLAGS="-pthread"
3657                         fi
3658                         ;;
3660             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3661                         AC_DEFINE(_REENTRANT) 
3662                         ;;
3664             *-*-nto*) 
3665                         AC_DEFINE(_REENTRANT) 
3666                         ;;
3668             *-aix4.3*|*-aix5*)
3669                         AC_DEFINE(_REENTRANT) 
3670                         ;;
3672             *-hpux11.*)
3673                         AC_DEFINE(_REENTRANT) 
3674                         ;;
3676             alpha*-*-osf*)
3677                         AC_DEFINE(_REENTRANT)
3678                         ;;
3680             *-*-solaris*) 
3681                         AC_DEFINE(_REENTRANT)
3682                         if test "$SOLARIS_SUNPRO_CC"; then
3683                                 CFLAGS="$CFLAGS -mt" 
3684                                 CXXFLAGS="$CXXFLAGS -mt" 
3685                         fi
3686                         ;;
3687         esac
3688     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3691 dnl ========================================================
3692 dnl See if mmap sees writes
3693 dnl For cross compiling, just define it as no, which is a safe default
3694 dnl ========================================================
3695 AC_MSG_CHECKING(whether mmap() sees write()s)
3697 changequote(,)
3698 mmap_test_prog='
3699     #include <stdlib.h>
3700     #include <unistd.h>
3701     #include <sys/mman.h>
3702     #include <sys/types.h>
3703     #include <sys/stat.h>
3704     #include <fcntl.h>
3706     char fname[] = "conftest.file";
3707     char zbuff[1024]; /* Fractional page is probably worst case */
3709     int main() {
3710         char *map;
3711         int fd;
3712         int i;
3713         unlink(fname);
3714         fd = open(fname, O_RDWR | O_CREAT, 0660);
3715         if(fd<0) return 1;
3716         unlink(fname);
3717         write(fd, zbuff, sizeof(zbuff));
3718         lseek(fd, 0, SEEK_SET);
3719         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3720         if(map==(char*)-1) return 2;
3721         for(i=0; fname[i]; i++) {
3722             int rc = write(fd, &fname[i], 1);
3723             if(map[i]!=fname[i]) return 4;
3724         }
3725         return 0;
3726     }
3728 changequote([,])
3730 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3732 AC_MSG_RESULT("$result")
3734 if test "$result" = "no"; then
3735     AC_DEFINE(MMAP_MISSES_WRITES)
3739 dnl Checks for library functions.
3740 dnl ========================================================
3741 AC_PROG_GCC_TRADITIONAL
3742 AC_FUNC_MEMCMP
3743 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3744 AC_CHECK_FUNCS(flockfile getpagesize)
3745 AC_CHECK_FUNCS(localtime_r strtok_r)
3747 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3748 _SAVE_LDFLAGS=$LDFLAGS
3749 LDFLAGS="$LDFLAGS -lrt"
3750 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3751                ac_cv_have_clock_monotonic,
3752                [AC_TRY_LINK([#include <time.h>],
3753                             [ struct timespec ts;
3754                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3755                             ac_cv_have_clock_monotonic=yes,
3756                             ac_cv_have_clock_monotonic=no)])
3757 LDFLAGS=$_SAVE_LDFLAGS
3758 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3759     HAVE_CLOCK_MONOTONIC=1
3760     REALTIME_LIBS=-lrt
3761     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3762     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3763     AC_SUBST(REALTIME_LIBS)
3766 dnl check for wcrtomb/mbrtowc
3767 dnl =======================================================================
3768 if test -z "$MACOS_DEPLOYMENT_TARGET" -o "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3769 AC_LANG_SAVE
3770 AC_LANG_CPLUSPLUS
3771 AC_CACHE_CHECK(for wcrtomb,
3772     ac_cv_have_wcrtomb,
3773     [AC_TRY_LINK([#include <wchar.h>],
3774                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3775                  ac_cv_have_wcrtomb="yes",
3776                  ac_cv_have_wcrtomb="no")])
3777 if test "$ac_cv_have_wcrtomb" = "yes"; then
3778     AC_DEFINE(HAVE_WCRTOMB)
3780 AC_CACHE_CHECK(for mbrtowc,
3781     ac_cv_have_mbrtowc,
3782     [AC_TRY_LINK([#include <wchar.h>],
3783                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3784                  ac_cv_have_mbrtowc="yes",
3785                  ac_cv_have_mbrtowc="no")])
3786 if test "$ac_cv_have_mbrtowc" = "yes"; then
3787     AC_DEFINE(HAVE_MBRTOWC)
3789 AC_LANG_RESTORE
3792 AC_CACHE_CHECK(
3793     [for res_ninit()],
3794     ac_cv_func_res_ninit,
3795     [AC_TRY_LINK([
3796         #ifdef linux
3797         #define _BSD_SOURCE 1
3798         #endif
3799         #include <resolv.h>
3800         ],
3801         [int foo = res_ninit(&_res);],
3802         [ac_cv_func_res_ninit=yes],
3803         [ac_cv_func_res_ninit=no])
3804     ])
3806 if test "$ac_cv_func_res_ninit" = "yes"; then
3807     AC_DEFINE(HAVE_RES_NINIT)
3808 dnl must add the link line we do something as foolish as this... dougt
3809 dnl else
3810 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3811 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3814 AC_LANG_CPLUSPLUS
3815 AC_CACHE_CHECK(
3816     [for gnu_get_libc_version()],
3817     ac_cv_func_gnu_get_libc_version,
3818     [AC_TRY_LINK([
3819         #ifdef HAVE_GNU_LIBC_VERSION_H
3820         #include <gnu/libc-version.h>
3821         #endif
3822         ],
3823         [const char *glibc_version = gnu_get_libc_version();],
3824         [ac_cv_func_gnu_get_libc_version=yes],
3825         [ac_cv_func_gnu_get_libc_version=no] 
3826         )]
3827     )
3829 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3830     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3833 case $target_os in
3834     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3835         ;;
3836     *)
3837     
3838 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3839     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3840         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3841 _SAVE_LIBS=$LIBS
3842 LIBS="$LIBS $_ICONV_LIBS"
3843 AC_CACHE_CHECK(
3844     [for iconv()],
3845     ac_cv_func_iconv,
3846     [AC_TRY_LINK([
3847         #include <stdlib.h>
3848         #include <iconv.h>
3849         ],
3850         [
3851             iconv_t h = iconv_open("", "");
3852             iconv(h, NULL, NULL, NULL, NULL);
3853             iconv_close(h);
3854         ],
3855         [ac_cv_func_iconv=yes],
3856         [ac_cv_func_iconv=no] 
3857         )]
3858     )
3859 if test "$ac_cv_func_iconv" = "yes"; then
3860     AC_DEFINE(HAVE_ICONV)
3861     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3862     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3863     LIBICONV="$_ICONV_LIBS"
3864     AC_CACHE_CHECK(
3865         [for iconv() with const input],
3866         ac_cv_func_const_iconv,
3867         [AC_TRY_COMPILE([
3868             #include <stdlib.h>
3869             #include <iconv.h>
3870             ],
3871             [
3872                 const char *input = "testing";
3873                 iconv_t h = iconv_open("", "");
3874                 iconv(h, &input, NULL, NULL, NULL);
3875                 iconv_close(h);
3876             ],
3877             [ac_cv_func_const_iconv=yes],
3878             [ac_cv_func_const_iconv=no] 
3879             )]
3880         )
3881     if test "$ac_cv_func_const_iconv" = "yes"; then
3882         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3883     fi
3885 LIBS=$_SAVE_LIBS
3887     ;;
3888 esac
3890 AM_LANGINFO_CODESET
3892 AC_LANG_C
3894 dnl **********************
3895 dnl *** va_copy checks ***
3896 dnl **********************
3897 dnl we currently check for all three va_copy possibilities, so we get
3898 dnl all results in config.log for bug reports.
3899 AC_MSG_CHECKING(for an implementation of va_copy())
3900 AC_CACHE_VAL(ac_cv_va_copy,[
3901     AC_TRY_RUN([
3902         #include <stdarg.h>
3903         void f (int i, ...) {
3904             va_list args1, args2;
3905             va_start (args1, i);
3906             va_copy (args2, args1);
3907             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3908                 exit (1);
3909             va_end (args1); va_end (args2);
3910         }
3911         int main() { f (0, 42); return 0; }],
3912         ac_cv_va_copy=yes,
3913         ac_cv_va_copy=no,
3914         ac_cv_va_copy=no
3915     )
3917 AC_MSG_RESULT($ac_cv_va_copy)
3918 AC_MSG_CHECKING(for an implementation of __va_copy())
3919 AC_CACHE_VAL(ac_cv___va_copy,[
3920     AC_TRY_RUN([
3921         #include <stdarg.h>
3922         void f (int i, ...) {
3923             va_list args1, args2;
3924             va_start (args1, i);
3925             __va_copy (args2, args1);
3926             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3927                 exit (1);
3928             va_end (args1); va_end (args2);
3929         }
3930         int main() { f (0, 42); return 0; }],
3931         ac_cv___va_copy=yes,
3932         ac_cv___va_copy=no,
3933         ac_cv___va_copy=no
3934     )
3936 AC_MSG_RESULT($ac_cv___va_copy)
3937 AC_MSG_CHECKING(whether va_lists can be copied by value)
3938 AC_CACHE_VAL(ac_cv_va_val_copy,[
3939     AC_TRY_RUN([
3940         #include <stdarg.h>
3941         void f (int i, ...) {
3942             va_list args1, args2;
3943             va_start (args1, i);
3944             args2 = args1;
3945             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3946                 exit (1);
3947             va_end (args1); va_end (args2);
3948         }
3949         int main() { f (0, 42); return 0; }],
3950         ac_cv_va_val_copy=yes,
3951         ac_cv_va_val_copy=no,
3952         ac_cv_va_val_copy=yes
3953     )
3955 if test "x$ac_cv_va_copy" = "xyes"; then
3956     AC_DEFINE(VA_COPY, va_copy)
3957     AC_DEFINE(HAVE_VA_COPY)
3958 elif test "x$ac_cv___va_copy" = "xyes"; then
3959     AC_DEFINE(VA_COPY, __va_copy)
3960     AC_DEFINE(HAVE_VA_COPY)
3963 if test "x$ac_cv_va_val_copy" = "xno"; then
3964    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3966 AC_MSG_RESULT($ac_cv_va_val_copy)
3968 dnl Check for dll-challenged libc's.
3969 dnl This check is apparently only needed for Linux.
3970 case "$target" in
3971         *-linux*)
3972             dnl ===================================================================
3973             _curdir=`pwd`
3974             export _curdir
3975             rm -rf conftest* _conftest
3976             mkdir _conftest
3977             cat >> conftest.C <<\EOF
3978 #include <stdio.h>
3979 #include <link.h>
3980 #include <dlfcn.h>
3981 #ifdef _dl_loaded
3982 void __dump_link_map(void) {
3983   struct link_map *map = _dl_loaded;
3984   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3986 int main() {
3987   dlopen("./conftest1.so",RTLD_LAZY);
3988   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3989   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3990   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3991   __dump_link_map();
3993 #else
3994 /* _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).*/
3995 int main() { printf("./conftest1.so\n"); }
3996 #endif
3999             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4001             cat >> conftest1.C <<\EOF
4002 #include <stdio.h>
4003 void foo(void) {printf("foo in dll called\n");}
4005             ${CXX-g++} -fPIC -c -g conftest1.C
4006             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4007             ${CXX-g++} -g conftest.C -o conftest -ldl
4008             cp -f conftest1.so conftest _conftest
4009             cd _conftest
4010             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4011             then
4012                 echo
4013                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4014                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4015                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4016                 echo "*** will be excessive memory usage at runtime."
4017                 echo
4018             fi
4019             cd ${_curdir}
4020             rm -rf conftest* _conftest
4021             dnl ===================================================================
4022             ;;
4023 esac
4025 dnl ===================================================================
4026 dnl ========================================================
4027 dnl Put your C++ language/feature checks below
4028 dnl ========================================================
4029 AC_LANG_CPLUSPLUS
4031 ARM_ABI_PREFIX=
4032 HAVE_GCC3_ABI=
4033 if test "$GNU_CC"; then
4034   if test "$CPU_ARCH" = "arm" ; then
4035     AC_CACHE_CHECK(for ARM EABI,
4036         ac_cv_gcc_arm_eabi,
4037         [AC_TRY_COMPILE([],
4038                         [
4039 #if defined(__ARM_EABI__)
4040   return 0;
4041 #else
4042 #error Not ARM EABI.
4043 #endif
4044                         ],
4045                         ac_cv_gcc_arm_eabi="yes",
4046                         ac_cv_gcc_arm_eabi="no")])
4047     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4048         HAVE_ARM_EABI=1
4049         ARM_ABI_PREFIX=eabi-
4050     else
4051         ARM_ABI_PREFIX=oabi-
4052     fi
4053   fi
4055   AC_CACHE_CHECK(for gcc 3.0 ABI,
4056       ac_cv_gcc_three_abi,
4057       [AC_TRY_COMPILE([],
4058                       [
4059 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4060   return 0;
4061 #else
4062 #error Not gcc3.
4063 #endif
4064                       ],
4065                       ac_cv_gcc_three_abi="yes",
4066                       ac_cv_gcc_three_abi="no")])
4067   if test "$ac_cv_gcc_three_abi" = "yes"; then
4068       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4069       HAVE_GCC3_ABI=1
4070   else
4071       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4072   fi
4074 AC_SUBST(HAVE_GCC3_ABI)
4077 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4078                ac_cv_cpp_explicit,
4079                [AC_TRY_COMPILE(class X {
4080                                public: explicit X(int i) : i_(i) {}
4081                                private: int i_;
4082                                };,
4083                                X x(3);,
4084                                ac_cv_cpp_explicit=yes,
4085                                ac_cv_cpp_explicit=no)])
4086 if test "$ac_cv_cpp_explicit" = yes ; then
4087    AC_DEFINE(HAVE_CPP_EXPLICIT)
4090 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4091                ac_cv_cpp_typename,
4092                [AC_TRY_COMPILE(class param {
4093                                public:
4094                                    typedef unsigned long num_type;
4095                                };
4097                                template <class T> class tplt {
4098                                public:
4099                                    typedef typename T::num_type t_num_type;
4100                                    t_num_type foo(typename T::num_type num) {
4101                                        return num;
4102                                    }
4103                                };,
4104                                tplt<param> A;
4105                                A.foo(0);,
4106                                ac_cv_cpp_typename=yes,
4107                                ac_cv_cpp_typename=no)])
4108 if test "$ac_cv_cpp_typename" = yes ; then
4109    AC_DEFINE(HAVE_CPP_TYPENAME)
4112 dnl Check for support of modern template specialization syntax
4113 dnl Test code and requirement from scc@netscape.com.
4114 dnl Autoconf cut-and-paste job by waterson@netscape.com
4115 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4116                ac_cv_cpp_modern_specialize_template_syntax,
4117                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4118                                class Y {};
4119                                template <> struct X<Y> { double a; };,
4120                                X<int> int_x;
4121                                X<Y> y_x;,
4122                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4123                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4124 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4125   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4129 dnl Some compilers support only full specialization, and some don't.
4130 AC_CACHE_CHECK(whether partial template specialization works,
4131                ac_cv_cpp_partial_specialization,
4132                [AC_TRY_COMPILE(template <class T> class Foo {};
4133                                template <class T> class Foo<T*> {};,
4134                                return 0;,
4135                                ac_cv_cpp_partial_specialization=yes,
4136                                ac_cv_cpp_partial_specialization=no)])
4137 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4138   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4141 dnl Some compilers have limited support for operators with templates;
4142 dnl specifically, it is necessary to define derived operators when a base
4143 dnl class's operator declaration should suffice.
4144 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4145                ac_cv_need_derived_template_operators,
4146                [AC_TRY_COMPILE([template <class T> class Base { };
4147                                 template <class T>
4148                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4149                                 template <class T> class Derived : public Base<T> { };],
4150                                [Derived<char> a, b;
4151                                 Base<char> c = a + b;
4152                                 return 0;],
4153                                ac_cv_need_derived_template_operators=no,
4154                                ac_cv_need_derived_template_operators=yes)])
4155 if test "$ac_cv_need_derived_template_operators" = yes ; then
4156   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4160 dnl Some compilers have trouble detecting that a template class
4161 dnl that derives from another template is actually an instance
4162 dnl of the base class. This test checks for that.
4163 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4164                ac_cv_need_cpp_template_cast_to_base,
4165                [AC_TRY_COMPILE([template <class T> class Base { };
4166                                 template <class T> class Derived : public Base<T> { };
4167                                 template <class T> int foo(const Base<T>&) { return 0; }],
4168                                [Derived<char> bar; return foo(bar);],
4169                                ac_cv_need_cpp_template_cast_to_base=no,
4170                                ac_cv_need_cpp_template_cast_to_base=yes)])
4171 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4172   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4175 dnl Some compilers have trouble resolving the ambiguity between two
4176 dnl functions whose arguments differ only by cv-qualifications.
4177 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4178                ac_cv_can_resolve_const_ambiguity,
4179                [AC_TRY_COMPILE([
4180                                 template <class T> class ptrClass {
4181                                   public: T* ptr;
4182                                 };
4184                                 template <class T> T* a(ptrClass<T> *arg) {
4185                                   return arg->ptr;
4186                                 }
4188                                 template <class T>
4189                                 const T* a(const ptrClass<T> *arg) {
4190                                   return arg->ptr;
4191                                 }
4192                                ],
4193                                [ ptrClass<int> i;
4194                                  a(&i); ],
4195                                ac_cv_can_resolve_const_ambiguity=yes,
4196                                ac_cv_can_resolve_const_ambiguity=no)])
4197 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4198   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4202 dnl We don't do exceptions on unix.  The only reason this used to be here
4203 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4204 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4205 dnl So im commenting this out until someone writes some artificial 
4206 dnl intelligence to detect not only if the compiler has exceptions, but if 
4207 dnl they are enabled as well.
4208 dnl 
4209 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4210 dnl                ac_cv_cpp_exceptions,
4211 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4212 dnl                                static void F() { throw X(); },
4213 dnl                                try { F(); } catch(X & e) { },
4214 dnl                                ac_cv_cpp_exceptions=yes,
4215 dnl                                ac_cv_cpp_exceptions=no)])
4216 dnl if test $ac_cv_cpp_exceptions = yes ; then
4217 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4218 dnl fi
4220 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4221 dnl supports it well enough to allow us to use it to change access, but not
4222 dnl to resolve ambiguity. The next two tests determine how well the |using|
4223 dnl keyword is supported.
4225 dnl Check to see if we can change access with |using|.  Test both a
4226 dnl legal and an illegal example.
4227 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4228                ac_cv_cpp_access_changing_using2,
4229                [AC_TRY_COMPILE(
4230                    class A { protected: int foo() { return 0; } };
4231                    class B : public A { public: using A::foo; };,
4232                    B b; return b.foo();,
4233                    [AC_TRY_COMPILE(
4234                        class A { public: int foo() { return 1; } };
4235                        class B : public A { private: using A::foo; };,
4236                        B b; return b.foo();,
4237                        ac_cv_cpp_access_changing_using2=no,
4238                        ac_cv_cpp_access_changing_using2=yes)],
4239                    ac_cv_cpp_access_changing_using2=no)])
4240 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4241    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4244 dnl Check to see if we can resolve ambiguity with |using|.
4245 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4246                ac_cv_cpp_ambiguity_resolving_using,
4247                [AC_TRY_COMPILE(class X { 
4248                                  public: int go(const X&) {return 3;}
4249                                          int jo(const X&) {return 3;}
4250                                };
4251                                class Y : public X {
4252                                  public:  int go(int) {return 2;}
4253                                           int jo(int) {return 2;}
4254                                           using X::jo;
4255                                  private: using X::go;
4256                                };,
4257                                X x; Y y; y.jo(x);,
4258                                ac_cv_cpp_ambiguity_resolving_using=yes,
4259                                ac_cv_cpp_ambiguity_resolving_using=no)])
4260 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4261    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4264 dnl Check to see if the |std| namespace is supported. If so, we'll want
4265 dnl to qualify any standard library calls with "std::" to ensure that
4266 dnl those functions can be resolved.
4267 AC_CACHE_CHECK(for \"std::\" namespace,
4268                ac_cv_cpp_namespace_std,
4269                [AC_TRY_COMPILE([#include <algorithm>],
4270                                [return std::min(0, 1);],
4271                                ac_cv_cpp_namespace_std=yes,
4272                                ac_cv_cpp_namespace_std=no)])
4273 if test "$ac_cv_cpp_namespace_std" = yes ; then
4274    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4277 dnl Older compilers are overly ambitious with respect to using the standard
4278 dnl template library's |operator!=()| when |operator==()| is defined. In
4279 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4280 dnl ambiguity at compile-time. This test checks for that case.
4281 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4282                ac_cv_cpp_unambiguous_std_notequal,
4283                [AC_TRY_COMPILE([#include <algorithm>
4284                                 struct T1 {};
4285                                 int operator==(const T1&, const T1&) { return 0; }
4286                                 int operator!=(const T1&, const T1&) { return 0; }],
4287                                [T1 a,b; return a != b;],
4288                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4289                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4290 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4291   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4295 AC_CACHE_CHECK(for C++ reinterpret_cast,
4296                ac_cv_cpp_reinterpret_cast,
4297                [AC_TRY_COMPILE(struct X { int i; };
4298                                struct Y { int i; };,
4299                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4300                                ac_cv_cpp_reinterpret_cast=yes,
4301                                ac_cv_cpp_reinterpret_cast=no)])
4302 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4303    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4306 dnl See if a dynamic_cast to void* gives the most derived object.
4307 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4308                ac_cv_cpp_dynamic_cast_void_ptr,
4309                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4310                             class Y { int j; public: virtual ~Y() { } };
4311                             class Z : public X, public Y { int k; };
4313                             int main() {
4314                                  Z mdo;
4315                                  X *subx = (X*)&mdo;
4316                                  Y *suby = (Y*)&mdo;
4317                                  return !((((void*)&mdo != (void*)subx) &&
4318                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4319                                           (((void*)&mdo != (void*)suby) &&
4320                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4321                             }],
4322                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4323                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4324                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4325 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4326    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4330 dnl note that this one is reversed - if the test fails, then
4331 dnl we require implementations of unused virtual methods. Which
4332 dnl really blows because it means we'll have useless vtable
4333 dnl bloat.
4334 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4335                ac_cv_cpp_unused_required,
4336                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4337                                X x;,
4338                                ac_cv_cpp_unused_required=no,
4339                                ac_cv_cpp_unused_required=yes)])
4340 if test "$ac_cv_cpp_unused_required" = yes ; then
4341    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4345 dnl Some compilers have trouble comparing a constant reference to a templatized
4346 dnl class to zero, and require an explicit operator==() to be defined that takes
4347 dnl an int. This test separates the strong from the weak.
4349 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4350                ac_cv_trouble_comparing_to_zero,
4351                [AC_TRY_COMPILE([#include <algorithm>
4352                                 template <class T> class Foo {};
4353                                 class T2;
4354                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4355                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4356                                [Foo<int> f; return (0 != f);],
4357                                ac_cv_trouble_comparing_to_zero=no,
4358                                ac_cv_trouble_comparing_to_zero=yes)])
4359 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4360   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4363 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4364 _SAVE_LDFLAGS=$LDFLAGS
4365 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4366 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4367                ac_cv_thread_keyword,
4368                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4369                             [return tlsIsMainThread;],
4370                             ac_cv_thread_keyword=yes,
4371                             ac_cv_thread_keyword=no)])
4372 LDFLAGS=$_SAVE_LDFLAGS
4373 if test "$ac_cv_thread_keyword" = yes; then
4374   # mips builds fail with TLS variables because of a binutils bug.
4375   # See bug 528687
4376   case "${target}" in
4377     mips*-*)
4378       :
4379       ;;
4380     *-android*)
4381       :
4382       ;;
4383     *)
4384       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4385       ;;
4386   esac
4389 dnl Check for the existence of various allocation headers/functions
4391 MALLOC_H=
4392 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4393 if test "$MALLOC_H" = ""; then
4394   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4395   if test "$MALLOC_H" = ""; then
4396     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4397   fi
4399 if test "$MALLOC_H" != ""; then
4400    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4403 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4404 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4406 dnl See if compiler supports some gcc-style attributes
4408 AC_CACHE_CHECK(for __attribute__((always_inline)),
4409                ac_cv_attribute_always_inline,
4410                [AC_TRY_COMPILE([],
4411                                [inline void f(void) __attribute__((always_inline));],
4412                                ac_cv_attribute_always_inline=yes,
4413                                ac_cv_attribute_always_inline=no)])
4415 AC_CACHE_CHECK(for __attribute__((malloc)),
4416                ac_cv_attribute_malloc,
4417                [AC_TRY_COMPILE([],
4418                                [void* f(int) __attribute__((malloc));],
4419                                ac_cv_attribute_malloc=yes,
4420                                ac_cv_attribute_malloc=no)])
4422 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4423                ac_cv_attribute_warn_unused,
4424                [AC_TRY_COMPILE([],
4425                                [int f(void) __attribute__((warn_unused_result));],
4426                                ac_cv_attribute_warn_unused=yes,
4427                                ac_cv_attribute_warn_unused=no)])
4429 AC_CACHE_CHECK(for __attribute__((noreturn)),
4430                ac_cv_attribute_noreturn,
4431                [AC_TRY_COMPILE([],
4432                                [void f(void) __attribute__((noreturn));],
4433                                ac_cv_attribute_noreturn=yes,
4434                                ac_cv_attribute_noreturn=no)])
4436 dnl End of C++ language/feature checks
4437 AC_LANG_C
4439 dnl ========================================================
4440 dnl =  Internationalization checks
4441 dnl ========================================================
4443 dnl Internationalization and Locale support is different
4444 dnl on various UNIX platforms.  Checks for specific i18n
4445 dnl features go here.
4447 dnl check for LC_MESSAGES
4448 AC_CACHE_CHECK(for LC_MESSAGES,
4449                 ac_cv_i18n_lc_messages,
4450                 [AC_TRY_COMPILE([#include <locale.h>],
4451                                 [int category = LC_MESSAGES;],
4452                                 ac_cv_i18n_lc_messages=yes,
4453                                 ac_cv_i18n_lc_messages=no)])
4454 if test "$ac_cv_i18n_lc_messages" = yes; then
4455    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4458 AC_HAVE_FUNCS(localeconv)
4460 fi # SKIP_COMPILER_CHECKS
4462 TARGET_XPCOM_ABI=
4463 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4464     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4467 dnl Mozilla specific options
4468 dnl ========================================================
4469 dnl The macros used for command line options
4470 dnl are defined in build/autoconf/altoptions.m4.
4472 dnl If the compiler supports these attributes, define them as
4473 dnl convenience macros.
4474 if test "$ac_cv_attribute_always_inline" = yes ; then
4475   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4476 else
4477   AC_DEFINE(NS_ALWAYS_INLINE,)
4480 if test "$ac_cv_attribute_malloc" = yes ; then
4481   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4482 else
4483   AC_DEFINE(NS_ATTR_MALLOC,)
4486 if test "$ac_cv_attribute_warn_unused" = yes ; then
4487   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4488 else
4489   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4492 if test "$ac_cv_attribute_noreturn" = yes ; then
4493   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4494 else
4495   AC_DEFINE(NS_NORETURN,)
4498 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4499 dnl features that Windows actually does support.
4501 if test -n "$SKIP_COMPILER_CHECKS"; then
4502    dnl Windows has malloc.h
4503    AC_DEFINE(MALLOC_H, [<malloc.h>])
4504    AC_DEFINE(HAVE_FORCEINLINE)
4505    AC_DEFINE(HAVE_LOCALECONV)
4506 fi # SKIP_COMPILER_CHECKS
4508 dnl ========================================================
4509 dnl =
4510 dnl = Check for external package dependencies
4511 dnl =
4512 dnl ========================================================
4513 MOZ_ARG_HEADER(External Packages)
4515 MOZ_ENABLE_LIBXUL=1
4517 MOZ_ARG_WITH_STRING(libxul-sdk,
4518 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4519   LIBXUL_SDK_DIR=$withval)
4521 if test "$LIBXUL_SDK_DIR" = "yes"; then
4522     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4523 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4524     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4526     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4527         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4528     fi
4530     MOZ_ENABLE_LIBXUL=1
4532 AC_SUBST(LIBXUL_SDK)
4534 if test -n "$LIBXUL_SDK"; then
4535     LIBXUL_DIST="$LIBXUL_SDK"
4536 else
4537     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4539 AC_SUBST(LIBXUL_DIST)
4541 SYSTEM_LIBXUL=
4543 MOZ_ARG_WITH_BOOL(system-libxul,
4544 [  --with-system-libxul    Use system installed libxul SDK],
4545     SYSTEM_LIBXUL=1)
4547 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4548     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4551 dnl ========================================================
4552 dnl = If NSPR was not detected in the system, 
4553 dnl = use the one in the source tree (mozilla/nsprpub)
4554 dnl ========================================================
4555 MOZ_ARG_WITH_BOOL(system-nspr,
4556 [  --with-system-nspr      Use system installed NSPR],
4557     _USE_SYSTEM_NSPR=1 )
4559 if test -n "$_USE_SYSTEM_NSPR"; then
4560     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4563 if test -n "$MOZ_NATIVE_NSPR"; then
4564     _SAVE_CFLAGS=$CFLAGS
4565     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4566     AC_TRY_COMPILE([#include "prtypes.h"],
4567                 [#ifndef PR_STATIC_ASSERT
4568                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4569                  #endif],
4570                 [MOZ_NATIVE_NSPR=1],
4571                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4572     CFLAGS=$_SAVE_CFLAGS
4573 else
4574     if test "$OS_ARCH" = "WINCE"; then
4575         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4576         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4577     elif test "$OS_ARCH" = "WINNT"; then
4578         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4579         if test -n "$GNU_CC"; then
4580             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4581         else
4582             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4583         fi
4584     else
4585         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4586         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4587     fi
4590 dnl system libevent Support
4591 dnl ========================================================
4592 MOZ_ARG_WITH_STRING(system-libevent,
4593 [  --with-system-libevent=[PFX]
4594                           Use system libevent [installed at prefix PFX]],
4595     LIBEVENT_DIR=$withval)
4597 _SAVE_CFLAGS=$CFLAGS
4598 _SAVE_LDFLAGS=$LDFLAGS
4599 _SAVE_LIBS=$LIBS
4600 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4601     MOZ_NATIVE_LIBEVENT=
4602 else
4603     if test "${LIBEVENT_DIR}" = "yes"; then
4604         LIBEVENT_DIR=/usr
4605     fi
4606     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4607     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4608     AC_CHECK_HEADER(event.h,
4609                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4610                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4611                      fi],
4612                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4613     AC_CHECK_LIB(event, event_init,
4614                  [MOZ_NATIVE_LIBEVENT=1
4615                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4616                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4617                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4619 CFLAGS=$_SAVE_CFLAGS
4620 LDFLAGS=$_SAVE_LDFLAGS
4621 LIBS=$_SAVE_LIBS
4623 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4624 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4625 AC_SUBST(MOZ_LIBEVENT_LIBS)
4627 dnl ========================================================
4628 dnl = If NSS was not detected in the system, 
4629 dnl = use the one in the source tree (mozilla/security/nss)
4630 dnl ========================================================
4632 MOZ_ARG_WITH_BOOL(system-nss,
4633 [  --with-system-nss       Use system installed NSS],
4634     _USE_SYSTEM_NSS=1 )
4636 if test -n "$_USE_SYSTEM_NSS"; then
4637     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4640 if test -n "$MOZ_NATIVE_NSS"; then
4641    NSS_LIBS="$NSS_LIBS -lcrmf"
4642 else
4643    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4644    NSS_DEP_LIBS="\
4645         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4646         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4647         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4648         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4649         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4651    if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4652        NSS_LIBS="\
4653         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4654         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4655         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4656         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4657         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4658    else
4659        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4660    fi
4663 if test -z "$SKIP_LIBRARY_CHECKS"; then
4664 dnl system JPEG support
4665 dnl ========================================================
4666 MOZ_ARG_WITH_STRING(system-jpeg,
4667 [  --with-system-jpeg[=PFX]
4668                           Use system libjpeg [installed at prefix PFX]],
4669     JPEG_DIR=$withval)
4671 _SAVE_CFLAGS=$CFLAGS
4672 _SAVE_LDFLAGS=$LDFLAGS
4673 _SAVE_LIBS=$LIBS
4674 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4675     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4676     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4678 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4679     SYSTEM_JPEG=
4680 else
4681     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4684 if test "$SYSTEM_JPEG" = 1; then
4685     LIBS="$JPEG_LIBS $LIBS"
4686     AC_TRY_COMPILE([ #include <stdio.h>
4687                      #include <sys/types.h>
4688                      #include <jpeglib.h> ],
4689                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4690                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4691                      #endif ],
4692                    SYSTEM_JPEG=1,
4693                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4694 fi 
4695 CFLAGS=$_SAVE_CFLAGS
4696 LDFLAGS=$_SAVE_LDFLAGS
4697 LIBS=$_SAVE_LIBS
4699 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4700     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4701     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4704 dnl system ZLIB support
4705 dnl ========================================================
4706 MOZ_ARG_WITH_STRING(system-zlib,
4707 [  --with-system-zlib[=PFX]
4708                           Use system libz [installed at prefix PFX]],
4709     ZLIB_DIR=$withval)
4711 _SAVE_CFLAGS=$CFLAGS
4712 _SAVE_LDFLAGS=$LDFLAGS
4713 _SAVE_LIBS=$LIBS
4714 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4715     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4716     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4718 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4719     SYSTEM_ZLIB=
4720 else
4721     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4722         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4724 if test "$SYSTEM_ZLIB" = 1; then
4725     LIBS="$ZLIB_LIBS $LIBS"
4726     AC_TRY_COMPILE([ #include <stdio.h>
4727                      #include <string.h>
4728                      #include <zlib.h> ],
4729                    [ #if ZLIB_VERNUM < $MOZZLIB 
4730                      #error "Insufficient zlib version ($MOZZLIB required)."
4731                      #endif ],
4732                    SYSTEM_ZLIB=1,
4733                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4735 CFLAGS=$_SAVE_CFLAGS
4736 LDFLAGS=$_SAVE_LDFLAGS
4737 LIBS=$_SAVE_LIBS
4739 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4740     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4741     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4744 dnl system BZIP2 Support
4745 dnl ========================================================
4746 MOZ_ARG_WITH_STRING(system-bz2,
4747 [  --with-system-bz2[=PFX]
4748                           Use system libbz2 [installed at prefix PFX]],
4749     BZ2_DIR=$withval)
4751 _SAVE_CFLAGS=$CFLAGS
4752 _SAVE_LDFLAGS=$LDFLAGS
4753 _SAVE_LIBS=$LIBS
4754 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4755     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4756     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4758 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4759     SYSTEM_BZ2=
4760 else
4761     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4762         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4764 CFLAGS=$_SAVE_CFLAGS
4765 LDFLAGS=$_SAVE_LDFLAGS
4766 LIBS=$_SAVE_LIBS
4768 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4769     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4770     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4773 dnl system PNG Support
4774 dnl ========================================================
4775 MOZ_ARG_WITH_STRING(system-png, 
4776 [  --with-system-png[=PFX]
4777                           Use system libpng [installed at prefix PFX]],
4778     PNG_DIR=$withval)
4780 _SAVE_CFLAGS=$CFLAGS
4781 _SAVE_LDFLAGS=$LDFLAGS
4782 _SAVE_LIBS=$LIBS
4783 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4784 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4785 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4786     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4787     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4789 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4790     SYSTEM_PNG=
4791 else
4792     _SAVE_PNG_LIBS=$PNG_LIBS
4793     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4794                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4795                  $PNG_LIBS)
4796     AC_CHECK_LIB(png, png_get_acTL, ,
4797                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4798                  $_SAVE_PNG_LIBS)
4800 if test "$SYSTEM_PNG" = 1; then
4801     LIBS="$PNG_LIBS $LIBS"
4802     AC_TRY_COMPILE([ #include <stdio.h>
4803                      #include <sys/types.h>
4804                      #include <png.h> ],
4805                    [ #if PNG_LIBPNG_VER < $MOZPNG
4806                      #error "Insufficient libpng version ($MOZPNG required)."
4807                      #endif
4808                      #ifndef PNG_UINT_31_MAX
4809                      #error "Insufficient libpng version."
4810                      #endif ],
4811                    SYSTEM_PNG=1,
4812                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4814 CFLAGS=$_SAVE_CFLAGS
4815 LDFLAGS=$_SAVE_LDFLAGS
4816 LIBS=$_SAVE_LIBS
4818 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4819     PNG_CFLAGS="-I${PNG_DIR}/include"
4820     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4823 fi # SKIP_LIBRARY_CHECKS
4825 dnl system HunSpell Support
4826 dnl ========================================================
4827 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4828 [  --enable-system-hunspell
4829                           Use system hunspell (located with pkgconfig)],
4830     SYSTEM_HUNSPELL=1 )
4832 if test -n "$SYSTEM_HUNSPELL"; then
4833     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4836 AC_SUBST(SYSTEM_HUNSPELL)
4838 dnl ========================================================
4839 dnl Java SDK support
4840 dnl ========================================================
4841 JAVA_INCLUDE_PATH=
4842 MOZ_ARG_WITH_STRING(java-include-path,
4843 [  --with-java-include-path=dir
4844                           Location of Java SDK headers],
4845     JAVA_INCLUDE_PATH=$withval)
4847 JAVA_BIN_PATH=
4848 MOZ_ARG_WITH_STRING(java-bin-path,
4849 [  --with-java-bin-path=dir
4850                           Location of Java binaries (java, javac, jar)],
4851     JAVA_BIN_PATH=$withval)
4853 dnl ========================================================
4854 dnl =
4855 dnl = Application
4856 dnl =
4857 dnl ========================================================
4859 MOZ_ARG_HEADER(Application)
4861 BUILD_STATIC_LIBS=
4862 ENABLE_TESTS=1
4863 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4864 MOZ_BRANDING_DIRECTORY=
4865 MOZ_OFFICIAL_BRANDING=
4866 MOZ_FEEDS=1
4867 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4868 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4869 MOZ_INSTALLER=1
4870 MOZ_IPC=1
4871 MOZ_JAVAXPCOM=
4872 MOZ_JSDEBUGGER=1
4873 MOZ_JSLOADER=1
4874 MOZ_MATHML=1
4875 MOZ_MORK=
4876 MOZ_MORKREADER=1
4877 MOZ_AUTH_EXTENSION=1
4878 MOZ_NO_ACTIVEX_SUPPORT=1
4879 MOZ_NO_INSPECTOR_APIS=
4880 MOZ_NO_FAST_LOAD=
4881 MOZ_OGG=1
4882 MOZ_SYDNEYAUDIO=
4883 MOZ_VORBIS=
4884 MOZ_WAVE=1
4885 MOZ_MEDIA=
4886 MOZ_WEBM=1
4887 VPX_AS=
4888 VPX_ASFLAGS=
4889 VPX_X86_ASM=
4890 MOZ_PANGO=1
4891 MOZ_PERMISSIONS=1
4892 MOZ_PLACES=1
4893 MOZ_PLAINTEXT_EDITOR_ONLY=
4894 MOZ_PLUGINS=1
4895 MOZ_PREF_EXTENSIONS=1
4896 MOZ_PROFILELOCKING=1
4897 MOZ_PSM=1
4898 MOZ_RDF=1
4899 MOZ_REFLOW_PERF=
4900 MOZ_SAFE_BROWSING=
4901 MOZ_FASTSTART=
4902 MOZ_HELP_VIEWER=
4903 MOZ_SPELLCHECK=1
4904 MOZ_SPLASHSCREEN=
4905 MOZ_STORAGE=1
4906 MOZ_SVG=1
4907 MOZ_THUMB2=
4908 MOZ_TIMELINE=
4909 MOZ_TOOLKIT_SEARCH=1
4910 MOZ_UI_LOCALE=en-US
4911 MOZ_UNIVERSALCHARDET=1
4912 MOZ_URL_CLASSIFIER=
4913 MOZ_USE_NATIVE_UCONV=
4914 MOZ_VIEW_SOURCE=1
4915 MOZ_XSLT_STANDALONE=
4916 MOZ_XTF=1
4917 MOZ_XUL=1
4918 MOZ_ZIPWRITER=1
4919 NS_PRINTING=1
4920 NSS_DISABLE_DBM=
4921 NECKO_WIFI=1
4922 NECKO_COOKIES=1
4923 NECKO_DISK_CACHE=1
4924 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource"
4925 USE_ARM_KUSER=
4926 BUILD_CTYPES=1
4927 XPC_IDISPATCH_SUPPORT=
4930 case "$target_os" in
4931 darwin*|*wince*|*winmo*)
4932     ACCESSIBILITY=
4933     ;;
4935     ACCESSIBILITY=1
4936     ;;
4937 esac
4939 case "$target_os" in
4940     msvc*|mks*|cygwin*|mingw*)
4941         NS_ENABLE_TSF=1
4942         if test -z "$GNU_CC"; then 
4943             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4944                 NS_ENABLE_TSF=
4945             fi
4946         fi
4947         if test -n "$NS_ENABLE_TSF"; then
4948             AC_DEFINE(NS_ENABLE_TSF)
4949         fi
4950         ;;
4951 esac
4953 case "${target}" in
4954     arm-android-eabi)
4955         NSS_DISABLE_DBM=1
4956         USE_ARM_KUSER=1
4957         MOZ_INSTALLER=
4958         MOZ_CRASHREPORTER=
4959         NS_PRINTING=
4960         NECKO_WIFI=
4961         MOZ_THUMB2=1
4962         MOZ_THEME_FASTSTRIPE=1
4963         MOZ_TREE_FREETYPE=1
4964         MOZ_MEMORY=1
4965         ;;
4966 esac
4968 MOZ_ARG_ENABLE_STRING(application,
4969 [  --enable-application=APP
4970                           Options include:
4971                             browser (Firefox)
4972                             xulrunner
4973                             content/xslt (Standalone Transformiix XSLT)
4974                             netwerk (Standalone Necko)
4975                             tools/update-packaging (AUS-related packaging tools)
4976                             standalone (use this for standalone
4977                               xpcom/xpconnect or to manually drive a build)],
4978 [ MOZ_BUILD_APP=$enableval ] )
4980 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4981 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4982   XULRUNNER_STUB_NAME=$withval)
4984 if test -z "$XULRUNNER_STUB_NAME"; then
4985   case "$target_os" in
4986   darwin*)
4987     XULRUNNER_STUB_NAME=xulrunner
4988     ;;
4989   *)
4990     XULRUNNER_STUB_NAME=xulrunner-stub
4991   esac
4993 AC_SUBST(XULRUNNER_STUB_NAME)
4995 if test -z "$MOZ_BUILD_APP"; then
4996   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4997 else
4998   # We have a valid application only if it has a build.mk file in its top
4999   # directory.
5000   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5001     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5002   fi
5005 # Allow the application to influence configure with a confvars.sh script.
5007 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5008 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5009   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5010   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5011 else
5012   AC_MSG_RESULT([no])
5015 # Now is a good time to test for logic errors, define mismatches, etc.
5016 case "$MOZ_BUILD_APP" in
5017 xulrunner)
5018   if test "$LIBXUL_SDK"; then
5019     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5020   fi
5021   ;;
5022 esac
5024 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5025 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5026 # MOZ_BUILD_APP.
5027 case "$MOZ_BUILD_APP" in
5028 browser)
5029   AC_DEFINE(MOZ_PHOENIX)
5030   ;;
5032 xulrunner)
5033   AC_DEFINE(MOZ_XULRUNNER)
5034   ;;
5036 content/xslt)
5037   AC_DEFINE(TX_EXE)
5038   ;;
5040 standalone) 
5041   MOZ_APP_NAME=mozilla
5042   MOZ_APP_DISPLAYNAME=Mozilla
5043   MOZ_APP_VERSION=$MOZILLA_VERSION
5044   ;;
5046 esac
5048 AC_SUBST(MOZ_BUILD_APP)
5049 AC_SUBST(MOZ_PHOENIX)
5050 AC_SUBST(MOZ_XULRUNNER)
5052 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5054 dnl ========================================================
5055 dnl = 
5056 dnl = Toolkit Options
5057 dnl = 
5058 dnl ========================================================
5059 MOZ_ARG_HEADER(Toolkit Options)
5061     dnl ========================================================
5062     dnl = Select the default toolkit
5063     dnl ========================================================
5064         MOZ_ARG_ENABLE_STRING(default-toolkit,
5065         [  --enable-default-toolkit=TK
5066                           Select default toolkit
5067                           Platform specific defaults:
5068                             BeOS - cairo-beos
5069                             Mac OS X - cairo-cocoa
5070                             Neutrino/QNX - photon
5071                             OS/2 - cairo-os2
5072                             Win32/WinCE - cairo-windows
5073                             Gtk2 with DirectFB - cairo-gtk2-dfb
5074                             * - cairo-gtk2
5075                             * - cairo-qt],
5076     [ _DEFAULT_TOOLKIT=$enableval ],
5077     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5079     if test "$_DEFAULT_TOOLKIT" = "photon" \
5080         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5081         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5082         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5083         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5084         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5085         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5086         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5087         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5088         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5089     then
5090         dnl nglayout only supports building with one toolkit,
5091         dnl so ignore everything after the first comma (",").
5092         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5093     else
5094         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5095     fi
5097 dnl ========================================================
5098 dnl = Enable the toolkit as needed                         =
5099 dnl ========================================================
5101 case "$MOZ_WIDGET_TOOLKIT" in
5102 photon)
5103         MOZ_ENABLE_PHOTON=1
5104         AC_DEFINE(MOZ_WIDGET_PHOTON)
5105     ;;
5107 cairo-windows)
5108     MOZ_WIDGET_TOOLKIT=windows
5109     MOZ_WEBGL=1
5110     case "${target}" in
5111     *-wince*)
5112         NS_PRINTING=
5113         ;;
5114     esac
5115     ;;
5117 cairo-gtk2|cairo-gtk2-x11)
5118     MOZ_WIDGET_TOOLKIT=gtk2
5119     MOZ_ENABLE_GTK2=1
5120     MOZ_ENABLE_XREMOTE=1
5121     MOZ_WEBGL=1
5122     MOZ_WEBGL_GLX=1
5124     AC_DEFINE(MOZ_X11)
5125     MOZ_X11=1
5126     USE_FC_FREETYPE=1
5128     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5129     TK_LIBS='$(MOZ_GTK2_LIBS)'
5130     AC_DEFINE(MOZ_WIDGET_GTK2)
5131     ;;
5133 cairo-gtk2-dfb)
5134     MOZ_WIDGET_TOOLKIT=gtk2
5135     MOZ_ENABLE_GTK2=1
5136     MOZ_WEBGL=
5138     AC_DEFINE(MOZ_DFB)
5139     MOZ_DFB=1
5141     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5142     TK_LIBS='$(MOZ_GTK2_LIBS)'
5143     AC_DEFINE(MOZ_WIDGET_GTK2)
5144     if test "$no_x" != "yes"; then
5145         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5146         no_x=yes
5147     fi
5148     ;;
5150 cairo-qt)
5151     MOZ_WIDGET_TOOLKIT=qt
5152     MOZ_ENABLE_QT=1
5153     MOZ_ENABLE_XREMOTE=1
5154     MOZ_WEBGL=1
5155     MOZ_WEBGL_GLX=1
5156     USE_ELF_DYNSTR_GC=
5157     NS_PRINTING=
5159     AC_DEFINE(MOZ_X11)
5160     MOZ_X11=1
5161     USE_FC_FREETYPE=1
5163     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5164     TK_LIBS='$(MOZ_QT_LIBS)'
5165     AC_DEFINE(MOZ_WIDGET_QT)
5166     ;;
5168 cairo-beos)
5169     MOZ_WIDGET_TOOLKIT=beos
5170     USE_FC_FREETYPE=1
5171     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5172     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5173     ;;
5175 cairo-os2)
5176     MOZ_WIDGET_TOOLKIT=os2
5177     USE_FC_FREETYPE=1
5178     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5179     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5180     ;;
5182 cairo-cocoa)
5183     MOZ_WIDGET_TOOLKIT=cocoa
5184     AC_DEFINE(MOZ_WIDGET_COCOA)
5185     MOZ_USER_DIR="Mozilla"
5186     AC_DEFINE(XP_MACOSX)
5187     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5188     TK_CFLAGS="-DNO_X11"
5189     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5190     CFLAGS="$CFLAGS $TK_CFLAGS"
5191     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5192     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5193     MOZ_FS_LAYOUT=bundle
5194     MOZ_WEBGL=1
5195     ;;
5197 cairo-android)
5198     AC_DEFINE(MOZ_WIDGET_ANDROID)
5199     MOZ_WIDGET_TOOLKIT=android
5200     MOZ_WEBGL=
5201     ;;
5203 esac
5205 if test "$MOZ_ENABLE_XREMOTE"; then
5206     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5209 if test "$COMPILE_ENVIRONMENT"; then
5210   if test "$MOZ_ENABLE_GTK2"; then
5211     if test "$MOZ_X11"; then
5212       GDK_PACKAGES=gdk-x11-2.0
5213     elif test "$MOZ_DFB"; then
5214       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5215       GDK_PACKAGES=directfb
5216     fi
5218     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5219   fi
5221 fi # COMPILE_ENVIRONMENT
5223 AC_SUBST(MOZ_FS_LAYOUT)
5225 dnl ========================================================
5226 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5227 dnl their usage and use them in spidermonkey.
5228 dnl ========================================================
5229 MOZ_ARG_WITH_BOOL(arm-kuser,
5230 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5231     USE_ARM_KUSER=1,)
5232 if test -n "$USE_ARM_KUSER"; then
5233    AC_DEFINE(USE_ARM_KUSER)
5236 dnl ========================================================
5237 dnl = startup-notification support module
5238 dnl ========================================================
5240 if test "$MOZ_ENABLE_GTK2"
5241 then
5242     MOZ_ENABLE_STARTUP_NOTIFICATION=
5244     MOZ_ARG_ENABLE_BOOL(startup-notification,
5245     [  --enable-startup-notification
5246                           Enable startup-notification support (default: disabled) ],
5247         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5248         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5249     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5250     then
5251         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5252                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5253         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5254             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5255             then
5256                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5257             fi
5258             MOZ_ENABLE_STARTUP_NOTIFICATION=
5259         ])
5260     fi
5262     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5263         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5264     fi
5266     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5268 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5269 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5270 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5272 dnl ========================================================
5273 dnl = QT support
5274 dnl ========================================================
5275 if test "$MOZ_ENABLE_QT"
5276 then
5277     MOZ_ARG_WITH_STRING(qtdir,
5278     [  --with-qtdir=\$dir       Specify Qt directory ],
5279     [ QTDIR=$withval])
5281     if test -z "$QTDIR"; then
5282         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5283         AC_CHECK_PROGS(HOST_MOC, moc, "")
5284     else
5285         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5287         MOZ_QT_CFLAGS="-DQT_SHARED"
5288         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5289         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5290         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5291         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5292         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5293         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5294         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5295         HOST_MOC="$QTDIR/bin/moc"
5296     fi
5297     if test -z "$HOST_MOC"; then
5298         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5299 incorrect])
5300     fi
5301     MOC=$HOST_MOC
5304 AC_SUBST(GTK_CONFIG)
5305 AC_SUBST(TK_CFLAGS)
5306 AC_SUBST(TK_LIBS)
5308 AC_SUBST(MOZ_ENABLE_GTK2)
5309 AC_SUBST(MOZ_ENABLE_PHOTON)
5310 AC_SUBST(MOZ_ENABLE_QT)
5311 AC_SUBST(MOZ_ENABLE_XREMOTE)
5312 AC_SUBST(MOZ_GTK2_CFLAGS)
5313 AC_SUBST(MOZ_GTK2_LIBS)
5314 AC_SUBST(MOZ_QT_CFLAGS)
5315 AC_SUBST(MOZ_QT_LIBS)
5317 AC_SUBST(MOC)
5319 AC_SUBST(MOZ_DFB)
5320 AC_SUBST(MOZ_X11)
5322 dnl ========================================================
5323 dnl =
5324 dnl = Components & Features
5325 dnl = 
5326 dnl ========================================================
5327 MOZ_ARG_HEADER(Components and Features)
5329 dnl ========================================================
5330 dnl = Localization
5331 dnl ========================================================
5332 MOZ_ARG_ENABLE_STRING(ui-locale,
5333 [  --enable-ui-locale=ab-CD
5334                           Select the user interface locale (default: en-US)],
5335     MOZ_UI_LOCALE=$enableval )
5336 AC_SUBST(MOZ_UI_LOCALE)
5338 dnl ========================================================
5339 dnl = Trademarked Branding 
5340 dnl ========================================================
5341 MOZ_ARG_ENABLE_BOOL(official-branding,
5342 [  --enable-official-branding
5343                           Enable Official mozilla.org Branding
5344                           Do not distribute builds with
5345                           --enable-official-branding unless you have
5346                           permission to use trademarks per
5347                           http://www.mozilla.org/foundation/trademarks/ .],
5349   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5350     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5351   else
5352     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5353     MOZ_OFFICIAL_BRANDING=1
5354   fi
5355 ], MOZ_OFFICIAL_BRANDING=)
5357 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5358 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5359   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5362 MOZ_ARG_WITH_STRING(branding,
5363 [  --with-branding=dir     Use branding from the specified directory.],
5364     MOZ_BRANDING_DIRECTORY=$withval)
5366 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5367 if test -z "$REAL_BRANDING_DIRECTORY"; then
5368   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5371 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5372   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5375 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5377 dnl ========================================================
5378 dnl = Distribution ID
5379 dnl ========================================================
5380 MOZ_ARG_WITH_STRING(distribution-id,
5381 [  --with-distribution-id=ID
5382                           Set distribution-specific id (default=org.mozilla)],
5383 [ val=`echo $withval`
5384     MOZ_DISTRIBUTION_ID="$val"])
5386 if test -z "$MOZ_DISTRIBUTION_ID"; then
5387    MOZ_DISTRIBUTION_ID="org.mozilla"
5390 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5391 AC_SUBST(MOZ_DISTRIBUTION_ID)
5394 dnl ========================================================
5395 dnl complex text support off by default
5396 dnl ========================================================
5397 MOZ_ARG_DISABLE_BOOL(pango,
5398 [  --disable-pango         Disable usage of Pango ],
5399     MOZ_PANGO=,
5400     MOZ_PANGO=1)
5402 dnl ========================================================
5403 dnl = Pango
5404 dnl ========================================================
5405 if test "$MOZ_ENABLE_GTK2"
5406 then
5407     AC_SUBST(MOZ_PANGO)
5409     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5411     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5412     AC_SUBST(MOZ_PANGO_CFLAGS)
5413     AC_SUBST(MOZ_PANGO_LIBS)
5414     if test "$MOZ_PANGO"
5415     then
5416         AC_DEFINE(MOZ_PANGO)
5417     else
5418         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5419         AC_SUBST(FT2_CFLAGS)
5420         AC_SUBST(FT2_LIBS)
5421     fi
5424 if test "$MOZ_ENABLE_QT"
5425 then
5426     if test "$MOZ_PANGO"
5427     then
5428         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5429         [
5430             AC_SUBST(MOZ_PANGO_CFLAGS)
5431             AC_SUBST(MOZ_PANGO_LIBS)
5432             AC_DEFINE(MOZ_PANGO)
5433         ],
5434         [
5435             echo "Pango library not found, will use FT2 font engine"
5436             MOZ_PANGO=
5437         ])
5438     fi
5439     AC_SUBST(MOZ_PANGO)
5442 dnl ========================================================
5443 dnl = GnomeVFS, GIO and GConf support module
5444 dnl ========================================================
5446 if test "$MOZ_X11"
5447 then
5448     dnl build the gnomevfs extension by default only when the
5449     dnl GTK2 toolkit is in use.
5450     if test "$MOZ_ENABLE_GTK2"
5451     then
5452         MOZ_ENABLE_GNOMEVFS=1
5453         MOZ_ENABLE_GCONF=1
5454     fi
5456     dnl ========================================================
5457     dnl = GnomeVFS support module
5458     dnl ========================================================
5459     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5460     [  --disable-gnomevfs      Disable GnomeVFS support ],
5461         MOZ_ENABLE_GNOMEVFS=,
5462         MOZ_ENABLE_GNOMEVFS=force)
5464     if test "$MOZ_ENABLE_GNOMEVFS"
5465     then
5466         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5467             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5468             MOZ_ENABLE_GNOMEVFS=1
5469             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5470         ],[
5471             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5472             then
5473                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5474             fi
5475             MOZ_ENABLE_GNOMEVFS=
5476         ])
5477     else
5478         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5479             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5480               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5481             ])
5482         fi
5483     fi
5485     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5486     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5487     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5489     dnl ========================================================
5490     dnl = GIO support module
5491     dnl ========================================================
5492     MOZ_ARG_ENABLE_BOOL(gio,
5493     [  --enable-gio            Enable GIO support (default: disabled)],
5494         MOZ_ENABLE_GIO=force,
5495         MOZ_ENABLE_GIO=)
5497     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5498     then
5499         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5500             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5501             MOZ_ENABLE_GIO=1
5502             AC_DEFINE(MOZ_ENABLE_GIO)
5503         ],[
5504             if test "$MOZ_ENABLE_GIO" = "force"
5505             then
5506                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5507             fi
5508             MOZ_ENABLE_GIO=
5509         ])
5510     fi
5512     AC_SUBST(MOZ_ENABLE_GIO)
5513     AC_SUBST(MOZ_GIO_CFLAGS)
5514     AC_SUBST(MOZ_GIO_LIBS)
5515    
5516     dnl ========================================================
5517     dnl = GConf support module
5518     dnl ========================================================
5519     if test "$MOZ_ENABLE_GCONF"
5520     then
5521         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5522             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5523             MOZ_ENABLE_GCONF=1
5524         ],[
5525             if test "$MOZ_ENABLE_GCONF" = "force"
5526             then
5527                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5528             fi
5529             MOZ_ENABLE_GCONF=
5530         ])
5531     fi
5533     if test "$MOZ_ENABLE_GCONF"; then
5534         AC_DEFINE(MOZ_ENABLE_GCONF)
5535     fi
5537     AC_SUBST(MOZ_ENABLE_GCONF)
5538     AC_SUBST(MOZ_GCONF_CFLAGS)
5539     AC_SUBST(MOZ_GCONF_LIBS)
5542 dnl ========================================================
5543 dnl = libnotify support
5544 dnl ========================================================
5546 if test "$MOZ_ENABLE_GTK2"
5547 then
5548     MOZ_ENABLE_LIBNOTIFY=1
5550     MOZ_ARG_DISABLE_BOOL(libnotify,
5551     [  --disable-libnotify     Disable libnotify support ],
5552     MOZ_ENABLE_LIBNOTIFY=,
5553     MOZ_ENABLE_LIBNOTIFY=1)
5555     if test "$MOZ_ENABLE_LIBNOTIFY"
5556     then
5557         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5558     fi
5561 if test -z "$SKIP_LIBRARY_CHECKS"
5562 then
5563     if test "$MOZ_ENABLE_GTK2"
5564     then
5565         if test "$MOZ_ENABLE_LIBNOTIFY"
5566         then
5567             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5568         fi
5569     fi
5571 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5572 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5573 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5575 dnl ========================================================
5576 dnl = GNOME component (mozgnome)
5577 dnl ========================================================
5579 # The GNOME component is built if one of 
5580 # gnome-vfs, gio, gconf or libnotify is available.
5581 if test "$MOZ_ENABLE_GCONF" -o \
5582    "$MOZ_ENABLE_GNOMEVFS" -o \
5583    "$MOZ_ENABLE_GIO" -o \
5584    "$MOZ_ENABLE_LIBNOTIFY"; then
5585     MOZ_ENABLE_GNOME_COMPONENT=1
5586 else
5587     MOZ_ENABLE_GNOME_COMPONENT=
5589 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5591 dnl ========================================================
5592 dnl = libgnomeui support module
5593 dnl ========================================================
5595 if test "$MOZ_ENABLE_GTK2"
5596 then
5597     MOZ_ENABLE_GNOMEUI=1
5599     MOZ_ARG_DISABLE_BOOL(gnomeui,
5600     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5601         MOZ_ENABLE_GNOMEUI=,
5602         MOZ_ENABLE_GNOMEUI=force)
5604     if test "$MOZ_ENABLE_GNOMEUI"
5605     then
5606         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5607         [
5608             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5609             MOZ_ENABLE_GNOMEUI=1
5610         ],[
5611             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5612             then
5613                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5614             fi
5615             MOZ_ENABLE_GNOMEUI=
5616         ])
5617     fi
5619     if test "$MOZ_ENABLE_GNOMEUI"; then
5620         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5621     fi
5624 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5625 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5626 AC_SUBST(MOZ_GNOMEUI_LIBS)
5628 dnl ========================================================
5629 dnl = dbus support
5630 dnl ========================================================
5632 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5633 then
5634     MOZ_ENABLE_DBUS=1
5636     MOZ_ARG_DISABLE_BOOL(dbus,
5637     [  --disable-dbus          Disable dbus support ],
5638         MOZ_ENABLE_DBUS=,
5639         MOZ_ENABLE_DBUS=1)
5641     if test "$MOZ_ENABLE_DBUS"
5642     then
5643         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5644         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5645         AC_DEFINE(MOZ_ENABLE_DBUS)
5646     fi
5648 AC_SUBST(MOZ_ENABLE_DBUS)
5649 AC_SUBST(MOZ_DBUS_CFLAGS)
5650 AC_SUBST(MOZ_DBUS_LIBS)
5651 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5652 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5654 dnl ========================================================
5655 dnl = Build Personal Security Manager
5656 dnl ========================================================
5657 MOZ_ARG_DISABLE_BOOL(crypto,
5658 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5659     MOZ_PSM=,
5660     MOZ_PSM=1 )
5662 dnl ========================================================
5663 dnl = JS Debugger XPCOM component (js/jsd)
5664 dnl ========================================================
5665 MOZ_ARG_DISABLE_BOOL(jsd,
5666 [  --disable-jsd           Disable JavaScript debug library],
5667     MOZ_JSDEBUGGER=,
5668     MOZ_JSDEBUGGER=1)
5671 dnl ========================================================
5672 dnl = Disable IPC support for tabs and plugins
5673 dnl ========================================================
5674 case "${target}" in
5675 *-wince*)
5676     MOZ_IPC=
5677     ;;
5678 esac
5680 MOZ_ARG_DISABLE_BOOL(ipc,
5681 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5682     MOZ_IPC=,
5683     MOZ_IPC=1)
5685 if test -n "$MOZ_IPC"; then
5686     AC_DEFINE(MOZ_IPC)
5689 AC_SUBST(MOZ_IPC)
5691 dnl ========================================================
5692 dnl = Enable IPDL's "expensive" unit tests
5693 dnl ========================================================
5694 MOZ_IPDL_TESTS=
5696 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5697 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5698     MOZ_IPDL_TESTS=1,
5699     MOZ_IPDL_TESTS=)
5701 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5702     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5705 if test -n "$MOZ_IPDL_TESTS"; then
5706     AC_DEFINE(MOZ_IPDL_TESTS)
5709 AC_SUBST(MOZ_IPDL_TESTS)
5711 dnl ========================================================
5712 dnl = Disable plugin support
5713 dnl ========================================================
5714 MOZ_ARG_DISABLE_BOOL(plugins,
5715 [  --disable-plugins       Disable plugins support],
5716     MOZ_PLUGINS=,
5717     MOZ_PLUGINS=1)
5719 dnl ========================================================
5720 dnl = Disable building dbm
5721 dnl ========================================================
5722 MOZ_ARG_DISABLE_BOOL(dbm,
5723 [  --disable-dbm       Disable building dbm],
5724     NSS_DISABLE_DBM=1,
5725     NSS_DISABLE_DBM=)
5727 dnl bi-directional support always on
5728 IBMBIDI=1
5729 AC_DEFINE(IBMBIDI)
5731 dnl ========================================================
5732 dnl view source support on by default
5733 dnl ========================================================
5734 if test "$MOZ_VIEW_SOURCE"; then
5735     AC_DEFINE(MOZ_VIEW_SOURCE)
5738 dnl ========================================================
5739 dnl accessibility support on by default on all platforms 
5740 dnl except OS X.
5741 dnl ========================================================
5742 MOZ_ARG_DISABLE_BOOL(accessibility,
5743 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5744     ACCESSIBILITY=,
5745     ACCESSIBILITY=1 )
5746 if test "$ACCESSIBILITY"; then
5747     AC_DEFINE(ACCESSIBILITY)
5750 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5751 case "$target" in
5752 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5753     if test "$ac_cv_header_atlbase_h" = "no"; then
5754         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.])
5755     fi
5756     if test "$ac_cv_header_oleacc_idl" = "no"; then
5757         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.])
5758     fi
5759     ;;
5760 esac
5763 dnl ========================================================
5764 dnl xpcom js loader support on by default
5765 dnl ========================================================
5766 if test "$MOZ_JSLOADER"; then
5767     AC_DEFINE(MOZ_JSLOADER)
5770 dnl ========================================================
5771 dnl Disable printing
5772 dnl ========================================================
5773 MOZ_ARG_DISABLE_BOOL(printing,
5774 [  --disable-printing      Disable printing support],
5775     NS_PRINTING=,
5776     NS_PRINTING=1)
5778 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5779     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5780     NS_PRINTING=
5783 if test "$NS_PRINTING"; then
5784     AC_DEFINE(NS_PRINTING)
5785     AC_DEFINE(NS_PRINT_PREVIEW)
5787 dnl ========================================================
5788 dnl use native unicode converters
5789 dnl ========================================================
5790 MOZ_ARG_ENABLE_BOOL(native-uconv,
5791 [  --enable-native-uconv   Enable iconv support],
5792     MOZ_USE_NATIVE_UCONV=1,
5793     MOZ_USE_NATIVE_UCONV= )
5794 if test "$MOZ_USE_NATIVE_UCONV"; then
5795     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5797 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5798     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5802 dnl ========================================================
5803 dnl Libeditor can be build as plaintext-only,
5804 dnl or as a full html and text editing component.
5805 dnl We build both by default.
5806 dnl ========================================================
5807 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5808 [  --enable-plaintext-editor-only
5809                           Allow only plaintext editing],
5810     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5811     MOZ_PLAINTEXT_EDITOR_ONLY= )
5812 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5813 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5815 dnl ========================================================
5816 dnl = Disable Fast Load
5817 dnl ========================================================
5818 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5819 [  --disable-xpcom-fastload
5820                           Disable XPCOM fastload support],
5821     MOZ_NO_FAST_LOAD=1,
5822     MOZ_NO_FAST_LOAD=)
5824 AC_SUBST(MOZ_NO_FAST_LOAD)
5826 if test -n "$MOZ_NO_FAST_LOAD"; then
5827     AC_DEFINE(MOZ_NO_FAST_LOAD)
5830 dnl ========================================================
5831 dnl = Disable Ogg Codecs
5832 dnl ========================================================
5833 MOZ_ARG_DISABLE_BOOL(ogg,
5834 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5835     MOZ_OGG=,
5836     MOZ_OGG=1)
5838 if test -n "$MOZ_OGG"; then
5839     AC_DEFINE(MOZ_OGG)
5840     MOZ_SYDNEYAUDIO=1
5841     MOZ_MEDIA=1
5842     MOZ_VORBIS=1
5844     dnl Checks for __attribute__(aligned()) directive
5845     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5846         [ac_cv_c_attribute_aligned],
5847         [ac_cv_c_attribute_aligned=0
5848          CFLAGS_save="${CFLAGS}"
5849          CFLAGS="${CFLAGS} -Werror"
5850          for ac_cv_c_attr_align_try in 64 32 16 8; do
5851            echo "trying $ac_cv_c_attr_align_try"
5852            AC_TRY_COMPILE([],
5853                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5854                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5855            if test "$ac_cv_c_attribute_aligned" != 0; then
5856              break;
5857            fi
5858          done
5859            CFLAGS="${CFLAGS_save}"])
5860     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5861       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5862                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5863     fi
5866 dnl ========================================================
5867 dnl = Disable VP8 decoder support
5868 dnl ========================================================
5869 MOZ_ARG_DISABLE_BOOL(webm,
5870 [  --disable-webm         Disable support for WebM media (VP8 video and Vorbis audio)],
5871     MOZ_WEBM=,
5872     MOZ_WEBM=1)
5874 if test -n "$MOZ_WEBM"; then
5875     AC_DEFINE(MOZ_WEBM)
5876     MOZ_SYDNEYAUDIO=1
5877     MOZ_MEDIA=1
5878     MOZ_VORBIS=1
5880     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5881     dnl For Win32 (MSVC) we must use MASM.
5882     if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" = "x86" -a -z "$GNU_CC"; then
5883         AC_MSG_CHECKING([for MASM assembler])
5884         AC_CHECK_PROGS(VPX_AS, ml, "")
5885         if test -n "$VPX_AS"; then
5886           VPX_X86_ASM=1
5887           VPX_AS='sh $(topsrcdir)/media/libvpx/yasm2masm-as.sh'
5888         else
5889             AC_MSG_ERROR([Need MASM (ml.exe) in order to assemble libvpx optimized assembly. Either disable webm (reconfigure with --disable-webm) or install MASM. MASM is included in the Windows 7 SDK, or you can download MASM directly from http://www.microsoft.com/downloads/details.aspx?familyid=7a1c9da0-0510-44a2-b042-7ef370530c64&displaylang=en])
5890         fi
5891     else 
5893       dnl For Darwin x86, Darwin x86_64, Linux x86, and WINNT x86_64
5894       dnl we can use YASM.
5895       AC_MSG_CHECKING([for YASM assembler])
5896       AC_CHECK_PROGS(VPX_AS, yasm, "")
5897       if test -n "$VPX_AS"; then
5898         dnl We have YASM, see if we have assembly on this platform.  
5899         case "$OS_ARCH:$OS_TEST" in
5900         Linux:x86|Linux:i?86)
5901           VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5902           VPX_X86_ASM=1
5903         ;;
5904         Linux:x86_64)
5905           VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5906           VPX_X86_ASM=1
5907         ;;
5908         SunOS:i?86)
5909           VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5910           VPX_X86_ASM=1
5911         ;;
5912         SunOS:x86_64)
5913           VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5914           VPX_X86_ASM=1
5915         ;;
5916         Darwin:i?86)
5917           VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5918           VPX_X86_ASM=1
5919         ;;
5920         Darwin:x86_64)
5921           VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5922           VPX_X86_ASM=1
5923         ;;
5924         WINNT:x86_64)
5925           if test -z "$GNU_CC"; then
5926             VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5927             VPX_X86_ASM=1
5928           fi
5929         ;;
5930         esac
5931       fi # end have YASM
5932     fi # end !WINNT_x86_MSVC
5934     if test -n "$VPX_X86_ASM"; then
5935       AC_DEFINE(VPX_X86_ASM)
5936     else
5937       AC_MSG_WARN([No assembler or assembly support for libvpx, using unoptimized C routines.])
5938     fi
5941 dnl ========================================================
5942 dnl = Disable Wave decoder support
5943 dnl ========================================================
5944 MOZ_ARG_DISABLE_BOOL(wave,
5945 [  --disable-wave          Disable Wave decoder support],
5946     MOZ_WAVE=,
5947     MOZ_WAVE=1)
5949 if test -n "$MOZ_WAVE"; then
5950     AC_DEFINE(MOZ_WAVE)
5951     MOZ_SYDNEYAUDIO=1
5952     MOZ_MEDIA=1
5955 dnl ========================================================
5956 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5957 dnl ========================================================
5959 if test -n "$MOZ_SYDNEYAUDIO"; then
5960     AC_DEFINE(MOZ_SYDNEYAUDIO)
5963 if test -n "$MOZ_MEDIA"; then
5964     AC_DEFINE(MOZ_MEDIA)
5967 if test -n "$MOZ_VORBIS"; then
5968     AC_DEFINE(MOZ_VORBIS)
5971 dnl ========================================================
5972 dnl = Check alsa availability on Linux if using sydneyaudio
5973 dnl ========================================================
5975 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5976 if test -n "$MOZ_SYDNEYAUDIO"; then
5977    case "$target_os" in
5978 linux*)
5979       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5980          [echo "$MOZ_ALSA_PKG_ERRORS"
5981           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.)])])
5982       ;;
5983    esac
5986 dnl ========================================================
5987 dnl Splashscreen
5988 dnl ========================================================
5989 AC_ARG_ENABLE(splashscreen,
5990               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5991               [enable_splash="yes"],[enable_splash=""])
5992 if test "x$enable_splash" = "xyes"; then
5993   MOZ_SPLASHSCREEN=1
5994   AC_DEFINE(MOZ_SPLASHSCREEN)
5996 AC_SUBST(MOZ_SPLASHSCREEN)
5998 dnl ========================================================
5999 dnl Permissions System
6000 dnl ========================================================
6001 MOZ_ARG_DISABLE_BOOL(permissions,
6002 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6003     MOZ_PERMISSIONS=,
6004     MOZ_PERMISSIONS=1
6007 dnl ========================================================
6008 dnl NegotiateAuth
6009 dnl ========================================================
6010 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6011 [  --disable-negotiateauth Disable GSS-API negotiation ],
6012     MOZ_AUTH_EXTENSION=,
6013     MOZ_AUTH_EXTENSION=1 )
6015 dnl ========================================================
6016 dnl XTF
6017 dnl ========================================================
6018 MOZ_ARG_DISABLE_BOOL(xtf,
6019 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6020     MOZ_XTF=,
6021     MOZ_XTF=1 )
6022 if test "$MOZ_XTF"; then
6023   AC_DEFINE(MOZ_XTF)
6026 dnl ========================================================
6027 dnl Pref extensions (autoconfig and system-pref)
6028 dnl ========================================================
6029 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6030 [  --disable-pref-extensions
6031                           Disable pref extensions such as autoconfig and
6032                           system-pref],
6033   MOZ_PREF_EXTENSIONS=,
6034   MOZ_PREF_EXTENSIONS=1 )
6036 dnl ========================================================
6037 dnl = Universalchardet
6038 dnl ========================================================
6039 MOZ_ARG_DISABLE_BOOL(universalchardet,
6040 [  --disable-universalchardet
6041                           Disable universal encoding detection],
6042   MOZ_UNIVERSALCHARDET=,
6043   MOZ_UNIVERSALCHARDET=1 )
6045 dnl ========================================================
6046 dnl JavaXPCOM
6047 dnl ========================================================
6048 case "${target}" in
6049 *-wince*)
6050     MOZ_JAVAXPCOM=
6051     ;;
6052 esac
6054 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6055 [  --enable-javaxpcom
6056                           Enable Java-XPCOM bridge],
6057     MOZ_JAVAXPCOM=1,
6058     MOZ_JAVAXPCOM=)
6060 case "$host_os" in
6061   cygwin*|msvc*|mks*)
6062     if test -n "$JAVA_HOME"; then
6063       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6064     fi
6065     ;;
6066   *mingw*)
6067     if test -n "$JAVA_HOME"; then
6068       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6069     fi
6070     ;;
6071 esac
6073 if test -n "${JAVA_BIN_PATH}"; then
6074   dnl Look for javac and jar in the specified path.
6075   JAVA_PATH="$JAVA_BIN_PATH"
6076 else
6077   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6078   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6081 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6082 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6083 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6085 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6086   if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6087     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}])
6088   fi
6091 if test -n "${MOZ_JAVAXPCOM}"; then
6092   if test -n "${JAVA_INCLUDE_PATH}"; then
6093     dnl Make sure jni.h exists in the given include path.
6094     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6095       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6096     fi
6097   else
6098     case "$target_os" in
6099       darwin*)
6100         dnl Default to java system location
6101         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6102         ;;
6103       *)
6104         dnl Try $JAVA_HOME
6105         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6106         ;;
6107     esac
6108     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6109       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.])
6110     fi
6111   fi
6114 dnl ========================================================
6115 dnl = Breakpad crash reporting (on by default on supported platforms)
6116 dnl ========================================================
6118 case $target in
6119 i?86-*-mingw*)
6120   MOZ_CRASHREPORTER=1
6121   ;;
6122 i?86-apple-darwin*|powerpc-apple-darwin*)
6123   MOZ_CRASHREPORTER=1
6124   ;;
6125 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6126   MOZ_CRASHREPORTER=1
6127   ;;
6128 *solaris*)
6129   MOZ_CRASHREPORTER=1
6130   ;;
6131 esac
6133 MOZ_ARG_DISABLE_BOOL(crashreporter,
6134 [  --disable-crashreporter Disable breakpad crash reporting],
6135     MOZ_CRASHREPORTER=,
6136     MOZ_CRASHREPORTER=1)
6138 if test -n "$MOZ_CRASHREPORTER"; then
6139    AC_DEFINE(MOZ_CRASHREPORTER)
6141   if (test "$OS_ARCH" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6142     test -z "$SKIP_LIBRARY_CHECKS"; then
6143     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6144     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6145     AC_SUBST(MOZ_GTHREAD_LIBS)
6147     AC_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
6148   fi
6151 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6152 [  --with-crashreporter-enable-percent=NN
6153                           Enable sending crash reports by default on NN% of users. (default=100)],
6154 [ val=`echo $withval | sed 's/[^0-9]//g'`
6155     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6157 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6158    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6160 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6162 dnl ========================================================
6163 dnl = Enable compilation of specific extension modules
6164 dnl ========================================================
6166 MOZ_ARG_ENABLE_STRING(extensions,
6167 [  --enable-extensions     Enable extensions],
6168 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6169     if test "$option" = "yes" -o "$option" = "all"; then
6170         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6171     elif test "$option" = "no" -o "$option" = "none"; then
6172         MOZ_EXTENSIONS=""
6173     elif test "$option" = "default"; then
6174         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6175     elif test `echo "$option" | grep -c \^-` != 0; then
6176         option=`echo $option | sed 's/^-//'`
6177         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6178     else
6179         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6180     fi
6181 done],
6182     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6184 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6185     # Suppress warning on non-X11 platforms
6186     if test -n "$MOZ_X11"; then
6187         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6188     fi
6189     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6192 dnl Do not build gnomevfs with libxul based apps
6193 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6194     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6197 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6198     # Suppress warning on non-X11 platforms
6199     if test -n "$MOZ_X11"; then
6200         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6201     fi
6202     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6205 dnl Do not build gio with libxul based apps
6206 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6207     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6210 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6211     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6212     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6215 dnl This might be temporary: build tridentprofile only on Windows
6216 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6217     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6218     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6221 dnl cookie must be built before tridentprofile. put it at list's end.
6222 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6223   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6224   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6227 dnl xforms requires xtf and schema-validation
6228 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6229     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6230     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6232 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6233     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
6234     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6237 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6238     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6239     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6242 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6243     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6244     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6247 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6248     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6249     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6252 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6253     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6254     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6257 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6258     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6259     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6262 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6263     AC_MSG_WARN([spellcheck is no longer an extension.])
6264     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6267 dnl Remove dupes
6268 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6270 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6271 dnl when trying to build a nonexistent extension.
6272 for extension in $MOZ_EXTENSIONS; do
6273     if test ! -d "${srcdir}/extensions/${extension}"; then
6274         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6275     fi
6276 done
6279 dnl ========================================================
6280 dnl Image decoders
6281 dnl ========================================================
6282 case "$MOZ_WIDGET_TOOLKIT" in
6283 beos|windows|os2|mac|cocoa)
6284     ;;
6286     if test -z "$MOZ_ENABLE_GTK2" -a -z "$MOZ_ENABLE_QT"; then
6287        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6288     fi
6289     ;;
6290 esac
6292 MOZ_ARG_ENABLE_STRING(image-decoders,
6293 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
6294                           Enable specific image decoders],
6295 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6296     if test "$option" = "yes" -o "$option" = "all"; then
6297         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6298     elif test "$option" = "no" -o "$option" = "none"; then
6299         MOZ_IMG_DECODERS=""
6300     elif test "$option" = "default"; then
6301         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6302     elif test `echo "$option" | grep -c \^-` != 0; then
6303         option=`echo $option | sed 's/^-//'`
6304         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6305     else
6306         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6307     fi
6308 done],
6309     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6311 dnl Dupes are removed in the encoder section because it will also add decoders
6313 dnl ========================================================
6314 dnl Image encoders
6315 dnl ========================================================
6316 MOZ_ARG_ENABLE_STRING(image-encoders,
6317 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6318                           Enable specific image encoders],
6319 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6320     if test "$option" = "yes" -o "$option" = "all"; then
6321         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6322     elif test "$option" = "no" -o "$option" = "none"; then
6323         MOZ_IMG_ENCODERS=""
6324         addencoder=""
6325     elif test "$option" = "default"; then
6326         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6327     elif test `echo "$option" | grep -c \^-` != 0; then
6328         option=`echo $option | sed 's/^-//'`
6329         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6330     else
6331         addencoder="$option"
6332     fi
6333     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6334 done],
6335     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6337 dnl Remove dupes
6338 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6339 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6341 dnl ========================================================
6342 dnl MathML on by default
6343 dnl ========================================================
6344 MOZ_ARG_DISABLE_BOOL(mathml,
6345 [  --disable-mathml        Disable MathML support],
6346     MOZ_MATHML=,
6347     MOZ_MATHML=1 )
6348 if test "$MOZ_MATHML"; then
6349   AC_DEFINE(MOZ_MATHML)
6352 dnl ========================================================
6353 dnl SVG
6354 dnl ========================================================
6355 MOZ_ARG_DISABLE_BOOL(svg,
6356 [  --disable-svg           Disable SVG support],
6357     MOZ_SVG=,
6358     MOZ_SVG=1 )
6359 if test -n "$MOZ_SVG"; then
6360   AC_DEFINE(MOZ_SVG)
6363 dnl ========================================================
6364 dnl SMIL
6365 dnl ========================================================
6366 MOZ_SMIL=1
6367 MOZ_ARG_DISABLE_BOOL(smil,
6368 [  --disable-smil          Disable SMIL animation support],
6369     MOZ_SMIL=,
6370     MOZ_SMIL=1 )
6371 # Automatically disable SMIL if SVG is disabled
6372 if test -z "$MOZ_SVG"; then
6373   MOZ_SMIL=
6375 if test -n "$MOZ_SMIL"; then
6376   AC_DEFINE(MOZ_SMIL)
6379 dnl ========================================================
6380 dnl Build Freetype in the tree
6381 dnl ========================================================
6382 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6383 [  --enable-tree-freetype  Enable Tree FreeType],
6384     MOZ_TREE_FREETYPE=1,
6385     MOZ_TREE_FREETYPE= )
6386 if test -n "$MOZ_TREE_FREETYPE"; then
6387    AC_DEFINE(MOZ_TREE_FREETYPE)
6388    AC_SUBST(MOZ_TREE_FREETYPE)
6389    MOZ_ENABLE_CAIRO_FT=1       
6390    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6391    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6392    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6393    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6394    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6395    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6396    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6397    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6398    AC_SUBST(CAIRO_FT_CFLAGS)
6402 dnl ========================================================
6403 dnl Installer
6404 dnl ========================================================
6405 case "$target_os" in
6406     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6407         MOZ_INSTALLER=1
6408         ;;
6409 esac
6411 MOZ_ARG_DISABLE_BOOL(installer,
6412 [  --disable-installer     Disable building of installer],
6413     MOZ_INSTALLER=,
6414     MOZ_INSTALLER=1)
6415 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6416     # Disable installer for Windows builds that use the new toolkit if the
6417     # required major version and minimum minor version of Unicode NSIS isn't in
6418     # the path.
6419     REQ_NSIS_MAJOR_VER=2
6420     MIN_NSIS_MINOR_VER=33
6421     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6422     if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6423         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.])
6424     fi
6425     changequote(,)
6426     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6427     changequote([,])
6428     if test ! "$MAKENSISU_VER" == ""; then
6429         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6430         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6431     fi
6432     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6433     if test "$MAKENSISU_VER" == "" -o \
6434        ! "$MAKENSISU_MAJOR_VER" == "$REQ_NSIS_MAJOR_VER" -o \
6435        ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6436         AC_MSG_RESULT([no])
6437         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.])
6438     fi
6439     AC_MSG_RESULT([yes])
6440     MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6442     # The Windows build for NSIS requires the iconv command line utility to
6443     # convert the charset of the locale files.
6444     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6445     if test -z "$HOST_ICONV"; then
6446         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6447     fi
6450 AC_SUBST(MOZ_INSTALLER)
6452 AC_MSG_CHECKING([for tar archiver])
6453 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6454 if test -z "$TAR"; then
6455     AC_MSG_ERROR([no tar archiver found in \$PATH])
6457 AC_MSG_RESULT([$TAR])
6458 AC_SUBST(TAR)
6460 AC_MSG_CHECKING([for wget])
6461 AC_CHECK_PROGS(WGET, wget, "")
6462 AC_MSG_RESULT([$WGET])
6463 AC_SUBST(WGET)
6465 dnl ========================================================
6466 dnl Updater
6467 dnl ========================================================
6469 MOZ_ARG_DISABLE_BOOL(updater,
6470 [  --disable-updater       Disable building of updater],
6471     MOZ_UPDATER=,
6472     MOZ_UPDATER=1 )
6474 if test -n "$MOZ_UPDATER"; then
6475     AC_DEFINE(MOZ_UPDATER)
6478 # app update channel is 'default' when not supplied.
6479 MOZ_ARG_ENABLE_STRING([update-channel],
6480 [  --enable-update-channel=CHANNEL
6481                           Select application update channel (default=default)],
6482     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6484 if test -z "$MOZ_UPDATE_CHANNEL"; then
6485     MOZ_UPDATE_CHANNEL=default
6487 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6488 AC_SUBST(MOZ_UPDATE_CHANNEL)
6490 # tools/update-packaging is not checked out by default.
6491 MOZ_ARG_ENABLE_BOOL(update-packaging,
6492 [  --enable-update-packaging
6493                           Enable tools/update-packaging],
6494     MOZ_UPDATE_PACKAGING=1,
6495     MOZ_UPDATE_PACKAGING= )
6496 AC_SUBST(MOZ_UPDATE_PACKAGING)
6498 dnl ========================================================
6499 dnl ActiveX
6500 dnl ========================================================
6502 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6503 [  --disable-xpconnect-idispatch
6504                           Disable building of xpconnect support for IDispatch
6505                           (win32 only)],
6506     XPC_IDISPATCH_SUPPORT=,
6507     XPC_IDISPATCH_SUPPORT=1)
6508 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6510 MOZ_ARG_DISABLE_BOOL(activex,
6511 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6512     MOZ_NO_ACTIVEX_SUPPORT=1,
6513     MOZ_NO_ACTIVEX_SUPPORT= )
6514 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6516 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6517 [  --enable-activex-scripting
6518                           Enable building of ActiveX scripting support (win32)],
6519     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6520     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6521 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6523 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6524 then
6525     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6528 if test "$COMPILE_ENVIRONMENT" = "1"; then
6529 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6530 case "$target" in
6531 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6532     if test "$ac_cv_header_atlbase_h" = "no"; then
6533         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.])
6534     fi
6535     ;;
6536 esac
6540 dnl ========================================================
6541 dnl leaky
6542 dnl ========================================================
6543 MOZ_ARG_ENABLE_BOOL(leaky,
6544 [  --enable-leaky          Build leaky memory tool],
6545     MOZ_LEAKY=1,
6546     MOZ_LEAKY=)
6549 dnl ========================================================
6550 dnl build the tests by default
6551 dnl ========================================================
6552 MOZ_ARG_DISABLE_BOOL(tests,
6553 [  --disable-tests         Do not build test libraries & programs],
6554     ENABLE_TESTS=,
6555     ENABLE_TESTS=1 )
6557 dnl ========================================================
6558 dnl parental controls (for Windows Vista)
6559 dnl ========================================================
6560 MOZ_ARG_DISABLE_BOOL(parental-controls,
6561 [  --disable-parental-controls
6562                           Do not build parental controls],
6563    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6564    MOZ_DISABLE_PARENTAL_CONTROLS=)
6565 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6566     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6569 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6571 dnl ========================================================
6572 dnl =
6573 dnl = Module specific options
6574 dnl =
6575 dnl ========================================================
6576 MOZ_ARG_HEADER(Individual module options)
6578 dnl ========================================================
6579 dnl = Disable feed handling components
6580 dnl ========================================================
6581 MOZ_ARG_DISABLE_BOOL(feeds,
6582 [  --disable-feeds         Disable feed handling and processing components],
6583     MOZ_FEEDS=,
6584     MOZ_FEEDS=1 )
6585 if test -n "$MOZ_FEEDS"; then
6586     AC_DEFINE(MOZ_FEEDS)
6587 else
6588     if test "$MOZ_BUILD_APP" = "browser"; then
6589         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6590     fi
6593 dnl ========================================================
6594 dnl = Enable mozStorage
6595 dnl ========================================================
6596 dnl Implicitly enabled by default if building calendar or places
6597 MOZ_ARG_ENABLE_BOOL(storage,
6598 [  --enable-storage        Enable mozStorage module and related components],
6599     MOZ_STORAGE=1,
6600     MOZ_STORAGE= )
6601 if test -n "$MOZ_STORAGE"; then
6602     AC_DEFINE(MOZ_STORAGE)
6605 dnl ========================================================
6606 dnl Check for sqlite
6607 dnl ========================================================
6609 MOZ_NATIVE_SQLITE=
6610 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6611 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6612 MOZ_NATIVE_SQLITE=1,
6613 MOZ_NATIVE_SQLITE= )
6615 if test -z "$MOZ_NATIVE_SQLITE"
6616 then
6617     SQLITE_CFLAGS=
6618     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6619 else
6620     dnl ============================
6621     dnl === SQLite Version check ===
6622     dnl ============================
6623     dnl Check to see if the system SQLite package is new enough.
6624     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6626     dnl ==================================
6627     dnl === SQLITE_SECURE_DELETE check ===
6628     dnl ==================================
6629     dnl Check to see if the system SQLite package is compiled with
6630     dnl SQLITE_SECURE_DELETE enabled.
6631     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6632     _SAVE_CFLAGS="$CFLAGS"
6633     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6634     _SAVE_LIBS="$LIBS"
6635     LIBS="$LIBS $SQLITE_LIBS"
6636     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6637         AC_TRY_RUN([
6638             #include "sqlite3.h"
6640             int main(int argc, char **argv){
6641               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6642             }],
6643             ac_cv_sqlite_secure_delete=yes,
6644             ac_cv_sqlite_secure_delete=no,
6645             ac_cv_sqlite_secure_delete=no
6646         )
6647     ])
6648     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6649     CFLAGS="$_SAVE_CFLAGS"
6650     LIBS="$_SAVE_LIBS"
6651     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6652         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6653     fi
6655     dnl ===============================
6656     dnl === SQLITE_THREADSAFE check ===
6657     dnl ===============================
6658     dnl Check to see if the system SQLite package is compiled with
6659     dnl SQLITE_THREADSAFE enabled.
6660     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6661     _SAVE_CFLAGS="$CFLAGS"
6662     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6663     _SAVE_LIBS="$LIBS"
6664     LIBS="$LIBS $SQLITE_LIBS"
6665     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6666         AC_TRY_RUN([
6667             #include "sqlite3.h"
6669             int main(int argc, char **argv){
6670               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6671             }],
6672             ac_cv_sqlite_threadsafe=yes,
6673             ac_cv_sqlite_threadsafe=no,
6674             ac_cv_sqlite_threadsafe=no
6675         )
6676     ])
6677     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6678     CFLAGS="$_SAVE_CFLAGS"
6679     LIBS="$_SAVE_LIBS"
6680     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6681         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6682     fi
6684     dnl ================================
6685     dnl === SQLITE_ENABLE_FTS3 check ===
6686     dnl ================================
6687     dnl check to see if the system SQLite package is compiled with
6688     dnl SQLITE_ENABLE_FTS3 enabled.
6689     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6690     _SAVE_CFLAGS="$CFLAGS"
6691     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6692     _SAVE_LIBS="$LIBS"
6693     LIBS="$LIBS $SQLITE_LIBS"
6694     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6695         AC_TRY_RUN([
6696             #include "sqlite3.h"
6698             int main(int argc, char **argv){
6699               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6700             }],
6701             ac_cv_sqlite_enable_fts3=yes,
6702             ac_cv_sqlite_enable_fts3=no,
6703             ac_cv_sqlite_enable_fts3=no
6704         )
6705     ])
6706     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6707     CFLAGS="$_SAVE_CFLAGS"
6708     LIBS="$_SAVE_LIBS"
6709     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6710         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6711     fi
6713     dnl =========================================
6714     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6715     dnl =========================================
6716     dnl check to see if the system SQLite package is compiled with
6717     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6718     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6719     _SAVE_CFLAGS="$CFLAGS"
6720     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6721     _SAVE_LIBS="$LIBS"
6722     LIBS="$LIBS $SQLITE_LIBS"
6723     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6724         AC_TRY_RUN([
6725             #include "sqlite3.h"
6727             int main(int argc, char **argv){
6728               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6729             }],
6730             ac_cv_sqlite_enable_unlock_notify=yes,
6731             ac_cv_sqlite_enable_unlock_notify=no,
6732             ac_cv_sqlite_enable_unlock_notify=no
6733         )
6734     ])
6735     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6736     CFLAGS="$_SAVE_CFLAGS"
6737     LIBS="$_SAVE_LIBS"
6738     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6739         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6740     fi
6743 AC_SUBST(MOZ_NATIVE_SQLITE)
6745 dnl ========================================================
6746 dnl = Enable help viewer (off by default)
6747 dnl ========================================================
6748 if test -n "$MOZ_HELP_VIEWER"; then
6749      dnl Do this if defined in confvars.sh
6750      AC_DEFINE(MOZ_HELP_VIEWER)
6753 dnl ========================================================
6754 dnl = Enable safe browsing (anti-phishing)
6755 dnl ========================================================
6756 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6757 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6758     MOZ_SAFE_BROWSING=1,
6759     MOZ_SAFE_BROWSING= )
6760 if test -n "$MOZ_SAFE_BROWSING"; then
6761     AC_DEFINE(MOZ_SAFE_BROWSING)
6763 AC_SUBST(MOZ_SAFE_BROWSING)
6765 dnl ========================================================
6766 dnl = Enable faststart component
6767 dnl ========================================================
6768 MOZ_ARG_ENABLE_BOOL(faststart,
6769 [  --enable-faststart      Enable the faststart component],
6770     MOZ_FASTSTART=1,
6771     MOZ_FASTSTART= )
6772 if test -n "$MOZ_FASTSTART"; then
6773     AC_DEFINE(MOZ_FASTSTART)
6775 AC_SUBST(MOZ_FASTSTART)
6777 dnl ========================================================
6778 dnl = Enable url-classifier
6779 dnl ========================================================
6780 dnl Implicitly enabled by default if building with safe-browsing
6781 if test -n "$MOZ_SAFE_BROWSING"; then
6782     MOZ_URL_CLASSIFIER=1
6784 MOZ_ARG_ENABLE_BOOL(url-classifier,
6785 [  --enable-url-classifier Enable url classifier module],
6786     MOZ_URL_CLASSIFIER=1,
6787     MOZ_URL_CLASSIFIER= )
6788 if test -n "$MOZ_URL_CLASSIFIER"; then
6789     AC_DEFINE(MOZ_URL_CLASSIFIER)
6791 AC_SUBST(MOZ_URL_CLASSIFIER)
6793 dnl ========================================================
6794 dnl = Disable zipwriter
6795 dnl ========================================================
6796 MOZ_ARG_DISABLE_BOOL(zipwriter,
6797 [  --disable-zipwriter     Disable zipwriter component],
6798     MOZ_ZIPWRITER=,
6799     MOZ_ZIPWRITER=1 )
6800 AC_SUBST(MOZ_ZIPWRITER)
6802 dnl ========================================================
6803 dnl = Disable libconic
6804 dnl ========================================================
6805 MOZ_ENABLE_LIBCONIC=1
6806 MOZ_ARG_DISABLE_BOOL(libconic,
6807 [  --disable-libconic      Disable libconic],
6808     MOZ_ENABLE_LIBCONIC=,
6809     MOZ_ENABLE_LIBCONIC=1 )
6811 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6812     PKG_CHECK_MODULES(LIBCONIC, conic,
6813                       MOZ_ENABLE_LIBCONIC=1,
6814                       MOZ_ENABLE_LIBCONIC=)
6816 if test "$MOZ_ENABLE_LIBCONIC"; then
6817     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6820 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6821 AC_SUBST(LIBCONIC_CFLAGS)
6822 AC_SUBST(LIBCONIC_LIBS)
6824 dnl ========================================================
6825 dnl = Maemo checks
6826 dnl ========================================================
6828 MAEMO_SDK_TARGET_VER=-1
6830 MOZ_ARG_WITH_STRING(maemo-version,
6831 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6832                           Maemo SDK Version],
6833   MAEMO_SDK_TARGET_VER=$withval)
6835 case "$MAEMO_SDK_TARGET_VER" in
6837     MOZ_PLATFORM_MAEMO=5
6838     ;;
6841     MOZ_PLATFORM_MAEMO=6
6842     ;;
6845     dnl We aren't compiling for Maemo, move on.
6846     ;;
6848     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6849     ;;
6850 esac
6852 if test $MOZ_PLATFORM_MAEMO; then
6853    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6855    if test -z "$MOZ_ENABLE_DBUS"; then
6856        AC_MSG_ERROR([DBus is required when building for Maemo])
6857    fi
6859    MOZ_GFX_OPTIMIZE_MOBILE=1
6860    MOZ_WEBGL_GLX=
6861    MOZ_MAEMO_LIBLOCATION=
6863    if test $MOZ_PLATFORM_MAEMO = 5; then
6864       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6865       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6866                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6867       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6868                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6870       AC_SUBST(XCOMPOSITE_LIBS)
6872       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6873       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6874       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6875       if test -z "$_LIB_FOUND"; then
6876          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6877       fi
6880       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6881       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6882       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6883       if test -z "$_LIB_FOUND"; then
6884          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6885       fi
6887       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6888       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6889       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6890       if test -z "$_LIB_FOUND"; then
6891          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6892       fi
6894    fi
6896    if test "$MOZ_PLATFORM_MAEMO" -gt 5; then
6897      MOZ_THUMB2=1
6898    fi
6900    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6901    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6902    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6903    if test "$_LIB_FOUND"; then
6904       MOZ_MAEMO_LIBLOCATION=1
6905       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6906    else
6907       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6908    fi
6909    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6911    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6912    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6915 dnl ========================================================
6916 dnl = Enable building the Thumb2 instruction set
6917 dnl ========================================================
6918 MOZ_ARG_ENABLE_BOOL(thumb2,
6919  [  --enable-thumb2         Enable Thumb2 instruction set],
6920     MOZ_THUMB2=1,
6921     MOZ_THUMB2=)
6923 if test -n "$MOZ_THUMB2"; then
6924   case "$target_cpu" in
6925     arm*)
6926       if test "$GNU_CC"; then
6927         CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6928         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6929         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
6930       else
6931         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
6932       fi
6933     ;;
6934     *)
6935       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
6936     ;;
6937   esac
6940 dnl ========================================================
6941 dnl = faststripe theme
6942 dnl ========================================================
6943 MOZ_ARG_ENABLE_BOOL(faststripe,
6944 [  --enable-faststripe     Use faststripe theme],
6945     MOZ_THEME_FASTSTRIPE=1,
6946     MOZ_THEME_FASTSTRIPE= )
6947 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6949 dnl ========================================================
6950 dnl =
6951 dnl = Feature options that require extra sources to be pulled
6952 dnl =
6953 dnl ========================================================
6954 dnl MOZ_ARG_HEADER(Features that require extra sources)
6956 dnl ========================================================
6957 dnl =
6958 dnl = Debugging Options
6959 dnl = 
6960 dnl ========================================================
6961 MOZ_ARG_HEADER(Debugging and Optimizations)
6963 dnl ========================================================
6964 dnl = Disable building with debug info.
6965 dnl = Debugging is OFF by default
6966 dnl ========================================================
6967 if test -z "$MOZ_DEBUG_FLAGS"; then
6968   MOZ_DEBUG_FLAGS="-g"
6971 MOZ_ARG_ENABLE_STRING(debug,
6972 [  --enable-debug[=DBG]    Enable building with developer debug info
6973                            (using compiler flags DBG)],
6974 [ if test "$enableval" != "no"; then
6975     MOZ_DEBUG=1
6976     if test -n "$enableval" -a "$enableval" != "yes"; then
6977         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6978         _MOZ_DEBUG_FLAGS_SET=1
6979     fi
6980   else
6981     MOZ_DEBUG=
6982   fi ],
6983   MOZ_DEBUG=)
6985 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6986 MOZ_ARG_WITH_STRING(debug-label,
6987 [  --with-debug-label=LABELS
6988                           Define DEBUG_<value> for each comma-separated
6989                           value given.],
6990 [ for option in `echo $withval | sed 's/,/ /g'`; do
6991     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6992 done])
6994 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6996 if test -n "$MOZ_DEBUG"; then
6997     AC_MSG_CHECKING([for valid debug flags])
6998     _SAVE_CFLAGS=$CFLAGS
6999     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7000     AC_TRY_COMPILE([#include <stdio.h>], 
7001         [printf("Hello World\n");],
7002         _results=yes,
7003         _results=no)
7004     AC_MSG_RESULT([$_results])
7005     if test "$_results" = "no"; then
7006         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7007     fi
7008     CFLAGS=$_SAVE_CFLAGS
7011 dnl ========================================================
7012 dnl enable mobile optimizations
7013 dnl ========================================================
7014 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7015 [  --enable-mobile-optimize
7016                           Enable mobile optimizations],
7017     MOZ_GFX_OPTIMIZE_MOBILE=1)
7019 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7021 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7022     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7025 dnl ========================================================
7026 dnl = Enable code optimization. ON by default.
7027 dnl ========================================================
7028 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7029         MOZ_OPTIMIZE_FLAGS="-O"
7032 MOZ_ARG_ENABLE_STRING(optimize,
7033 [  --disable-optimize      Disable compiler optimization
7034   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7035 [ if test "$enableval" != "no"; then
7036     MOZ_OPTIMIZE=1
7037     if test -n "$enableval" -a "$enableval" != "yes"; then
7038         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7039         MOZ_OPTIMIZE=2
7040     fi
7041 else
7042     MOZ_OPTIMIZE=
7043 fi ], MOZ_OPTIMIZE=1)
7045 if test "$COMPILE_ENVIRONMENT"; then
7046 if test -n "$MOZ_OPTIMIZE"; then
7047     AC_MSG_CHECKING([for valid optimization flags])
7048     _SAVE_CFLAGS=$CFLAGS
7049     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7050     AC_TRY_COMPILE([#include <stdio.h>], 
7051         [printf("Hello World\n");],
7052         _results=yes,
7053         _results=no)
7054     AC_MSG_RESULT([$_results])
7055     if test "$_results" = "no"; then
7056         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7057     fi
7058     CFLAGS=$_SAVE_CFLAGS
7060 fi # COMPILE_ENVIRONMENT
7062 AC_SUBST(MOZ_OPTIMIZE)
7063 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7064 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7065 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7067 dnl ========================================================
7068 dnl = (Deprecated) generation of debugger info for specific modules
7069 dnl ========================================================
7070 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7071 [  --enable-debugger-info-modules
7072                           Enable/disable debugger info for specific modules],
7073 [ if test "$enableval" != "no"; then
7074     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7075     MOZ_DEBUG_SYMBOLS=1
7076   fi ])
7078 dnl ========================================================
7079 dnl = Enable generation of debug symbols
7080 dnl ========================================================
7081 MOZ_ARG_ENABLE_STRING(debug-symbols,
7082 [  --enable-debug-symbols[=DBG]
7083                           Enable debugging symbols (using compiler flags DBG)],
7084 [ if test "$enableval" != "no"; then
7085       MOZ_DEBUG_SYMBOLS=1
7086       if test -n "$enableval" -a "$enableval" != "yes"; then
7087           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7088               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7089           else
7090               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7091           fi
7092       fi
7093   fi ])
7095 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7096     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7097     export MOZ_DEBUG_SYMBOLS
7100 dnl ========================================================
7101 dnl = Disable any treating of compile warnings as errors
7102 dnl ========================================================
7103 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7104 [  --disable-warnings-as-errors
7105                           Disable treating of warnings as errors],
7106     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7107     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7108 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7109    WARNINGS_AS_ERRORS=''
7112 dnl ========================================================
7113 dnl = Disable runtime logging checks
7114 dnl ========================================================
7115 MOZ_ARG_DISABLE_BOOL(logging,
7116 [  --disable-logging       Disable logging facilities],
7117     NS_DISABLE_LOGGING=1,
7118     NS_DISABLE_LOGGING= )
7119 if test "$NS_DISABLE_LOGGING"; then
7120     AC_DEFINE(NS_DISABLE_LOGGING)
7121 else
7122     AC_DEFINE(MOZ_LOGGING)
7125 dnl ========================================================
7126 dnl = This will enable logging of addref, release, ctor, dtor.
7127 dnl ========================================================
7128 _ENABLE_LOGREFCNT=42
7129 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7130 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7131     _ENABLE_LOGREFCNT=1,
7132     _ENABLE_LOGREFCNT= )
7133 if test "$_ENABLE_LOGREFCNT" = "1"; then
7134     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7135 elif test -z "$_ENABLE_LOGREFCNT"; then
7136     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7139 dnl ========================================================
7140 dnl = Enable trace malloc
7141 dnl ========================================================
7142 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7143 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7144 [  --enable-trace-malloc   Enable malloc tracing],
7145     NS_TRACE_MALLOC=1,
7146     NS_TRACE_MALLOC= )
7147 if test "$NS_TRACE_MALLOC"; then
7148   # Please, Mr. Linker Man, don't take away our symbol names
7149   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7150   USE_ELF_DYNSTR_GC=
7151   AC_DEFINE(NS_TRACE_MALLOC)
7153 AC_SUBST(NS_TRACE_MALLOC)
7155 dnl ========================================================
7156 dnl = Enable jemalloc
7157 dnl ========================================================
7158 MOZ_ARG_ENABLE_BOOL(jemalloc,
7159 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7160     MOZ_MEMORY=1,
7161     MOZ_MEMORY=)
7163 if test "$NS_TRACE_MALLOC"; then
7164     MOZ_MEMORY=
7167 if test "$MOZ_MEMORY"; then
7169   dnl Don't try to run compiler tests on Windows  
7170   if test "$OS_ARCH" = "WINNT"; then
7171     if test -z "$HAVE_64BIT_OS"; then
7172       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7173     else
7174       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7175     fi
7176   else
7177     AC_CHECK_SIZEOF([int *], [4])
7178     case "${ac_cv_sizeof_int_p}" in
7179     4)
7180       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7181       ;;
7182     8)
7183       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7184       ;;
7185     *)
7186       AC_MSG_ERROR([Unexpected pointer size])
7187       ;;
7188     esac
7189   fi
7191   AC_DEFINE(MOZ_MEMORY)
7192   if test "x$MOZ_DEBUG" = "x1"; then
7193     AC_DEFINE(MOZ_MEMORY_DEBUG)
7194   fi
7195   dnl The generic feature tests that determine how to compute ncpus are long and
7196   dnl complicated.  Therefore, simply define special cpp variables for the
7197   dnl platforms we have special knowledge of.
7198   case "${target}" in
7199   *-darwin*)
7200     AC_DEFINE(MOZ_MEMORY_DARWIN)
7201     ;;
7202   *-*freebsd*)
7203     AC_DEFINE(MOZ_MEMORY_BSD)
7204     ;;
7205   *-*linux*)
7206     AC_DEFINE(MOZ_MEMORY_LINUX)
7207     ;;
7208   *-netbsd*)
7209     AC_DEFINE(MOZ_MEMORY_BSD)
7210     ;;
7211   *-solaris*)
7212     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7213     ;;
7214   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7215     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7216     dnl This is sort of awful. Will revisit if we add support for more versions
7217     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7218         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7219     fi
7220     if test -z "$WIN32_CRT_SRC_DIR"; then
7221       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7222         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).])
7223       else
7224         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7225       fi
7226     fi
7227     dnl cpu check
7228     case "${target_cpu}" in
7229     i*86)
7230       MOZ_CRT_CPU_ARCH=intel
7231       ;;
7232     x86_64)
7233       MOZ_CRT_CPU_ARCH=amd64
7234       ;;
7235     *)
7236       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7237       ;;
7238     esac
7240     AC_SUBST(MOZ_CRT_CPU_ARCH)
7242     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7243       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7244     fi
7245     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7246     _objdir_win=`pwd -W`
7247     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7248     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7249     dnl Also pass this to NSPR/NSS
7250     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7251     export DLLFLAGS
7252     ;;
7253   *-*wince)
7254     AC_DEFINE(MOZ_MEMORY_WINCE)
7255     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7256     if test -z "$WINCE_WINDOWS_MOBILE"; then
7257       AC_DEFINE(MOZ_MEMORY_WINCE6)
7258     fi
7259     ;;
7260   *-*winmo)
7261     AC_DEFINE(MOZ_MEMORY_WINCE)
7262     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7263     ;;
7264   *-android*)
7265     AC_DEFINE(MOZ_MEMORY_LINUX)
7266     AC_DEFINE(MOZ_MEMORY_ANDROID)
7267     _WRAP_MALLOC=1
7268     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc"
7269     ;;
7270   *)
7271     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7272     ;;
7273   esac
7275   if test "$OS_ARCH" != "Darwin"; then
7276     dnl NB: this must be kept in sync with jemalloc.h
7277     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7278     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7279     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7280   fi
7282 AC_SUBST(MOZ_MEMORY)
7283 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7284 AC_SUBST(WIN32_CRT_SRC_DIR)
7285 dnl Need to set this for make because NSS doesn't have configure
7286 AC_SUBST(DLLFLAGS)
7288 dnl ========================================================
7289 dnl = Use malloc wrapper lib
7290 dnl ========================================================
7291 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7292 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7293     _WRAP_MALLOC=1,
7294     _WRAP_MALLOC= )
7296 if test -n "$_WRAP_MALLOC"; then
7297     if test "$GNU_CC"; then
7298     WRAP_MALLOC_CFLAGS="${LDFLAGS} -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"
7299     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7300     fi
7303 dnl ========================================================
7304 dnl = Location of malloc wrapper lib
7305 dnl ========================================================
7306 MOZ_ARG_WITH_STRING(wrap-malloc,
7307 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7308     WRAP_MALLOC_LIB=$withval)
7310 dnl ========================================================
7311 dnl = Use TraceVis
7312 dnl ========================================================
7313 MOZ_ARG_ENABLE_BOOL(tracevis,
7314 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7315     MOZ_TRACEVIS=1,
7316     MOZ_TRACEVIS= )
7317 if test -n "$MOZ_TRACEVIS"; then
7318     AC_DEFINE(MOZ_TRACEVIS)
7321 dnl ========================================================
7322 dnl = Use GCTimer
7323 dnl ========================================================
7324 MOZ_ARG_ENABLE_BOOL(gctimer,
7325 [  --enable-gctimer        Enable GC timer (default=no)],
7326     MOZ_GCTIMER=1,
7327     MOZ_GCTIMER= )
7328 if test -n "$MOZ_GCTIMER"; then
7329     AC_DEFINE(MOZ_GCTIMER)
7332 dnl ========================================================
7333 dnl = Use Valgrind
7334 dnl ========================================================
7335 MOZ_ARG_ENABLE_BOOL(valgrind,
7336 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7337     MOZ_VALGRIND=1,
7338     MOZ_VALGRIND= )
7339 if test -n "$MOZ_VALGRIND"; then
7340     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7341         AC_MSG_ERROR(
7342             [--enable-valgrind specified but Valgrind is not installed]))
7343     AC_DEFINE(MOZ_VALGRIND)
7346 dnl ========================================================
7347 dnl jprof
7348 dnl ========================================================
7349 MOZ_ARG_ENABLE_BOOL(jprof,
7350 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7351     MOZ_JPROF=1,
7352     MOZ_JPROF= )
7353 if test -n "$MOZ_JPROF"; then
7354     AC_DEFINE(MOZ_JPROF)
7357 dnl ========================================================
7358 dnl shark
7359 dnl ========================================================
7360 MOZ_ARG_ENABLE_BOOL(shark,
7361 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7362     MOZ_SHARK=1,
7363     MOZ_SHARK= )
7364 if test -n "$MOZ_SHARK"; then
7365     AC_DEFINE(MOZ_SHARK)
7368 dnl ========================================================
7369 dnl callgrind
7370 dnl ========================================================
7371 MOZ_ARG_ENABLE_BOOL(callgrind,
7372 [  --enable-callgrind      Enable callgrind profiling],
7373     MOZ_CALLGRIND=1,
7374     MOZ_CALLGRIND= )
7375 if test -n "$MOZ_CALLGRIND"; then
7376     AC_DEFINE(MOZ_CALLGRIND)
7379 dnl ========================================================
7380 dnl vtune
7381 dnl ========================================================
7382 MOZ_ARG_ENABLE_BOOL(vtune,
7383 [  --enable-vtune          Enable vtune profiling],
7384     MOZ_VTUNE=1,
7385     MOZ_VTUNE= )
7386 if test -n "$MOZ_VTUNE"; then
7387     AC_DEFINE(MOZ_VTUNE)
7390 dnl ========================================================
7391 dnl Zealous JavaScript GC
7392 dnl ========================================================
7393 MOZ_ARG_ENABLE_BOOL(gczeal,
7394 [  --enable-gczeal         Enable zealous JavaScript GCing],
7395     JS_GC_ZEAL=1,
7396     JS_GC_ZEAL= )
7397 if test -n "$JS_GC_ZEAL"; then
7398     AC_DEFINE(JS_GC_ZEAL)
7401 dnl ======================================================
7402 dnl = Enable compiling with ccache
7403 dnl ======================================================
7404 MOZ_ARG_WITH_STRING(ccache,
7405 [  --with-ccache=path/to/ccache
7406                           Enable compiling with ccache],
7407     CCACHE_PATH=$withval,)
7409 if test -n "$CCACHE_PATH"; then
7410   CC="$CCACHE_PATH $CC"
7411   CXX="$CCACHE_PATH $CXX"
7414 dnl ========================================================
7415 dnl = Enable static checking using gcc-dehydra
7416 dnl ========================================================
7418 MOZ_ARG_WITH_STRING(static-checking,
7419 [  --with-static-checking=path/to/gcc_dehydra.so
7420                           Enable static checking of code using GCC-dehydra],
7421     DEHYDRA_PATH=$withval,
7422     DEHYDRA_PATH= )
7424 if test -n "$DEHYDRA_PATH"; then
7425     if test ! -f "$DEHYDRA_PATH"; then
7426         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7427     fi
7428     AC_DEFINE(NS_STATIC_CHECKING)
7430 AC_SUBST(DEHYDRA_PATH)
7432 dnl ========================================================
7433 dnl = Enable stripping of libs & executables
7434 dnl ========================================================
7435 MOZ_ARG_ENABLE_BOOL(strip,
7436 [  --enable-strip          Enable stripping of libs & executables ],
7437     ENABLE_STRIP=1,
7438     ENABLE_STRIP= )
7440 dnl ========================================================
7441 dnl = Enable stripping of libs & executables when packaging
7442 dnl ========================================================
7443 MOZ_ARG_ENABLE_BOOL(install-strip,
7444 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7445     PKG_SKIP_STRIP= ,
7446     PKG_SKIP_STRIP=1)
7448 dnl ========================================================
7449 dnl = --enable-elf-dynstr-gc
7450 dnl ========================================================
7451 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7452 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7453     USE_ELF_DYNSTR_GC=1,
7454     USE_ELF_DYNSTR_GC= )
7456 dnl ========================================================
7457 dnl = 
7458 dnl = Profiling and Instrumenting
7459 dnl = 
7460 dnl ========================================================
7461 MOZ_ARG_HEADER(Profiling and Instrumenting)
7463 dnl ========================================================
7464 dnl = Enable timeline service, which provides lightweight
7465 dnl = instrumentation of mozilla for performance measurement.
7466 dnl = Timeline is off by default.
7467 dnl ========================================================
7468 MOZ_ARG_ENABLE_BOOL(timeline,
7469 [  --enable-timeline       Enable timeline services ],
7470     MOZ_TIMELINE=1,
7471     MOZ_TIMELINE= )
7472 if test -n "$MOZ_TIMELINE"; then
7473     AC_DEFINE(MOZ_TIMELINE)
7476 dnl ========================================================
7477 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7478 dnl = timing for identifying code bottlenecks 
7479 dnl = NS_FUNCTION_TIMER is off by default.
7480 dnl ========================================================
7481 MOZ_ARG_ENABLE_BOOL(functiontimer,
7482 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7483     NS_FUNCTION_TIMER=1,
7484     NS_FUNCTION_TIMER= )
7485 if test -n "$NS_FUNCTION_TIMER"; then
7486     AC_DEFINE(NS_FUNCTION_TIMER)
7489 dnl ========================================================
7490 dnl Turn on reflow counting
7491 dnl ========================================================
7492 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7493 [  --enable-reflow-perf    Enable reflow performance tracing],
7494     MOZ_REFLOW_PERF=1,
7495     MOZ_REFLOW_PERF= )
7496 if test -n "$MOZ_REFLOW_PERF"; then
7497     AC_DEFINE(MOZ_REFLOW_PERF)
7500 dnl ========================================================
7501 dnl Enable code size metrics.
7502 dnl ========================================================
7503 MOZ_ARG_ENABLE_BOOL(codesighs,
7504 [  --enable-codesighs      Enable code size analysis tools],
7505     _ENABLE_CODESIGHS=1,
7506     _ENABLE_CODESIGHS= )
7507 if test -n "$_ENABLE_CODESIGHS"; then
7508     if test -d $srcdir/tools/codesighs; then 
7509         MOZ_MAPINFO=1
7510     else
7511         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7512     fi
7515 dnl ========================================================
7516 dnl = Support for Quantify (Windows)
7517 dnl ========================================================
7518 MOZ_ARG_ENABLE_BOOL(quantify,
7519 [  --enable-quantify       Enable Quantify support (Windows only) ],
7520     MOZ_QUANTIFY=1,
7521     MOZ_QUANTIFY= )
7523 dnl ========================================================
7524 dnl = Support for demangling undefined symbols
7525 dnl ========================================================
7526 if test -z "$SKIP_LIBRARY_CHECKS"; then
7527     AC_LANG_SAVE
7528     AC_LANG_CPLUSPLUS
7529     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7530     AC_LANG_RESTORE
7533 # Demangle only for debug or trace-malloc builds
7534 MOZ_DEMANGLE_SYMBOLS=
7535 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7536     MOZ_DEMANGLE_SYMBOLS=1
7537     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7539 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7541 dnl ========================================================
7542 dnl = Support for gcc stack unwinding (from gcc 3.3)
7543 dnl ========================================================
7544 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7545     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7548 dnl ========================================================
7549 dnl =
7550 dnl = Misc. Options
7551 dnl = 
7552 dnl ========================================================
7553 MOZ_ARG_HEADER(Misc. Options)
7555 dnl ========================================================
7556 dnl update xterm title
7557 dnl ========================================================
7558 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7559 [  --enable-xterm-updates  Update XTERM titles with current command.],
7560     MOZ_UPDATE_XTERM=1,
7561     MOZ_UPDATE_XTERM= )
7563 dnl =========================================================
7564 dnl = Chrome format
7565 dnl =========================================================
7566 MOZ_ARG_ENABLE_STRING([chrome-format],
7567 [  --enable-chrome-format=jar|flat|both|symlink|omni
7568                           Select FORMAT of chrome files (default=jar)],
7569     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7571 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7572     MOZ_CHROME_FILE_FORMAT=jar
7575 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7576     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7577     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7578     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7579     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7580     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7583 dnl =========================================================
7584 dnl Omnijar packaging (bug 552121)
7585 dnl =========================================================
7586 dnl Omnijar packaging is compatible with flat packaging.
7587 dnl In unpackaged builds, omnijar looks for files as if
7588 dnl things were flat packaged. After packaging, all files
7589 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7590 dnl is set to flat since putting files into jars is only
7591 dnl done during packaging with omnijar.
7592 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7593     MOZ_OMNIJAR=1
7594     AC_DEFINE(MOZ_OMNIJAR)
7595     MOZ_CHROME_FILE_FORMAT=flat
7596 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7597     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7600 AC_SUBST(MOZ_OMNIJAR)
7602 dnl ========================================================
7603 dnl = Define default location for MOZILLA_FIVE_HOME
7604 dnl ========================================================
7605 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7606 [  --with-default-mozilla-five-home
7607                           Set the default value for MOZILLA_FIVE_HOME],
7608 [ val=`echo $withval`
7609   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7611 dnl ========================================================
7612 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7613 dnl ========================================================
7614 MOZ_ARG_WITH_STRING(user-appdir,
7615 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7616 [ val=`echo $withval`
7617 if echo "$val" | grep "\/" >/dev/null; then
7618     AC_MSG_ERROR("Homedir must be single relative path.")
7619 else 
7620     MOZ_USER_DIR="$val"
7621 fi])
7623 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7625 dnl ========================================================
7626 dnl = Doxygen configuration
7627 dnl ========================================================
7628 dnl Use commas to specify multiple dirs to this arg
7629 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7630 MOZ_ARG_WITH_STRING(doc-input-dirs,
7631 [  --with-doc-input-dirs=DIRS
7632                           Header/idl dirs to create docs from],
7633 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7634 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7636 dnl Use commas to specify multiple dirs to this arg
7637 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7638 MOZ_ARG_WITH_STRING(doc-include-dirs,
7639 [  --with-doc-include-dirs=DIRS  
7640                           Include dirs to preprocess doc headers],
7641 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7642 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7644 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7645 MOZ_ARG_WITH_STRING(doc-output-dir,
7646 [  --with-doc-output-dir=DIR
7647                           Dir to generate docs into],
7648 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7649 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7651 if test -z "$SKIP_COMPILER_CHECKS"; then
7652 dnl ========================================================
7653 dnl =
7654 dnl = Compiler Options
7655 dnl = 
7656 dnl ========================================================
7657 MOZ_ARG_HEADER(Compiler Options)
7659 dnl ========================================================
7660 dnl Check for gcc -pipe support
7661 dnl ========================================================
7662 AC_MSG_CHECKING([for gcc -pipe support])
7663 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7664     echo '#include <stdio.h>' > dummy-hello.c
7665     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7666     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7667     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7668     if test $? = 0; then
7669         _res_as_stdin="yes"
7670     else
7671         _res_as_stdin="no"
7672     fi
7673     if test "$_res_as_stdin" = "yes"; then
7674         _SAVE_CFLAGS=$CFLAGS
7675         CFLAGS="$CFLAGS -pipe"
7676         AC_TRY_COMPILE( [ #include <stdio.h> ],
7677             [printf("Hello World\n");],
7678             [_res_gcc_pipe="yes"],
7679             [_res_gcc_pipe="no"] )
7680         CFLAGS=$_SAVE_CFLAGS
7681     fi
7682     if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7683         _res="yes";
7684         CFLAGS="$CFLAGS -pipe"
7685         CXXFLAGS="$CXXFLAGS -pipe"
7686     else
7687         _res="no"
7688     fi
7689     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7690     AC_MSG_RESULT([$_res])
7691 else
7692     AC_MSG_RESULT([no])
7695 dnl ========================================================
7696 dnl Profile guided optimization
7697 dnl ========================================================
7698 dnl Test for profiling options
7699 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7701 dnl Provide a switch to disable PGO even when called via profiledbuild.
7702 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7703 [  --disable-profile-guided-optimization
7704                           Don't build with PGO even if called via make profiledbuild],
7705 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7706 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7708 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7710 _SAVE_CFLAGS="$CFLAGS"
7711 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7713 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7714 AC_TRY_COMPILE([], [return 0;],
7715                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7716                  result="yes" ], result="no")
7717 AC_MSG_RESULT([$result])
7719 if test $result = "yes"; then
7720   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7721   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7722   PROFILE_USE_LDFLAGS="-fprofile-use"
7725 CFLAGS="$_SAVE_CFLAGS"
7727 if test -n "$INTEL_CC"; then
7728   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7729   PROFILE_GEN_LDFLAGS=
7730   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7731   PROFILE_USE_LDFLAGS=
7734 dnl Sun Studio on Solaris
7735 if test "$SOLARIS_SUNPRO_CC"; then
7736   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7737   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7738   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7739   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7742 AC_SUBST(PROFILE_GEN_CFLAGS)
7743 AC_SUBST(PROFILE_GEN_LDFLAGS)
7744 AC_SUBST(PROFILE_USE_CFLAGS)
7745 AC_SUBST(PROFILE_USE_LDFLAGS)
7747 AC_LANG_CPLUSPLUS
7749 dnl ========================================================
7750 dnl Test for -pedantic bustage
7751 dnl ========================================================
7752 MOZ_ARG_DISABLE_BOOL(pedantic,
7753 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7754 _PEDANTIC= )
7755 if test "$_PEDANTIC"; then
7756     _SAVE_CXXFLAGS=$CXXFLAGS
7757     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7758     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7759     AC_TRY_COMPILE([$configure_static_assert_macros],
7760                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7761                    result="no", result="yes" )
7762     AC_MSG_RESULT([$result])
7763     CXXFLAGS="$_SAVE_CXXFLAGS"
7765     case "$result" in
7766     no)
7767         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7768         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7769         ;;
7770     yes)
7771         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7772         ;;
7773     esac
7776 dnl ========================================================
7777 dnl Test for correct temporary object destruction order
7778 dnl ========================================================
7779 dnl We want to make sure the compiler follows the C++ spec here as 
7780 dnl xpcom and the string classes depend on it (bug 235381).
7781 AC_MSG_CHECKING([for correct temporary object destruction order])
7782 AC_TRY_RUN([ class A {
7783              public:  A(int& x) : mValue(x) {}
7784                       ~A() { mValue--; }
7785                       operator char**() { return 0; }
7786              private:  int& mValue;
7787              };
7788              void func(char **arg) {}
7789              int m=2;
7790              void test() {
7791                   func(A(m));
7792                   if (m==1) m = 0;
7793              }
7794              int main() {
7795                  test();
7796                  return(m);
7797              }
7798              ],
7799      result="yes", result="no", result="maybe")
7800 AC_MSG_RESULT([$result])
7802 if test "$result" = "no"; then
7803     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7806 dnl ========================================================
7807 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7808 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7809 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7810 dnl ========================================================
7811 _SAVE_CXXFLAGS=$CXXFLAGS
7812 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7813 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7814     ac_nscap_nonconst_opeq_bug,
7815     [AC_TRY_COMPILE([
7816                       template <class T>
7817                       class Pointer
7818                         {
7819                         public:
7820                           T* myPtr;
7821                         };
7822                       
7823                       template <class T, class U>
7824                       int operator==(const Pointer<T>& rhs, U* lhs)
7825                         {
7826                           return rhs.myPtr == lhs;
7827                         }
7828                       
7829                       template <class T, class U>
7830                       int operator==(const Pointer<T>& rhs, const U* lhs)
7831                         {
7832                           return rhs.myPtr == lhs;
7833                         }
7834                     ],
7835                     [
7836                       Pointer<int> foo;
7837                       const int* bar;
7838                       return foo == bar;
7839                     ],
7840                     ac_nscap_nonconst_opeq_bug="no",
7841                     ac_nscap_nonconst_opeq_bug="yes")])
7842 CXXFLAGS="$_SAVE_CXXFLAGS"
7844 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7845     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7847 fi # SKIP_COMPILER_CHECKS
7849 dnl ========================================================
7850 dnl C++ rtti
7851 dnl Should be smarter and check that the compiler does indeed have rtti
7852 dnl ========================================================
7854 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7855 [  --enable-cpp-rtti       Enable C++ RTTI ],
7856 [ _MOZ_USE_RTTI=1 ],
7857 [ _MOZ_USE_RTTI= ])
7859 if test "$_MOZ_USE_RTTI"; then
7860    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7861 else
7862    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7865 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7867 dnl ========================================================
7868 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7869 dnl Should be smarter and check that the compiler does indeed have exceptions
7870 dnl ========================================================
7871 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7872 [  --enable-cpp-exceptions Enable C++ exceptions ],
7873 [ _MOZ_CPP_EXCEPTIONS=1 ],
7874 [ _MOZ_CPP_EXCEPTIONS= ])
7876 if test "$_MOZ_CPP_EXCEPTIONS"; then
7877     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7878     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7879 else
7880     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7883 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7885 # Irix & OSF native compilers do not like exception declarations 
7886 # when exceptions are disabled
7887 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7888     AC_DEFINE(CPP_THROW_NEW, [])
7889 else
7890     AC_DEFINE(CPP_THROW_NEW, [throw()])
7892 AC_LANG_C
7894 dnl ========================================================
7895 dnl =
7896 dnl = Build depencency options
7897 dnl =
7898 dnl ========================================================
7899 MOZ_ARG_HEADER(Build dependencies)
7901 dnl ========================================================
7902 dnl = Do not auto generate dependency info
7903 dnl ========================================================
7904 MOZ_AUTO_DEPS=1
7905 MOZ_ARG_DISABLE_BOOL(auto-deps,
7906 [  --disable-auto-deps     Do not automatically generate dependency info],
7907     MOZ_AUTO_DEPS=,
7908     MOZ_AUTO_DEPS=1)
7910 if test -n "$MOZ_AUTO_DEPS"; then
7911 dnl ========================================================
7912 dnl = Use mkdepend instead of $CC -MD for dependency generation
7913 dnl ========================================================
7914 _cpp_md_flag=
7915 MOZ_ARG_DISABLE_BOOL(md,
7916 [  --disable-md            Do not use compiler-based dependencies ],
7917   [_cpp_md_flag=],
7918   [_cpp_md_flag=1],
7919   [dnl Default is to turn on -MD if using GNU-compatible compilers
7920    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7921      _cpp_md_flag=1
7922    fi
7923   dnl Default is to use -xM if using Sun Studio on Solaris
7924    if test "$SOLARIS_SUNPRO_CC"; then
7925      _cpp_md_flag=1
7926    fi])
7927 if test "$_cpp_md_flag"; then
7928   COMPILER_DEPEND=1
7929   if test "$OS_ARCH" = "OpenVMS"; then
7930     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7931   else
7932     _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
7933   fi
7934   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7935   if test "$SOLARIS_SUNPRO_CC"; then
7936     _DEPEND_CFLAGS=
7937   fi
7938 else
7939   COMPILER_DEPEND=
7940   dnl Don't override this for MSVC
7941   if test -z "$_WIN32_MSVC"; then
7942     _USE_CPP_INCLUDE_FLAG=
7943     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7944     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7945   fi
7947 fi # MOZ_AUTO_DEPS
7948 MDDEPDIR='.deps'
7949 AC_SUBST(MOZ_AUTO_DEPS)
7950 AC_SUBST(COMPILER_DEPEND)
7951 AC_SUBST(MDDEPDIR)
7954 dnl ========================================================
7955 dnl =
7956 dnl = Static Build Options
7957 dnl =
7958 dnl ========================================================
7959 MOZ_ARG_HEADER(Static build options)
7961 MOZ_ARG_ENABLE_BOOL(static,
7962 [  --enable-static         Enable building of internal static libs],
7963     BUILD_STATIC_LIBS=1,
7964     BUILD_STATIC_LIBS=)
7966 MOZ_ARG_ENABLE_BOOL(libxul,
7967 [  --enable-libxul         Enable building of libxul],
7968     MOZ_ENABLE_LIBXUL=1,
7969     MOZ_ENABLE_LIBXUL=)
7971 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7972         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7975 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7976         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7979 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7980     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7983 AC_SUBST(LIBXUL_LIBS)
7985 if test -n "$MOZ_ENABLE_LIBXUL"; then
7986     XPCOM_LIBS="$LIBXUL_LIBS"
7987     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7988 else
7989     if test -n "$BUILD_STATIC_LIBS"; then
7990         AC_DEFINE(MOZ_STATIC_BUILD)
7991     fi
7992     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7995 dnl ========================================================
7996 dnl =
7997 dnl = Standalone module options
7998 dnl = 
7999 dnl ========================================================
8000 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8002 dnl Check for GLib and libIDL.
8003 dnl ========================================================
8004 SKIP_IDL_CHECK="no"
8006 if test -z "$COMPILE_ENVIRONMENT"; then
8007     SKIP_IDL_CHECK="yes"
8010 dnl = Allow users to disable libIDL checking for standalone modules
8011 MOZ_ARG_WITHOUT_BOOL(libIDL,
8012 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8013         SKIP_IDL_CHECK="yes")
8015 if test -z "$CROSS_COMPILE"; then
8016     if test -z "$HOST_LIBIDL_CONFIG"; then
8017         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8018     fi
8019     if test -z "$HOST_LIBIDL_PREFIX"; then
8020         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8021     fi
8024 if test "$SKIP_IDL_CHECK" = "no"
8025 then
8026     _LIBIDL_FOUND=
8027     case "$host" in
8028     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8029         if test -n "$GLIB_PREFIX"; then
8030             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8031             if test "$?" = "0"; then
8032                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8033                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8034                 fi
8035                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8036             else
8037                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8038             fi
8039         else
8040             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8041         fi
8042         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8043             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8044         fi
8045         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8046         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8047             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8048         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8049             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8050         else
8051             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8052         fi
8054         if test -n "$HOST_LIBIDL_PREFIX"; then
8055             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8056             if test "$?" = "0"; then
8057                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8058                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8059                 fi
8060                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8061             else
8062                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8063             fi
8064         else
8065             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8066         fi        
8067         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8068             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8069         fi
8070         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8071         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8072             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8073             STATIC_LIBIDL=1
8074         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8075             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8076         else
8077             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8078         fi
8079         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8080         _LIBIDL_FOUND=1
8081         ;;
8082     esac
8084     if test -z "$_LIBIDL_FOUND"; then
8085         if test "$MACOS_SDK_DIR"; then 
8086             dnl xpidl, and therefore libIDL, is only needed on the build host.
8087             dnl Don't build it against the SDK, as that causes problems.
8088             _MACSAVE_CFLAGS="$CFLAGS"
8089             _MACSAVE_LIBS="$LIBS"
8090             _MACSAVE_LDFLAGS="$LDFLAGS"
8091             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8092           changequote(,)
8093           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"`
8094           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8095           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8096           changequote([,])
8097           unset NEXT_ROOT
8098         fi
8100         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8101     fi
8103     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8104     dnl to either libIDL1 or libIDL2.
8105     if test -z "$_LIBIDL_FOUND"; then
8106         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8107         if test -z "$_LIBIDL_FOUND"; then
8108             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8109         fi
8110     fi
8111     dnl
8112     dnl If we don't have a libIDL config program & not cross-compiling, 
8113     dnl     look for orbit-config instead.
8114     dnl
8115     if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8116         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8117         if test -n "$ORBIT_CONFIG"; then
8118             AC_MSG_CHECKING([for ORBit libIDL usability])
8119                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8120             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8121             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8122             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8123             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8124             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8125             HOST_LIBIDL_CONFIG=
8126             _SAVE_CFLAGS="$CFLAGS"
8127             _SAVE_LIBS="$LIBS"
8128             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8129             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8130             AC_TRY_RUN([
8131 #include <stdlib.h>
8132 #include <libIDL/IDL.h>
8133 int main() {
8134   char *s;
8135   s=strdup(IDL_get_libver_string());
8136   if(s==NULL) {
8137     exit(1);
8138   }
8139   exit(0);
8141             ], [_LIBIDL_FOUND=1
8142                 result="yes"],
8143                [HOST_LIBIDL_CFLAGS=
8144                 HOST_LIBIDL_LIBS=
8145                 result="no"],
8146                [_LIBIDL_FOUND=1
8147                 result="maybe"] )
8148             AC_MSG_RESULT($result)
8149             CFLAGS="$_SAVE_CFLAGS"
8150             LIBS="$_SAVE_LIBS"
8151         fi
8152     fi
8153     if test -z "$_LIBIDL_FOUND"; then
8154         AC_MSG_ERROR([libIDL not found.
8155         libIDL $LIBIDL_VERSION or higher is required.])
8156     fi
8157     if test "$MACOS_SDK_DIR"; then
8158       CFLAGS="$_MACSAVE_CFLAGS"
8159       LIBS="$_MACSAVE_LIBS"
8160       LDFLAGS="$_MACSAVE_LDFLAGS"
8161       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8162         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8163       fi
8164     fi
8167 if test -n "$CROSS_COMPILE"; then
8168     case "$target" in
8169     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8170         if test -n "$GLIB_PREFIX"; then
8171             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8172             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8173                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8174             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8175                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8176             else
8177                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8178             fi
8179         fi
8181         if test -n "$LIBIDL_PREFIX"; then
8182             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8183             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8184                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8185                 STATIC_LIBIDL=1
8186             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8187                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8188             else
8189                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8190             fi
8191         fi
8192         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8193         ;;
8194     *)
8195         if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8196             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8197             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8198         fi
8199         ;;
8200     esac
8201 else
8202     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8203     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8206 if test -z "$SKIP_PATH_CHECKS"; then
8207 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8208     if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8209         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8210     else
8211         AM_PATH_GLIB(${GLIB_VERSION})
8212     fi
8216 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8217     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8220 AC_SUBST(LIBIDL_CFLAGS)
8221 AC_SUBST(LIBIDL_LIBS)
8222 AC_SUBST(STATIC_LIBIDL)
8223 AC_SUBST(GLIB_CFLAGS)
8224 AC_SUBST(GLIB_LIBS)
8225 AC_SUBST(GLIB_GMODULE_LIBS)
8226 AC_SUBST(HOST_LIBIDL_CONFIG)
8227 AC_SUBST(HOST_LIBIDL_CFLAGS)
8228 AC_SUBST(HOST_LIBIDL_LIBS)
8230 dnl ========================================================
8231 dnl Check for cairo
8232 dnl ========================================================
8233 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8235 MOZ_TREE_CAIRO=1
8236 MOZ_ARG_ENABLE_BOOL(system-cairo,
8237 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8238 MOZ_TREE_CAIRO=,
8239 MOZ_TREE_CAIRO=1 )
8241 # Check for headers defining standard int types.
8242 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8244 if test "$MOZ_TREE_CAIRO"; then
8245     AC_DEFINE(MOZ_TREE_CAIRO)
8247     # For now we assume that we will have a uint64_t available through
8248     # one of the above headers or mozstdint.h.
8249     AC_DEFINE(HAVE_UINT64_T)
8251     # Define macros for cairo-features.h
8252     if test "$MOZ_X11"; then
8253         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8254         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8255         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8256         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8257         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8258         MOZ_ENABLE_CAIRO_FT=1
8259         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8260     fi
8261     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8262         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8263     fi
8264     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8265         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8266         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8267         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8268     fi
8269     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8270         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8271         if test -z "$WINCE"; then
8272             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8273             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8274                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8275                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8276                 MOZ_ENABLE_D2D_SURFACE=1
8277                 MOZ_ENABLE_DWRITE_FONT=1
8278             else
8279                 WIN32_DWRITE_FONT_FEATURE=
8280                 WIN32_D2D_SURFACE_FEATURE=
8281             fi
8282         else
8283             WIN32_FONT_FEATURE=
8284             WIN32_DWRITE_FONT_FEATURE=
8285             WIN32_D2D_SURFACE_FEATURE=
8286         fi
8288         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8290         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8291         if test -z "$HAS_DDRAW"; then
8292             AC_MSG_WARN([DirectDraw ddraw.h header not found or it's missing DDLOCK_WAITNOTBUSY, disabling DirectDraw surface.  If you have an older SDK (such as the CE5 SDK), try copying in ddraw.lib and ddraw.h from the WM6 SDK.])
8293             DDRAW_SURFACE_FEATURE=
8294         else
8295             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8296         fi
8298         if test -z "$OGLES_SDK_DIR"; then
8299             OGLES_SURFACE_FEATURE=
8300         else
8301             AC_TRY_COMPILE([
8302               #include <EGL/egl.h>
8303               #include <EGL/eglext.h>
8304               #include <GLES2/gl2.h>
8305               #include <GLES2/gl2ext.h>
8306             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8307             if test -z "$HAS_OGLES"; then
8308               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8309               OGLES_SURFACE_FEATURE=
8310             else
8311               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8312             fi
8313         fi
8315         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8316     fi
8317     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8318         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8319         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8320         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8321         MOZ_ENABLE_CAIRO_FT=1
8322         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8323         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8324     fi
8325     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8326         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8327         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8328         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8329         MOZ_ENABLE_CAIRO_FT=1
8330     fi
8331     if test "$USE_FC_FREETYPE"; then
8332         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8333     fi
8334     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8335     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8336     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8337     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8338     AC_SUBST(CAIRO_FT_CFLAGS)
8339     AC_SUBST(HAS_OGLES)
8341     if test "$MOZ_DEBUG"; then
8342       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8343     else
8344       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8345     fi
8347     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8349     AC_SUBST(PS_SURFACE_FEATURE)
8350     AC_SUBST(PDF_SURFACE_FEATURE)
8351     AC_SUBST(SVG_SURFACE_FEATURE)
8352     AC_SUBST(XLIB_SURFACE_FEATURE)
8353     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8354     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8355     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8356     AC_SUBST(XCB_SURFACE_FEATURE)
8357     AC_SUBST(WIN32_SURFACE_FEATURE)
8358     AC_SUBST(DDRAW_SURFACE_FEATURE)
8359     AC_SUBST(OGLES_SURFACE_FEATURE)    
8360     AC_SUBST(OS2_SURFACE_FEATURE)
8361     AC_SUBST(BEOS_SURFACE_FEATURE)
8362     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8363     AC_SUBST(FT_FONT_FEATURE)
8364     AC_SUBST(FC_FONT_FEATURE)
8365     AC_SUBST(WIN32_FONT_FEATURE)
8366     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8367     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8368     AC_SUBST(QUARTZ_FONT_FEATURE)
8369     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8370     AC_SUBST(QT_SURFACE_FEATURE)
8372     if test "$_WIN32_MSVC"; then
8373         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
8374     else
8375         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
8377         if test "$MOZ_X11"; then
8378             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8379         fi
8380     fi
8382     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8383     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8385 else
8386    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8387    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8388    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8389    if test "$MOZ_X11"; then
8390         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8391         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8392         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8393    fi
8396 AC_SUBST(MOZ_TREE_CAIRO)
8397 AC_SUBST(MOZ_CAIRO_CFLAGS)
8398 AC_SUBST(MOZ_CAIRO_LIBS)
8400 dnl ========================================================
8401 dnl qcms
8402 dnl ========================================================
8404 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8405 AC_SUBST(QCMS_LIBS)
8407 dnl ========================================================
8408 dnl HarfBuzz
8409 dnl ========================================================
8410 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8411 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8413 dnl ========================================================
8414 dnl disable xul
8415 dnl ========================================================
8416 MOZ_ARG_DISABLE_BOOL(xul,
8417 [  --disable-xul           Disable XUL],
8418     MOZ_XUL= )
8419 if test "$MOZ_XUL"; then
8420   AC_DEFINE(MOZ_XUL)
8421 else
8422   dnl remove extensions that require XUL
8423   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8426 AC_SUBST(MOZ_XUL)
8428 dnl ========================================================
8429 dnl disable profile locking
8430 dnl   do no use this in applications that can have more than
8431 dnl   one process accessing the profile directory.
8432 dnl ========================================================
8433 MOZ_ARG_DISABLE_BOOL(profilelocking,
8434 [  --disable-profilelocking
8435                           Disable profile locking],
8436     MOZ_PROFILELOCKING=,
8437     MOZ_PROFILELOCKING=1 )
8438 if test "$MOZ_PROFILELOCKING"; then
8439   AC_DEFINE(MOZ_PROFILELOCKING)
8442 dnl ========================================================
8443 dnl disable rdf services
8444 dnl ========================================================
8445 MOZ_ARG_DISABLE_BOOL(rdf,
8446 [  --disable-rdf           Disable RDF],
8447     MOZ_RDF= )
8448 if test "$MOZ_RDF"; then
8449   AC_DEFINE(MOZ_RDF)
8452 AC_SUBST(MOZ_RDF)
8454 dnl ========================================================
8455 dnl necko configuration options
8456 dnl ========================================================
8459 dnl option to disable various necko protocols
8461 MOZ_ARG_ENABLE_STRING(necko-protocols,
8462 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8463                           Enable/disable specific protocol handlers],
8464 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8465     if test "$option" = "yes" -o "$option" = "all"; then
8466         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8467     elif test "$option" = "no" -o "$option" = "none"; then
8468         NECKO_PROTOCOLS=""
8469     elif test "$option" = "default"; then
8470         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8471     elif test `echo "$option" | grep -c \^-` != 0; then
8472         option=`echo $option | sed 's/^-//'`
8473         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8474     else
8475         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8476     fi
8477 done],
8478     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8479 dnl Remove dupes
8480 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8481 AC_SUBST(NECKO_PROTOCOLS)
8482 for p in $NECKO_PROTOCOLS; do
8483     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8484 done
8487 dnl option to disable necko's disk cache
8489 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8490 [  --disable-necko-disk-cache
8491                           Disable necko disk cache],
8492     NECKO_DISK_CACHE=,
8493     NECKO_DISK_CACHE=1)
8494 AC_SUBST(NECKO_DISK_CACHE)
8495 if test "$NECKO_DISK_CACHE"; then
8496     AC_DEFINE(NECKO_DISK_CACHE)
8500 dnl option to disable necko's wifi scanner
8502 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8503 [  --disable-necko-wifi    Disable necko wifi scanner],
8504     NECKO_WIFI=,
8505     NECKO_WIFI=1)
8507 if test "$OS_ARCH" = "OS2"; then
8508   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8509   NECKO_WIFI=
8511 if test "$NECKO_WIFI" -a \
8512         "$OS_ARCH" != "Linux" -a \
8513         "$OS_ARCH" != "Darwin" -a \
8514         "$OS_ARCH" != "SunOS" -a \
8515         "$OS_ARCH" != "WINNT" -a \
8516         "$OS_ARCH" != "WINCE"; then
8517   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8520 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8521 then
8522   AC_CHECK_HEADER([iwlib.h])
8523   if test "$ac_cv_header_iwlib_h" != "yes"; then
8524     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])
8525   fi
8528 if test "$NECKO_WIFI"; then
8529   AC_DEFINE(NECKO_WIFI)
8531 AC_SUBST(NECKO_WIFI)
8534 dnl option to disable cookies
8536 MOZ_ARG_DISABLE_BOOL(cookies,
8537 [  --disable-cookies       Disable cookie support],
8538     NECKO_COOKIES=,
8539     NECKO_COOKIES=1)
8540 AC_SUBST(NECKO_COOKIES)
8541 if test "$NECKO_COOKIES"; then
8542     AC_DEFINE(NECKO_COOKIES)
8546 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8548 MOZ_ARG_DISABLE_BOOL(ctypes,
8549 [  --disable-ctypes        Disable js-ctypes],
8550     BUILD_CTYPES=,
8551     BUILD_CTYPES=1)
8552 AC_SUBST(BUILD_CTYPES)
8553 if test "$BUILD_CTYPES"; then
8554   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8555     # Disable ctypes for arm/wince.
8556     BUILD_CTYPES=
8557   else
8558     AC_DEFINE(BUILD_CTYPES)
8559   fi
8562 dnl NECKO_ configuration options are not global
8563 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8565 dnl Only build Mork if it's required
8566 AC_SUBST(MOZ_MORK)
8567 if test "$MOZ_MORK"; then
8568   AC_DEFINE(MOZ_MORK)
8571 dnl Build the lightweight Mork reader if required
8572 AC_SUBST(MOZ_MORKREADER)
8573 if test "$MOZ_MORKREADER"; then
8574   AC_DEFINE(MOZ_MORKREADER)
8577 dnl Build Places if required
8578 if test "$MOZ_PLACES"; then
8579   AC_DEFINE(MOZ_PLACES)
8582 dnl Build Sync Services if required
8583 AC_SUBST(MOZ_SERVICES_SYNC)
8584 if test -n "$MOZ_SERVICES_SYNC"; then
8585   AC_DEFINE(MOZ_SERVICES_SYNC)
8588 dnl ========================================================
8589 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8590     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8593 dnl ========================================================
8594 dnl =
8595 dnl = Maintainer debug option (no --enable equivalent)
8596 dnl =
8597 dnl ========================================================
8599 AC_SUBST(AR)
8600 AC_SUBST(AR_FLAGS)
8601 AC_SUBST(AR_LIST)
8602 AC_SUBST(AR_EXTRACT)
8603 AC_SUBST(AR_DELETE)
8604 AC_SUBST(AS)
8605 AC_SUBST(ASFLAGS)
8606 AC_SUBST(AS_DASH_C_FLAG)
8607 AC_SUBST(LD)
8608 AC_SUBST(RC)
8609 AC_SUBST(RCFLAGS)
8610 AC_SUBST(WINDRES)
8611 AC_SUBST(IMPLIB)
8612 AC_SUBST(FILTER)
8613 AC_SUBST(BIN_FLAGS)
8614 AC_SUBST(NS_USE_NATIVE)
8615 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8616 AC_SUBST(MOZ_UPDATE_XTERM)
8617 AC_SUBST(MINIMO)
8618 AC_SUBST(MOZ_PLATFORM_MAEMO)
8619 AC_SUBST(MOZ_AUTH_EXTENSION)
8620 AC_SUBST(MOZ_MATHML)
8621 AC_SUBST(MOZ_PERMISSIONS)
8622 AC_SUBST(MOZ_XTF)
8623 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8624 AC_SUBST(MOZ_PREF_EXTENSIONS)
8625 AC_SUBST(MOZ_SVG)
8626 AC_SUBST(MOZ_SMIL)
8627 AC_SUBST(MOZ_XSLT_STANDALONE)
8628 AC_SUBST(MOZ_JS_LIBS)
8629 AC_SUBST(MOZ_PSM)
8630 AC_SUBST(MOZ_DEBUG)
8631 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8632 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8633 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8634 AC_SUBST(MOZ_DEBUG_FLAGS)
8635 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8636 AC_SUBST(WARNINGS_AS_ERRORS)
8637 AC_SUBST(MOZ_EXTENSIONS)
8638 AC_SUBST(MOZ_IMG_DECODERS)
8639 AC_SUBST(MOZ_IMG_ENCODERS)
8640 AC_SUBST(MOZ_JSDEBUGGER)
8641 AC_SUBST(MOZ_PLUGINS)
8642 AC_SUBST(MOZ_LOG_REFCNT)
8643 AC_SUBST(MOZ_LEAKY)
8644 AC_SUBST(MOZ_JPROF)
8645 AC_SUBST(MOZ_SHARK)
8646 AC_SUBST(MOZ_CALLGRIND)
8647 AC_SUBST(MOZ_VTUNE)
8648 AC_SUBST(MOZ_JSLOADER)
8649 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8650 AC_SUBST(MOZ_QUANTIFY)
8651 AC_SUBST(LIBICONV)
8652 AC_SUBST(MOZ_PLACES)
8653 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8654 AC_SUBST(MOZ_STORAGE)
8655 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8656 AC_SUBST(MOZ_FEEDS)
8657 AC_SUBST(NS_PRINTING)
8658 AC_SUBST(MOZ_WEBGL)
8659 AC_SUBST(MOZ_HELP_VIEWER)
8661 AC_SUBST(MOZ_JAVAXPCOM)
8662 AC_SUBST(JAVA_INCLUDE_PATH)
8663 AC_SUBST(JAVA)
8664 AC_SUBST(JAVAC)
8665 AC_SUBST(JAR)
8667 AC_SUBST(MOZ_PROFILELOCKING)
8669 AC_SUBST(HAVE_XIE)
8670 AC_SUBST(MOZ_XIE_LIBS)
8672 AC_SUBST(BUILD_STATIC_LIBS)
8673 AC_SUBST(MOZ_ENABLE_LIBXUL)
8674 AC_SUBST(ENABLE_TESTS)
8675 AC_SUBST(IBMBIDI)
8676 AC_SUBST(MOZ_UNIVERSALCHARDET)
8677 AC_SUBST(ACCESSIBILITY)
8678 AC_SUBST(MOZ_VIEW_SOURCE)
8679 AC_SUBST(MOZ_SPELLCHECK)
8680 AC_SUBST(MOZ_USER_DIR)
8681 AC_SUBST(MOZ_CRASHREPORTER)
8682 AC_SUBST(MOZ_UPDATER)
8684 AC_SUBST(ENABLE_STRIP)
8685 AC_SUBST(PKG_SKIP_STRIP)
8686 AC_SUBST(USE_ELF_DYNSTR_GC)
8687 AC_SUBST(INCREMENTAL_LINKER)
8688 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8689 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8691 AC_SUBST(MOZ_FIX_LINK_PATHS)
8692 AC_SUBST(XPCOM_LIBS)
8693 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8694 AC_SUBST(XPCOM_GLUE_LDOPTS)
8695 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8697 AC_SUBST(USE_DEPENDENT_LIBS)
8699 AC_SUBST(MOZ_BUILD_ROOT)
8700 AC_SUBST(MOZ_OS2_TOOLS)
8701 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8703 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8704 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8705 AC_SUBST(MOZ_TIMELINE)
8706 AC_SUBST(OGLES_SDK_DIR)
8708 AC_SUBST(MOZ_APP_NAME)
8709 AC_SUBST(MOZ_APP_DISPLAYNAME)
8710 AC_SUBST(MOZ_APP_VERSION)
8711 AC_SUBST(MOZ_APP_UA_EXTRA)
8712 AC_SUBST(FIREFOX_VERSION)
8714 AC_SUBST(MOZ_PKG_SPECIAL)
8716 AC_SUBST(MOZILLA_OFFICIAL)
8718 dnl win32 options
8719 AC_SUBST(MOZ_MAPINFO)
8720 AC_SUBST(MOZ_BROWSE_INFO)
8721 AC_SUBST(MOZ_TOOLS_DIR)
8722 AC_SUBST(CYGWIN_WRAPPER)
8723 AC_SUBST(AS_PERL)
8724 AC_SUBST(WIN32_REDIST_DIR)
8725 AC_SUBST(PYTHON)
8726 AC_SUBST(MAKENSISU)
8728 AC_SUBST(WINCE)
8729 AC_SUBST(WINCE_SDK_DIR)
8730 AC_SUBST(WINCE_WINDOWS_MOBILE)
8732 dnl Echo the CFLAGS to remove extra whitespace.
8733 CFLAGS=`echo \
8734         $_WARNINGS_CFLAGS \
8735         $CFLAGS`
8737 CXXFLAGS=`echo \
8738         $_MOZ_RTTI_FLAGS \
8739         $_MOZ_EXCEPTIONS_FLAGS \
8740         $_WARNINGS_CXXFLAGS \
8741         $CXXFLAGS`
8743 COMPILE_CFLAGS=`echo \
8744     $_DEFINES_CFLAGS \
8745         $_DEPEND_CFLAGS \
8746     $COMPILE_CFLAGS`
8748 COMPILE_CXXFLAGS=`echo \
8749     $_DEFINES_CXXFLAGS \
8750         $_DEPEND_CFLAGS \
8751     $COMPILE_CXXFLAGS`
8753 AC_SUBST(SYSTEM_MAKEDEPEND)
8754 AC_SUBST(SYSTEM_LIBXUL)
8755 AC_SUBST(SYSTEM_JPEG)
8756 AC_SUBST(SYSTEM_PNG)
8757 AC_SUBST(SYSTEM_ZLIB)
8758 AC_SUBST(SYSTEM_BZ2)
8760 AC_SUBST(JPEG_CFLAGS)
8761 AC_SUBST(JPEG_LIBS)
8762 AC_SUBST(ZLIB_CFLAGS)
8763 AC_SUBST(ZLIB_LIBS)
8764 AC_SUBST(BZ2_CFLAGS)
8765 AC_SUBST(BZ2_LIBS)
8766 AC_SUBST(PNG_CFLAGS)
8767 AC_SUBST(PNG_LIBS)
8769 AC_SUBST(MOZ_JPEG_CFLAGS)
8770 AC_SUBST(MOZ_JPEG_LIBS)
8771 AC_SUBST(MOZ_ZLIB_CFLAGS)
8772 AC_SUBST(MOZ_ZLIB_LIBS)
8773 AC_SUBST(MOZ_BZ2_CFLAGS)
8774 AC_SUBST(MOZ_BZ2_LIBS)
8775 AC_SUBST(MOZ_PNG_CFLAGS)
8776 AC_SUBST(MOZ_PNG_LIBS)
8778 AC_SUBST(NSPR_CFLAGS)
8779 AC_SUBST(NSPR_LIBS)
8780 AC_SUBST(MOZ_NATIVE_NSPR)
8782 AC_SUBST(NSS_CFLAGS)
8783 AC_SUBST(NSS_LIBS)
8784 AC_SUBST(NSS_DEP_LIBS)
8785 AC_SUBST(MOZ_NATIVE_NSS)
8786 AC_SUBST(NSS_DISABLE_DBM)
8788 AC_SUBST(CFLAGS)
8789 AC_SUBST(CXXFLAGS)
8790 AC_SUBST(CPPFLAGS)
8791 AC_SUBST(COMPILE_CFLAGS)
8792 AC_SUBST(COMPILE_CXXFLAGS)
8793 AC_SUBST(LDFLAGS)
8794 AC_SUBST(LIBS)
8795 AC_SUBST(CROSS_COMPILE)
8796 AC_SUBST(WCHAR_CFLAGS)
8798 AC_SUBST(HOST_CC)
8799 AC_SUBST(HOST_CXX)
8800 AC_SUBST(HOST_CFLAGS)
8801 AC_SUBST(HOST_CXXFLAGS)
8802 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8803 AC_SUBST(HOST_AR)
8804 AC_SUBST(HOST_AR_FLAGS)
8805 AC_SUBST(HOST_LD)
8806 AC_SUBST(HOST_RANLIB)
8807 AC_SUBST(HOST_NSPR_MDCPUCFG)
8808 AC_SUBST(HOST_BIN_SUFFIX)
8809 AC_SUBST(HOST_OS_ARCH)
8811 AC_SUBST(TARGET_CPU)
8812 AC_SUBST(TARGET_VENDOR)
8813 AC_SUBST(TARGET_OS)
8814 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8815 AC_SUBST(TARGET_MD_ARCH)
8816 AC_SUBST(TARGET_XPCOM_ABI)
8817 AC_SUBST(OS_TARGET)
8818 AC_SUBST(OS_ARCH)
8819 AC_SUBST(OS_RELEASE)
8820 AC_SUBST(OS_TEST)
8822 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8823 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8825 AC_SUBST(WRAP_MALLOC_CFLAGS)
8826 AC_SUBST(WRAP_MALLOC_LIB)
8827 AC_SUBST(MKSHLIB)
8828 AC_SUBST(MKCSHLIB)
8829 AC_SUBST(MKSHLIB_FORCE_ALL)
8830 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8831 AC_SUBST(DSO_CFLAGS)
8832 AC_SUBST(DSO_PIC_CFLAGS)
8833 AC_SUBST(DSO_LDOPTS)
8834 AC_SUBST(LIB_PREFIX)
8835 AC_SUBST(DLL_PREFIX)
8836 AC_SUBST(DLL_SUFFIX)
8837 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8838 AC_SUBST(LIB_SUFFIX)
8839 AC_SUBST(OBJ_SUFFIX)
8840 AC_SUBST(BIN_SUFFIX)
8841 AC_SUBST(ASM_SUFFIX)
8842 AC_SUBST(IMPORT_LIB_SUFFIX)
8843 AC_SUBST(USE_N32)
8844 AC_SUBST(CC_VERSION)
8845 AC_SUBST(CXX_VERSION)
8846 AC_SUBST(MSMANIFEST_TOOL)
8847 AC_SUBST(NS_ENABLE_TSF)
8848 AC_SUBST(MOZ_NSS_PATCH)
8850 AC_SUBST(MOZ_MEDIA)
8851 AC_SUBST(MOZ_SYDNEYAUDIO)
8852 AC_SUBST(MOZ_WAVE)
8853 AC_SUBST(MOZ_VORBIS)
8854 AC_SUBST(MOZ_WEBM)
8855 AC_SUBST(MOZ_OGG)
8856 AC_SUBST(MOZ_ALSA_LIBS)
8857 AC_SUBST(VPX_AS)
8858 AC_SUBST(VPX_ASFLAGS)
8859 AC_SUBST(VPX_X86_ASM)
8861 if test "$USING_HCC"; then
8862    CC='${topsrcdir}/build/hcc'
8863    CC="$CC '$_OLDCC'"
8864    CXX='${topsrcdir}/build/hcpp'
8865    CXX="$CXX '$_OLDCXX'"
8866    AC_SUBST(CC)
8867    AC_SUBST(CXX)
8870 dnl Check for missing components
8871 if test "$COMPILE_ENVIRONMENT"; then
8872 if test "$MOZ_X11"; then
8873     dnl ====================================================
8874     dnl = Check if X headers exist
8875     dnl ====================================================
8876     _SAVE_CFLAGS=$CFLAGS
8877     CFLAGS="$CFLAGS $XCFLAGS"
8878     AC_TRY_COMPILE([
8879         #include <stdio.h>
8880         #include <stdlib.h>
8881         #include <X11/Xlib.h>
8882         #include <X11/Intrinsic.h>
8883     ],
8884     [
8885         Display *dpy = 0;
8886         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8887             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8888             exit(1);
8889         }
8890     ], [], 
8891     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8892     CFLAGS="$_SAVE_CFLAGS"
8894     if test ! -z "$MISSING_X"; then
8895         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8896     fi
8898 fi # MOZ_X11
8900 dnl Check for headers, etc. needed by WebGL.
8901 if test -n "$MOZ_WEBGL_GLX"; then
8902     AC_CHECK_HEADER(GL/glx.h)
8903     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8904         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8905     fi
8906 fi # MOZ_WEBGL_GLX
8907 fi # COMPILE_ENVIRONMENT
8909 if test "$USE_FC_FREETYPE"; then
8910     if test "$COMPILE_ENVIRONMENT"; then
8911         _SAVE_CPPFLAGS="$CPPFLAGS"
8912         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8913         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8914             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8915         CPPFLAGS="$_SAVE_CPPFLAGS"
8916     else
8917         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8918     fi
8921 dnl Set various defines and substitutions
8922 dnl ========================================================
8924 if test "$OS_ARCH" = "BeOS"; then
8925   AC_DEFINE(XP_BEOS)
8926 elif test "$OS_ARCH" = "Darwin"; then
8927   AC_DEFINE(XP_UNIX)
8928   AC_DEFINE(UNIX_ASYNC_DNS)
8929 elif test "$OS_ARCH" = "OpenVMS"; then
8930   AC_DEFINE(XP_UNIX)
8931 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8932   AC_DEFINE(XP_UNIX)
8933   AC_DEFINE(UNIX_ASYNC_DNS)
8936 if test "$MOZ_DEBUG"; then
8937     AC_DEFINE(MOZ_REFLOW_PERF)
8938     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8941 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8942     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8943     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8944     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8945     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8946     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8947     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8948     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8949     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8952 dnl ========================================================
8953 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8954 dnl ========================================================
8955 case "$host_os" in
8956 mingw*)
8957     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8958     ;;
8959 cygwin*|msvc*|mks*)
8960     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8961     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8962     CC="\$(CYGWIN_WRAPPER) $CC"
8963     CXX="\$(CYGWIN_WRAPPER) $CXX"
8964     CPP="\$(CYGWIN_WRAPPER) $CPP"
8965     LD="\$(CYGWIN_WRAPPER) $LD"
8966     AS="\$(CYGWIN_WRAPPER) $AS"
8967     RC="\$(CYGWIN_WRAPPER) $RC"
8968     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8969     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8970     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8971     ;;
8972 esac
8974 AC_SUBST(CYGDRIVE_MOUNT)
8975 AC_SUBST(WIN_TOP_SRC)
8977 AC_SUBST(MOZILLA_VERSION)
8979 AC_SUBST(ac_configure_args)
8981 dnl Spit out some output
8982 dnl ========================================================
8984 dnl The following defines are used by xpcom
8985 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8986 CPP_THROW_NEW
8987 HAVE_CPP_2BYTE_WCHAR_T
8988 HAVE_CPP_ACCESS_CHANGING_USING
8989 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8990 HAVE_CPP_BOOL
8991 HAVE_CPP_CHAR16_T
8992 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8993 HAVE_CPP_EXPLICIT
8994 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8995 HAVE_CPP_NAMESPACE_STD
8996 HAVE_CPP_NEW_CASTS
8997 HAVE_CPP_PARTIAL_SPECIALIZATION
8998 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8999 HAVE_CPP_TYPENAME
9000 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9001 HAVE_STATVFS
9002 NEED_CPP_UNUSED_IMPLEMENTATIONS
9003 NEW_H
9004 HAVE_GETPAGESIZE
9005 HAVE_ICONV
9006 HAVE_ICONV_WITH_CONST_INPUT
9007 HAVE_MBRTOWC
9008 HAVE_SYS_MOUNT_H
9009 HAVE_SYS_VFS_H
9010 HAVE_WCRTOMB
9013 AC_CONFIG_HEADER(
9014 netwerk/necko-config.h
9015 xpcom/xpcom-config.h
9016 xpcom/xpcom-private.h
9019 # Save the defines header file before autoconf removes it.
9020 # (Do not add AC_DEFINE calls after this line.)
9021   _CONFIG_TMP=confdefs-tmp.h
9022   _CONFIG_DEFS_H=mozilla-config.h
9024   cat > $_CONFIG_TMP <<\EOF
9025 /* List of defines generated by configure. Included with preprocessor flag,
9026  * -include, to avoid long list of -D defines on the compile command-line.
9027  * Do not edit.
9028  */
9030 #ifndef _MOZILLA_CONFIG_H_
9031 #define _MOZILLA_CONFIG_H_
9034 _EGREP_PATTERN='^#define ('
9035 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9036     for f in $_NON_GLOBAL_ACDEFINES; do
9037         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9038     done
9040 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9042   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9044   cat >> $_CONFIG_TMP <<\EOF
9046 #endif /* _MOZILLA_CONFIG_H_ */
9050   # Only write mozilla-config.h when something changes (or it doesn't exist)
9051   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9052     rm $_CONFIG_TMP
9053   else
9054     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9055     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9057     echo ==== $_CONFIG_DEFS_H =================================
9058     cat $_CONFIG_DEFS_H
9059   fi
9061 dnl Probably shouldn't call this manually but we always want the output of DEFS
9062 rm -f confdefs.h.save
9063 mv confdefs.h confdefs.h.save
9064 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9065 AC_OUTPUT_MAKE_DEFS()
9066 MOZ_DEFINES=$DEFS
9067 AC_SUBST(MOZ_DEFINES)
9068 rm -f confdefs.h
9069 mv confdefs.h.save confdefs.h
9071 dnl Load the list of Makefiles to generate.
9072 dnl   To add new Makefiles, edit allmakefiles.sh.
9073 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9074 . ${srcdir}/allmakefiles.sh
9075 dnl 
9076 dnl Run a perl script to quickly create the makefiles.
9077 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9078 dnl   for the files it cannot handle correctly. This way, config.status
9079 dnl   will handle these files.
9080 dnl If it fails, nothing is set and config.status will run as usual.
9082 dnl This does not change the $MAKEFILES variable.
9084 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9086 if test -z "${AS_PERL}"; then
9087 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9088 else
9089 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9091 . ./conftest.sh
9092 rm conftest.sh
9094 echo $MAKEFILES > unallmakefiles
9096 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9098 AC_OUTPUT($MAKEFILES)
9100 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9101 if test "$CAIRO_FEATURES_H"; then
9102   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9103     echo "$CAIRO_FEATURES_H is unchanged"
9104     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9105   else
9106     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9107   fi
9110 dnl ========================================================
9111 dnl = Setup a nice relatively clean build environment for
9112 dnl = sub-configures.
9113 dnl ========================================================
9114 CC="$_SUBDIR_CC" 
9115 CXX="$_SUBDIR_CXX" 
9116 CFLAGS="$_SUBDIR_CFLAGS" 
9117 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9118 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9119 LDFLAGS="$_SUBDIR_LDFLAGS"
9120 HOST_CC="$_SUBDIR_HOST_CC" 
9121 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9122 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9125 unset MAKEFILES
9126 unset CONFIG_FILES
9128 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9129 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9131 if test -n "$MOZ_THUMB2"; then
9132   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9134 if test -n "$_WRAP_MALLOC"; then
9135   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9138 if test -z "$MOZ_NATIVE_NSPR"; then
9139     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9140     if test -z "$MOZ_DEBUG"; then
9141         ac_configure_args="$ac_configure_args --disable-debug"
9142     fi
9143     if test "$MOZ_OPTIMIZE" = "1"; then
9144         ac_configure_args="$ac_configure_args --enable-optimize"
9145     fi
9146     if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9147        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9148     fi
9149     if test -n "$HAVE_64BIT_OS"; then
9150         ac_configure_args="$ac_configure_args --enable-64bit"
9151     fi
9152     if test -n "$USE_ARM_KUSER"; then
9153         ac_configure_args="$ac_configure_args --with-arm-kuser"
9154     fi
9155     AC_OUTPUT_SUBDIRS(nsprpub)
9156     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9159 if test -z "$MOZ_NATIVE_NSPR"; then
9160     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9161     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9162     if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9163        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9164        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9165        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9166        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9167     fi
9168     rm -f config/autoconf.mk.bak
9171 # Run the SpiderMonkey 'configure' script.
9172 dist=$MOZ_BUILD_ROOT/dist
9173 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9174 ac_configure_args="$ac_configure_args --enable-threadsafe"
9175 if test "$BUILD_CTYPES"; then
9176     # Build js-ctypes on the platforms we can.
9177     ac_configure_args="$ac_configure_args --enable-ctypes"
9179 if test -z "$MOZ_NATIVE_NSPR"; then
9180     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9181     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9183 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9184 ac_configure_args="$ac_configure_args --prefix=$dist"
9185 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9186 if test "$MOZ_MEMORY"; then
9187    ac_configure_args="$ac_configure_args --enable-jemalloc"
9188    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9189      export MOZ_MEMORY_LDFLAGS
9190    fi
9192 AC_OUTPUT_SUBDIRS(js/src)
9193 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9195 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9197 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9198 dnl Needs to be at the end to respect possible changes from NSPR configure
9199 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9200   echo "config/autoconf.mk is unchanged"
9201   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9202 else
9203   rm -f config/autoconf.mk.orig 2> /dev/null