Bug 574778 - Fix win widget's ConstrainPosition so that it supports full screen windo...
[mozilla-central.git] / configure.in
blobb69696727dbaaf11a50a151c2a4f85e8ba38fc5a
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" || test "$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" && test "$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. 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" || test "$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" || test "$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" && test "$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 # Can't have force w/o an unforce.
2073 #    # Hack for FreeBSD 2.2
2074 #    if test -z "$MKSHLIB_FORCE_ALL"; then
2075 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
2076 #       MKSHLIB_UNFORCE_ALL=''
2077 #    fi
2078     ;; 
2080 ia64*-hpux*)
2081     DLL_SUFFIX=".so"
2082     if test ! "$GNU_CC"; then
2083        DSO_LDOPTS='-b'
2084        DSO_CFLAGS=""
2085        DSO_PIC_CFLAGS=
2086        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2087        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2088        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2089     else
2090        DSO_LDOPTS='-b -E'
2091        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2092        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2093     fi
2094     MOZ_FIX_LINK_PATHS=
2095     SYSTEM_MAKEDEPEND=
2096     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2097     AC_DEFINE(_LARGEFILE64_SOURCE)
2098     ;;
2100 *-hpux*)
2101     DLL_SUFFIX=".sl"
2102     if test ! "$GNU_CC"; then
2103         DSO_LDOPTS='-b -Wl,+s'
2104         DSO_CFLAGS=""
2105         DSO_PIC_CFLAGS="+Z"
2106         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2107         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2108         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2109     else
2110         DSO_LDOPTS='-b -E +s'
2111         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2112         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2113     fi
2114     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2115     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2116     ;;
2118 *-irix5*)
2119     AC_DEFINE(IRIX)
2120     DSO_LDOPTS='-elf -shared'
2122     if test "$GNU_CC"; then
2123        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2124        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2125        MKSHLIB_FORCE_ALL='-Wl,-all'
2126        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2127        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2128     else
2129        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2130        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2131        MKSHLIB_FORCE_ALL='-all'
2132        MKSHLIB_UNFORCE_ALL='-none'
2133     fi
2134     ;;
2136 *-irix6*)
2137     AC_DEFINE(IRIX)
2138     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2139     dnl compile and link using -n32
2140     USE_N32=1
2141     TARGET_COMPILER_ABI=n32
2142     DSO_LDOPTS='-elf -shared'
2143     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2144     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2145     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2146     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2147     if test "$GNU_CC"; then
2148        MKSHLIB_FORCE_ALL='-Wl,-all'
2149        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2150        _WARNINGS_CFLAGS="-Wall"
2151        _WARNINGS_CXXFLAGS="-Wall"
2152        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2153     else
2154        MKSHLIB_FORCE_ALL='-all'
2155        MKSHLIB_UNFORCE_ALL='-none'
2156            AR_LIST="$AR t"
2157            AR_EXTRACT="$AR x"
2158            AR_DELETE="$AR d"
2159            AR='$(CXX) -ar'
2160            AR_FLAGS='-o $@'
2161        CFLAGS="$CFLAGS -woff 3262 -G 4"
2162        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2163        if test -n "$USE_N32"; then
2164            ASFLAGS="$ASFLAGS -n32"
2165            CFLAGS="$CFLAGS -n32"
2166            CXXFLAGS="$CXXFLAGS -n32"
2167            LDFLAGS="$LDFLAGS -n32"
2168        fi
2169        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2170        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2171        MOZ_FIX_LINK_PATHS=
2172     fi
2173     if test -z "$GNU_CXX"; then
2174       MIPSPRO_CXX=1
2175     fi
2176     ;;
2178 *-*linux*)
2179     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2180     # Similarly for GNU_CXX and INTEL_CXX.
2181     if test "$INTEL_CC" || test "$INTEL_CXX"; then
2182         # -Os has been broken on Intel's C/C++ compilers for quite a
2183         # while; Intel recommends against using it.
2184         MOZ_OPTIMIZE_FLAGS="-O2"
2185         MOZ_DEBUG_FLAGS="-g"
2186     elif test "$GNU_CC" || test "$GNU_CXX"; then
2187         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2188         case $GCC_VERSION in
2189         4.1.*|4.2.*|4.5.*)
2190             # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2191             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2192         esac
2193         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2194         MOZ_DEBUG_FLAGS="-g"
2195     fi
2197     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2199     MOZ_MEMORY=1
2201     case "${target_cpu}" in
2202     alpha*)
2203         CFLAGS="$CFLAGS -mieee"
2204         CXXFLAGS="$CXXFLAGS -mieee"
2205     ;;
2206     i*86)
2207         USE_ELF_DYNSTR_GC=1
2208     ;;
2209     mips*)
2210         MOZ_DEBUG_FLAGS="-g" # We want inlining
2211     ;;
2212     esac
2213     ;;
2215 *-wince*|*-winmo*)
2216     TARGET_COMPILER_ABI=msvc
2217     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2218     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2219     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2220     AR_LIST="$AR -list"
2221     AR_EXTRACT="$AR -extract"
2222     AR_DELETE="$AR d"
2223     AR_FLAGS='-OUT:"$@"'
2224     MOZ_MEMORY=1
2225     NSS_DISABLE_DBM=1
2226     MOZ_OGG=
2227     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2229     if test "$AS_BIN"; then
2230         AS="$AS_BIN"
2231     fi
2232     DSO_CFLAGS=
2233     DSO_PIC_CFLAGS=
2234     DLL_SUFFIX=.dll
2235     BIN_SUFFIX='.exe'
2236     if test -z "$RC"; then 
2237         RC=rc.exe  
2238     fi
2239     # certain versions of cygwin's makedepend barf on the 
2240     # #include <string> vs -I./dist/include/string issue so don't use it
2241     SYSTEM_MAKEDEPEND=
2243     HOST_CC=cl
2244     HOST_CXX=cl
2245     HOST_LD=link
2246     HOST_AR='lib -OUT:$@'
2247     HOST_RANLIB='echo ranlib'
2248     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2249         
2250         
2251     WARNINGS_AS_ERRORS='-WX'
2252     MOZ_OPTIMIZE_FLAGS='-Ox'
2253     AR_FLAGS='-NOLOGO -OUT:"$@"'
2254     ASM_SUFFIX=asm
2255     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2256     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2257     DLL_PREFIX=
2258     DOXYGEN=:
2259     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2260     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2261     GARBAGE=
2262     IMPORT_LIB_SUFFIX=lib
2263     dnl Need to force-link against mozalloc because it's used in the shunt
2264     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2265     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2266     LIB_PREFIX=
2267     LIB_SUFFIX=lib 
2268     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2269     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2270     MKSHLIB_FORCE_ALL=
2271     MKSHLIB_UNFORCE_ALL=
2272     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2273     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2274     MOZ_DEBUG_FLAGS='-Zi'
2275     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2276     MOZ_FIX_LINK_PATHS=
2277     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2278     OBJ_SUFFIX=obj
2279     RANLIB='echo not_ranlib'
2280     STRIP='echo not_strip'
2281     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2282     UNZIP=unzip
2283     XARGS=xargs
2284     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2285     ZIP=zip
2286     MOZ_TREE_FREETYPE=1
2288     AC_DEFINE(HAVE_SNPRINTF)
2289     AC_DEFINE(_WINDOWS)
2290     AC_DEFINE(WIN32)
2291     AC_DEFINE(XP_WIN)
2292     AC_DEFINE(XP_WIN32)
2293     AC_DEFINE(HW_THREADS)
2294     AC_DEFINE(STDC_HEADERS)
2295     AC_DEFINE(NEW_H, <new>)
2296     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2297     AC_DEFINE(HAVE_LOCALTIME_R)
2299     TARGET_MD_ARCH=win32
2300     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2301     BIN_SUFFIX='.exe'
2302     MOZ_USER_DIR="Mozilla"
2304     MOZ_GFX_OPTIMIZE_MOBILE=1
2306     # Sanity check for WINCE_WINDOWS_MOBILE
2307     # XXX disabled until we can fix the mobile tinderbox
2308     ##if test "$WINCE_WINDOWS_MOBILE"; then
2309     ##   AC_CHECK_HEADER(tpcshell.h, [],
2310     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2311     ##fi
2315 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2316     DSO_CFLAGS=
2317     DSO_PIC_CFLAGS=
2318     DLL_SUFFIX=.dll
2319     RC=rc.exe
2320     # certain versions of cygwin's makedepend barf on the 
2321     # #include <string> vs -I./dist/include/string issue so don't use it
2322     SYSTEM_MAKEDEPEND=
2323     if test -n "$GNU_CC"; then
2324         CC="$CC -mno-cygwin"
2325         CXX="$CXX -mno-cygwin"
2326         CPP="$CPP -mno-cygwin"
2327         CFLAGS="$CFLAGS -mms-bitfields"
2328         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2329         DSO_LDOPTS='-shared'
2330         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2331         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2332         RC='$(WINDRES)'
2333         # Use temp file for windres (bug 213281)
2334         RCFLAGS='-O coff --use-temp-file'
2335         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2336         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2337         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2338         MOZ_FIX_LINK_PATHS=
2339         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2340         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2341         DLL_PREFIX=
2342         IMPORT_LIB_SUFFIX=dll.a
2343         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2344     else
2345         TARGET_COMPILER_ABI=msvc
2346         HOST_CC='$(CC)'
2347         HOST_CXX='$(CXX)'
2348         HOST_LD='$(LD)'
2349         if test "$AS_BIN"; then
2350             AS="$(basename "$AS_BIN")"
2351         fi
2352         AR='lib -NOLOGO -OUT:"$@"'
2353         AR_FLAGS=
2354         RANLIB='echo not_ranlib'
2355         STRIP='echo not_strip'
2356         XARGS=xargs
2357         ZIP=zip
2358         UNZIP=unzip
2359         DOXYGEN=:
2360         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2361         ASM_SUFFIX=asm
2362         OBJ_SUFFIX=obj
2363         LIB_SUFFIX=lib
2364         DLL_PREFIX=
2365         LIB_PREFIX=
2366         IMPORT_LIB_SUFFIX=lib
2367         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2368         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2369         MKSHLIB_FORCE_ALL=
2370         MKSHLIB_UNFORCE_ALL=
2371         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2372         _USE_CPP_INCLUDE_FLAG=1
2373         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2374         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2375         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2376         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2377         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2378         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2379         MOZ_DEBUG_FLAGS='-Zi'
2380         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2381         WARNINGS_AS_ERRORS='-WX'
2382         MOZ_OPTIMIZE_FLAGS='-O1'
2383         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2384         MOZ_FIX_LINK_PATHS=
2385         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2386         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2387         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2388         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2389         if test $_MSC_VER -ge 1400; then
2390             LDFLAGS="$LDFLAGS -NXCOMPAT"
2391             dnl For profile-guided optimization
2392             PROFILE_GEN_CFLAGS="-GL"
2393             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2394             dnl XXX: PGO builds can fail with warnings treated as errors,
2395             dnl specifically "no profile data available" appears to be
2396             dnl treated as an error sometimes. This might be a consequence
2397             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2398             dnl with the linker doing most of the work in the whole-program
2399             dnl optimization/PGO case. I think it's probably a compiler bug,
2400             dnl but we work around it here.
2401             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2402             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2403             dnl Probably also a compiler bug, but what can you do?
2404             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2405             if test -n "$_USE_DYNAMICBASE"; then
2406                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2407             fi
2408         fi
2409     fi
2410     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2411     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2412     AC_DEFINE(HAVE_SNPRINTF)
2413     AC_DEFINE(_WINDOWS)
2414     AC_DEFINE(WIN32)
2415     AC_DEFINE(XP_WIN)
2416     AC_DEFINE(XP_WIN32)
2417     AC_DEFINE(HW_THREADS)
2418     AC_DEFINE(STDC_HEADERS)
2419     AC_DEFINE(NEW_H, <new>)
2420     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2421     TARGET_MD_ARCH=win32
2422     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2423     BIN_SUFFIX='.exe'
2424     MOZ_USER_DIR="Mozilla"
2426     dnl Hardcode to win95 for now - cls
2427     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2429     dnl set NO_X11 defines here as the general check is skipped on win32
2430     no_x=yes
2431     AC_DEFINE(NO_X11)
2433     dnl MinGW/MSYS doesn't provide or need cygpath
2434     case "$host" in
2435     *-mingw*)
2436         CYGPATH_W=echo
2437         CYGPATH_S=cat
2438         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2439         ;;
2440     *-cygwin*|*-msvc*|*-mks*)
2441         CYGPATH_W="cygpath -a -w"
2442         CYGPATH_S="sed -e s|\\\\|/|g"
2443         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2444         ;;
2445     esac
2446     case "$host" in
2447     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2449     if test -z "$MOZ_TOOLS"; then
2450         AC_MSG_ERROR([MOZ_TOOLS is not set])
2451     fi
2453     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2454     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2455         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2456     fi
2457     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2458     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2459         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2460     fi
2461     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2462     ;;
2463     esac 
2466     case "$host_os" in
2467     cygwin*|msvc*|mks*)
2468         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])
2469         ;;
2471     *)
2472         AC_CHECK_HEADERS(oleacc.idl)
2474         AC_LANG_SAVE
2475         AC_LANG_CPLUSPLUS
2476         AC_CHECK_HEADERS(atlbase.h)
2477         AC_LANG_RESTORE
2478         ;;
2479     esac
2481     case "$target" in
2482     i*86-*)
2483         if test "$HAVE_64BIT_OS"; then
2484             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2485         fi
2487         if test $_MSC_VER -ge 1400; then
2488             LDFLAGS="$LDFLAGS -SAFESEH"
2489         fi
2490         AC_CHECK_HEADERS(mmintrin.h)
2491         AC_DEFINE(_X86_)
2492         ;;
2493     alpha-*)
2494         AC_DEFINE(_ALPHA_)
2495         ;;
2496     mips-*)
2497         AC_DEFINE(_MIPS_)
2498         ;;
2499     x86_64-*)
2500         AC_DEFINE(_AMD64_)
2501         ;;
2502     *)
2503         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2504         ;;
2505     esac
2507     if test "$HAVE_64BIT_OS"; then
2508         AC_DEFINE(_WIN64)
2509     fi
2510     ;;
2512 *-netbsd*)
2513     DSO_CFLAGS=''
2514     CFLAGS="$CFLAGS -Dunix"
2515     CXXFLAGS="$CXXFLAGS -Dunix"
2516     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2517         DLL_SUFFIX=".so"
2518         DSO_PIC_CFLAGS='-fPIC -DPIC'
2519         DSO_LDOPTS='-shared'
2520         BIN_FLAGS='-Wl,--export-dynamic'
2521     else
2522         DSO_PIC_CFLAGS='-fPIC -DPIC'
2523         DLL_SUFFIX=".so.1.0"
2524         DSO_LDOPTS='-shared'
2525     fi
2526     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2527     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2528     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2529     if test "$LIBRUNPATH"; then
2530         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2531     fi
2532     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2533     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2534     ;;
2536 *-nto*) 
2537         AC_DEFINE(NTO)  
2538         AC_DEFINE(_QNX_SOURCE)
2539         AC_DEFINE(_i386)
2540         OS_TARGET=NTO
2541         WARNINGS_AS_ERRORS=''
2542         MOZ_OPTIMIZE_FLAGS="-O"
2543         MOZ_DEBUG_FLAGS="-gstabs"
2544         USE_PTHREADS=1
2545         _PEDANTIC=
2546         LIBS="$LIBS -lsocket -lstdc++"
2547         _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2548         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2549         if test "$with_x" != "yes"
2550         then
2551                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2552             TK_CFLAGS='-I/usr/include/photon'
2553                 TK_LIBS='-lph'
2554         fi
2555         case "${target_cpu}" in
2556         ppc*)
2557         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2558         ;;
2559         esac
2560         case "${host_cpu}" in
2561         i*86)
2562         USE_ELF_DYNSTR_GC=1
2563         ;;
2564         esac
2565         ;;
2567 *-openbsd*)
2568     DLL_SUFFIX=".so.1.0"
2569     DSO_CFLAGS=''
2570     DSO_PIC_CFLAGS='-fPIC'
2571     DSO_LDOPTS='-shared -fPIC'
2572     if test "$LIBRUNPATH"; then
2573         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2574     fi
2575     ;;
2577 *-openvms*) 
2578     AC_DEFINE(NO_PW_GECOS)
2579     AC_DEFINE(NO_UDSOCK)
2580     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2581     USE_PTHREADS=1
2582     MKSHLIB_FORCE_ALL='-all'
2583     MKSHLIB_UNFORCE_ALL='-none'
2584     AS='as'
2585     AS_DASH_C_FLAG='-Wc/names=as_is'
2586     AR_FLAGS='c $@'
2587     DSO_LDOPTS='-shared -auto_symvec'
2588     DSO_PIC_CFLAGS=
2589     MOZ_DEBUG_LDFLAGS='-g'
2590     COMPAQ_CXX=1
2591     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2592     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2593     ;;
2596 *-os2*)
2597     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2598     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2599     AC_DEFINE(OS2)
2600     AC_DEFINE(XP_OS2)
2601     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2602     AC_DEFINE(TCPV40HDRS)
2603     DLL_PREFIX=
2604     LIB_PREFIX=
2605     LIB_SUFFIX=lib
2606     BIN_SUFFIX=".exe"
2607     DLL_SUFFIX=".dll"
2608     IMPORT_LIB_SUFFIX=lib
2609     DSO_PIC_CFLAGS=
2610     AR=emxomfar
2611     AR_FLAGS='r $@'
2612     CFLAGS="$CFLAGS -Zomf"
2613     CXXFLAGS="$CXXFLAGS -Zomf"
2614     DSO_LDOPTS='-Zdll'
2615     BIN_FLAGS='-Zlinker /ST:0x100000'
2616     IMPLIB='emximp -o'
2617     FILTER='emxexp -o'
2618     LDFLAGS='-Zmap'
2619     WARNINGS_AS_ERRORS='-Werror'
2620     MOZ_DEBUG_FLAGS="-g -fno-inline"
2621     MOZ_OPTIMIZE_FLAGS="-O2"
2622     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2623     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2624     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2625     TARGET_MD_ARCH=os2
2626     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2627     RC=rc.exe
2628     RCFLAGS='-n'
2629     MOZ_USER_DIR="Mozilla"
2631     if test "$MOZTOOLS"; then
2632         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2633     else
2634         AC_MSG_ERROR([MOZTOOLS is not set])
2635     fi
2636     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2637         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2638         LDFLAGS="$LDFLAGS -Zhigh-mem"
2639         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2640         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2641     fi
2643     # GCC for OS/2 currently predefines these, but we don't want them
2644     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2645     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2647     AC_CACHE_CHECK(for __declspec(dllexport),
2648         ac_os2_declspec,
2649         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2650                         [return 0;],
2651                         ac_os2_declspec="yes",
2652                         ac_os2_declspec="no")])
2653     if test "$ac_os2_declspec" = "yes"; then
2654         FILTER='true'
2655         MOZ_OS2_USE_DECLSPEC='1'
2656     fi
2657     ;;
2659 alpha*-*-osf*)
2660     if test "$GNU_CC"; then
2661       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2662       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2664     else
2665         MOZ_DEBUG_FLAGS='-g'
2666         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2667         CFLAGS="$CFLAGS -ieee"
2668         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2669         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2670         DSO_CFLAGS=
2671         DSO_PIC_CFLAGS=
2672         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2673         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2674         MKSHLIB_FORCE_ALL='-all'
2675         MKSHLIB_UNFORCE_ALL='-none'
2676         dnl Might fix the libxpcom.so breakage on this platform as well....
2677         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2678         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2679     fi
2680     if test -z "$GNU_CXX"; then
2681       COMPAQ_CXX=1
2682     fi
2683     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2684     ;;
2686 *-qnx*) 
2687     DIRENT_INO=d_stat.st_ino
2688     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2689     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2690     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2691     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2692     AC_DEFINE(STDC_HEADERS)
2693     if test "$no_x" = "yes"; then
2694             _PLATFORM_DEFAULT_TOOLKIT='photon'
2695             TK_CFLAGS='-I/usr/nto/include/photon'
2696             TK_LIBS='-lphoton -lphrender'
2697     fi
2698     ;;
2700 *-sco*) 
2701     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2702     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2703     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2704     if test ! "$GNU_CC"; then
2705        DSO_LDOPTS='-G'
2706     fi
2707     ;;
2709 *-solaris*) 
2710     AC_DEFINE(SOLARIS)
2711     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2712     SYSTEM_MAKEDEPEND=
2713     MOZ_FIX_LINK_PATHS=
2714     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2715     # libraries one level up (e.g. libnspr4.so)
2716     if test "$SOLARIS_SUNPRO_CC"; then
2717        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2718        LIBS="-lCrun -lCstd -lc $LIBS"
2719        NS_USE_NATIVE=1
2720        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2721        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2722        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__"
2723        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2724        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2725        LDFLAGS="-xildoff $LDFLAGS"
2726        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2727            _SAVE_LDFLAGS=$LDFLAGS
2728            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2729            AC_TRY_LINK([#include <stdio.h>],
2730                        [printf("Hello World\n");],
2731                        ,
2732                        [LDFLAGS=$_SAVE_LDFLAGS])
2733        fi
2734        WARNINGS_AS_ERRORS='-Werror'
2735        MOZ_OPTIMIZE_FLAGS="-xO4"
2736        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2737        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2738        MKSHLIB_FORCE_ALL='-z allextract'
2739        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2740        DSO_LDOPTS='-G'
2741        AR_LIST="$AR t"
2742        AR_EXTRACT="$AR x"
2743        AR_DELETE="$AR d"
2744        AR='$(CXX) -xar'
2745        AR_FLAGS='-o $@'
2746        AS='/usr/ccs/bin/as'
2747        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2748        AS_DASH_C_FLAG=''
2749        TARGET_COMPILER_ABI="sunc"
2750        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2751        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2752        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2753        AC_LANG_SAVE
2754        AC_LANG_CPLUSPLUS
2755        AC_TRY_COMPILE([],
2756            [#if (__SUNPRO_CC < 0x590)
2757            #error "Denied"
2758            #endif],
2759            _BAD_COMPILER=,_BAD_COMPILER=1)
2760        if test -n "$_BAD_COMPILER"; then
2761            _res="no"
2762            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2763        else
2764            _res="yes"
2765        fi
2766        AC_TRY_COMPILE([],
2767            [#if (__SUNPRO_CC >= 0x5100)
2768            #error "Sun C++ 5.10 or above"
2769            #endif],
2770            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2771        if test "$_ABOVE_SS12U1"; then
2772            # disable xannotate
2773            CXXFLAGS="$CXXFLAGS -xannotate=no"
2774        fi
2775        AC_MSG_RESULT([$_res])
2776        AC_LANG_RESTORE
2777     else
2778        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2779        LIBS="-lc $LIBS"
2780        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2781        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2782        ASFLAGS="$ASFLAGS -fPIC"
2783        DSO_LDOPTS='-shared'
2784        _WARNINGS_CFLAGS=''
2785        _WARNINGS_CXXFLAGS=''
2786        if test "$OS_RELEASE" = "5.3"; then
2787            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2788        fi
2789     fi
2790     if test "$OS_RELEASE" = "5.5.1"; then
2791         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2792     fi
2793     ;;
2795 *-sunos*) 
2796     DSO_LDOPTS='-Bdynamic'
2797     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2798     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2799     AC_DEFINE(SUNOS4)
2800     AC_DEFINE(SPRINTF_RETURNS_STRING)
2801     case "$(target_os)" in
2802     sunos4.1*)
2803         DLL_SUFFIX='.so.1.0'
2804         ;;
2805     esac
2806     ;;
2808 *-sysv4.2uw7*) 
2809         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2810     ;;
2812 *-os2*)
2813     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2814     ;;
2816 *-android*)
2817     AC_DEFINE(NO_PW_GECOS)
2818     no_x=yes
2819     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2820     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2822     MOZ_GFX_OPTIMIZE_MOBILE=1
2823     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2824     ;;
2826 esac
2828 dnl Only one oddball right now (QNX), but this gives us flexibility
2829 dnl if any other platforms need to override this in the future.
2830 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2832 dnl ========================================================
2833 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2834 dnl by now will not have any way to link most binaries (tests
2835 dnl as well as viewer, apprunner, etc.), because some symbols
2836 dnl will be left out of the "composite" .so's by ld as unneeded.
2837 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2838 dnl they can link in the static libs that provide the missing
2839 dnl symbols.
2840 dnl ========================================================
2841 NO_LD_ARCHIVE_FLAGS=
2842 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2843     NO_LD_ARCHIVE_FLAGS=1
2845 case "$target" in
2846 *-os2*)
2847     NO_LD_ARCHIVE_FLAGS=
2848     ;;
2849 *-aix4.3*|*-aix5*)
2850     NO_LD_ARCHIVE_FLAGS=
2851     ;;
2852 *-openvms*)
2853     NO_LD_ARCHIVE_FLAGS=
2854     ;;
2855 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2856     if test -z "$GNU_CC"; then
2857         NO_LD_ARCHIVE_FLAGS=
2858     fi
2859     ;;
2860 esac
2861 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2863 dnl ========================================================
2864 dnl = Flags to strip unused symbols from .so components
2865 dnl ========================================================
2866 case "$target" in
2867     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2868         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2869         ;;
2870     *-solaris*)
2871         if test -z "$GNU_CC"; then
2872          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2873         else
2874          if test -z "$GCC_USE_GNU_LD"; then
2875           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2876          else
2877           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2878          fi
2879         fi
2880         ;;
2881     *-nto*) 
2882         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2883         ;;
2884     *-darwin*)
2885         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2886         ;;
2887     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2888         if test -n "$GNU_CC"; then
2889            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2890         fi
2891         ;;
2892 esac
2894 if test -z "$COMPILE_ENVIRONMENT"; then
2895     SKIP_COMPILER_CHECKS=1
2896     SKIP_LIBRARY_CHECKS=1
2899 if test -z "$SKIP_COMPILER_CHECKS"; then
2900 dnl Checks for typedefs, structures, and compiler characteristics.
2901 dnl ========================================================
2902 AC_HEADER_STDC
2903 AC_C_CONST
2904 AC_TYPE_MODE_T
2905 AC_TYPE_OFF_T
2906 AC_TYPE_PID_T
2907 AC_TYPE_SIZE_T
2908 AC_LANG_CPLUSPLUS
2909 AC_MSG_CHECKING(for __stdcall)
2910 AC_CACHE_VAL(ac_cv___stdcall,
2911  [AC_TRY_COMPILE([template <typename Method> struct foo;
2912                   template <> struct foo<void (*)()> {};
2913                   template <> struct foo<void (__stdcall*)()> {};],
2914                  [],
2915                  [ac_cv___stdcall=true],
2916                  [ac_cv___stdcall=false])])
2917 if test "$ac_cv___stdcall" = true ; then
2918   AC_DEFINE(HAVE_STDCALL)
2919   AC_MSG_RESULT(yes)
2920 else
2921   AC_MSG_RESULT(no)
2923 AC_LANG_C
2924 AC_MSG_CHECKING(for ssize_t)
2925 AC_CACHE_VAL(ac_cv_type_ssize_t,
2926  [AC_TRY_COMPILE([#include <stdio.h>
2927                   #include <sys/types.h>],
2928                  [ssize_t foo = 0;],
2929                  [ac_cv_type_ssize_t=true],
2930                  [ac_cv_type_ssize_t=false])])
2931 if test "$ac_cv_type_ssize_t" = true ; then
2932   AC_DEFINE(HAVE_SSIZE_T)
2933   AC_MSG_RESULT(yes)
2934 else
2935   AC_MSG_RESULT(no)
2937 AC_STRUCT_ST_BLKSIZE
2938 AC_MSG_CHECKING(for siginfo_t)
2939 AC_CACHE_VAL(ac_cv_siginfo_t,
2940  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2941                   #include <signal.h>],
2942                  [siginfo_t* info;],
2943                  [ac_cv_siginfo_t=true],
2944                  [ac_cv_siginfo_t=false])])
2945 if test "$ac_cv_siginfo_t" = true ; then
2946   AC_DEFINE(HAVE_SIGINFO_T)
2947   AC_MSG_RESULT(yes)
2948 else
2949   AC_MSG_RESULT(no)
2952 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2953 dnl ========================================================
2954 AC_MSG_CHECKING(for int16_t)
2955 AC_CACHE_VAL(ac_cv_int16_t,
2956  [AC_TRY_COMPILE([#include <stdio.h>
2957                   #include <sys/types.h>],
2958                  [int16_t foo = 0;],
2959                  [ac_cv_int16_t=true],
2960                  [ac_cv_int16_t=false])])
2961 if test "$ac_cv_int16_t" = true ; then
2962   AC_DEFINE(HAVE_INT16_T)
2963   AC_MSG_RESULT(yes)
2964 else
2965   AC_MSG_RESULT(no)
2967 AC_MSG_CHECKING(for int32_t)
2968 AC_CACHE_VAL(ac_cv_int32_t,
2969  [AC_TRY_COMPILE([#include <stdio.h>
2970                   #include <sys/types.h>],
2971                  [int32_t foo = 0;],
2972                  [ac_cv_int32_t=true],
2973                  [ac_cv_int32_t=false])])
2974 if test "$ac_cv_int32_t" = true ; then
2975   AC_DEFINE(HAVE_INT32_T)
2976   AC_MSG_RESULT(yes)
2977 else
2978   AC_MSG_RESULT(no)
2980 AC_MSG_CHECKING(for int64_t)
2981 AC_CACHE_VAL(ac_cv_int64_t,
2982  [AC_TRY_COMPILE([#include <stdio.h>
2983                   #include <sys/types.h>],
2984                  [int64_t foo = 0;],
2985                  [ac_cv_int64_t=true],
2986                  [ac_cv_int64_t=false])])
2987 if test "$ac_cv_int64_t" = true ; then
2988   AC_DEFINE(HAVE_INT64_T)
2989   AC_MSG_RESULT(yes)
2990 else
2991   AC_MSG_RESULT(no)
2993 AC_MSG_CHECKING(for int64)
2994 AC_CACHE_VAL(ac_cv_int64,
2995  [AC_TRY_COMPILE([#include <stdio.h>
2996                   #include <sys/types.h>],
2997                  [int64 foo = 0;],
2998                  [ac_cv_int64=true],
2999                  [ac_cv_int64=false])])
3000 if test "$ac_cv_int64" = true ; then
3001   AC_DEFINE(HAVE_INT64)
3002   AC_MSG_RESULT(yes)
3003 else
3004   AC_MSG_RESULT(no)
3006 AC_MSG_CHECKING(for uint)
3007 AC_CACHE_VAL(ac_cv_uint,
3008  [AC_TRY_COMPILE([#include <stdio.h>
3009                   #include <sys/types.h>],
3010                  [uint foo = 0;],
3011                  [ac_cv_uint=true],
3012                  [ac_cv_uint=false])])
3013 if test "$ac_cv_uint" = true ; then
3014   AC_DEFINE(HAVE_UINT)
3015   AC_MSG_RESULT(yes)
3016 else
3017   AC_MSG_RESULT(no)
3019 AC_MSG_CHECKING(for uint_t)
3020 AC_CACHE_VAL(ac_cv_uint_t,
3021  [AC_TRY_COMPILE([#include <stdio.h>
3022                   #include <sys/types.h>],
3023                  [uint_t foo = 0;],
3024                  [ac_cv_uint_t=true],
3025                  [ac_cv_uint_t=false])])
3026 if test "$ac_cv_uint_t" = true ; then
3027   AC_DEFINE(HAVE_UINT_T)
3028   AC_MSG_RESULT(yes)
3029 else
3030   AC_MSG_RESULT(no)
3032 AC_MSG_CHECKING(for uint16_t)
3033 AC_CACHE_VAL(ac_cv_uint16_t,
3034  [AC_TRY_COMPILE([#include <stdio.h>
3035                   #include <sys/types.h>],
3036                  [uint16_t foo = 0;],
3037                  [ac_cv_uint16_t=true],
3038                  [ac_cv_uint16_t=false])])
3039 if test "$ac_cv_uint16_t" = true ; then
3040   AC_DEFINE(HAVE_UINT16_T)
3041   AC_MSG_RESULT(yes)
3042 else
3043   AC_MSG_RESULT(no)
3046 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3047 dnl are defined when compiling C++ but not C.  Since the result of this
3048 dnl test is used only in C++, do it in C++.
3049 AC_LANG_CPLUSPLUS
3051 AC_MSG_CHECKING(for uname.domainname)
3052 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3053     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3054         [ struct utsname *res; char *domain; 
3055             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3056         [ac_cv_have_uname_domainname_field=true],
3057         [ac_cv_have_uname_domainname_field=false])])
3059 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3060     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3061     AC_MSG_RESULT(yes)
3062 else
3063     AC_MSG_RESULT(no)
3066 AC_MSG_CHECKING(for uname.__domainname)
3067 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3068     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3069         [ struct utsname *res; char *domain; 
3070             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3071         [ac_cv_have_uname_us_domainname_field=true],
3072         [ac_cv_have_uname_us_domainname_field=false])])
3074 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3075     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3076     AC_MSG_RESULT(yes)
3077 else
3078     AC_MSG_RESULT(no)
3081 AC_LANG_CPLUSPLUS
3083 dnl Check for usable char16_t (2 bytes, unsigned)
3084 dnl (we might not need the unsignedness check anymore)
3085 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3086     ac_cv_have_usable_char16_t,
3087     [AC_TRY_COMPILE([$configure_static_assert_macros],
3088                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3089                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3090                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3091                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3092                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3093                     ac_cv_have_usable_char16_t="yes",
3094                     ac_cv_have_usable_char16_t="no")])
3095 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3096     AC_DEFINE(HAVE_CPP_CHAR16_T)
3097     HAVE_CPP_CHAR16_T=1
3100 dnl Check for usable wchar_t (2 bytes, unsigned)
3101 dnl (we really don't need the unsignedness check anymore)
3102 dnl ========================================================
3104 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3105     ac_cv_have_usable_wchar_v2,
3106     [AC_TRY_COMPILE([#include <stddef.h>
3107                      $configure_static_assert_macros],
3108                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3109                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3110                     ac_cv_have_usable_wchar_v2="yes",
3111                     ac_cv_have_usable_wchar_v2="no")])
3112 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3113     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3114     HAVE_CPP_2BYTE_WCHAR_T=1
3115 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3116 dnl This is really gcc-only
3117 dnl Do this test using CXX only since some versions of gcc
3118 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3119 dnl only have short-wchar support for c++.
3120 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3122     _SAVE_CXXFLAGS=$CXXFLAGS
3123     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3125     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3126         ac_cv_have_usable_wchar_option_v2,
3127         [AC_TRY_LINK([#include <stddef.h>
3128                       $configure_static_assert_macros],
3129                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3130                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3131                      ac_cv_have_usable_wchar_option_v2="yes",
3132                      ac_cv_have_usable_wchar_option_v2="no")])
3134     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3135         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3136         HAVE_CPP_2BYTE_WCHAR_T=1
3137         WCHAR_CFLAGS="-fshort-wchar"
3138     else    
3139         CXXFLAGS=$_SAVE_CXXFLAGS
3140     fi
3143 AC_LANG_C
3145 dnl Check for .hidden assembler directive and visibility attribute.
3146 dnl Borrowed from glibc configure.in
3147 dnl ===============================================================
3148 if test "$GNU_CC"; then
3149   AC_CACHE_CHECK(for visibility(hidden) attribute,
3150                  ac_cv_visibility_hidden,
3151                  [cat > conftest.c <<EOF
3152                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3154                   ac_cv_visibility_hidden=no
3155                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3156                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3157                       ac_cv_visibility_hidden=yes
3158                     fi
3159                   fi
3160                   rm -f conftest.[cs]
3161                  ])
3162   if test "$ac_cv_visibility_hidden" = "yes"; then
3163     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3165     AC_CACHE_CHECK(for visibility(default) attribute,
3166                    ac_cv_visibility_default,
3167                    [cat > conftest.c <<EOF
3168                     int foo __attribute__ ((visibility ("default"))) = 1;
3170                     ac_cv_visibility_default=no
3171                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3172                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3173                         ac_cv_visibility_default=yes
3174                       fi
3175                     fi
3176                     rm -f conftest.[cs]
3177                    ])
3178     if test "$ac_cv_visibility_default" = "yes"; then
3179       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3181       AC_CACHE_CHECK(for visibility pragma support,
3182                      ac_cv_visibility_pragma,
3183                      [cat > conftest.c <<EOF
3184 #pragma GCC visibility push(hidden)
3185                       int foo_hidden = 1;
3186 #pragma GCC visibility push(default)
3187                       int foo_default = 1;
3189                       ac_cv_visibility_pragma=no
3190                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3191                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3192                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3193                             ac_cv_visibility_pragma=yes
3194                           fi
3195                         fi
3196                       fi
3197                       rm -f conftest.[cs]
3198                     ])
3199       if test "$ac_cv_visibility_pragma" = "yes"; then
3200         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3201                        ac_cv_have_visibility_class_bug,
3202                        [cat > conftest.c <<EOF
3203 #pragma GCC visibility push(hidden)
3204 struct __attribute__ ((visibility ("default"))) TestStruct {
3205   static void Init();
3207 __attribute__ ((visibility ("default"))) void TestFunc() {
3208   TestStruct::Init();
3211                        ac_cv_have_visibility_class_bug=no
3212                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3213                          ac_cv_have_visibility_class_bug=yes
3214                        else
3215                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3216                            ac_cv_have_visibility_class_bug=yes
3217                          fi
3218                        fi
3219                        rm -rf conftest.{c,S}
3220                        ])
3222         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3223                        ac_cv_have_visibility_builtin_bug,
3224                        [cat > conftest.c <<EOF
3225 #pragma GCC visibility push(hidden)
3226 #pragma GCC visibility push(default)
3227 #include <string.h>
3228 #pragma GCC visibility pop
3230 __attribute__ ((visibility ("default"))) void Func() {
3231   char c[[100]];
3232   memset(c, 0, sizeof(c));
3235                        ac_cv_have_visibility_builtin_bug=no
3236                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3237                          ac_cv_have_visibility_builtin_bug=yes
3238                        else
3239                          if test `grep -c "@PLT" conftest.S` = 0; then
3240                            ac_cv_visibility_builtin_bug=yes
3241                          fi
3242                        fi
3243                        rm -f conftest.{c,S}
3244                        ])
3245         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3246                 "$ac_cv_have_visibility_class_bug" = "no"; then
3247           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3248           WRAP_SYSTEM_INCLUDES=1
3249           STL_FLAGS='-I$(DIST)/stl_wrappers'
3250           WRAP_STL_INCLUDES=1
3251         else
3252           VISIBILITY_FLAGS='-fvisibility=hidden'
3253         fi # have visibility pragma bug
3254       fi   # have visibility pragma
3255     fi     # have visibility(default) attribute
3256   fi       # have visibility(hidden) attribute
3257 fi         # GNU_CC
3259 # visibility hidden flag for Sun Studio on Solaris
3260 if test "$SOLARIS_SUNPRO_CC"; then
3261 VISIBILITY_FLAGS='-xldscope=hidden'
3262 fi         # Sun Studio on Solaris
3264 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3265 AC_SUBST(VISIBILITY_FLAGS)
3267 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3268 dnl ========================================================
3269 if test "$GNU_CC"; then
3270   CFLAGS_save="${CFLAGS}"
3271   CFLAGS="${CFLAGS} -Werror"
3272   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3273                  ac_cv_force_align_arg_pointer,
3274                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3275                                  [],
3276                                  ac_cv_force_align_arg_pointer="yes",
3277                                  ac_cv_force_align_arg_pointer="no")])
3278   CFLAGS="${CFLAGS_save}"
3279   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3280     HAVE_GCC_ALIGN_ARG_POINTER=1
3281   else
3282     HAVE_GCC_ALIGN_ARG_POINTER=
3283   fi
3285 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3287 dnl Checks for header files.
3288 dnl ========================================================
3289 AC_HEADER_DIRENT
3290 case "$target_os" in
3291 freebsd*)
3292 # for stuff like -lXshm
3293     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3294     ;;
3295 esac
3296 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3297 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3298 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3299 AC_CHECK_HEADERS(malloc.h)
3300 AC_CHECK_HEADERS(X11/XKBlib.h)
3301 AC_CHECK_HEADERS(io.h)
3303 dnl These are all the places some variant of statfs can be hiding.
3304 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3306 dnl Quota support
3307 AC_CHECK_HEADERS(sys/quota.h)
3308 AC_CHECK_HEADERS(linux/quota.h)
3310 dnl Try for MMX support
3311 dnl NB - later gcc versions require -mmmx for this header to be successfully
3312 dnl included (or another option which implies it, such as -march=pentium-mmx)
3313 AC_CHECK_HEADERS(mmintrin.h)
3315 dnl Check whether the compiler supports the new-style C++ standard
3316 dnl library headers (i.e. <new>) or needs the old "new.h"
3317 AC_LANG_CPLUSPLUS
3318 NEW_H=new.h
3319 AC_CHECK_HEADER(new, [NEW_H=new])
3320 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3321 AC_LANG_C
3323 AC_ARG_ENABLE(dtrace,
3324               [  --enable-dtrace         build with dtrace support if available (default=no)],
3325               [enable_dtrace="yes"],)
3326 if test "x$enable_dtrace" = "xyes"; then
3327   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3328   if test -n "$HAVE_DTRACE"; then
3329       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3330   else
3331       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3332   fi
3334 AC_SUBST(HAVE_DTRACE)
3336 case $target in
3337 *-aix4.3*|*-aix5*)
3338         ;;
3340         AC_CHECK_HEADERS(sys/cdefs.h)
3341         ;;
3342 esac
3344 dnl Checks for libraries.
3345 dnl ========================================================
3346 case $target in
3347 *-hpux11.*)
3348         ;;
3350         AC_CHECK_LIB(c_r, gethostbyname_r)
3351         ;;
3352 esac
3354 dnl We don't want to link with libdl even if it's present on OS X, since
3355 dnl it's not used and not part of the default installation.
3356 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3357 dnl We don't want to link against libm or libpthread on Darwin since
3358 dnl they both are just symlinks to libSystem and explicitly linking
3359 dnl against libSystem causes issues when debugging (see bug 299601).
3360 case $target in
3361 *-darwin*)
3362     ;;
3363 *-beos*)
3364     ;;
3365 *-os2*)
3366     ;;
3368     AC_CHECK_LIB(m, atan)
3369     AC_CHECK_LIB(dl, dlopen,
3370     AC_CHECK_HEADER(dlfcn.h, 
3371         LIBS="-ldl $LIBS"
3372         AC_DEFINE(HAVE_LIBDL)))
3373     ;;
3374 esac
3376 _SAVE_CFLAGS="$CFLAGS"
3377 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3378 AC_CHECK_FUNCS(dladdr)
3379 CFLAGS="$_SAVE_CFLAGS"
3381 if test ! "$GNU_CXX"; then
3383     case $target in
3384     *-aix*)
3385         AC_CHECK_LIB(C_r, demangle)
3386         ;;
3387      *)
3388         AC_CHECK_LIB(C, demangle)
3389         ;;
3390      esac
3393 dnl OS/2 has socket in libc.
3394 case $target in
3395 *-os2*)
3396     ;;
3398     AC_CHECK_LIB(socket, socket)
3399 esac
3401 dnl ========================================================
3402 dnl Check whether we can compile code for Core Text
3403 dnl (available on Mac OS X 10.5 or later)
3404 dnl ========================================================
3405 case "$target" in
3406 *-darwin*)
3407   AC_MSG_CHECKING([for Core Text])
3408   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3409                  [CTLineRef lineRef;],
3410                   ac_cv_have_core_text="yes",
3411                   ac_cv_have_core_text="no")
3412   AC_MSG_RESULT([$ac_cv_have_core_text])
3414   if test "$ac_cv_have_core_text" = "no"; then
3415     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3416   fi
3417   ;;
3418 esac
3420 XLDFLAGS="$X_LIBS"
3421 XLIBS="$X_EXTRA_LIBS"
3423 dnl ========================================================
3424 dnl Checks for X libraries.
3425 dnl Ordering is important.
3426 dnl Xt is dependent upon SM as of X11R6
3427 dnl ========================================================
3428 if test "$no_x" = "yes"; then
3429     AC_DEFINE(NO_X11)
3430 else
3431     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3432         XLIBS="-lX11 $XLIBS"
3433         _SAVE_LDFLAGS="$LDFLAGS"
3434         LDFLAGS="$XLDFLAGS $LDFLAGS"
3435         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3436                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3437         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3438                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3439      
3440         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3441         unset ac_cv_lib_Xt_XtFree
3442             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3443             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3444         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3445                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3446         ])
3448     # AIX needs the motif library linked before libXt to prevent
3449     # crashes in plugins linked against Motif - Bug #98892
3450     case "${target_os}" in
3451     aix*)
3452         XT_LIBS="-lXm $XT_LIBS"
3453         ;;
3454     esac
3456     dnl ========================================================
3457     dnl = Check for XShm
3458     dnl ========================================================
3459     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3460         $XLIBS $XEXT_LIBS)
3461     AC_CHECK_HEADER(X11/extensions/XShm.h)
3462     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3463         test -n "$_HAVE_XSHM_XEXT"; then
3464         AC_DEFINE(HAVE_XSHM)
3465     fi
3467     dnl ========================================================
3468     dnl = Check for XIE
3469     dnl ========================================================
3470     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3471         $XLIBS $XEXT_LIBS)
3472     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3474     if test "$MOZ_XIE_LIBS"; then
3475         dnl ====================================================
3476         dnl = If XIE is present and is desired, turn it on
3477         dnl ====================================================
3478         case $target in
3479             *-hpux*)
3480                 ;;
3481             *)
3482                 HAVE_XIE=1
3483                 ;;
3484         esac
3485     fi
3487         LDFLAGS="$_SAVE_LDFLAGS"
3489     dnl ========================================================
3490     dnl = Check for freetype2 and its functionality
3491     dnl ========================================================
3492     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3494     if test "$_HAVE_FREETYPE2"; then
3495         _SAVE_LIBS="$LIBS"
3496         _SAVE_CFLAGS="$CFLAGS"
3497         LIBS="$LIBS $FT2_LIBS"
3498         CFLAGS="$CFLAGS $FT2_CFLAGS"
3500         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3501             ac_cv_member_FT_Bitmap_Size_y_ppem,
3502             [AC_TRY_COMPILE([#include <ft2build.h>
3503                              #include FT_FREETYPE_H],
3504                             [FT_Bitmap_Size s;
3505                              if (sizeof s.y_ppem) return 0;
3506                              return 1],
3507                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3508                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3509         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3510             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3511         else
3512             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3513         fi
3514         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3515                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3516                            [FT_Bitmap_Size structure includes y_ppem field])
3518         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3520         LIBS="$_SAVE_LIBS"
3521         CFLAGS="$_SAVE_CFLAGS"
3522     fi
3524 fi # $no_x
3526 AC_SUBST(XCFLAGS)
3527 AC_SUBST(XLDFLAGS)
3528 AC_SUBST(XLIBS)
3529 AC_SUBST(XEXT_LIBS)
3530 AC_SUBST(XT_LIBS)
3532 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3533 AC_TRY_COMPILE([],
3534                [asm("uqadd8 r1, r1, r2");],
3535                result="yes", result="no")
3536 AC_MSG_RESULT("$result")
3537 if test "$result" = "yes"; then
3538     AC_DEFINE(HAVE_ARM_SIMD)
3539     HAVE_ARM_SIMD=1
3541 AC_SUBST(HAVE_ARM_SIMD)
3543 AC_MSG_CHECKING(for ARM NEON support in compiler)
3544 _SAVE_CFLAGS="$CFLAGS"
3545 if test "$GNU_CC"; then
3546   # gcc needs -mfpu=neon to recognize NEON instructions
3547   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3549 AC_TRY_COMPILE([],
3550                [asm("vadd.i8 d0, d0, d0");],
3551                result="yes", result="no")
3552 AC_MSG_RESULT("$result")
3553 if test "$result" = "yes"; then
3554     AC_DEFINE(HAVE_ARM_NEON)
3555     HAVE_ARM_NEON=1
3557 CFLAGS="$_SAVE_CFLAGS"
3558 AC_SUBST(HAVE_ARM_NEON)
3560 dnl ========================================================
3561 dnl = pthread support
3562 dnl = Start by checking whether the system support pthreads
3563 dnl ========================================================
3564 case "$target_os" in
3565 darwin*)
3566     USE_PTHREADS=1
3567     ;;
3569     MOZ_CHECK_PTHREADS(pthreads,
3570         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3571         MOZ_CHECK_PTHREADS(pthread,
3572             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3573             MOZ_CHECK_PTHREADS(c_r,
3574                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3575                 MOZ_CHECK_PTHREADS(c,
3576                     USE_PTHREADS=1
3577                 )
3578             )
3579         )
3580     )
3581     ;;
3582 esac
3584 dnl ========================================================
3585 dnl Check the command line for --with-pthreads 
3586 dnl ========================================================
3587 MOZ_ARG_WITH_BOOL(pthreads,
3588 [  --with-pthreads         Force use of system pthread library with NSPR ],
3589 [ if test "$USE_PTHREADS"x = x; then
3590     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3591 fi],
3592     USE_PTHREADS=
3593     _PTHREAD_LDFLAGS=
3596 dnl ========================================================
3597 dnl Do the platform specific pthread hackery
3598 dnl ========================================================
3599 if test "$USE_PTHREADS"x != x
3600 then
3601         dnl
3602         dnl See if -pthread is supported.
3603         dnl
3604         rm -f conftest*
3605         ac_cv_have_dash_pthread=no
3606         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3607         echo 'int main() { return 0; }' | cat > conftest.c
3608         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3609         if test $? -eq 0; then
3610                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3611                         ac_cv_have_dash_pthread=yes
3612                 case "$target_os" in
3613                 freebsd*)
3614 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3615                 ;;
3616                 *)
3617                             CFLAGS="$CFLAGS -pthread"
3618                             CXXFLAGS="$CXXFLAGS -pthread"
3619                 ;;
3620                 esac
3621                 fi
3622         fi
3623         rm -f conftest*
3624     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3626         dnl
3627         dnl See if -pthreads is supported.
3628         dnl
3629     ac_cv_have_dash_pthreads=no
3630     if test "$ac_cv_have_dash_pthread" = "no"; then
3631             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3632         echo 'int main() { return 0; }' | cat > conftest.c
3633             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3634         if test $? -eq 0; then
3635                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3636                             ac_cv_have_dash_pthreads=yes
3637                             CFLAGS="$CFLAGS -pthreads"
3638                             CXXFLAGS="$CXXFLAGS -pthreads"
3639                     fi
3640             fi
3641             rm -f conftest*
3642         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3643     fi
3645         case "$target" in
3646             *-*-freebsd*)
3647                         AC_DEFINE(_REENTRANT)
3648                         AC_DEFINE(_THREAD_SAFE)
3649                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3650                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3651                                 _PTHREAD_LDFLAGS="-pthread"
3652                         else
3653                                 _PTHREAD_LDFLAGS="-lc_r"
3654                         fi
3655                         ;;
3657             *-*-openbsd*|*-*-bsdi*)
3658                         AC_DEFINE(_REENTRANT)
3659                         AC_DEFINE(_THREAD_SAFE)
3660                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3661                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3662                 _PTHREAD_LDFLAGS="-pthread"
3663                         fi
3664                         ;;
3666             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3667                         AC_DEFINE(_REENTRANT) 
3668                         ;;
3670             *-*-nto*) 
3671                         AC_DEFINE(_REENTRANT) 
3672                         ;;
3674             *-aix4.3*|*-aix5*)
3675                         AC_DEFINE(_REENTRANT) 
3676                         ;;
3678             *-hpux11.*)
3679                         AC_DEFINE(_REENTRANT) 
3680                         ;;
3682             alpha*-*-osf*)
3683                         AC_DEFINE(_REENTRANT)
3684                         ;;
3686             *-*-solaris*) 
3687                         AC_DEFINE(_REENTRANT)
3688                         if test "$SOLARIS_SUNPRO_CC"; then
3689                                 CFLAGS="$CFLAGS -mt" 
3690                                 CXXFLAGS="$CXXFLAGS -mt" 
3691                         fi
3692                         ;;
3693         esac
3694     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3697 dnl ========================================================
3698 dnl See if mmap sees writes
3699 dnl For cross compiling, just define it as no, which is a safe default
3700 dnl ========================================================
3701 AC_MSG_CHECKING(whether mmap() sees write()s)
3703 changequote(,)
3704 mmap_test_prog='
3705     #include <stdlib.h>
3706     #include <unistd.h>
3707     #include <sys/mman.h>
3708     #include <sys/types.h>
3709     #include <sys/stat.h>
3710     #include <fcntl.h>
3712     char fname[] = "conftest.file";
3713     char zbuff[1024]; /* Fractional page is probably worst case */
3715     int main() {
3716         char *map;
3717         int fd;
3718         int i;
3719         unlink(fname);
3720         fd = open(fname, O_RDWR | O_CREAT, 0660);
3721         if(fd<0) return 1;
3722         unlink(fname);
3723         write(fd, zbuff, sizeof(zbuff));
3724         lseek(fd, 0, SEEK_SET);
3725         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3726         if(map==(char*)-1) return 2;
3727         for(i=0; fname[i]; i++) {
3728             int rc = write(fd, &fname[i], 1);
3729             if(map[i]!=fname[i]) return 4;
3730         }
3731         return 0;
3732     }
3734 changequote([,])
3736 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3738 AC_MSG_RESULT("$result")
3740 if test "$result" = "no"; then
3741     AC_DEFINE(MMAP_MISSES_WRITES)
3745 dnl Checks for library functions.
3746 dnl ========================================================
3747 AC_PROG_GCC_TRADITIONAL
3748 AC_FUNC_MEMCMP
3749 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3750 AC_CHECK_FUNCS(flockfile getpagesize)
3751 AC_CHECK_FUNCS(localtime_r strtok_r)
3753 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3754 _SAVE_LDFLAGS=$LDFLAGS
3755 LDFLAGS="$LDFLAGS -lrt"
3756 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3757                ac_cv_have_clock_monotonic,
3758                [AC_TRY_LINK([#include <time.h>],
3759                             [ struct timespec ts;
3760                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3761                             ac_cv_have_clock_monotonic=yes,
3762                             ac_cv_have_clock_monotonic=no)])
3763 LDFLAGS=$_SAVE_LDFLAGS
3764 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3765     HAVE_CLOCK_MONOTONIC=1
3766     REALTIME_LIBS=-lrt
3767     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3768     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3769     AC_SUBST(REALTIME_LIBS)
3772 dnl check for wcrtomb/mbrtowc
3773 dnl =======================================================================
3774 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3775 AC_LANG_SAVE
3776 AC_LANG_CPLUSPLUS
3777 AC_CACHE_CHECK(for wcrtomb,
3778     ac_cv_have_wcrtomb,
3779     [AC_TRY_LINK([#include <wchar.h>],
3780                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3781                  ac_cv_have_wcrtomb="yes",
3782                  ac_cv_have_wcrtomb="no")])
3783 if test "$ac_cv_have_wcrtomb" = "yes"; then
3784     AC_DEFINE(HAVE_WCRTOMB)
3786 AC_CACHE_CHECK(for mbrtowc,
3787     ac_cv_have_mbrtowc,
3788     [AC_TRY_LINK([#include <wchar.h>],
3789                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3790                  ac_cv_have_mbrtowc="yes",
3791                  ac_cv_have_mbrtowc="no")])
3792 if test "$ac_cv_have_mbrtowc" = "yes"; then
3793     AC_DEFINE(HAVE_MBRTOWC)
3795 AC_LANG_RESTORE
3798 AC_CACHE_CHECK(
3799     [for res_ninit()],
3800     ac_cv_func_res_ninit,
3801     [AC_TRY_LINK([
3802         #ifdef linux
3803         #define _BSD_SOURCE 1
3804         #endif
3805         #include <resolv.h>
3806         ],
3807         [int foo = res_ninit(&_res);],
3808         [ac_cv_func_res_ninit=yes],
3809         [ac_cv_func_res_ninit=no])
3810     ])
3812 if test "$ac_cv_func_res_ninit" = "yes"; then
3813     AC_DEFINE(HAVE_RES_NINIT)
3814 dnl must add the link line we do something as foolish as this... dougt
3815 dnl else
3816 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3817 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3820 AC_LANG_CPLUSPLUS
3821 AC_CACHE_CHECK(
3822     [for gnu_get_libc_version()],
3823     ac_cv_func_gnu_get_libc_version,
3824     [AC_TRY_LINK([
3825         #ifdef HAVE_GNU_LIBC_VERSION_H
3826         #include <gnu/libc-version.h>
3827         #endif
3828         ],
3829         [const char *glibc_version = gnu_get_libc_version();],
3830         [ac_cv_func_gnu_get_libc_version=yes],
3831         [ac_cv_func_gnu_get_libc_version=no] 
3832         )]
3833     )
3835 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3836     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3839 case $target_os in
3840     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3841         ;;
3842     *)
3843     
3844 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3845     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3846         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3847 _SAVE_LIBS=$LIBS
3848 LIBS="$LIBS $_ICONV_LIBS"
3849 AC_CACHE_CHECK(
3850     [for iconv()],
3851     ac_cv_func_iconv,
3852     [AC_TRY_LINK([
3853         #include <stdlib.h>
3854         #include <iconv.h>
3855         ],
3856         [
3857             iconv_t h = iconv_open("", "");
3858             iconv(h, NULL, NULL, NULL, NULL);
3859             iconv_close(h);
3860         ],
3861         [ac_cv_func_iconv=yes],
3862         [ac_cv_func_iconv=no] 
3863         )]
3864     )
3865 if test "$ac_cv_func_iconv" = "yes"; then
3866     AC_DEFINE(HAVE_ICONV)
3867     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3868     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3869     LIBICONV="$_ICONV_LIBS"
3870     AC_CACHE_CHECK(
3871         [for iconv() with const input],
3872         ac_cv_func_const_iconv,
3873         [AC_TRY_COMPILE([
3874             #include <stdlib.h>
3875             #include <iconv.h>
3876             ],
3877             [
3878                 const char *input = "testing";
3879                 iconv_t h = iconv_open("", "");
3880                 iconv(h, &input, NULL, NULL, NULL);
3881                 iconv_close(h);
3882             ],
3883             [ac_cv_func_const_iconv=yes],
3884             [ac_cv_func_const_iconv=no] 
3885             )]
3886         )
3887     if test "$ac_cv_func_const_iconv" = "yes"; then
3888         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3889     fi
3891 LIBS=$_SAVE_LIBS
3893     ;;
3894 esac
3896 AM_LANGINFO_CODESET
3898 AC_LANG_C
3900 dnl **********************
3901 dnl *** va_copy checks ***
3902 dnl **********************
3903 dnl we currently check for all three va_copy possibilities, so we get
3904 dnl all results in config.log for bug reports.
3905 AC_MSG_CHECKING(for an implementation of va_copy())
3906 AC_CACHE_VAL(ac_cv_va_copy,[
3907     AC_TRY_RUN([
3908         #include <stdarg.h>
3909         void f (int i, ...) {
3910             va_list args1, args2;
3911             va_start (args1, i);
3912             va_copy (args2, args1);
3913             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3914                 exit (1);
3915             va_end (args1); va_end (args2);
3916         }
3917         int main() { f (0, 42); return 0; }],
3918         ac_cv_va_copy=yes,
3919         ac_cv_va_copy=no,
3920         ac_cv_va_copy=no
3921     )
3923 AC_MSG_RESULT($ac_cv_va_copy)
3924 AC_MSG_CHECKING(for an implementation of __va_copy())
3925 AC_CACHE_VAL(ac_cv___va_copy,[
3926     AC_TRY_RUN([
3927         #include <stdarg.h>
3928         void f (int i, ...) {
3929             va_list args1, args2;
3930             va_start (args1, i);
3931             __va_copy (args2, args1);
3932             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3933                 exit (1);
3934             va_end (args1); va_end (args2);
3935         }
3936         int main() { f (0, 42); return 0; }],
3937         ac_cv___va_copy=yes,
3938         ac_cv___va_copy=no,
3939         ac_cv___va_copy=no
3940     )
3942 AC_MSG_RESULT($ac_cv___va_copy)
3943 AC_MSG_CHECKING(whether va_lists can be copied by value)
3944 AC_CACHE_VAL(ac_cv_va_val_copy,[
3945     AC_TRY_RUN([
3946         #include <stdarg.h>
3947         void f (int i, ...) {
3948             va_list args1, args2;
3949             va_start (args1, i);
3950             args2 = args1;
3951             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3952                 exit (1);
3953             va_end (args1); va_end (args2);
3954         }
3955         int main() { f (0, 42); return 0; }],
3956         ac_cv_va_val_copy=yes,
3957         ac_cv_va_val_copy=no,
3958         ac_cv_va_val_copy=yes
3959     )
3961 if test "x$ac_cv_va_copy" = "xyes"; then
3962     AC_DEFINE(VA_COPY, va_copy)
3963     AC_DEFINE(HAVE_VA_COPY)
3964 elif test "x$ac_cv___va_copy" = "xyes"; then
3965     AC_DEFINE(VA_COPY, __va_copy)
3966     AC_DEFINE(HAVE_VA_COPY)
3969 if test "x$ac_cv_va_val_copy" = "xno"; then
3970    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3972 AC_MSG_RESULT($ac_cv_va_val_copy)
3974 dnl Check for dll-challenged libc's.
3975 dnl This check is apparently only needed for Linux.
3976 case "$target" in
3977         *-linux*)
3978             dnl ===================================================================
3979             _curdir=`pwd`
3980             export _curdir
3981             rm -rf conftest* _conftest
3982             mkdir _conftest
3983             cat >> conftest.C <<\EOF
3984 #include <stdio.h>
3985 #include <link.h>
3986 #include <dlfcn.h>
3987 #ifdef _dl_loaded
3988 void __dump_link_map(void) {
3989   struct link_map *map = _dl_loaded;
3990   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3992 int main() {
3993   dlopen("./conftest1.so",RTLD_LAZY);
3994   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3995   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3996   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3997   __dump_link_map();
3999 #else
4000 /* _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).*/
4001 int main() { printf("./conftest1.so\n"); }
4002 #endif
4005             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4007             cat >> conftest1.C <<\EOF
4008 #include <stdio.h>
4009 void foo(void) {printf("foo in dll called\n");}
4011             ${CXX-g++} -fPIC -c -g conftest1.C
4012             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4013             ${CXX-g++} -g conftest.C -o conftest -ldl
4014             cp -f conftest1.so conftest _conftest
4015             cd _conftest
4016             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4017             then
4018                 echo
4019                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4020                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4021                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4022                 echo "*** will be excessive memory usage at runtime."
4023                 echo
4024             fi
4025             cd ${_curdir}
4026             rm -rf conftest* _conftest
4027             dnl ===================================================================
4028             ;;
4029 esac
4031 dnl ===================================================================
4032 dnl ========================================================
4033 dnl Put your C++ language/feature checks below
4034 dnl ========================================================
4035 AC_LANG_CPLUSPLUS
4037 ARM_ABI_PREFIX=
4038 HAVE_GCC3_ABI=
4039 if test "$GNU_CC"; then
4040   if test "$CPU_ARCH" = "arm" ; then
4041     AC_CACHE_CHECK(for ARM EABI,
4042         ac_cv_gcc_arm_eabi,
4043         [AC_TRY_COMPILE([],
4044                         [
4045 #if defined(__ARM_EABI__)
4046   return 0;
4047 #else
4048 #error Not ARM EABI.
4049 #endif
4050                         ],
4051                         ac_cv_gcc_arm_eabi="yes",
4052                         ac_cv_gcc_arm_eabi="no")])
4053     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4054         HAVE_ARM_EABI=1
4055         ARM_ABI_PREFIX=eabi-
4056     else
4057         ARM_ABI_PREFIX=oabi-
4058     fi
4059   fi
4061   AC_CACHE_CHECK(for gcc 3.0 ABI,
4062       ac_cv_gcc_three_abi,
4063       [AC_TRY_COMPILE([],
4064                       [
4065 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4066   return 0;
4067 #else
4068 #error Not gcc3.
4069 #endif
4070                       ],
4071                       ac_cv_gcc_three_abi="yes",
4072                       ac_cv_gcc_three_abi="no")])
4073   if test "$ac_cv_gcc_three_abi" = "yes"; then
4074       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4075       HAVE_GCC3_ABI=1
4076   else
4077       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4078   fi
4080 AC_SUBST(HAVE_GCC3_ABI)
4083 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4084                ac_cv_cpp_explicit,
4085                [AC_TRY_COMPILE(class X {
4086                                public: explicit X(int i) : i_(i) {}
4087                                private: int i_;
4088                                };,
4089                                X x(3);,
4090                                ac_cv_cpp_explicit=yes,
4091                                ac_cv_cpp_explicit=no)])
4092 if test "$ac_cv_cpp_explicit" = yes ; then
4093    AC_DEFINE(HAVE_CPP_EXPLICIT)
4096 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4097                ac_cv_cpp_typename,
4098                [AC_TRY_COMPILE(class param {
4099                                public:
4100                                    typedef unsigned long num_type;
4101                                };
4103                                template <class T> class tplt {
4104                                public:
4105                                    typedef typename T::num_type t_num_type;
4106                                    t_num_type foo(typename T::num_type num) {
4107                                        return num;
4108                                    }
4109                                };,
4110                                tplt<param> A;
4111                                A.foo(0);,
4112                                ac_cv_cpp_typename=yes,
4113                                ac_cv_cpp_typename=no)])
4114 if test "$ac_cv_cpp_typename" = yes ; then
4115    AC_DEFINE(HAVE_CPP_TYPENAME)
4118 dnl Check for support of modern template specialization syntax
4119 dnl Test code and requirement from scc@netscape.com.
4120 dnl Autoconf cut-and-paste job by waterson@netscape.com
4121 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4122                ac_cv_cpp_modern_specialize_template_syntax,
4123                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4124                                class Y {};
4125                                template <> struct X<Y> { double a; };,
4126                                X<int> int_x;
4127                                X<Y> y_x;,
4128                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4129                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4130 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4131   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4135 dnl Some compilers support only full specialization, and some don't.
4136 AC_CACHE_CHECK(whether partial template specialization works,
4137                ac_cv_cpp_partial_specialization,
4138                [AC_TRY_COMPILE(template <class T> class Foo {};
4139                                template <class T> class Foo<T*> {};,
4140                                return 0;,
4141                                ac_cv_cpp_partial_specialization=yes,
4142                                ac_cv_cpp_partial_specialization=no)])
4143 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4144   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4147 dnl Some compilers have limited support for operators with templates;
4148 dnl specifically, it is necessary to define derived operators when a base
4149 dnl class's operator declaration should suffice.
4150 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4151                ac_cv_need_derived_template_operators,
4152                [AC_TRY_COMPILE([template <class T> class Base { };
4153                                 template <class T>
4154                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4155                                 template <class T> class Derived : public Base<T> { };],
4156                                [Derived<char> a, b;
4157                                 Base<char> c = a + b;
4158                                 return 0;],
4159                                ac_cv_need_derived_template_operators=no,
4160                                ac_cv_need_derived_template_operators=yes)])
4161 if test "$ac_cv_need_derived_template_operators" = yes ; then
4162   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4166 dnl Some compilers have trouble detecting that a template class
4167 dnl that derives from another template is actually an instance
4168 dnl of the base class. This test checks for that.
4169 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4170                ac_cv_need_cpp_template_cast_to_base,
4171                [AC_TRY_COMPILE([template <class T> class Base { };
4172                                 template <class T> class Derived : public Base<T> { };
4173                                 template <class T> int foo(const Base<T>&) { return 0; }],
4174                                [Derived<char> bar; return foo(bar);],
4175                                ac_cv_need_cpp_template_cast_to_base=no,
4176                                ac_cv_need_cpp_template_cast_to_base=yes)])
4177 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4178   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4181 dnl Some compilers have trouble resolving the ambiguity between two
4182 dnl functions whose arguments differ only by cv-qualifications.
4183 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4184                ac_cv_can_resolve_const_ambiguity,
4185                [AC_TRY_COMPILE([
4186                                 template <class T> class ptrClass {
4187                                   public: T* ptr;
4188                                 };
4190                                 template <class T> T* a(ptrClass<T> *arg) {
4191                                   return arg->ptr;
4192                                 }
4194                                 template <class T>
4195                                 const T* a(const ptrClass<T> *arg) {
4196                                   return arg->ptr;
4197                                 }
4198                                ],
4199                                [ ptrClass<int> i;
4200                                  a(&i); ],
4201                                ac_cv_can_resolve_const_ambiguity=yes,
4202                                ac_cv_can_resolve_const_ambiguity=no)])
4203 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4204   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4208 dnl We don't do exceptions on unix.  The only reason this used to be here
4209 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4210 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4211 dnl So im commenting this out until someone writes some artificial 
4212 dnl intelligence to detect not only if the compiler has exceptions, but if 
4213 dnl they are enabled as well.
4214 dnl 
4215 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4216 dnl                ac_cv_cpp_exceptions,
4217 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4218 dnl                                static void F() { throw X(); },
4219 dnl                                try { F(); } catch(X & e) { },
4220 dnl                                ac_cv_cpp_exceptions=yes,
4221 dnl                                ac_cv_cpp_exceptions=no)])
4222 dnl if test $ac_cv_cpp_exceptions = yes ; then
4223 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4224 dnl fi
4226 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4227 dnl supports it well enough to allow us to use it to change access, but not
4228 dnl to resolve ambiguity. The next two tests determine how well the |using|
4229 dnl keyword is supported.
4231 dnl Check to see if we can change access with |using|.  Test both a
4232 dnl legal and an illegal example.
4233 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4234                ac_cv_cpp_access_changing_using2,
4235                [AC_TRY_COMPILE(
4236                    class A { protected: int foo() { return 0; } };
4237                    class B : public A { public: using A::foo; };,
4238                    B b; return b.foo();,
4239                    [AC_TRY_COMPILE(
4240                        class A { public: int foo() { return 1; } };
4241                        class B : public A { private: using A::foo; };,
4242                        B b; return b.foo();,
4243                        ac_cv_cpp_access_changing_using2=no,
4244                        ac_cv_cpp_access_changing_using2=yes)],
4245                    ac_cv_cpp_access_changing_using2=no)])
4246 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4247    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4250 dnl Check to see if we can resolve ambiguity with |using|.
4251 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4252                ac_cv_cpp_ambiguity_resolving_using,
4253                [AC_TRY_COMPILE(class X { 
4254                                  public: int go(const X&) {return 3;}
4255                                          int jo(const X&) {return 3;}
4256                                };
4257                                class Y : public X {
4258                                  public:  int go(int) {return 2;}
4259                                           int jo(int) {return 2;}
4260                                           using X::jo;
4261                                  private: using X::go;
4262                                };,
4263                                X x; Y y; y.jo(x);,
4264                                ac_cv_cpp_ambiguity_resolving_using=yes,
4265                                ac_cv_cpp_ambiguity_resolving_using=no)])
4266 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4267    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4270 dnl Check to see if the |std| namespace is supported. If so, we'll want
4271 dnl to qualify any standard library calls with "std::" to ensure that
4272 dnl those functions can be resolved.
4273 AC_CACHE_CHECK(for \"std::\" namespace,
4274                ac_cv_cpp_namespace_std,
4275                [AC_TRY_COMPILE([#include <algorithm>],
4276                                [return std::min(0, 1);],
4277                                ac_cv_cpp_namespace_std=yes,
4278                                ac_cv_cpp_namespace_std=no)])
4279 if test "$ac_cv_cpp_namespace_std" = yes ; then
4280    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4283 dnl Older compilers are overly ambitious with respect to using the standard
4284 dnl template library's |operator!=()| when |operator==()| is defined. In
4285 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4286 dnl ambiguity at compile-time. This test checks for that case.
4287 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4288                ac_cv_cpp_unambiguous_std_notequal,
4289                [AC_TRY_COMPILE([#include <algorithm>
4290                                 struct T1 {};
4291                                 int operator==(const T1&, const T1&) { return 0; }
4292                                 int operator!=(const T1&, const T1&) { return 0; }],
4293                                [T1 a,b; return a != b;],
4294                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4295                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4296 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4297   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4301 AC_CACHE_CHECK(for C++ reinterpret_cast,
4302                ac_cv_cpp_reinterpret_cast,
4303                [AC_TRY_COMPILE(struct X { int i; };
4304                                struct Y { int i; };,
4305                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4306                                ac_cv_cpp_reinterpret_cast=yes,
4307                                ac_cv_cpp_reinterpret_cast=no)])
4308 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4309    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4312 dnl See if a dynamic_cast to void* gives the most derived object.
4313 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4314                ac_cv_cpp_dynamic_cast_void_ptr,
4315                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4316                             class Y { int j; public: virtual ~Y() { } };
4317                             class Z : public X, public Y { int k; };
4319                             int main() {
4320                                  Z mdo;
4321                                  X *subx = (X*)&mdo;
4322                                  Y *suby = (Y*)&mdo;
4323                                  return !((((void*)&mdo != (void*)subx) &&
4324                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4325                                           (((void*)&mdo != (void*)suby) &&
4326                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4327                             }],
4328                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4329                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4330                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4331 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4332    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4336 dnl note that this one is reversed - if the test fails, then
4337 dnl we require implementations of unused virtual methods. Which
4338 dnl really blows because it means we'll have useless vtable
4339 dnl bloat.
4340 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4341                ac_cv_cpp_unused_required,
4342                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4343                                X x;,
4344                                ac_cv_cpp_unused_required=no,
4345                                ac_cv_cpp_unused_required=yes)])
4346 if test "$ac_cv_cpp_unused_required" = yes ; then
4347    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4351 dnl Some compilers have trouble comparing a constant reference to a templatized
4352 dnl class to zero, and require an explicit operator==() to be defined that takes
4353 dnl an int. This test separates the strong from the weak.
4355 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4356                ac_cv_trouble_comparing_to_zero,
4357                [AC_TRY_COMPILE([#include <algorithm>
4358                                 template <class T> class Foo {};
4359                                 class T2;
4360                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4361                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4362                                [Foo<int> f; return (0 != f);],
4363                                ac_cv_trouble_comparing_to_zero=no,
4364                                ac_cv_trouble_comparing_to_zero=yes)])
4365 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4366   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4369 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4370 _SAVE_LDFLAGS=$LDFLAGS
4371 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4372 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4373                ac_cv_thread_keyword,
4374                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4375                             [return tlsIsMainThread;],
4376                             ac_cv_thread_keyword=yes,
4377                             ac_cv_thread_keyword=no)])
4378 LDFLAGS=$_SAVE_LDFLAGS
4379 if test "$ac_cv_thread_keyword" = yes; then
4380   # mips builds fail with TLS variables because of a binutils bug.
4381   # See bug 528687
4382   case "${target}" in
4383     mips*-*)
4384       :
4385       ;;
4386     *-android*)
4387       :
4388       ;;
4389     *)
4390       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4391       ;;
4392   esac
4395 dnl Check for the existence of various allocation headers/functions
4397 MALLOC_H=
4398 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4399 if test "$MALLOC_H" = ""; then
4400   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4401   if test "$MALLOC_H" = ""; then
4402     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4403   fi
4405 if test "$MALLOC_H" != ""; then
4406    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4409 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4410 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4412 dnl See if compiler supports some gcc-style attributes
4414 AC_CACHE_CHECK(for __attribute__((always_inline)),
4415                ac_cv_attribute_always_inline,
4416                [AC_TRY_COMPILE([],
4417                                [inline void f(void) __attribute__((always_inline));],
4418                                ac_cv_attribute_always_inline=yes,
4419                                ac_cv_attribute_always_inline=no)])
4421 AC_CACHE_CHECK(for __attribute__((malloc)),
4422                ac_cv_attribute_malloc,
4423                [AC_TRY_COMPILE([],
4424                                [void* f(int) __attribute__((malloc));],
4425                                ac_cv_attribute_malloc=yes,
4426                                ac_cv_attribute_malloc=no)])
4428 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4429                ac_cv_attribute_warn_unused,
4430                [AC_TRY_COMPILE([],
4431                                [int f(void) __attribute__((warn_unused_result));],
4432                                ac_cv_attribute_warn_unused=yes,
4433                                ac_cv_attribute_warn_unused=no)])
4435 AC_CACHE_CHECK(for __attribute__((noreturn)),
4436                ac_cv_attribute_noreturn,
4437                [AC_TRY_COMPILE([],
4438                                [void f(void) __attribute__((noreturn));],
4439                                ac_cv_attribute_noreturn=yes,
4440                                ac_cv_attribute_noreturn=no)])
4442 dnl End of C++ language/feature checks
4443 AC_LANG_C
4445 dnl ========================================================
4446 dnl =  Internationalization checks
4447 dnl ========================================================
4449 dnl Internationalization and Locale support is different
4450 dnl on various UNIX platforms.  Checks for specific i18n
4451 dnl features go here.
4453 dnl check for LC_MESSAGES
4454 AC_CACHE_CHECK(for LC_MESSAGES,
4455                 ac_cv_i18n_lc_messages,
4456                 [AC_TRY_COMPILE([#include <locale.h>],
4457                                 [int category = LC_MESSAGES;],
4458                                 ac_cv_i18n_lc_messages=yes,
4459                                 ac_cv_i18n_lc_messages=no)])
4460 if test "$ac_cv_i18n_lc_messages" = yes; then
4461    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4464 AC_HAVE_FUNCS(localeconv)
4466 fi # SKIP_COMPILER_CHECKS
4468 TARGET_XPCOM_ABI=
4469 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4470     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4473 dnl Mozilla specific options
4474 dnl ========================================================
4475 dnl The macros used for command line options
4476 dnl are defined in build/autoconf/altoptions.m4.
4478 dnl If the compiler supports these attributes, define them as
4479 dnl convenience macros.
4480 if test "$ac_cv_attribute_always_inline" = yes ; then
4481   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4482 else
4483   AC_DEFINE(NS_ALWAYS_INLINE,)
4486 if test "$ac_cv_attribute_malloc" = yes ; then
4487   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4488 else
4489   AC_DEFINE(NS_ATTR_MALLOC,)
4492 if test "$ac_cv_attribute_warn_unused" = yes ; then
4493   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4494 else
4495   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4498 if test "$ac_cv_attribute_noreturn" = yes ; then
4499   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4500 else
4501   AC_DEFINE(NS_NORETURN,)
4504 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4505 dnl features that Windows actually does support.
4507 if test -n "$SKIP_COMPILER_CHECKS"; then
4508    dnl Windows has malloc.h
4509    AC_DEFINE(MALLOC_H, [<malloc.h>])
4510    AC_DEFINE(HAVE_FORCEINLINE)
4511    AC_DEFINE(HAVE_LOCALECONV)
4512 fi # SKIP_COMPILER_CHECKS
4514 dnl ========================================================
4515 dnl =
4516 dnl = Check for external package dependencies
4517 dnl =
4518 dnl ========================================================
4519 MOZ_ARG_HEADER(External Packages)
4521 MOZ_ENABLE_LIBXUL=1
4523 MOZ_ARG_WITH_STRING(libxul-sdk,
4524 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4525   LIBXUL_SDK_DIR=$withval)
4527 if test "$LIBXUL_SDK_DIR" = "yes"; then
4528     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4529 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4530     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4532     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4533         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4534     fi
4536     MOZ_ENABLE_LIBXUL=1
4538 AC_SUBST(LIBXUL_SDK)
4540 if test -n "$LIBXUL_SDK"; then
4541     LIBXUL_DIST="$LIBXUL_SDK"
4542 else
4543     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4545 AC_SUBST(LIBXUL_DIST)
4547 SYSTEM_LIBXUL=
4549 MOZ_ARG_WITH_BOOL(system-libxul,
4550 [  --with-system-libxul    Use system installed libxul SDK],
4551     SYSTEM_LIBXUL=1)
4553 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4554     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4557 dnl ========================================================
4558 dnl = If NSPR was not detected in the system, 
4559 dnl = use the one in the source tree (mozilla/nsprpub)
4560 dnl ========================================================
4561 MOZ_ARG_WITH_BOOL(system-nspr,
4562 [  --with-system-nspr      Use system installed NSPR],
4563     _USE_SYSTEM_NSPR=1 )
4565 if test -n "$_USE_SYSTEM_NSPR"; then
4566     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4569 if test -n "$MOZ_NATIVE_NSPR"; then
4570     _SAVE_CFLAGS=$CFLAGS
4571     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4572     AC_TRY_COMPILE([#include "prtypes.h"],
4573                 [#ifndef PR_STATIC_ASSERT
4574                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4575                  #endif],
4576                 [MOZ_NATIVE_NSPR=1],
4577                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4578     CFLAGS=$_SAVE_CFLAGS
4579 else
4580     if test "$OS_ARCH" = "WINCE"; then
4581         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
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     elif test "$OS_ARCH" = "WINNT"; then
4584         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4585         if test -n "$GNU_CC"; then
4586             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4587         else
4588             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4589         fi
4590     else
4591         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4592         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4593     fi
4596 dnl system libevent Support
4597 dnl ========================================================
4598 MOZ_ARG_WITH_STRING(system-libevent,
4599 [  --with-system-libevent=[PFX]
4600                           Use system libevent [installed at prefix PFX]],
4601     LIBEVENT_DIR=$withval)
4603 _SAVE_CFLAGS=$CFLAGS
4604 _SAVE_LDFLAGS=$LDFLAGS
4605 _SAVE_LIBS=$LIBS
4606 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4607     MOZ_NATIVE_LIBEVENT=
4608 else
4609     if test "${LIBEVENT_DIR}" = "yes"; then
4610         LIBEVENT_DIR=/usr
4611     fi
4612     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4613     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4614     AC_CHECK_HEADER(event.h,
4615                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4616                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4617                      fi],
4618                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4619     AC_CHECK_LIB(event, event_init,
4620                  [MOZ_NATIVE_LIBEVENT=1
4621                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4622                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4623                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4625 CFLAGS=$_SAVE_CFLAGS
4626 LDFLAGS=$_SAVE_LDFLAGS
4627 LIBS=$_SAVE_LIBS
4629 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4630 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4631 AC_SUBST(MOZ_LIBEVENT_LIBS)
4633 dnl ========================================================
4634 dnl = If NSS was not detected in the system, 
4635 dnl = use the one in the source tree (mozilla/security/nss)
4636 dnl ========================================================
4638 MOZ_ARG_WITH_BOOL(system-nss,
4639 [  --with-system-nss       Use system installed NSS],
4640     _USE_SYSTEM_NSS=1 )
4642 if test -n "$_USE_SYSTEM_NSS"; then
4643     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4646 if test -n "$MOZ_NATIVE_NSS"; then
4647    NSS_LIBS="$NSS_LIBS -lcrmf"
4648 else
4649    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4650    NSS_DEP_LIBS="\
4651         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4652         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4653         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4654         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4655         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4657    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4658        NSS_LIBS="\
4659         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4660         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4661         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4662         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4663         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4664    else
4665        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4666    fi
4669 if test -z "$SKIP_LIBRARY_CHECKS"; then
4670 dnl system JPEG support
4671 dnl ========================================================
4672 MOZ_ARG_WITH_STRING(system-jpeg,
4673 [  --with-system-jpeg[=PFX]
4674                           Use system libjpeg [installed at prefix PFX]],
4675     JPEG_DIR=$withval)
4677 _SAVE_CFLAGS=$CFLAGS
4678 _SAVE_LDFLAGS=$LDFLAGS
4679 _SAVE_LIBS=$LIBS
4680 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4681     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4682     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4684 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4685     SYSTEM_JPEG=
4686 else
4687     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4690 if test "$SYSTEM_JPEG" = 1; then
4691     LIBS="$JPEG_LIBS $LIBS"
4692     AC_TRY_COMPILE([ #include <stdio.h>
4693                      #include <sys/types.h>
4694                      #include <jpeglib.h> ],
4695                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4696                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4697                      #endif ],
4698                    SYSTEM_JPEG=1,
4699                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4700 fi 
4701 CFLAGS=$_SAVE_CFLAGS
4702 LDFLAGS=$_SAVE_LDFLAGS
4703 LIBS=$_SAVE_LIBS
4705 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4706     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4707     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4710 dnl system ZLIB support
4711 dnl ========================================================
4712 MOZ_ARG_WITH_STRING(system-zlib,
4713 [  --with-system-zlib[=PFX]
4714                           Use system libz [installed at prefix PFX]],
4715     ZLIB_DIR=$withval)
4717 _SAVE_CFLAGS=$CFLAGS
4718 _SAVE_LDFLAGS=$LDFLAGS
4719 _SAVE_LIBS=$LIBS
4720 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4721     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4722     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4724 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4725     SYSTEM_ZLIB=
4726 else
4727     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4728         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4730 if test "$SYSTEM_ZLIB" = 1; then
4731     LIBS="$ZLIB_LIBS $LIBS"
4732     AC_TRY_COMPILE([ #include <stdio.h>
4733                      #include <string.h>
4734                      #include <zlib.h> ],
4735                    [ #if ZLIB_VERNUM < $MOZZLIB 
4736                      #error "Insufficient zlib version ($MOZZLIB required)."
4737                      #endif ],
4738                    SYSTEM_ZLIB=1,
4739                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4741 CFLAGS=$_SAVE_CFLAGS
4742 LDFLAGS=$_SAVE_LDFLAGS
4743 LIBS=$_SAVE_LIBS
4745 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4746     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4747     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4750 dnl system BZIP2 Support
4751 dnl ========================================================
4752 MOZ_ARG_WITH_STRING(system-bz2,
4753 [  --with-system-bz2[=PFX]
4754                           Use system libbz2 [installed at prefix PFX]],
4755     BZ2_DIR=$withval)
4757 _SAVE_CFLAGS=$CFLAGS
4758 _SAVE_LDFLAGS=$LDFLAGS
4759 _SAVE_LIBS=$LIBS
4760 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4761     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4762     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4764 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4765     SYSTEM_BZ2=
4766 else
4767     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4768         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4770 CFLAGS=$_SAVE_CFLAGS
4771 LDFLAGS=$_SAVE_LDFLAGS
4772 LIBS=$_SAVE_LIBS
4774 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4775     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4776     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4779 dnl system PNG Support
4780 dnl ========================================================
4781 MOZ_ARG_WITH_STRING(system-png, 
4782 [  --with-system-png[=PFX]
4783                           Use system libpng [installed at prefix PFX]],
4784     PNG_DIR=$withval)
4786 _SAVE_CFLAGS=$CFLAGS
4787 _SAVE_LDFLAGS=$LDFLAGS
4788 _SAVE_LIBS=$LIBS
4789 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4790 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4791 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4792     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4793     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4795 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4796     SYSTEM_PNG=
4797 else
4798     _SAVE_PNG_LIBS=$PNG_LIBS
4799     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4800                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4801                  $PNG_LIBS)
4802     AC_CHECK_LIB(png, png_get_acTL, ,
4803                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4804                  $_SAVE_PNG_LIBS)
4806 if test "$SYSTEM_PNG" = 1; then
4807     LIBS="$PNG_LIBS $LIBS"
4808     AC_TRY_COMPILE([ #include <stdio.h>
4809                      #include <sys/types.h>
4810                      #include <png.h> ],
4811                    [ #if PNG_LIBPNG_VER < $MOZPNG
4812                      #error "Insufficient libpng version ($MOZPNG required)."
4813                      #endif
4814                      #ifndef PNG_UINT_31_MAX
4815                      #error "Insufficient libpng version."
4816                      #endif ],
4817                    SYSTEM_PNG=1,
4818                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4820 CFLAGS=$_SAVE_CFLAGS
4821 LDFLAGS=$_SAVE_LDFLAGS
4822 LIBS=$_SAVE_LIBS
4824 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4825     PNG_CFLAGS="-I${PNG_DIR}/include"
4826     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4829 fi # SKIP_LIBRARY_CHECKS
4831 dnl system HunSpell Support
4832 dnl ========================================================
4833 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4834 [  --enable-system-hunspell
4835                           Use system hunspell (located with pkgconfig)],
4836     SYSTEM_HUNSPELL=1 )
4838 if test -n "$SYSTEM_HUNSPELL"; then
4839     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4842 AC_SUBST(SYSTEM_HUNSPELL)
4844 dnl ========================================================
4845 dnl Java SDK support
4846 dnl ========================================================
4847 JAVA_INCLUDE_PATH=
4848 MOZ_ARG_WITH_STRING(java-include-path,
4849 [  --with-java-include-path=dir
4850                           Location of Java SDK headers],
4851     JAVA_INCLUDE_PATH=$withval)
4853 JAVA_BIN_PATH=
4854 MOZ_ARG_WITH_STRING(java-bin-path,
4855 [  --with-java-bin-path=dir
4856                           Location of Java binaries (java, javac, jar)],
4857     JAVA_BIN_PATH=$withval)
4859 dnl ========================================================
4860 dnl =
4861 dnl = Application
4862 dnl =
4863 dnl ========================================================
4865 MOZ_ARG_HEADER(Application)
4867 BUILD_STATIC_LIBS=
4868 ENABLE_TESTS=1
4869 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4870 MOZ_BRANDING_DIRECTORY=
4871 MOZ_OFFICIAL_BRANDING=
4872 MOZ_FEEDS=1
4873 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4874 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4875 MOZ_INSTALLER=1
4876 MOZ_IPC=1
4877 MOZ_JAVAXPCOM=
4878 MOZ_JSDEBUGGER=1
4879 MOZ_JSLOADER=1
4880 MOZ_MATHML=1
4881 MOZ_MORK=
4882 MOZ_MORKREADER=1
4883 MOZ_AUTH_EXTENSION=1
4884 MOZ_NO_ACTIVEX_SUPPORT=1
4885 MOZ_NO_INSPECTOR_APIS=
4886 MOZ_NO_FAST_LOAD=
4887 MOZ_OGG=1
4888 MOZ_SYDNEYAUDIO=
4889 MOZ_VORBIS=
4890 MOZ_WAVE=1
4891 MOZ_MEDIA=
4892 MOZ_WEBM=1
4893 VPX_AS=
4894 VPX_ASFLAGS=
4895 VPX_X86_ASM=
4896 MOZ_PANGO=1
4897 MOZ_PERMISSIONS=1
4898 MOZ_PLACES=1
4899 MOZ_PLAINTEXT_EDITOR_ONLY=
4900 MOZ_PLUGINS=1
4901 MOZ_PREF_EXTENSIONS=1
4902 MOZ_PROFILELOCKING=1
4903 MOZ_PSM=1
4904 MOZ_RDF=1
4905 MOZ_REFLOW_PERF=
4906 MOZ_SAFE_BROWSING=
4907 MOZ_FASTSTART=
4908 MOZ_HELP_VIEWER=
4909 MOZ_SPELLCHECK=1
4910 MOZ_SPLASHSCREEN=
4911 MOZ_STORAGE=1
4912 MOZ_SVG=1
4913 MOZ_THUMB2=
4914 MOZ_TIMELINE=
4915 MOZ_TOOLKIT_SEARCH=1
4916 MOZ_UI_LOCALE=en-US
4917 MOZ_UNIVERSALCHARDET=1
4918 MOZ_URL_CLASSIFIER=
4919 MOZ_USE_NATIVE_UCONV=
4920 MOZ_VIEW_SOURCE=1
4921 MOZ_XSLT_STANDALONE=
4922 MOZ_XTF=1
4923 MOZ_XUL=1
4924 MOZ_ZIPWRITER=1
4925 NS_PRINTING=1
4926 NSS_DISABLE_DBM=
4927 NECKO_WIFI=1
4928 NECKO_COOKIES=1
4929 NECKO_DISK_CACHE=1
4930 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource"
4931 USE_ARM_KUSER=
4932 BUILD_CTYPES=1
4933 XPC_IDISPATCH_SUPPORT=
4936 case "$target_os" in
4937 darwin*|*wince*|*winmo*)
4938     ACCESSIBILITY=
4939     ;;
4941     ACCESSIBILITY=1
4942     ;;
4943 esac
4945 case "$target_os" in
4946     msvc*|mks*|cygwin*|mingw*)
4947         NS_ENABLE_TSF=1
4948         if test -z "$GNU_CC"; then 
4949             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4950                 NS_ENABLE_TSF=
4951             fi
4952         fi
4953         if test -n "$NS_ENABLE_TSF"; then
4954             AC_DEFINE(NS_ENABLE_TSF)
4955         fi
4956         ;;
4957 esac
4959 case "${target}" in
4960     arm-android-eabi)
4961         NSS_DISABLE_DBM=1
4962         USE_ARM_KUSER=1
4963         MOZ_INSTALLER=
4964         MOZ_CRASHREPORTER=
4965         NS_PRINTING=
4966         NECKO_WIFI=
4967         MOZ_THUMB2=1
4968         MOZ_THEME_FASTSTRIPE=1
4969         MOZ_TREE_FREETYPE=1
4970         MOZ_MEMORY=1
4971         ;;
4972 esac
4974 MOZ_ARG_ENABLE_STRING(application,
4975 [  --enable-application=APP
4976                           Options include:
4977                             browser (Firefox)
4978                             xulrunner
4979                             content/xslt (Standalone Transformiix XSLT)
4980                             netwerk (Standalone Necko)
4981                             tools/update-packaging (AUS-related packaging tools)
4982                             standalone (use this for standalone
4983                               xpcom/xpconnect or to manually drive a build)],
4984 [ MOZ_BUILD_APP=$enableval ] )
4986 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4987 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4988   XULRUNNER_STUB_NAME=$withval)
4990 if test -z "$XULRUNNER_STUB_NAME"; then
4991   case "$target_os" in
4992   darwin*)
4993     XULRUNNER_STUB_NAME=xulrunner
4994     ;;
4995   *)
4996     XULRUNNER_STUB_NAME=xulrunner-stub
4997   esac
4999 AC_SUBST(XULRUNNER_STUB_NAME)
5001 if test -z "$MOZ_BUILD_APP"; then
5002   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5003 else
5004   # We have a valid application only if it has a build.mk file in its top
5005   # directory.
5006   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5007     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5008   fi
5011 # Allow the application to influence configure with a confvars.sh script.
5013 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5014 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5015   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5016   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5017 else
5018   AC_MSG_RESULT([no])
5021 # Now is a good time to test for logic errors, define mismatches, etc.
5022 case "$MOZ_BUILD_APP" in
5023 xulrunner)
5024   if test "$LIBXUL_SDK"; then
5025     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5026   fi
5027   ;;
5028 esac
5030 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5031 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5032 # MOZ_BUILD_APP.
5033 case "$MOZ_BUILD_APP" in
5034 browser)
5035   AC_DEFINE(MOZ_PHOENIX)
5036   ;;
5038 xulrunner)
5039   AC_DEFINE(MOZ_XULRUNNER)
5040   ;;
5042 content/xslt)
5043   AC_DEFINE(TX_EXE)
5044   ;;
5046 standalone) 
5047   MOZ_APP_NAME=mozilla
5048   MOZ_APP_DISPLAYNAME=Mozilla
5049   MOZ_APP_VERSION=$MOZILLA_VERSION
5050   ;;
5052 esac
5054 AC_SUBST(MOZ_BUILD_APP)
5055 AC_SUBST(MOZ_PHOENIX)
5056 AC_SUBST(MOZ_XULRUNNER)
5058 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5060 dnl ========================================================
5061 dnl = 
5062 dnl = Toolkit Options
5063 dnl = 
5064 dnl ========================================================
5065 MOZ_ARG_HEADER(Toolkit Options)
5067     dnl ========================================================
5068     dnl = Select the default toolkit
5069     dnl ========================================================
5070         MOZ_ARG_ENABLE_STRING(default-toolkit,
5071         [  --enable-default-toolkit=TK
5072                           Select default toolkit
5073                           Platform specific defaults:
5074                             BeOS - cairo-beos
5075                             Mac OS X - cairo-cocoa
5076                             Neutrino/QNX - photon
5077                             OS/2 - cairo-os2
5078                             Win32/WinCE - cairo-windows
5079                             Gtk2 with DirectFB - cairo-gtk2-dfb
5080                             * - cairo-gtk2
5081                             * - cairo-qt],
5082     [ _DEFAULT_TOOLKIT=$enableval ],
5083     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5085     if test "$_DEFAULT_TOOLKIT" = "photon" \
5086         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5087         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5088         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5089         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5090         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5091         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5092         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5093         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5094         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5095     then
5096         dnl nglayout only supports building with one toolkit,
5097         dnl so ignore everything after the first comma (",").
5098         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5099     else
5100         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5101     fi
5103 dnl ========================================================
5104 dnl = Enable the toolkit as needed                         =
5105 dnl ========================================================
5107 case "$MOZ_WIDGET_TOOLKIT" in
5108 photon)
5109         MOZ_ENABLE_PHOTON=1
5110         AC_DEFINE(MOZ_WIDGET_PHOTON)
5111     ;;
5113 cairo-windows)
5114     MOZ_WIDGET_TOOLKIT=windows
5115     MOZ_WEBGL=1
5116     case "${target}" in
5117     *-wince*)
5118         NS_PRINTING=
5119         ;;
5120     esac
5121     ;;
5123 cairo-gtk2|cairo-gtk2-x11)
5124     MOZ_WIDGET_TOOLKIT=gtk2
5125     MOZ_ENABLE_GTK2=1
5126     MOZ_ENABLE_XREMOTE=1
5127     MOZ_WEBGL=1
5128     MOZ_WEBGL_GLX=1
5130     AC_DEFINE(MOZ_X11)
5131     MOZ_X11=1
5132     USE_FC_FREETYPE=1
5134     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5135     TK_LIBS='$(MOZ_GTK2_LIBS)'
5136     AC_DEFINE(MOZ_WIDGET_GTK2)
5137     ;;
5139 cairo-gtk2-dfb)
5140     MOZ_WIDGET_TOOLKIT=gtk2
5141     MOZ_ENABLE_GTK2=1
5142     MOZ_WEBGL=
5144     AC_DEFINE(MOZ_DFB)
5145     MOZ_DFB=1
5147     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5148     TK_LIBS='$(MOZ_GTK2_LIBS)'
5149     AC_DEFINE(MOZ_WIDGET_GTK2)
5150     if test "$no_x" != "yes"; then
5151         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5152         no_x=yes
5153     fi
5154     ;;
5156 cairo-qt)
5157     MOZ_WIDGET_TOOLKIT=qt
5158     MOZ_ENABLE_QT=1
5159     MOZ_ENABLE_XREMOTE=1
5160     MOZ_WEBGL=1
5161     MOZ_WEBGL_GLX=1
5162     USE_ELF_DYNSTR_GC=
5163     NS_PRINTING=
5165     AC_DEFINE(MOZ_X11)
5166     MOZ_X11=1
5167     USE_FC_FREETYPE=1
5169     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5170     TK_LIBS='$(MOZ_QT_LIBS)'
5171     AC_DEFINE(MOZ_WIDGET_QT)
5172     ;;
5174 cairo-beos)
5175     MOZ_WIDGET_TOOLKIT=beos
5176     USE_FC_FREETYPE=1
5177     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5178     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5179     ;;
5181 cairo-os2)
5182     MOZ_WIDGET_TOOLKIT=os2
5183     USE_FC_FREETYPE=1
5184     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5185     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5186     ;;
5188 cairo-cocoa)
5189     MOZ_WIDGET_TOOLKIT=cocoa
5190     AC_DEFINE(MOZ_WIDGET_COCOA)
5191     MOZ_USER_DIR="Mozilla"
5192     AC_DEFINE(XP_MACOSX)
5193     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5194     TK_CFLAGS="-DNO_X11"
5195     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5196     CFLAGS="$CFLAGS $TK_CFLAGS"
5197     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5198     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5199     MOZ_FS_LAYOUT=bundle
5200     MOZ_WEBGL=1
5201     ;;
5203 cairo-android)
5204     AC_DEFINE(MOZ_WIDGET_ANDROID)
5205     MOZ_WIDGET_TOOLKIT=android
5206     MOZ_WEBGL=
5207     ;;
5209 esac
5211 if test "$MOZ_ENABLE_XREMOTE"; then
5212     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5215 if test "$COMPILE_ENVIRONMENT"; then
5216   if test "$MOZ_ENABLE_GTK2"; then
5217     if test "$MOZ_X11"; then
5218       GDK_PACKAGES=gdk-x11-2.0
5219     elif test "$MOZ_DFB"; then
5220       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5221       GDK_PACKAGES=directfb
5222     fi
5224     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5225   fi
5227 fi # COMPILE_ENVIRONMENT
5229 AC_SUBST(MOZ_FS_LAYOUT)
5231 dnl ========================================================
5232 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5233 dnl their usage and use them in spidermonkey.
5234 dnl ========================================================
5235 MOZ_ARG_WITH_BOOL(arm-kuser,
5236 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5237     USE_ARM_KUSER=1,)
5238 if test -n "$USE_ARM_KUSER"; then
5239    AC_DEFINE(USE_ARM_KUSER)
5242 dnl ========================================================
5243 dnl = startup-notification support module
5244 dnl ========================================================
5246 if test "$MOZ_ENABLE_GTK2"
5247 then
5248     MOZ_ENABLE_STARTUP_NOTIFICATION=
5250     MOZ_ARG_ENABLE_BOOL(startup-notification,
5251     [  --enable-startup-notification
5252                           Enable startup-notification support (default: disabled) ],
5253         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5254         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5255     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5256     then
5257         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5258                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5259         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5260             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5261             then
5262                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5263             fi
5264             MOZ_ENABLE_STARTUP_NOTIFICATION=
5265         ])
5266     fi
5268     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5269         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5270     fi
5272     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5274 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5275 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5276 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5278 dnl ========================================================
5279 dnl = QT support
5280 dnl ========================================================
5281 if test "$MOZ_ENABLE_QT"
5282 then
5283     MOZ_ARG_WITH_STRING(qtdir,
5284     [  --with-qtdir=\$dir       Specify Qt directory ],
5285     [ QTDIR=$withval])
5287     if test -z "$QTDIR"; then
5288         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5289         AC_CHECK_PROGS(HOST_MOC, moc, "")
5290     else
5291         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5293         MOZ_QT_CFLAGS="-DQT_SHARED"
5294         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5295         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5296         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5297         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5298         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5299         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5300         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5301         HOST_MOC="$QTDIR/bin/moc"
5302     fi
5303     if test -z "$HOST_MOC"; then
5304         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5305 incorrect])
5306     fi
5307     MOC=$HOST_MOC
5310 AC_SUBST(GTK_CONFIG)
5311 AC_SUBST(TK_CFLAGS)
5312 AC_SUBST(TK_LIBS)
5314 AC_SUBST(MOZ_ENABLE_GTK2)
5315 AC_SUBST(MOZ_ENABLE_PHOTON)
5316 AC_SUBST(MOZ_ENABLE_QT)
5317 AC_SUBST(MOZ_ENABLE_XREMOTE)
5318 AC_SUBST(MOZ_GTK2_CFLAGS)
5319 AC_SUBST(MOZ_GTK2_LIBS)
5320 AC_SUBST(MOZ_QT_CFLAGS)
5321 AC_SUBST(MOZ_QT_LIBS)
5323 AC_SUBST(MOC)
5325 AC_SUBST(MOZ_DFB)
5326 AC_SUBST(MOZ_X11)
5328 dnl ========================================================
5329 dnl =
5330 dnl = Components & Features
5331 dnl = 
5332 dnl ========================================================
5333 MOZ_ARG_HEADER(Components and Features)
5335 dnl ========================================================
5336 dnl = Localization
5337 dnl ========================================================
5338 MOZ_ARG_ENABLE_STRING(ui-locale,
5339 [  --enable-ui-locale=ab-CD
5340                           Select the user interface locale (default: en-US)],
5341     MOZ_UI_LOCALE=$enableval )
5342 AC_SUBST(MOZ_UI_LOCALE)
5344 dnl ========================================================
5345 dnl = Trademarked Branding 
5346 dnl ========================================================
5347 MOZ_ARG_ENABLE_BOOL(official-branding,
5348 [  --enable-official-branding
5349                           Enable Official mozilla.org Branding
5350                           Do not distribute builds with
5351                           --enable-official-branding unless you have
5352                           permission to use trademarks per
5353                           http://www.mozilla.org/foundation/trademarks/ .],
5355   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5356     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5357   else
5358     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5359     MOZ_OFFICIAL_BRANDING=1
5360   fi
5361 ], MOZ_OFFICIAL_BRANDING=)
5363 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5364 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5365   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5368 MOZ_ARG_WITH_STRING(branding,
5369 [  --with-branding=dir     Use branding from the specified directory.],
5370     MOZ_BRANDING_DIRECTORY=$withval)
5372 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5373 if test -z "$REAL_BRANDING_DIRECTORY"; then
5374   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5377 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5378   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5381 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5383 dnl ========================================================
5384 dnl = Distribution ID
5385 dnl ========================================================
5386 MOZ_ARG_WITH_STRING(distribution-id,
5387 [  --with-distribution-id=ID
5388                           Set distribution-specific id (default=org.mozilla)],
5389 [ val=`echo $withval`
5390     MOZ_DISTRIBUTION_ID="$val"])
5392 if test -z "$MOZ_DISTRIBUTION_ID"; then
5393    MOZ_DISTRIBUTION_ID="org.mozilla"
5396 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5397 AC_SUBST(MOZ_DISTRIBUTION_ID)
5400 dnl ========================================================
5401 dnl complex text support off by default
5402 dnl ========================================================
5403 MOZ_ARG_DISABLE_BOOL(pango,
5404 [  --disable-pango         Disable usage of Pango ],
5405     MOZ_PANGO=,
5406     MOZ_PANGO=1)
5408 dnl ========================================================
5409 dnl = Pango
5410 dnl ========================================================
5411 if test "$MOZ_ENABLE_GTK2"
5412 then
5413     AC_SUBST(MOZ_PANGO)
5415     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5417     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5418     AC_SUBST(MOZ_PANGO_CFLAGS)
5419     AC_SUBST(MOZ_PANGO_LIBS)
5420     if test "$MOZ_PANGO"
5421     then
5422         AC_DEFINE(MOZ_PANGO)
5423     else
5424         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5425         AC_SUBST(FT2_CFLAGS)
5426         AC_SUBST(FT2_LIBS)
5427     fi
5430 if test "$MOZ_ENABLE_QT"
5431 then
5432     if test "$MOZ_PANGO"
5433     then
5434         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5435         [
5436             AC_SUBST(MOZ_PANGO_CFLAGS)
5437             AC_SUBST(MOZ_PANGO_LIBS)
5438             AC_DEFINE(MOZ_PANGO)
5439         ],
5440         [
5441             echo "Pango library not found, will use FT2 font engine"
5442             MOZ_PANGO=
5443         ])
5444     fi
5445     AC_SUBST(MOZ_PANGO)
5448 dnl ========================================================
5449 dnl = GnomeVFS, GIO and GConf support module
5450 dnl ========================================================
5452 if test "$MOZ_X11"
5453 then
5454     dnl build the gnomevfs extension by default only when the
5455     dnl GTK2 toolkit is in use.
5456     if test "$MOZ_ENABLE_GTK2"
5457     then
5458         MOZ_ENABLE_GNOMEVFS=1
5459         MOZ_ENABLE_GCONF=1
5460     fi
5462     dnl ========================================================
5463     dnl = GnomeVFS support module
5464     dnl ========================================================
5465     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5466     [  --disable-gnomevfs      Disable GnomeVFS support ],
5467         MOZ_ENABLE_GNOMEVFS=,
5468         MOZ_ENABLE_GNOMEVFS=force)
5470     if test "$MOZ_ENABLE_GNOMEVFS"
5471     then
5472         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5473             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5474             MOZ_ENABLE_GNOMEVFS=1
5475             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5476         ],[
5477             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5478             then
5479                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5480             fi
5481             MOZ_ENABLE_GNOMEVFS=
5482         ])
5483     else
5484         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5485             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5486               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5487             ])
5488         fi
5489     fi
5491     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5492     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5493     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5495     dnl ========================================================
5496     dnl = GIO support module
5497     dnl ========================================================
5498     MOZ_ARG_ENABLE_BOOL(gio,
5499     [  --enable-gio            Enable GIO support (default: disabled)],
5500         MOZ_ENABLE_GIO=force,
5501         MOZ_ENABLE_GIO=)
5503     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5504     then
5505         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5506             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5507             MOZ_ENABLE_GIO=1
5508             AC_DEFINE(MOZ_ENABLE_GIO)
5509         ],[
5510             if test "$MOZ_ENABLE_GIO" = "force"
5511             then
5512                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5513             fi
5514             MOZ_ENABLE_GIO=
5515         ])
5516     fi
5518     AC_SUBST(MOZ_ENABLE_GIO)
5519     AC_SUBST(MOZ_GIO_CFLAGS)
5520     AC_SUBST(MOZ_GIO_LIBS)
5521    
5522     dnl ========================================================
5523     dnl = GConf support module
5524     dnl ========================================================
5525     if test "$MOZ_ENABLE_GCONF"
5526     then
5527         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5528             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5529             MOZ_ENABLE_GCONF=1
5530         ],[
5531             if test "$MOZ_ENABLE_GCONF" = "force"
5532             then
5533                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5534             fi
5535             MOZ_ENABLE_GCONF=
5536         ])
5537     fi
5539     if test "$MOZ_ENABLE_GCONF"; then
5540         AC_DEFINE(MOZ_ENABLE_GCONF)
5541     fi
5543     AC_SUBST(MOZ_ENABLE_GCONF)
5544     AC_SUBST(MOZ_GCONF_CFLAGS)
5545     AC_SUBST(MOZ_GCONF_LIBS)
5548 dnl ========================================================
5549 dnl = libnotify support
5550 dnl ========================================================
5552 if test "$MOZ_ENABLE_GTK2"
5553 then
5554     MOZ_ENABLE_LIBNOTIFY=1
5556     MOZ_ARG_DISABLE_BOOL(libnotify,
5557     [  --disable-libnotify     Disable libnotify support ],
5558     MOZ_ENABLE_LIBNOTIFY=,
5559     MOZ_ENABLE_LIBNOTIFY=1)
5561     if test "$MOZ_ENABLE_LIBNOTIFY"
5562     then
5563         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5564     fi
5567 if test -z "$SKIP_LIBRARY_CHECKS"
5568 then
5569     if test "$MOZ_ENABLE_GTK2"
5570     then
5571         if test "$MOZ_ENABLE_LIBNOTIFY"
5572         then
5573             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5574         fi
5575     fi
5577 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5578 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5579 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5581 dnl ========================================================
5582 dnl = GNOME component (mozgnome)
5583 dnl ========================================================
5585 # The GNOME component is built if one of 
5586 # gnome-vfs, gio, gconf or libnotify is available.
5587 if test "$MOZ_ENABLE_GCONF" || \
5588    test "$MOZ_ENABLE_GNOMEVFS" || \
5589    test "$MOZ_ENABLE_GIO" || \
5590    test "$MOZ_ENABLE_LIBNOTIFY"; then
5591     MOZ_ENABLE_GNOME_COMPONENT=1
5592 else
5593     MOZ_ENABLE_GNOME_COMPONENT=
5595 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5597 dnl ========================================================
5598 dnl = libgnomeui support module
5599 dnl ========================================================
5601 if test "$MOZ_ENABLE_GTK2"
5602 then
5603     MOZ_ENABLE_GNOMEUI=1
5605     MOZ_ARG_DISABLE_BOOL(gnomeui,
5606     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5607         MOZ_ENABLE_GNOMEUI=,
5608         MOZ_ENABLE_GNOMEUI=force)
5610     if test "$MOZ_ENABLE_GNOMEUI"
5611     then
5612         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5613         [
5614             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5615             MOZ_ENABLE_GNOMEUI=1
5616         ],[
5617             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5618             then
5619                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5620             fi
5621             MOZ_ENABLE_GNOMEUI=
5622         ])
5623     fi
5625     if test "$MOZ_ENABLE_GNOMEUI"; then
5626         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5627     fi
5630 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5631 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5632 AC_SUBST(MOZ_GNOMEUI_LIBS)
5634 dnl ========================================================
5635 dnl = dbus support
5636 dnl ========================================================
5638 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5639 then
5640     MOZ_ENABLE_DBUS=1
5642     MOZ_ARG_DISABLE_BOOL(dbus,
5643     [  --disable-dbus          Disable dbus support ],
5644         MOZ_ENABLE_DBUS=,
5645         MOZ_ENABLE_DBUS=1)
5647     if test "$MOZ_ENABLE_DBUS"
5648     then
5649         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5650         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5651         AC_DEFINE(MOZ_ENABLE_DBUS)
5652     fi
5654 AC_SUBST(MOZ_ENABLE_DBUS)
5655 AC_SUBST(MOZ_DBUS_CFLAGS)
5656 AC_SUBST(MOZ_DBUS_LIBS)
5657 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5658 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5660 dnl ========================================================
5661 dnl = Build Personal Security Manager
5662 dnl ========================================================
5663 MOZ_ARG_DISABLE_BOOL(crypto,
5664 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5665     MOZ_PSM=,
5666     MOZ_PSM=1 )
5668 dnl ========================================================
5669 dnl = JS Debugger XPCOM component (js/jsd)
5670 dnl ========================================================
5671 MOZ_ARG_DISABLE_BOOL(jsd,
5672 [  --disable-jsd           Disable JavaScript debug library],
5673     MOZ_JSDEBUGGER=,
5674     MOZ_JSDEBUGGER=1)
5677 dnl ========================================================
5678 dnl = Disable IPC support for tabs and plugins
5679 dnl ========================================================
5680 case "${target}" in
5681 *-wince*)
5682     MOZ_IPC=
5683     ;;
5684 esac
5686 MOZ_ARG_DISABLE_BOOL(ipc,
5687 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5688     MOZ_IPC=,
5689     MOZ_IPC=1)
5691 if test -n "$MOZ_IPC"; then
5692     AC_DEFINE(MOZ_IPC)
5695 AC_SUBST(MOZ_IPC)
5697 dnl ========================================================
5698 dnl = Enable IPDL's "expensive" unit tests
5699 dnl ========================================================
5700 MOZ_IPDL_TESTS=
5702 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5703 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5704     MOZ_IPDL_TESTS=1,
5705     MOZ_IPDL_TESTS=)
5707 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5708     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5711 if test -n "$MOZ_IPDL_TESTS"; then
5712     AC_DEFINE(MOZ_IPDL_TESTS)
5715 AC_SUBST(MOZ_IPDL_TESTS)
5717 dnl ========================================================
5718 dnl = Disable plugin support
5719 dnl ========================================================
5720 MOZ_ARG_DISABLE_BOOL(plugins,
5721 [  --disable-plugins       Disable plugins support],
5722     MOZ_PLUGINS=,
5723     MOZ_PLUGINS=1)
5725 dnl ========================================================
5726 dnl = Disable building dbm
5727 dnl ========================================================
5728 MOZ_ARG_DISABLE_BOOL(dbm,
5729 [  --disable-dbm       Disable building dbm],
5730     NSS_DISABLE_DBM=1,
5731     NSS_DISABLE_DBM=)
5733 dnl bi-directional support always on
5734 IBMBIDI=1
5735 AC_DEFINE(IBMBIDI)
5737 dnl ========================================================
5738 dnl view source support on by default
5739 dnl ========================================================
5740 if test "$MOZ_VIEW_SOURCE"; then
5741     AC_DEFINE(MOZ_VIEW_SOURCE)
5744 dnl ========================================================
5745 dnl accessibility support on by default on all platforms 
5746 dnl except OS X.
5747 dnl ========================================================
5748 MOZ_ARG_DISABLE_BOOL(accessibility,
5749 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5750     ACCESSIBILITY=,
5751     ACCESSIBILITY=1 )
5752 if test "$ACCESSIBILITY"; then
5753     AC_DEFINE(ACCESSIBILITY)
5756 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5757 case "$target" in
5758 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5759     if test "$ac_cv_header_atlbase_h" = "no"; then
5760         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.])
5761     fi
5762     if test "$ac_cv_header_oleacc_idl" = "no"; then
5763         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.])
5764     fi
5765     ;;
5766 esac
5769 dnl ========================================================
5770 dnl xpcom js loader support on by default
5771 dnl ========================================================
5772 if test "$MOZ_JSLOADER"; then
5773     AC_DEFINE(MOZ_JSLOADER)
5776 dnl ========================================================
5777 dnl Disable printing
5778 dnl ========================================================
5779 MOZ_ARG_DISABLE_BOOL(printing,
5780 [  --disable-printing      Disable printing support],
5781     NS_PRINTING=,
5782     NS_PRINTING=1)
5784 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5785     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5786     NS_PRINTING=
5789 if test "$NS_PRINTING"; then
5790     AC_DEFINE(NS_PRINTING)
5791     AC_DEFINE(NS_PRINT_PREVIEW)
5793 dnl ========================================================
5794 dnl use native unicode converters
5795 dnl ========================================================
5796 MOZ_ARG_ENABLE_BOOL(native-uconv,
5797 [  --enable-native-uconv   Enable iconv support],
5798     MOZ_USE_NATIVE_UCONV=1,
5799     MOZ_USE_NATIVE_UCONV= )
5800 if test "$MOZ_USE_NATIVE_UCONV"; then
5801     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5803 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5804     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5808 dnl ========================================================
5809 dnl Libeditor can be build as plaintext-only,
5810 dnl or as a full html and text editing component.
5811 dnl We build both by default.
5812 dnl ========================================================
5813 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5814 [  --enable-plaintext-editor-only
5815                           Allow only plaintext editing],
5816     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5817     MOZ_PLAINTEXT_EDITOR_ONLY= )
5818 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5819 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5821 dnl ========================================================
5822 dnl = Disable Fast Load
5823 dnl ========================================================
5824 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5825 [  --disable-xpcom-fastload
5826                           Disable XPCOM fastload support],
5827     MOZ_NO_FAST_LOAD=1,
5828     MOZ_NO_FAST_LOAD=)
5830 AC_SUBST(MOZ_NO_FAST_LOAD)
5832 if test -n "$MOZ_NO_FAST_LOAD"; then
5833     AC_DEFINE(MOZ_NO_FAST_LOAD)
5836 dnl ========================================================
5837 dnl = Disable Ogg Codecs
5838 dnl ========================================================
5839 MOZ_ARG_DISABLE_BOOL(ogg,
5840 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5841     MOZ_OGG=,
5842     MOZ_OGG=1)
5844 if test -n "$MOZ_OGG"; then
5845     AC_DEFINE(MOZ_OGG)
5846     MOZ_SYDNEYAUDIO=1
5847     MOZ_MEDIA=1
5848     MOZ_VORBIS=1
5850     dnl Checks for __attribute__(aligned()) directive
5851     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5852         [ac_cv_c_attribute_aligned],
5853         [ac_cv_c_attribute_aligned=0
5854          CFLAGS_save="${CFLAGS}"
5855          CFLAGS="${CFLAGS} -Werror"
5856          for ac_cv_c_attr_align_try in 64 32 16 8; do
5857            echo "trying $ac_cv_c_attr_align_try"
5858            AC_TRY_COMPILE([],
5859                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5860                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5861            if test "$ac_cv_c_attribute_aligned" != 0; then
5862              break;
5863            fi
5864          done
5865            CFLAGS="${CFLAGS_save}"])
5866     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5867       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5868                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5869     fi
5872 dnl ========================================================
5873 dnl = Disable VP8 decoder support
5874 dnl ========================================================
5875 MOZ_ARG_DISABLE_BOOL(webm,
5876 [  --disable-webm         Disable support for WebM media (VP8 video and Vorbis audio)],
5877     MOZ_WEBM=,
5878     MOZ_WEBM=1)
5880 if test -n "$MOZ_WEBM"; then
5881     AC_DEFINE(MOZ_WEBM)
5882     MOZ_SYDNEYAUDIO=1
5883     MOZ_MEDIA=1
5884     MOZ_VORBIS=1
5886     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5887     dnl For Win32 (MSVC) we must use MASM.
5888     if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" = "x86" -a -z "$GNU_CC"; then
5889         AC_MSG_CHECKING([for MASM assembler])
5890         AC_CHECK_PROGS(VPX_AS, ml, "")
5891         if test -n "$VPX_AS"; then
5892           VPX_X86_ASM=1
5893           VPX_AS='sh $(topsrcdir)/media/libvpx/yasm2masm-as.sh'
5894         else
5895             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])
5896         fi
5897     else 
5899       dnl For Darwin x86, Darwin x86_64, Linux x86, and WINNT x86_64
5900       dnl we can use YASM.
5901       AC_MSG_CHECKING([for YASM assembler])
5902       AC_CHECK_PROGS(VPX_AS, yasm, "")
5903       if test -n "$VPX_AS"; then
5904         dnl We have YASM, see if we have assembly on this platform.  
5905         case "$OS_ARCH:$OS_TEST" in
5906         Linux:x86|Linux:i?86)
5907           VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5908           VPX_X86_ASM=1
5909         ;;
5910         Linux:x86_64)
5911           VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5912           VPX_X86_ASM=1
5913         ;;
5914         SunOS:i?86)
5915           VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5916           VPX_X86_ASM=1
5917         ;;
5918         SunOS:x86_64)
5919           VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5920           VPX_X86_ASM=1
5921         ;;
5922         Darwin:i?86)
5923           VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5924           VPX_X86_ASM=1
5925         ;;
5926         Darwin:x86_64)
5927           VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5928           VPX_X86_ASM=1
5929         ;;
5930         WINNT:x86_64)
5931           if test -z "$GNU_CC"; then
5932             VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5933             VPX_X86_ASM=1
5934           fi
5935         ;;
5936         esac
5937       fi # end have YASM
5938     fi # end !WINNT_x86_MSVC
5940     if test -n "$VPX_X86_ASM"; then
5941       AC_DEFINE(VPX_X86_ASM)
5942     else
5943       AC_MSG_WARN([No assembler or assembly support for libvpx, using unoptimized C routines.])
5944     fi
5947 dnl ========================================================
5948 dnl = Disable Wave decoder support
5949 dnl ========================================================
5950 MOZ_ARG_DISABLE_BOOL(wave,
5951 [  --disable-wave          Disable Wave decoder support],
5952     MOZ_WAVE=,
5953     MOZ_WAVE=1)
5955 if test -n "$MOZ_WAVE"; then
5956     AC_DEFINE(MOZ_WAVE)
5957     MOZ_SYDNEYAUDIO=1
5958     MOZ_MEDIA=1
5961 dnl ========================================================
5962 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5963 dnl ========================================================
5965 if test -n "$MOZ_SYDNEYAUDIO"; then
5966     AC_DEFINE(MOZ_SYDNEYAUDIO)
5969 if test -n "$MOZ_MEDIA"; then
5970     AC_DEFINE(MOZ_MEDIA)
5973 if test -n "$MOZ_VORBIS"; then
5974     AC_DEFINE(MOZ_VORBIS)
5977 dnl ========================================================
5978 dnl = Check alsa availability on Linux if using sydneyaudio
5979 dnl ========================================================
5981 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5982 if test -n "$MOZ_SYDNEYAUDIO"; then
5983    case "$target_os" in
5984 linux*)
5985       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5986          [echo "$MOZ_ALSA_PKG_ERRORS"
5987           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.)])])
5988       ;;
5989    esac
5992 dnl ========================================================
5993 dnl Splashscreen
5994 dnl ========================================================
5995 AC_ARG_ENABLE(splashscreen,
5996               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5997               [enable_splash="yes"],[enable_splash=""])
5998 if test "x$enable_splash" = "xyes"; then
5999   MOZ_SPLASHSCREEN=1
6000   AC_DEFINE(MOZ_SPLASHSCREEN)
6002 AC_SUBST(MOZ_SPLASHSCREEN)
6004 dnl ========================================================
6005 dnl Permissions System
6006 dnl ========================================================
6007 MOZ_ARG_DISABLE_BOOL(permissions,
6008 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6009     MOZ_PERMISSIONS=,
6010     MOZ_PERMISSIONS=1
6013 dnl ========================================================
6014 dnl NegotiateAuth
6015 dnl ========================================================
6016 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6017 [  --disable-negotiateauth Disable GSS-API negotiation ],
6018     MOZ_AUTH_EXTENSION=,
6019     MOZ_AUTH_EXTENSION=1 )
6021 dnl ========================================================
6022 dnl XTF
6023 dnl ========================================================
6024 MOZ_ARG_DISABLE_BOOL(xtf,
6025 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6026     MOZ_XTF=,
6027     MOZ_XTF=1 )
6028 if test "$MOZ_XTF"; then
6029   AC_DEFINE(MOZ_XTF)
6032 dnl ========================================================
6033 dnl Pref extensions (autoconfig and system-pref)
6034 dnl ========================================================
6035 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6036 [  --disable-pref-extensions
6037                           Disable pref extensions such as autoconfig and
6038                           system-pref],
6039   MOZ_PREF_EXTENSIONS=,
6040   MOZ_PREF_EXTENSIONS=1 )
6042 dnl ========================================================
6043 dnl = Universalchardet
6044 dnl ========================================================
6045 MOZ_ARG_DISABLE_BOOL(universalchardet,
6046 [  --disable-universalchardet
6047                           Disable universal encoding detection],
6048   MOZ_UNIVERSALCHARDET=,
6049   MOZ_UNIVERSALCHARDET=1 )
6051 dnl ========================================================
6052 dnl JavaXPCOM
6053 dnl ========================================================
6054 case "${target}" in
6055 *-wince*)
6056     MOZ_JAVAXPCOM=
6057     ;;
6058 esac
6060 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6061 [  --enable-javaxpcom
6062                           Enable Java-XPCOM bridge],
6063     MOZ_JAVAXPCOM=1,
6064     MOZ_JAVAXPCOM=)
6066 case "$host_os" in
6067   cygwin*|msvc*|mks*)
6068     if test -n "$JAVA_HOME"; then
6069       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6070     fi
6071     ;;
6072   *mingw*)
6073     if test -n "$JAVA_HOME"; then
6074       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6075     fi
6076     ;;
6077 esac
6079 if test -n "${JAVA_BIN_PATH}"; then
6080   dnl Look for javac and jar in the specified path.
6081   JAVA_PATH="$JAVA_BIN_PATH"
6082 else
6083   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6084   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6087 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6088 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6089 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6091 if test -n "${JAVA_BIN_PATH}" || test "$OS_TARGET" = Android; then
6092   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
6093     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}])
6094   fi
6097 if test -n "${MOZ_JAVAXPCOM}"; then
6098   if test -n "${JAVA_INCLUDE_PATH}"; then
6099     dnl Make sure jni.h exists in the given include path.
6100     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6101       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6102     fi
6103   else
6104     case "$target_os" in
6105       darwin*)
6106         dnl Default to java system location
6107         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6108         ;;
6109       *)
6110         dnl Try $JAVA_HOME
6111         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6112         ;;
6113     esac
6114     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6115       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.])
6116     fi
6117   fi
6120 dnl ========================================================
6121 dnl = Breakpad crash reporting (on by default on supported platforms)
6122 dnl ========================================================
6124 case $target in
6125 i?86-*-mingw*)
6126   MOZ_CRASHREPORTER=1
6127   ;;
6128 i?86-apple-darwin*|powerpc-apple-darwin*)
6129   MOZ_CRASHREPORTER=1
6130   ;;
6131 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6132   MOZ_CRASHREPORTER=1
6133   ;;
6134 *solaris*)
6135   MOZ_CRASHREPORTER=1
6136   ;;
6137 esac
6139 MOZ_ARG_DISABLE_BOOL(crashreporter,
6140 [  --disable-crashreporter Disable breakpad crash reporting],
6141     MOZ_CRASHREPORTER=,
6142     MOZ_CRASHREPORTER=1)
6144 if test -n "$MOZ_CRASHREPORTER"; then
6145    AC_DEFINE(MOZ_CRASHREPORTER)
6147   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
6148     test -z "$SKIP_LIBRARY_CHECKS"; then
6149     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6150     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6151     AC_SUBST(MOZ_GTHREAD_LIBS)
6153     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.])])
6154   fi
6157 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6158 [  --with-crashreporter-enable-percent=NN
6159                           Enable sending crash reports by default on NN% of users. (default=100)],
6160 [ val=`echo $withval | sed 's/[^0-9]//g'`
6161     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6163 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6164    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6166 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6168 dnl ========================================================
6169 dnl = Enable compilation of specific extension modules
6170 dnl ========================================================
6172 MOZ_ARG_ENABLE_STRING(extensions,
6173 [  --enable-extensions     Enable extensions],
6174 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6175     if test "$option" = "yes" || test "$option" = "all"; then
6176         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6177     elif test "$option" = "no" || test "$option" = "none"; then
6178         MOZ_EXTENSIONS=""
6179     elif test "$option" = "default"; then
6180         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6181     elif test `echo "$option" | grep -c \^-` != 0; then
6182         option=`echo $option | sed 's/^-//'`
6183         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6184     else
6185         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6186     fi
6187 done],
6188     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6190 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6191     # Suppress warning on non-X11 platforms
6192     if test -n "$MOZ_X11"; then
6193         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6194     fi
6195     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6198 dnl Do not build gnomevfs with libxul based apps
6199 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6200     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6203 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6204     # Suppress warning on non-X11 platforms
6205     if test -n "$MOZ_X11"; then
6206         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6207     fi
6208     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6211 dnl Do not build gio with libxul based apps
6212 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6213     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6216 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6217     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6218     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6221 dnl This might be temporary: build tridentprofile only on Windows
6222 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6223     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6224     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6227 dnl cookie must be built before tridentprofile. put it at list's end.
6228 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6229   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6230   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6233 dnl xforms requires xtf and schema-validation
6234 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6235     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6236     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6238 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6239     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
6240     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6243 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6244     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6245     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6248 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6249     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6250     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6253 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6254     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6255     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6258 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6259     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6260     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6263 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6264     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6265     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6268 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6269     AC_MSG_WARN([spellcheck is no longer an extension.])
6270     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6273 dnl Remove dupes
6274 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6276 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6277 dnl when trying to build a nonexistent extension.
6278 for extension in $MOZ_EXTENSIONS; do
6279     if test ! -d "${srcdir}/extensions/${extension}"; then
6280         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6281     fi
6282 done
6285 dnl ========================================================
6286 dnl Image decoders
6287 dnl ========================================================
6288 case "$MOZ_WIDGET_TOOLKIT" in
6289 beos|windows|os2|mac|cocoa)
6290     ;;
6292     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6293        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6294     fi
6295     ;;
6296 esac
6298 MOZ_ARG_ENABLE_STRING(image-decoders,
6299 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
6300                           Enable specific image decoders],
6301 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6302     if test "$option" = "yes" || test "$option" = "all"; then
6303         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6304     elif test "$option" = "no" || test "$option" = "none"; then
6305         MOZ_IMG_DECODERS=""
6306     elif test "$option" = "default"; then
6307         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6308     elif test `echo "$option" | grep -c \^-` != 0; then
6309         option=`echo $option | sed 's/^-//'`
6310         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6311     else
6312         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6313     fi
6314 done],
6315     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6317 dnl Dupes are removed in the encoder section because it will also add decoders
6319 dnl ========================================================
6320 dnl Image encoders
6321 dnl ========================================================
6322 MOZ_ARG_ENABLE_STRING(image-encoders,
6323 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6324                           Enable specific image encoders],
6325 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6326     if test "$option" = "yes" || test "$option" = "all"; then
6327         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6328     elif test "$option" = "no" || test "$option" = "none"; then
6329         MOZ_IMG_ENCODERS=""
6330         addencoder=""
6331     elif test "$option" = "default"; then
6332         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6333     elif test `echo "$option" | grep -c \^-` != 0; then
6334         option=`echo $option | sed 's/^-//'`
6335         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6336     else
6337         addencoder="$option"
6338     fi
6339     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6340 done],
6341     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6343 dnl Remove dupes
6344 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6345 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6347 dnl ========================================================
6348 dnl MathML on by default
6349 dnl ========================================================
6350 MOZ_ARG_DISABLE_BOOL(mathml,
6351 [  --disable-mathml        Disable MathML support],
6352     MOZ_MATHML=,
6353     MOZ_MATHML=1 )
6354 if test "$MOZ_MATHML"; then
6355   AC_DEFINE(MOZ_MATHML)
6358 dnl ========================================================
6359 dnl SVG
6360 dnl ========================================================
6361 MOZ_ARG_DISABLE_BOOL(svg,
6362 [  --disable-svg           Disable SVG support],
6363     MOZ_SVG=,
6364     MOZ_SVG=1 )
6365 if test -n "$MOZ_SVG"; then
6366   AC_DEFINE(MOZ_SVG)
6369 dnl ========================================================
6370 dnl SMIL
6371 dnl ========================================================
6372 MOZ_SMIL=1
6373 MOZ_ARG_DISABLE_BOOL(smil,
6374 [  --disable-smil          Disable SMIL animation support],
6375     MOZ_SMIL=,
6376     MOZ_SMIL=1 )
6377 # Automatically disable SMIL if SVG is disabled
6378 if test -z "$MOZ_SVG"; then
6379   MOZ_SMIL=
6381 if test -n "$MOZ_SMIL"; then
6382   AC_DEFINE(MOZ_SMIL)
6385 dnl ========================================================
6386 dnl Build Freetype in the tree
6387 dnl ========================================================
6388 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6389 [  --enable-tree-freetype  Enable Tree FreeType],
6390     MOZ_TREE_FREETYPE=1,
6391     MOZ_TREE_FREETYPE= )
6392 if test -n "$MOZ_TREE_FREETYPE"; then
6393    AC_DEFINE(MOZ_TREE_FREETYPE)
6394    AC_SUBST(MOZ_TREE_FREETYPE)
6395    MOZ_ENABLE_CAIRO_FT=1       
6396    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6397    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6398    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6399    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6400    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6401    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6402    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6403    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6404    AC_SUBST(CAIRO_FT_CFLAGS)
6408 dnl ========================================================
6409 dnl Installer
6410 dnl ========================================================
6411 case "$target_os" in
6412     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6413         MOZ_INSTALLER=1
6414         ;;
6415 esac
6417 MOZ_ARG_DISABLE_BOOL(installer,
6418 [  --disable-installer     Disable building of installer],
6419     MOZ_INSTALLER=,
6420     MOZ_INSTALLER=1)
6421 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6422     # Disable installer for Windows builds that use the new toolkit if the
6423     # required major version and minimum minor version of Unicode NSIS isn't in
6424     # the path.
6425     REQ_NSIS_MAJOR_VER=2
6426     MIN_NSIS_MINOR_VER=33
6427     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6428     if test -z "$MAKENSISU" || test "$MAKENSISU" = ":"; then
6429         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.])
6430     fi
6431     changequote(,)
6432     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6433     changequote([,])
6434     if test ! "$MAKENSISU_VER" == ""; then
6435         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6436         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6437     fi
6438     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6439     if test "$MAKENSISU_VER" == "" ||
6440        test ! "$MAKENSISU_MAJOR_VER" == "$REQ_NSIS_MAJOR_VER" ||
6441        test ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6442         AC_MSG_RESULT([no])
6443         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.])
6444     fi
6445     AC_MSG_RESULT([yes])
6446     MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6448     # The Windows build for NSIS requires the iconv command line utility to
6449     # convert the charset of the locale files.
6450     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6451     if test -z "$HOST_ICONV"; then
6452         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6453     fi
6456 AC_SUBST(MOZ_INSTALLER)
6458 AC_MSG_CHECKING([for tar archiver])
6459 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6460 if test -z "$TAR"; then
6461     AC_MSG_ERROR([no tar archiver found in \$PATH])
6463 AC_MSG_RESULT([$TAR])
6464 AC_SUBST(TAR)
6466 AC_MSG_CHECKING([for wget])
6467 AC_CHECK_PROGS(WGET, wget, "")
6468 AC_MSG_RESULT([$WGET])
6469 AC_SUBST(WGET)
6471 dnl ========================================================
6472 dnl Updater
6473 dnl ========================================================
6475 MOZ_ARG_DISABLE_BOOL(updater,
6476 [  --disable-updater       Disable building of updater],
6477     MOZ_UPDATER=,
6478     MOZ_UPDATER=1 )
6480 if test -n "$MOZ_UPDATER"; then
6481     AC_DEFINE(MOZ_UPDATER)
6484 # app update channel is 'default' when not supplied.
6485 MOZ_ARG_ENABLE_STRING([update-channel],
6486 [  --enable-update-channel=CHANNEL
6487                           Select application update channel (default=default)],
6488     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6490 if test -z "$MOZ_UPDATE_CHANNEL"; then
6491     MOZ_UPDATE_CHANNEL=default
6493 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6494 AC_SUBST(MOZ_UPDATE_CHANNEL)
6496 # tools/update-packaging is not checked out by default.
6497 MOZ_ARG_ENABLE_BOOL(update-packaging,
6498 [  --enable-update-packaging
6499                           Enable tools/update-packaging],
6500     MOZ_UPDATE_PACKAGING=1,
6501     MOZ_UPDATE_PACKAGING= )
6502 AC_SUBST(MOZ_UPDATE_PACKAGING)
6504 dnl ========================================================
6505 dnl ActiveX
6506 dnl ========================================================
6508 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6509 [  --disable-xpconnect-idispatch
6510                           Disable building of xpconnect support for IDispatch
6511                           (win32 only)],
6512     XPC_IDISPATCH_SUPPORT=,
6513     XPC_IDISPATCH_SUPPORT=1)
6514 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6516 MOZ_ARG_DISABLE_BOOL(activex,
6517 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6518     MOZ_NO_ACTIVEX_SUPPORT=1,
6519     MOZ_NO_ACTIVEX_SUPPORT= )
6520 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6522 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6523 [  --enable-activex-scripting
6524                           Enable building of ActiveX scripting support (win32)],
6525     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6526     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6527 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6529 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6530 then
6531     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6534 if test "$COMPILE_ENVIRONMENT" = "1"; then
6535 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6536 case "$target" in
6537 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6538     if test "$ac_cv_header_atlbase_h" = "no"; then
6539         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.])
6540     fi
6541     ;;
6542 esac
6546 dnl ========================================================
6547 dnl leaky
6548 dnl ========================================================
6549 MOZ_ARG_ENABLE_BOOL(leaky,
6550 [  --enable-leaky          Build leaky memory tool],
6551     MOZ_LEAKY=1,
6552     MOZ_LEAKY=)
6555 dnl ========================================================
6556 dnl build the tests by default
6557 dnl ========================================================
6558 MOZ_ARG_DISABLE_BOOL(tests,
6559 [  --disable-tests         Do not build test libraries & programs],
6560     ENABLE_TESTS=,
6561     ENABLE_TESTS=1 )
6563 dnl ========================================================
6564 dnl parental controls (for Windows Vista)
6565 dnl ========================================================
6566 MOZ_ARG_DISABLE_BOOL(parental-controls,
6567 [  --disable-parental-controls
6568                           Do not build parental controls],
6569    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6570    MOZ_DISABLE_PARENTAL_CONTROLS=)
6571 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6572     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6575 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6577 dnl ========================================================
6578 dnl =
6579 dnl = Module specific options
6580 dnl =
6581 dnl ========================================================
6582 MOZ_ARG_HEADER(Individual module options)
6584 dnl ========================================================
6585 dnl = Disable feed handling components
6586 dnl ========================================================
6587 MOZ_ARG_DISABLE_BOOL(feeds,
6588 [  --disable-feeds         Disable feed handling and processing components],
6589     MOZ_FEEDS=,
6590     MOZ_FEEDS=1 )
6591 if test -n "$MOZ_FEEDS"; then
6592     AC_DEFINE(MOZ_FEEDS)
6593 else
6594     if test "$MOZ_BUILD_APP" = "browser"; then
6595         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6596     fi
6599 dnl ========================================================
6600 dnl = Enable mozStorage
6601 dnl ========================================================
6602 dnl Implicitly enabled by default if building calendar or places
6603 MOZ_ARG_ENABLE_BOOL(storage,
6604 [  --enable-storage        Enable mozStorage module and related components],
6605     MOZ_STORAGE=1,
6606     MOZ_STORAGE= )
6607 if test -n "$MOZ_STORAGE"; then
6608     AC_DEFINE(MOZ_STORAGE)
6611 dnl ========================================================
6612 dnl Check for sqlite
6613 dnl ========================================================
6615 MOZ_NATIVE_SQLITE=
6616 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6617 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6618 MOZ_NATIVE_SQLITE=1,
6619 MOZ_NATIVE_SQLITE= )
6621 if test -z "$MOZ_NATIVE_SQLITE"
6622 then
6623     SQLITE_CFLAGS=
6624     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6625 else
6626     dnl ============================
6627     dnl === SQLite Version check ===
6628     dnl ============================
6629     dnl Check to see if the system SQLite package is new enough.
6630     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6632     dnl ==================================
6633     dnl === SQLITE_SECURE_DELETE check ===
6634     dnl ==================================
6635     dnl Check to see if the system SQLite package is compiled with
6636     dnl SQLITE_SECURE_DELETE enabled.
6637     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6638     _SAVE_CFLAGS="$CFLAGS"
6639     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6640     _SAVE_LIBS="$LIBS"
6641     LIBS="$LIBS $SQLITE_LIBS"
6642     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6643         AC_TRY_RUN([
6644             #include "sqlite3.h"
6646             int main(int argc, char **argv){
6647               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6648             }],
6649             ac_cv_sqlite_secure_delete=yes,
6650             ac_cv_sqlite_secure_delete=no,
6651             ac_cv_sqlite_secure_delete=no
6652         )
6653     ])
6654     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6655     CFLAGS="$_SAVE_CFLAGS"
6656     LIBS="$_SAVE_LIBS"
6657     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6658         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6659     fi
6661     dnl ===============================
6662     dnl === SQLITE_THREADSAFE check ===
6663     dnl ===============================
6664     dnl Check to see if the system SQLite package is compiled with
6665     dnl SQLITE_THREADSAFE enabled.
6666     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6667     _SAVE_CFLAGS="$CFLAGS"
6668     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6669     _SAVE_LIBS="$LIBS"
6670     LIBS="$LIBS $SQLITE_LIBS"
6671     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6672         AC_TRY_RUN([
6673             #include "sqlite3.h"
6675             int main(int argc, char **argv){
6676               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6677             }],
6678             ac_cv_sqlite_threadsafe=yes,
6679             ac_cv_sqlite_threadsafe=no,
6680             ac_cv_sqlite_threadsafe=no
6681         )
6682     ])
6683     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6684     CFLAGS="$_SAVE_CFLAGS"
6685     LIBS="$_SAVE_LIBS"
6686     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6687         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6688     fi
6690     dnl ================================
6691     dnl === SQLITE_ENABLE_FTS3 check ===
6692     dnl ================================
6693     dnl check to see if the system SQLite package is compiled with
6694     dnl SQLITE_ENABLE_FTS3 enabled.
6695     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6696     _SAVE_CFLAGS="$CFLAGS"
6697     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6698     _SAVE_LIBS="$LIBS"
6699     LIBS="$LIBS $SQLITE_LIBS"
6700     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6701         AC_TRY_RUN([
6702             #include "sqlite3.h"
6704             int main(int argc, char **argv){
6705               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6706             }],
6707             ac_cv_sqlite_enable_fts3=yes,
6708             ac_cv_sqlite_enable_fts3=no,
6709             ac_cv_sqlite_enable_fts3=no
6710         )
6711     ])
6712     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6713     CFLAGS="$_SAVE_CFLAGS"
6714     LIBS="$_SAVE_LIBS"
6715     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6716         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6717     fi
6719     dnl =========================================
6720     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6721     dnl =========================================
6722     dnl check to see if the system SQLite package is compiled with
6723     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6724     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6725     _SAVE_CFLAGS="$CFLAGS"
6726     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6727     _SAVE_LIBS="$LIBS"
6728     LIBS="$LIBS $SQLITE_LIBS"
6729     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6730         AC_TRY_RUN([
6731             #include "sqlite3.h"
6733             int main(int argc, char **argv){
6734               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6735             }],
6736             ac_cv_sqlite_enable_unlock_notify=yes,
6737             ac_cv_sqlite_enable_unlock_notify=no,
6738             ac_cv_sqlite_enable_unlock_notify=no
6739         )
6740     ])
6741     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6742     CFLAGS="$_SAVE_CFLAGS"
6743     LIBS="$_SAVE_LIBS"
6744     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6745         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6746     fi
6749 AC_SUBST(MOZ_NATIVE_SQLITE)
6751 dnl ========================================================
6752 dnl = Enable help viewer (off by default)
6753 dnl ========================================================
6754 if test -n "$MOZ_HELP_VIEWER"; then
6755      dnl Do this if defined in confvars.sh
6756      AC_DEFINE(MOZ_HELP_VIEWER)
6759 dnl ========================================================
6760 dnl = Enable safe browsing (anti-phishing)
6761 dnl ========================================================
6762 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6763 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6764     MOZ_SAFE_BROWSING=1,
6765     MOZ_SAFE_BROWSING= )
6766 if test -n "$MOZ_SAFE_BROWSING"; then
6767     AC_DEFINE(MOZ_SAFE_BROWSING)
6769 AC_SUBST(MOZ_SAFE_BROWSING)
6771 dnl ========================================================
6772 dnl = Enable faststart component
6773 dnl ========================================================
6774 MOZ_ARG_ENABLE_BOOL(faststart,
6775 [  --enable-faststart      Enable the faststart component],
6776     MOZ_FASTSTART=1,
6777     MOZ_FASTSTART= )
6778 if test -n "$MOZ_FASTSTART"; then
6779     AC_DEFINE(MOZ_FASTSTART)
6781 AC_SUBST(MOZ_FASTSTART)
6783 dnl ========================================================
6784 dnl = Enable url-classifier
6785 dnl ========================================================
6786 dnl Implicitly enabled by default if building with safe-browsing
6787 if test -n "$MOZ_SAFE_BROWSING"; then
6788     MOZ_URL_CLASSIFIER=1
6790 MOZ_ARG_ENABLE_BOOL(url-classifier,
6791 [  --enable-url-classifier Enable url classifier module],
6792     MOZ_URL_CLASSIFIER=1,
6793     MOZ_URL_CLASSIFIER= )
6794 if test -n "$MOZ_URL_CLASSIFIER"; then
6795     AC_DEFINE(MOZ_URL_CLASSIFIER)
6797 AC_SUBST(MOZ_URL_CLASSIFIER)
6799 dnl ========================================================
6800 dnl = Disable zipwriter
6801 dnl ========================================================
6802 MOZ_ARG_DISABLE_BOOL(zipwriter,
6803 [  --disable-zipwriter     Disable zipwriter component],
6804     MOZ_ZIPWRITER=,
6805     MOZ_ZIPWRITER=1 )
6806 AC_SUBST(MOZ_ZIPWRITER)
6808 dnl ========================================================
6809 dnl = Disable libconic
6810 dnl ========================================================
6811 MOZ_ENABLE_LIBCONIC=1
6812 MOZ_ARG_DISABLE_BOOL(libconic,
6813 [  --disable-libconic      Disable libconic],
6814     MOZ_ENABLE_LIBCONIC=,
6815     MOZ_ENABLE_LIBCONIC=1 )
6817 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6818     PKG_CHECK_MODULES(LIBCONIC, conic,
6819                       MOZ_ENABLE_LIBCONIC=1,
6820                       MOZ_ENABLE_LIBCONIC=)
6822 if test "$MOZ_ENABLE_LIBCONIC"; then
6823     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6826 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6827 AC_SUBST(LIBCONIC_CFLAGS)
6828 AC_SUBST(LIBCONIC_LIBS)
6830 dnl ========================================================
6831 dnl = Maemo checks
6832 dnl ========================================================
6834 MAEMO_SDK_TARGET_VER=-1
6836 MOZ_ARG_WITH_STRING(maemo-version,
6837 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6838                           Maemo SDK Version],
6839   MAEMO_SDK_TARGET_VER=$withval)
6841 case "$MAEMO_SDK_TARGET_VER" in
6843     MOZ_PLATFORM_MAEMO=5
6844     ;;
6847     MOZ_PLATFORM_MAEMO=6
6848     ;;
6851     dnl We aren't compiling for Maemo, move on.
6852     ;;
6854     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6855     ;;
6856 esac
6858 if test $MOZ_PLATFORM_MAEMO; then
6859    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6861    if test -z "$MOZ_ENABLE_DBUS"; then
6862        AC_MSG_ERROR([DBus is required when building for Maemo])
6863    fi
6865    MOZ_GFX_OPTIMIZE_MOBILE=1
6866    MOZ_WEBGL_GLX=
6867    MOZ_MAEMO_LIBLOCATION=
6869    if test $MOZ_PLATFORM_MAEMO = 5; then
6870       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6871       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6872                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6873       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6874                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6876       AC_SUBST(XCOMPOSITE_LIBS)
6878       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6879       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6880       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6881       if test -z "$_LIB_FOUND"; then
6882          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6883       fi
6886       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6887       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6888       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6889       if test -z "$_LIB_FOUND"; then
6890          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6891       fi
6893       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6894       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6895       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6896       if test -z "$_LIB_FOUND"; then
6897          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6898       fi
6900    fi
6902    if test "$MOZ_PLATFORM_MAEMO" -gt 5; then
6903      MOZ_THUMB2=1
6904    fi
6906    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6907    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6908    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6909    if test "$_LIB_FOUND"; then
6910       MOZ_MAEMO_LIBLOCATION=1
6911       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6912    else
6913       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6914    fi
6915    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6917    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6918    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6921 dnl ========================================================
6922 dnl = Enable building the Thumb2 instruction set
6923 dnl ========================================================
6924 MOZ_ARG_ENABLE_BOOL(thumb2,
6925  [  --enable-thumb2         Enable Thumb2 instruction set],
6926     MOZ_THUMB2=1,
6927     MOZ_THUMB2=)
6929 if test -n "$MOZ_THUMB2"; then
6930   case "$target_cpu" in
6931     arm*)
6932       if test "$GNU_CC"; then
6933         CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6934         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6935         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
6936       else
6937         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
6938       fi
6939     ;;
6940     *)
6941       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
6942     ;;
6943   esac
6946 dnl ========================================================
6947 dnl = faststripe theme
6948 dnl ========================================================
6949 MOZ_ARG_ENABLE_BOOL(faststripe,
6950 [  --enable-faststripe     Use faststripe theme],
6951     MOZ_THEME_FASTSTRIPE=1,
6952     MOZ_THEME_FASTSTRIPE= )
6953 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6955 dnl ========================================================
6956 dnl =
6957 dnl = Feature options that require extra sources to be pulled
6958 dnl =
6959 dnl ========================================================
6960 dnl MOZ_ARG_HEADER(Features that require extra sources)
6962 dnl ========================================================
6963 dnl =
6964 dnl = Debugging Options
6965 dnl = 
6966 dnl ========================================================
6967 MOZ_ARG_HEADER(Debugging and Optimizations)
6969 dnl ========================================================
6970 dnl = Disable building with debug info.
6971 dnl = Debugging is OFF by default
6972 dnl ========================================================
6973 if test -z "$MOZ_DEBUG_FLAGS"
6974 then
6975     case "$target" in
6976     *-irix*)
6977         if test "$GNU_CC"; then
6978             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6979             case "$GCC_VERSION" in
6980             2.95.*)
6981                 MOZ_DEBUG_FLAGS=""
6982                 ;;
6983             *)
6984                 MOZ_DEBUG_FLAGS="-g"
6985                 ;;
6986             esac
6987         else
6988             MOZ_DEBUG_FLAGS="-g"
6989         fi
6990         ;;
6991     *)
6992         MOZ_DEBUG_FLAGS="-g"
6993         ;;
6994     esac
6997 MOZ_ARG_ENABLE_STRING(debug,
6998 [  --enable-debug[=DBG]    Enable building with developer debug info
6999                            (using compiler flags DBG)],
7000 [ if test "$enableval" != "no"; then
7001     MOZ_DEBUG=1
7002     if test -n "$enableval" -a "$enableval" != "yes"; then
7003         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7004         _MOZ_DEBUG_FLAGS_SET=1
7005     fi
7006   else
7007     MOZ_DEBUG=
7008   fi ],
7009   MOZ_DEBUG=)
7011 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7012 MOZ_ARG_WITH_STRING(debug-label,
7013 [  --with-debug-label=LABELS
7014                           Define DEBUG_<value> for each comma-separated
7015                           value given.],
7016 [ for option in `echo $withval | sed 's/,/ /g'`; do
7017     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7018 done])
7020 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7022 if test -n "$MOZ_DEBUG"; then
7023     AC_MSG_CHECKING([for valid debug flags])
7024     _SAVE_CFLAGS=$CFLAGS
7025     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7026     AC_TRY_COMPILE([#include <stdio.h>], 
7027         [printf("Hello World\n");],
7028         _results=yes,
7029         _results=no)
7030     AC_MSG_RESULT([$_results])
7031     if test "$_results" = "no"; then
7032         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7033     fi
7034     CFLAGS=$_SAVE_CFLAGS
7037 dnl ========================================================
7038 dnl enable mobile optimizations
7039 dnl ========================================================
7040 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7041 [  --enable-mobile-optimize
7042                           Enable mobile optimizations],
7043     MOZ_GFX_OPTIMIZE_MOBILE=1)
7045 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7047 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7048     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7051 dnl ========================================================
7052 dnl = Enable code optimization. ON by default.
7053 dnl ========================================================
7054 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7055         MOZ_OPTIMIZE_FLAGS="-O"
7058 MOZ_ARG_ENABLE_STRING(optimize,
7059 [  --disable-optimize      Disable compiler optimization
7060   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7061 [ if test "$enableval" != "no"; then
7062     MOZ_OPTIMIZE=1
7063     if test -n "$enableval" && test "$enableval" != "yes"; then
7064         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7065         MOZ_OPTIMIZE=2
7066     fi
7067 else
7068     MOZ_OPTIMIZE=
7069 fi ], MOZ_OPTIMIZE=1)
7071 if test "$COMPILE_ENVIRONMENT"; then
7072 if test -n "$MOZ_OPTIMIZE"; then
7073     AC_MSG_CHECKING([for valid optimization flags])
7074     _SAVE_CFLAGS=$CFLAGS
7075     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7076     AC_TRY_COMPILE([#include <stdio.h>], 
7077         [printf("Hello World\n");],
7078         _results=yes,
7079         _results=no)
7080     AC_MSG_RESULT([$_results])
7081     if test "$_results" = "no"; then
7082         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7083     fi
7084     CFLAGS=$_SAVE_CFLAGS
7086 fi # COMPILE_ENVIRONMENT
7088 AC_SUBST(MOZ_OPTIMIZE)
7089 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7090 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7091 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7093 dnl ========================================================
7094 dnl = (Deprecated) generation of debugger info for specific modules
7095 dnl ========================================================
7096 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7097 [  --enable-debugger-info-modules
7098                           Enable/disable debugger info for specific modules],
7099 [ if test "$enableval" != "no"; then
7100     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7101     MOZ_DEBUG_SYMBOLS=1
7102   fi ])
7104 dnl ========================================================
7105 dnl = Enable generation of debug symbols
7106 dnl ========================================================
7107 MOZ_ARG_ENABLE_STRING(debug-symbols,
7108 [  --enable-debug-symbols[=DBG]
7109                           Enable debugging symbols (using compiler flags DBG)],
7110 [ if test "$enableval" != "no"; then
7111       MOZ_DEBUG_SYMBOLS=1
7112       if test -n "$enableval" -a "$enableval" != "yes"; then
7113           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7114               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7115           else
7116               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7117           fi
7118       fi
7119   fi ])
7121 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7122     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7123     export MOZ_DEBUG_SYMBOLS
7126 dnl ========================================================
7127 dnl = Disable any treating of compile warnings as errors
7128 dnl ========================================================
7129 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7130 [  --disable-warnings-as-errors
7131                           Disable treating of warnings as errors],
7132     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7133     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7134 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7135    WARNINGS_AS_ERRORS=''
7138 dnl ========================================================
7139 dnl = Disable runtime logging checks
7140 dnl ========================================================
7141 MOZ_ARG_DISABLE_BOOL(logging,
7142 [  --disable-logging       Disable logging facilities],
7143     NS_DISABLE_LOGGING=1,
7144     NS_DISABLE_LOGGING= )
7145 if test "$NS_DISABLE_LOGGING"; then
7146     AC_DEFINE(NS_DISABLE_LOGGING)
7147 else
7148     AC_DEFINE(MOZ_LOGGING)
7151 dnl ========================================================
7152 dnl = This will enable logging of addref, release, ctor, dtor.
7153 dnl ========================================================
7154 _ENABLE_LOGREFCNT=42
7155 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7156 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7157     _ENABLE_LOGREFCNT=1,
7158     _ENABLE_LOGREFCNT= )
7159 if test "$_ENABLE_LOGREFCNT" = "1"; then
7160     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7161 elif test -z "$_ENABLE_LOGREFCNT"; then
7162     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7165 dnl ========================================================
7166 dnl = Enable trace malloc
7167 dnl ========================================================
7168 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7169 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7170 [  --enable-trace-malloc   Enable malloc tracing],
7171     NS_TRACE_MALLOC=1,
7172     NS_TRACE_MALLOC= )
7173 if test "$NS_TRACE_MALLOC"; then
7174   # Please, Mr. Linker Man, don't take away our symbol names
7175   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7176   USE_ELF_DYNSTR_GC=
7177   AC_DEFINE(NS_TRACE_MALLOC)
7179 AC_SUBST(NS_TRACE_MALLOC)
7181 dnl ========================================================
7182 dnl = Enable jemalloc
7183 dnl ========================================================
7184 MOZ_ARG_ENABLE_BOOL(jemalloc,
7185 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7186     MOZ_MEMORY=1,
7187     MOZ_MEMORY=)
7189 if test "$NS_TRACE_MALLOC"; then
7190     MOZ_MEMORY=
7193 if test "$MOZ_MEMORY"; then
7195   dnl Don't try to run compiler tests on Windows  
7196   if test "$OS_ARCH" = "WINNT"; then
7197     if test -z "$HAVE_64BIT_OS"; then
7198       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7199     else
7200       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7201     fi
7202   else
7203     AC_CHECK_SIZEOF([int *], [4])
7204     case "${ac_cv_sizeof_int_p}" in
7205     4)
7206       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7207       ;;
7208     8)
7209       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7210       ;;
7211     *)
7212       AC_MSG_ERROR([Unexpected pointer size])
7213       ;;
7214     esac
7215   fi
7217   AC_DEFINE(MOZ_MEMORY)
7218   if test "x$MOZ_DEBUG" = "x1"; then
7219     AC_DEFINE(MOZ_MEMORY_DEBUG)
7220   fi
7221   dnl The generic feature tests that determine how to compute ncpus are long and
7222   dnl complicated.  Therefore, simply define special cpp variables for the
7223   dnl platforms we have special knowledge of.
7224   case "${target}" in
7225   *-darwin*)
7226     AC_DEFINE(MOZ_MEMORY_DARWIN)
7227     ;;
7228   *-*freebsd*)
7229     AC_DEFINE(MOZ_MEMORY_BSD)
7230     ;;
7231   *-*linux*)
7232     AC_DEFINE(MOZ_MEMORY_LINUX)
7233     ;;
7234   *-netbsd*)
7235     AC_DEFINE(MOZ_MEMORY_BSD)
7236     ;;
7237   *-solaris*)
7238     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7239     ;;
7240   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7241     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7242     dnl This is sort of awful. Will revisit if we add support for more versions
7243     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7244         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7245     fi
7246     if test -z "$WIN32_CRT_SRC_DIR"; then
7247       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7248         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).])
7249       else
7250         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7251       fi
7252     fi
7253     dnl cpu check
7254     case "${target_cpu}" in
7255     i*86)
7256       MOZ_CRT_CPU_ARCH=intel
7257       ;;
7258     x86_64)
7259       MOZ_CRT_CPU_ARCH=amd64
7260       ;;
7261     *)
7262       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7263       ;;
7264     esac
7266     AC_SUBST(MOZ_CRT_CPU_ARCH)
7268     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7269       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7270     fi
7271     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7272     _objdir_win=`pwd -W`
7273     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7274     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7275     dnl Also pass this to NSPR/NSS
7276     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7277     export DLLFLAGS
7278     ;;
7279   *-*wince)
7280     AC_DEFINE(MOZ_MEMORY_WINCE)
7281     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7282     if test -z "$WINCE_WINDOWS_MOBILE"; then
7283       AC_DEFINE(MOZ_MEMORY_WINCE6)
7284     fi
7285     ;;
7286   *-*winmo)
7287     AC_DEFINE(MOZ_MEMORY_WINCE)
7288     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7289     ;;
7290   *-android*)
7291     AC_DEFINE(MOZ_MEMORY_LINUX)
7292     AC_DEFINE(MOZ_MEMORY_ANDROID)
7293     _WRAP_MALLOC=1
7294     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc"
7295     ;;
7296   *)
7297     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7298     ;;
7299   esac
7301   if test "$OS_ARCH" != "Darwin"; then
7302     dnl NB: this must be kept in sync with jemalloc.h
7303     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7304     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7305     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7306   fi
7308 AC_SUBST(MOZ_MEMORY)
7309 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7310 AC_SUBST(WIN32_CRT_SRC_DIR)
7311 dnl Need to set this for make because NSS doesn't have configure
7312 AC_SUBST(DLLFLAGS)
7314 dnl ========================================================
7315 dnl = Use malloc wrapper lib
7316 dnl ========================================================
7317 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7318 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7319     _WRAP_MALLOC=1,
7320     _WRAP_MALLOC= )
7322 if test -n "$_WRAP_MALLOC"; then
7323     if test "$GNU_CC"; then
7324     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"
7325     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7326     fi
7329 dnl ========================================================
7330 dnl = Location of malloc wrapper lib
7331 dnl ========================================================
7332 MOZ_ARG_WITH_STRING(wrap-malloc,
7333 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7334     WRAP_MALLOC_LIB=$withval)
7336 dnl ========================================================
7337 dnl = Use TraceVis
7338 dnl ========================================================
7339 MOZ_ARG_ENABLE_BOOL(tracevis,
7340 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7341     MOZ_TRACEVIS=1,
7342     MOZ_TRACEVIS= )
7343 if test -n "$MOZ_TRACEVIS"; then
7344     AC_DEFINE(MOZ_TRACEVIS)
7347 dnl ========================================================
7348 dnl = Use GCTimer
7349 dnl ========================================================
7350 MOZ_ARG_ENABLE_BOOL(gctimer,
7351 [  --enable-gctimer        Enable GC timer (default=no)],
7352     MOZ_GCTIMER=1,
7353     MOZ_GCTIMER= )
7354 if test -n "$MOZ_GCTIMER"; then
7355     AC_DEFINE(MOZ_GCTIMER)
7358 dnl ========================================================
7359 dnl = Use Valgrind
7360 dnl ========================================================
7361 MOZ_ARG_ENABLE_BOOL(valgrind,
7362 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7363     MOZ_VALGRIND=1,
7364     MOZ_VALGRIND= )
7365 if test -n "$MOZ_VALGRIND"; then
7366     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7367         AC_MSG_ERROR(
7368             [--enable-valgrind specified but Valgrind is not installed]))
7369     AC_DEFINE(MOZ_VALGRIND)
7372 dnl ========================================================
7373 dnl jprof
7374 dnl ========================================================
7375 MOZ_ARG_ENABLE_BOOL(jprof,
7376 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7377     MOZ_JPROF=1,
7378     MOZ_JPROF= )
7379 if test -n "$MOZ_JPROF"; then
7380     AC_DEFINE(MOZ_JPROF)
7383 dnl ========================================================
7384 dnl shark
7385 dnl ========================================================
7386 MOZ_ARG_ENABLE_BOOL(shark,
7387 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7388     MOZ_SHARK=1,
7389     MOZ_SHARK= )
7390 if test -n "$MOZ_SHARK"; then
7391     AC_DEFINE(MOZ_SHARK)
7394 dnl ========================================================
7395 dnl callgrind
7396 dnl ========================================================
7397 MOZ_ARG_ENABLE_BOOL(callgrind,
7398 [  --enable-callgrind      Enable callgrind profiling],
7399     MOZ_CALLGRIND=1,
7400     MOZ_CALLGRIND= )
7401 if test -n "$MOZ_CALLGRIND"; then
7402     AC_DEFINE(MOZ_CALLGRIND)
7405 dnl ========================================================
7406 dnl vtune
7407 dnl ========================================================
7408 MOZ_ARG_ENABLE_BOOL(vtune,
7409 [  --enable-vtune          Enable vtune profiling],
7410     MOZ_VTUNE=1,
7411     MOZ_VTUNE= )
7412 if test -n "$MOZ_VTUNE"; then
7413     AC_DEFINE(MOZ_VTUNE)
7416 dnl ========================================================
7417 dnl Zealous JavaScript GC
7418 dnl ========================================================
7419 MOZ_ARG_ENABLE_BOOL(gczeal,
7420 [  --enable-gczeal         Enable zealous JavaScript GCing],
7421     JS_GC_ZEAL=1,
7422     JS_GC_ZEAL= )
7423 if test -n "$JS_GC_ZEAL"; then
7424     AC_DEFINE(JS_GC_ZEAL)
7427 dnl ======================================================
7428 dnl = Enable compiling with ccache
7429 dnl ======================================================
7430 MOZ_ARG_WITH_STRING(ccache,
7431 [  --with-ccache=path/to/ccache
7432                           Enable compiling with ccache],
7433     CCACHE_PATH=$withval,)
7435 if test -n "$CCACHE_PATH"; then
7436   CC="$CCACHE_PATH $CC"
7437   CXX="$CCACHE_PATH $CXX"
7440 dnl ========================================================
7441 dnl = Enable static checking using gcc-dehydra
7442 dnl ========================================================
7444 MOZ_ARG_WITH_STRING(static-checking,
7445 [  --with-static-checking=path/to/gcc_dehydra.so
7446                           Enable static checking of code using GCC-dehydra],
7447     DEHYDRA_PATH=$withval,
7448     DEHYDRA_PATH= )
7450 if test -n "$DEHYDRA_PATH"; then
7451     if test ! -f "$DEHYDRA_PATH"; then
7452         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7453     fi
7454     AC_DEFINE(NS_STATIC_CHECKING)
7456 AC_SUBST(DEHYDRA_PATH)
7458 dnl ========================================================
7459 dnl = Enable stripping of libs & executables
7460 dnl ========================================================
7461 MOZ_ARG_ENABLE_BOOL(strip,
7462 [  --enable-strip          Enable stripping of libs & executables ],
7463     ENABLE_STRIP=1,
7464     ENABLE_STRIP= )
7466 dnl ========================================================
7467 dnl = Enable stripping of libs & executables when packaging
7468 dnl ========================================================
7469 MOZ_ARG_ENABLE_BOOL(install-strip,
7470 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7471     PKG_SKIP_STRIP= ,
7472     PKG_SKIP_STRIP=1)
7474 dnl ========================================================
7475 dnl = --enable-elf-dynstr-gc
7476 dnl ========================================================
7477 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7478 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7479     USE_ELF_DYNSTR_GC=1,
7480     USE_ELF_DYNSTR_GC= )
7482 dnl ========================================================
7483 dnl = 
7484 dnl = Profiling and Instrumenting
7485 dnl = 
7486 dnl ========================================================
7487 MOZ_ARG_HEADER(Profiling and Instrumenting)
7489 dnl ========================================================
7490 dnl = Enable timeline service, which provides lightweight
7491 dnl = instrumentation of mozilla for performance measurement.
7492 dnl = Timeline is off by default.
7493 dnl ========================================================
7494 MOZ_ARG_ENABLE_BOOL(timeline,
7495 [  --enable-timeline       Enable timeline services ],
7496     MOZ_TIMELINE=1,
7497     MOZ_TIMELINE= )
7498 if test -n "$MOZ_TIMELINE"; then
7499     AC_DEFINE(MOZ_TIMELINE)
7502 dnl ========================================================
7503 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7504 dnl = timing for identifying code bottlenecks 
7505 dnl = NS_FUNCTION_TIMER is off by default.
7506 dnl ========================================================
7507 MOZ_ARG_ENABLE_BOOL(functiontimer,
7508 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7509     NS_FUNCTION_TIMER=1,
7510     NS_FUNCTION_TIMER= )
7511 if test -n "$NS_FUNCTION_TIMER"; then
7512     AC_DEFINE(NS_FUNCTION_TIMER)
7515 dnl ========================================================
7516 dnl Turn on reflow counting
7517 dnl ========================================================
7518 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7519 [  --enable-reflow-perf    Enable reflow performance tracing],
7520     MOZ_REFLOW_PERF=1,
7521     MOZ_REFLOW_PERF= )
7522 if test -n "$MOZ_REFLOW_PERF"; then
7523     AC_DEFINE(MOZ_REFLOW_PERF)
7526 dnl ========================================================
7527 dnl Enable code size metrics.
7528 dnl ========================================================
7529 MOZ_ARG_ENABLE_BOOL(codesighs,
7530 [  --enable-codesighs      Enable code size analysis tools],
7531     _ENABLE_CODESIGHS=1,
7532     _ENABLE_CODESIGHS= )
7533 if test -n "$_ENABLE_CODESIGHS"; then
7534     if test -d $srcdir/tools/codesighs; then 
7535         MOZ_MAPINFO=1
7536     else
7537         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7538     fi
7541 dnl ========================================================
7542 dnl = Support for Quantify (Windows)
7543 dnl ========================================================
7544 MOZ_ARG_ENABLE_BOOL(quantify,
7545 [  --enable-quantify       Enable Quantify support (Windows only) ],
7546     MOZ_QUANTIFY=1,
7547     MOZ_QUANTIFY= )
7549 dnl ========================================================
7550 dnl = Support for demangling undefined symbols
7551 dnl ========================================================
7552 if test -z "$SKIP_LIBRARY_CHECKS"; then
7553     AC_LANG_SAVE
7554     AC_LANG_CPLUSPLUS
7555     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7556     AC_LANG_RESTORE
7559 # Demangle only for debug or trace-malloc builds
7560 MOZ_DEMANGLE_SYMBOLS=
7561 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7562     MOZ_DEMANGLE_SYMBOLS=1
7563     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7565 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7567 dnl ========================================================
7568 dnl = Support for gcc stack unwinding (from gcc 3.3)
7569 dnl ========================================================
7570 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7571     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7574 dnl ========================================================
7575 dnl =
7576 dnl = Misc. Options
7577 dnl = 
7578 dnl ========================================================
7579 MOZ_ARG_HEADER(Misc. Options)
7581 dnl ========================================================
7582 dnl update xterm title
7583 dnl ========================================================
7584 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7585 [  --enable-xterm-updates  Update XTERM titles with current command.],
7586     MOZ_UPDATE_XTERM=1,
7587     MOZ_UPDATE_XTERM= )
7589 dnl =========================================================
7590 dnl = Chrome format
7591 dnl =========================================================
7592 MOZ_ARG_ENABLE_STRING([chrome-format],
7593 [  --enable-chrome-format=jar|flat|both|symlink|omni
7594                           Select FORMAT of chrome files (default=jar)],
7595     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7597 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7598     MOZ_CHROME_FILE_FORMAT=jar
7601 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7602     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7603     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7604     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7605     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7606     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7609 dnl =========================================================
7610 dnl Omnijar packaging (bug 552121)
7611 dnl =========================================================
7612 dnl Omnijar packaging is compatible with flat packaging.
7613 dnl In unpackaged builds, omnijar looks for files as if
7614 dnl things were flat packaged. After packaging, all files
7615 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7616 dnl is set to flat since putting files into jars is only
7617 dnl done during packaging with omnijar.
7618 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7619     MOZ_OMNIJAR=1
7620     AC_DEFINE(MOZ_OMNIJAR)
7621     MOZ_CHROME_FILE_FORMAT=flat
7622 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7623     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7626 AC_SUBST(MOZ_OMNIJAR)
7628 dnl ========================================================
7629 dnl = Define default location for MOZILLA_FIVE_HOME
7630 dnl ========================================================
7631 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7632 [  --with-default-mozilla-five-home
7633                           Set the default value for MOZILLA_FIVE_HOME],
7634 [ val=`echo $withval`
7635   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7637 dnl ========================================================
7638 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7639 dnl ========================================================
7640 MOZ_ARG_WITH_STRING(user-appdir,
7641 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7642 [ val=`echo $withval`
7643 if echo "$val" | grep "\/" >/dev/null; then
7644     AC_MSG_ERROR("Homedir must be single relative path.")
7645 else 
7646     MOZ_USER_DIR="$val"
7647 fi])
7649 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7651 dnl ========================================================
7652 dnl = Doxygen configuration
7653 dnl ========================================================
7654 dnl Use commas to specify multiple dirs to this arg
7655 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7656 MOZ_ARG_WITH_STRING(doc-input-dirs,
7657 [  --with-doc-input-dirs=DIRS
7658                           Header/idl dirs to create docs from],
7659 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7660 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7662 dnl Use commas to specify multiple dirs to this arg
7663 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7664 MOZ_ARG_WITH_STRING(doc-include-dirs,
7665 [  --with-doc-include-dirs=DIRS  
7666                           Include dirs to preprocess doc headers],
7667 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7668 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7670 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7671 MOZ_ARG_WITH_STRING(doc-output-dir,
7672 [  --with-doc-output-dir=DIR
7673                           Dir to generate docs into],
7674 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7675 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7677 if test -z "$SKIP_COMPILER_CHECKS"; then
7678 dnl ========================================================
7679 dnl =
7680 dnl = Compiler Options
7681 dnl = 
7682 dnl ========================================================
7683 MOZ_ARG_HEADER(Compiler Options)
7685 dnl ========================================================
7686 dnl Check for gcc -pipe support
7687 dnl ========================================================
7688 AC_MSG_CHECKING([for gcc -pipe support])
7689 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7690     echo '#include <stdio.h>' > dummy-hello.c
7691     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7692     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7693     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7694     if test $? = 0; then
7695         _res_as_stdin="yes"
7696     else
7697         _res_as_stdin="no"
7698     fi
7699     if test "$_res_as_stdin" = "yes"; then
7700         _SAVE_CFLAGS=$CFLAGS
7701         CFLAGS="$CFLAGS -pipe"
7702         AC_TRY_COMPILE( [ #include <stdio.h> ],
7703             [printf("Hello World\n");],
7704             [_res_gcc_pipe="yes"],
7705             [_res_gcc_pipe="no"] )
7706         CFLAGS=$_SAVE_CFLAGS
7707     fi
7708     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7709         _res="yes";
7710         CFLAGS="$CFLAGS -pipe"
7711         CXXFLAGS="$CXXFLAGS -pipe"
7712     else
7713         _res="no"
7714     fi
7715     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7716     AC_MSG_RESULT([$_res])
7717 else
7718     AC_MSG_RESULT([no])
7721 dnl ========================================================
7722 dnl Profile guided optimization
7723 dnl ========================================================
7724 dnl Test for profiling options
7725 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7726 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7728 dnl Provide a switch to disable PGO even when called via profiledbuild.
7729 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7730 [  --disable-profile-guided-optimization
7731                           Don't build with PGO even if called via make profiledbuild],
7732 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7733 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7735 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7737 _SAVE_CFLAGS="$CFLAGS"
7738 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7740 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7741 AC_TRY_COMPILE([], [return 0;],
7742                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7743                  result="yes" ], result="no")
7744 AC_MSG_RESULT([$result])
7746 if test $result = "yes"; then
7747   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7748   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7749   PROFILE_USE_LDFLAGS="-fprofile-use"
7750 else
7751   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7752   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7753   AC_TRY_COMPILE([], [return 0;],
7754                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7755                    result="yes" ], result="no")
7756   AC_MSG_RESULT([$result])
7757   if test $result = "yes"; then
7758     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7759   fi
7760   # don't really care, this is an old GCC
7761   PROFILE_GEN_LDFLAGS=
7762   PROFILE_USE_LDFLAGS=
7765 CFLAGS="$_SAVE_CFLAGS"
7767 if test -n "$INTEL_CC"; then
7768   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7769   PROFILE_GEN_LDFLAGS=
7770   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7771   PROFILE_USE_LDFLAGS=
7774 dnl Sun Studio on Solaris
7775 if test "$SOLARIS_SUNPRO_CC"; then
7776   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7777   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7778   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7779   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7782 AC_SUBST(PROFILE_GEN_CFLAGS)
7783 AC_SUBST(PROFILE_GEN_LDFLAGS)
7784 AC_SUBST(PROFILE_USE_CFLAGS)
7785 AC_SUBST(PROFILE_USE_LDFLAGS)
7787 AC_LANG_CPLUSPLUS
7789 dnl ========================================================
7790 dnl Test for -pedantic bustage
7791 dnl ========================================================
7792 MOZ_ARG_DISABLE_BOOL(pedantic,
7793 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7794 _PEDANTIC= )
7795 if test "$_PEDANTIC"; then
7796     _SAVE_CXXFLAGS=$CXXFLAGS
7797     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7798     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7799     AC_TRY_COMPILE([$configure_static_assert_macros],
7800                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7801                    result="no", result="yes" )
7802     AC_MSG_RESULT([$result])
7803     CXXFLAGS="$_SAVE_CXXFLAGS"
7805     case "$result" in
7806     no)
7807         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7808         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7809         ;;
7810     yes)
7811         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7812         ;;
7813     esac
7816 dnl ========================================================
7817 dnl Test for correct temporary object destruction order
7818 dnl ========================================================
7819 dnl We want to make sure the compiler follows the C++ spec here as 
7820 dnl xpcom and the string classes depend on it (bug 235381).
7821 AC_MSG_CHECKING([for correct temporary object destruction order])
7822 AC_TRY_RUN([ class A {
7823              public:  A(int& x) : mValue(x) {}
7824                       ~A() { mValue--; }
7825                       operator char**() { return 0; }
7826              private:  int& mValue;
7827              };
7828              void func(char **arg) {}
7829              int m=2;
7830              void test() {
7831                   func(A(m));
7832                   if (m==1) m = 0;
7833              }
7834              int main() {
7835                  test();
7836                  return(m);
7837              }
7838              ],
7839      result="yes", result="no", result="maybe")
7840 AC_MSG_RESULT([$result])
7842 if test "$result" = "no"; then
7843     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7846 dnl ========================================================
7847 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7848 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7849 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7850 dnl ========================================================
7851 _SAVE_CXXFLAGS=$CXXFLAGS
7852 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7853 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7854     ac_nscap_nonconst_opeq_bug,
7855     [AC_TRY_COMPILE([
7856                       template <class T>
7857                       class Pointer
7858                         {
7859                         public:
7860                           T* myPtr;
7861                         };
7862                       
7863                       template <class T, class U>
7864                       int operator==(const Pointer<T>& rhs, U* lhs)
7865                         {
7866                           return rhs.myPtr == lhs;
7867                         }
7868                       
7869                       template <class T, class U>
7870                       int operator==(const Pointer<T>& rhs, const U* lhs)
7871                         {
7872                           return rhs.myPtr == lhs;
7873                         }
7874                     ],
7875                     [
7876                       Pointer<int> foo;
7877                       const int* bar;
7878                       return foo == bar;
7879                     ],
7880                     ac_nscap_nonconst_opeq_bug="no",
7881                     ac_nscap_nonconst_opeq_bug="yes")])
7882 CXXFLAGS="$_SAVE_CXXFLAGS"
7884 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7885     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7887 fi # SKIP_COMPILER_CHECKS
7889 dnl ========================================================
7890 dnl C++ rtti
7891 dnl Should be smarter and check that the compiler does indeed have rtti
7892 dnl ========================================================
7894 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7895 [  --enable-cpp-rtti       Enable C++ RTTI ],
7896 [ _MOZ_USE_RTTI=1 ],
7897 [ _MOZ_USE_RTTI= ])
7899 if test "$_MOZ_USE_RTTI"; then
7900    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7901 else
7902    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7905 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7907 dnl ========================================================
7908 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7909 dnl Should be smarter and check that the compiler does indeed have exceptions
7910 dnl ========================================================
7911 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7912 [  --enable-cpp-exceptions Enable C++ exceptions ],
7913 [ _MOZ_CPP_EXCEPTIONS=1 ],
7914 [ _MOZ_CPP_EXCEPTIONS= ])
7916 if test "$_MOZ_CPP_EXCEPTIONS"; then
7917     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7918     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7919 else
7920     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7923 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7925 # Irix & OSF native compilers do not like exception declarations 
7926 # when exceptions are disabled
7927 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7928     AC_DEFINE(CPP_THROW_NEW, [])
7929 else
7930     AC_DEFINE(CPP_THROW_NEW, [throw()])
7932 AC_LANG_C
7934 dnl ========================================================
7935 dnl =
7936 dnl = Build depencency options
7937 dnl =
7938 dnl ========================================================
7939 MOZ_ARG_HEADER(Build dependencies)
7941 dnl ========================================================
7942 dnl = Do not auto generate dependency info
7943 dnl ========================================================
7944 MOZ_AUTO_DEPS=1
7945 MOZ_ARG_DISABLE_BOOL(auto-deps,
7946 [  --disable-auto-deps     Do not automatically generate dependency info],
7947     MOZ_AUTO_DEPS=,
7948     MOZ_AUTO_DEPS=1)
7950 if test -n "$MOZ_AUTO_DEPS"; then
7951 dnl ========================================================
7952 dnl = Use mkdepend instead of $CC -MD for dependency generation
7953 dnl ========================================================
7954 _cpp_md_flag=
7955 MOZ_ARG_DISABLE_BOOL(md,
7956 [  --disable-md            Do not use compiler-based dependencies ],
7957   [_cpp_md_flag=],
7958   [_cpp_md_flag=1],
7959   [dnl Default is to turn on -MD if using GNU-compatible compilers
7960    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7961      _cpp_md_flag=1
7962    fi
7963   dnl Default is to use -xM if using Sun Studio on Solaris
7964    if test "$SOLARIS_SUNPRO_CC"; then
7965      _cpp_md_flag=1
7966    fi])
7967 if test "$_cpp_md_flag"; then
7968   COMPILER_DEPEND=1
7969   if test "$OS_ARCH" = "OpenVMS"; then
7970     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7971   else
7972     _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
7973   fi
7974   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7975   if test "$SOLARIS_SUNPRO_CC"; then
7976     _DEPEND_CFLAGS=
7977   fi
7978 else
7979   COMPILER_DEPEND=
7980   dnl Don't override this for MSVC
7981   if test -z "$_WIN32_MSVC"; then
7982     _USE_CPP_INCLUDE_FLAG=
7983     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7984     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7985   fi
7987 fi # MOZ_AUTO_DEPS
7988 MDDEPDIR='.deps'
7989 AC_SUBST(MOZ_AUTO_DEPS)
7990 AC_SUBST(COMPILER_DEPEND)
7991 AC_SUBST(MDDEPDIR)
7994 dnl ========================================================
7995 dnl =
7996 dnl = Static Build Options
7997 dnl =
7998 dnl ========================================================
7999 MOZ_ARG_HEADER(Static build options)
8001 MOZ_ARG_ENABLE_BOOL(static,
8002 [  --enable-static         Enable building of internal static libs],
8003     BUILD_STATIC_LIBS=1,
8004     BUILD_STATIC_LIBS=)
8006 MOZ_ARG_ENABLE_BOOL(libxul,
8007 [  --enable-libxul         Enable building of libxul],
8008     MOZ_ENABLE_LIBXUL=1,
8009     MOZ_ENABLE_LIBXUL=)
8011 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8012         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8015 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8016         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8019 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8020     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8023 AC_SUBST(LIBXUL_LIBS)
8025 if test -n "$MOZ_ENABLE_LIBXUL"; then
8026     XPCOM_LIBS="$LIBXUL_LIBS"
8027     AC_DEFINE(MOZ_ENABLE_LIBXUL)
8028 else
8029     if test -n "$BUILD_STATIC_LIBS"; then
8030         AC_DEFINE(MOZ_STATIC_BUILD)
8031     fi
8032     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8035 dnl ========================================================
8036 dnl =
8037 dnl = Standalone module options
8038 dnl = 
8039 dnl ========================================================
8040 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8042 dnl Check for GLib and libIDL.
8043 dnl ========================================================
8044 SKIP_IDL_CHECK="no"
8046 if test -z "$COMPILE_ENVIRONMENT"; then
8047     SKIP_IDL_CHECK="yes"
8050 dnl = Allow users to disable libIDL checking for standalone modules
8051 MOZ_ARG_WITHOUT_BOOL(libIDL,
8052 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8053         SKIP_IDL_CHECK="yes")
8055 if test -z "$CROSS_COMPILE"; then
8056     if test -z "$HOST_LIBIDL_CONFIG"; then
8057         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8058     fi
8059     if test -z "$HOST_LIBIDL_PREFIX"; then
8060         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8061     fi
8064 if test "$SKIP_IDL_CHECK" = "no"
8065 then
8066     _LIBIDL_FOUND=
8067     case "$host" in
8068     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8069         if test -n "$GLIB_PREFIX"; then
8070             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8071             if test "$?" = "0"; then
8072                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8073                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8074                 fi
8075                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8076             else
8077                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8078             fi
8079         else
8080             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8081         fi
8082         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8083             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8084         fi
8085         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8086         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8087             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8088         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8089             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8090         else
8091             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8092         fi
8094         if test -n "$HOST_LIBIDL_PREFIX"; then
8095             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8096             if test "$?" = "0"; then
8097                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8098                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8099                 fi
8100                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8101             else
8102                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8103             fi
8104         else
8105             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8106         fi        
8107         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8108             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8109         fi
8110         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8111         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8112             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8113             STATIC_LIBIDL=1
8114         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8115             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8116         else
8117             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8118         fi
8119         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8120         _LIBIDL_FOUND=1
8121         ;;
8122     esac
8124     if test -z "$_LIBIDL_FOUND"; then
8125         if test "$MACOS_SDK_DIR"; then 
8126             dnl xpidl, and therefore libIDL, is only needed on the build host.
8127             dnl Don't build it against the SDK, as that causes problems.
8128             _MACSAVE_CFLAGS="$CFLAGS"
8129             _MACSAVE_LIBS="$LIBS"
8130             _MACSAVE_LDFLAGS="$LDFLAGS"
8131             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8132           changequote(,)
8133           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"`
8134           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8135           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8136           changequote([,])
8137           unset NEXT_ROOT
8138         fi
8140         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8141     fi
8143     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8144     dnl to either libIDL1 or libIDL2.
8145     if test -z "$_LIBIDL_FOUND"; then
8146         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8147         if test -z "$_LIBIDL_FOUND"; then
8148             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8149         fi
8150     fi
8151     dnl
8152     dnl If we don't have a libIDL config program & not cross-compiling, 
8153     dnl     look for orbit-config instead.
8154     dnl
8155     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
8156         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8157         if test -n "$ORBIT_CONFIG"; then
8158             AC_MSG_CHECKING([for ORBit libIDL usability])
8159                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8160             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8161             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8162             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8163             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8164             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8165             HOST_LIBIDL_CONFIG=
8166             _SAVE_CFLAGS="$CFLAGS"
8167             _SAVE_LIBS="$LIBS"
8168             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8169             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8170             AC_TRY_RUN([
8171 #include <stdlib.h>
8172 #include <libIDL/IDL.h>
8173 int main() {
8174   char *s;
8175   s=strdup(IDL_get_libver_string());
8176   if(s==NULL) {
8177     exit(1);
8178   }
8179   exit(0);
8181             ], [_LIBIDL_FOUND=1
8182                 result="yes"],
8183                [HOST_LIBIDL_CFLAGS=
8184                 HOST_LIBIDL_LIBS=
8185                 result="no"],
8186                [_LIBIDL_FOUND=1
8187                 result="maybe"] )
8188             AC_MSG_RESULT($result)
8189             CFLAGS="$_SAVE_CFLAGS"
8190             LIBS="$_SAVE_LIBS"
8191         fi
8192     fi
8193     if test -z "$_LIBIDL_FOUND"; then
8194         AC_MSG_ERROR([libIDL not found.
8195         libIDL $LIBIDL_VERSION or higher is required.])
8196     fi
8197     if test "$MACOS_SDK_DIR"; then
8198       CFLAGS="$_MACSAVE_CFLAGS"
8199       LIBS="$_MACSAVE_LIBS"
8200       LDFLAGS="$_MACSAVE_LDFLAGS"
8201       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8202         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8203       fi
8204     fi
8207 if test -n "$CROSS_COMPILE"; then
8208     case "$target" in
8209     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8210         if test -n "$GLIB_PREFIX"; then
8211             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8212             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8213                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8214             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8215                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8216             else
8217                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8218             fi
8219         fi
8221         if test -n "$LIBIDL_PREFIX"; then
8222             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8223             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8224                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8225                 STATIC_LIBIDL=1
8226             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8227                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8228             else
8229                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8230             fi
8231         fi
8232         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8233         ;;
8234     *)
8235         if test -n "LIBIDL_CONFIG" && test "LIBIDL_CONFIG" != "no"; then
8236             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8237             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8238         fi
8239         ;;
8240     esac
8241 else
8242     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8243     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8246 if test -z "$SKIP_PATH_CHECKS"; then
8247 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
8248     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
8249         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8250     else
8251         AM_PATH_GLIB(${GLIB_VERSION})
8252     fi
8256 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8257     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8260 AC_SUBST(LIBIDL_CFLAGS)
8261 AC_SUBST(LIBIDL_LIBS)
8262 AC_SUBST(STATIC_LIBIDL)
8263 AC_SUBST(GLIB_CFLAGS)
8264 AC_SUBST(GLIB_LIBS)
8265 AC_SUBST(GLIB_GMODULE_LIBS)
8266 AC_SUBST(HOST_LIBIDL_CONFIG)
8267 AC_SUBST(HOST_LIBIDL_CFLAGS)
8268 AC_SUBST(HOST_LIBIDL_LIBS)
8270 dnl ========================================================
8271 dnl Check for cairo
8272 dnl ========================================================
8273 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8275 MOZ_TREE_CAIRO=1
8276 MOZ_ARG_ENABLE_BOOL(system-cairo,
8277 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8278 MOZ_TREE_CAIRO=,
8279 MOZ_TREE_CAIRO=1 )
8281 # Check for headers defining standard int types.
8282 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8284 if test "$MOZ_TREE_CAIRO"; then
8285     AC_DEFINE(MOZ_TREE_CAIRO)
8287     # For now we assume that we will have a uint64_t available through
8288     # one of the above headers or mozstdint.h.
8289     AC_DEFINE(HAVE_UINT64_T)
8291     # Define macros for cairo-features.h
8292     if test "$MOZ_X11"; then
8293         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8294         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8295         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8296         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8297         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8298         MOZ_ENABLE_CAIRO_FT=1
8299         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8300     fi
8301     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8302         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8303     fi
8304     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8305         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8306         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8307         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8308     fi
8309     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8310         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8311         if test -z "$WINCE"; then
8312             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8313             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8314                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8315                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8316                 MOZ_ENABLE_D2D_SURFACE=1
8317                 MOZ_ENABLE_DWRITE_FONT=1
8318             else
8319                 WIN32_DWRITE_FONT_FEATURE=
8320                 WIN32_D2D_SURFACE_FEATURE=
8321             fi
8322         else
8323             WIN32_FONT_FEATURE=
8324             WIN32_DWRITE_FONT_FEATURE=
8325             WIN32_D2D_SURFACE_FEATURE=
8326         fi
8328         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8330         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8331         if test -z "$HAS_DDRAW"; then
8332             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.])
8333             DDRAW_SURFACE_FEATURE=
8334         else
8335             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8336         fi
8338         if test -z "$OGLES_SDK_DIR"; then
8339             OGLES_SURFACE_FEATURE=
8340         else
8341             AC_TRY_COMPILE([
8342               #include <EGL/egl.h>
8343               #include <EGL/eglext.h>
8344               #include <GLES2/gl2.h>
8345               #include <GLES2/gl2ext.h>
8346             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8347             if test -z "$HAS_OGLES"; then
8348               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8349               OGLES_SURFACE_FEATURE=
8350             else
8351               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8352             fi
8353         fi
8355         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8356     fi
8357     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8358         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8359         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8360         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8361         MOZ_ENABLE_CAIRO_FT=1
8362         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8363         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8364     fi
8365     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8366         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8367         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8368         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8369         MOZ_ENABLE_CAIRO_FT=1
8370     fi
8371     if test "$USE_FC_FREETYPE"; then
8372         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8373     fi
8374     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8375     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8376     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8377     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8378     AC_SUBST(CAIRO_FT_CFLAGS)
8379     AC_SUBST(HAS_OGLES)
8381     if test "$MOZ_DEBUG"; then
8382       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8383     else
8384       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8385     fi
8387     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8389     AC_SUBST(PS_SURFACE_FEATURE)
8390     AC_SUBST(PDF_SURFACE_FEATURE)
8391     AC_SUBST(SVG_SURFACE_FEATURE)
8392     AC_SUBST(XLIB_SURFACE_FEATURE)
8393     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8394     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8395     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8396     AC_SUBST(XCB_SURFACE_FEATURE)
8397     AC_SUBST(WIN32_SURFACE_FEATURE)
8398     AC_SUBST(DDRAW_SURFACE_FEATURE)
8399     AC_SUBST(OGLES_SURFACE_FEATURE)    
8400     AC_SUBST(OS2_SURFACE_FEATURE)
8401     AC_SUBST(BEOS_SURFACE_FEATURE)
8402     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8403     AC_SUBST(FT_FONT_FEATURE)
8404     AC_SUBST(FC_FONT_FEATURE)
8405     AC_SUBST(WIN32_FONT_FEATURE)
8406     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8407     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8408     AC_SUBST(QUARTZ_FONT_FEATURE)
8409     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8410     AC_SUBST(QT_SURFACE_FEATURE)
8412     if test "$_WIN32_MSVC"; then
8413         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
8414     else
8415         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"
8417         if test "$MOZ_X11"; then
8418             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8419         fi
8420     fi
8422     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8423     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8425 else
8426    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8427    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8428    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8429    if test "$MOZ_X11"; then
8430         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8431         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8432         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8433    fi
8436 AC_SUBST(MOZ_TREE_CAIRO)
8437 AC_SUBST(MOZ_CAIRO_CFLAGS)
8438 AC_SUBST(MOZ_CAIRO_LIBS)
8440 dnl ========================================================
8441 dnl qcms
8442 dnl ========================================================
8444 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8445 AC_SUBST(QCMS_LIBS)
8447 dnl ========================================================
8448 dnl HarfBuzz
8449 dnl ========================================================
8450 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8451 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8453 dnl ========================================================
8454 dnl disable xul
8455 dnl ========================================================
8456 MOZ_ARG_DISABLE_BOOL(xul,
8457 [  --disable-xul           Disable XUL],
8458     MOZ_XUL= )
8459 if test "$MOZ_XUL"; then
8460   AC_DEFINE(MOZ_XUL)
8461 else
8462   dnl remove extensions that require XUL
8463   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8466 AC_SUBST(MOZ_XUL)
8468 dnl ========================================================
8469 dnl disable profile locking
8470 dnl   do no use this in applications that can have more than
8471 dnl   one process accessing the profile directory.
8472 dnl ========================================================
8473 MOZ_ARG_DISABLE_BOOL(profilelocking,
8474 [  --disable-profilelocking
8475                           Disable profile locking],
8476     MOZ_PROFILELOCKING=,
8477     MOZ_PROFILELOCKING=1 )
8478 if test "$MOZ_PROFILELOCKING"; then
8479   AC_DEFINE(MOZ_PROFILELOCKING)
8482 dnl ========================================================
8483 dnl disable rdf services
8484 dnl ========================================================
8485 MOZ_ARG_DISABLE_BOOL(rdf,
8486 [  --disable-rdf           Disable RDF],
8487     MOZ_RDF= )
8488 if test "$MOZ_RDF"; then
8489   AC_DEFINE(MOZ_RDF)
8492 AC_SUBST(MOZ_RDF)
8494 dnl ========================================================
8495 dnl necko configuration options
8496 dnl ========================================================
8499 dnl option to disable various necko protocols
8501 MOZ_ARG_ENABLE_STRING(necko-protocols,
8502 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8503                           Enable/disable specific protocol handlers],
8504 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8505     if test "$option" = "yes" || test "$option" = "all"; then
8506         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8507     elif test "$option" = "no" || test "$option" = "none"; then
8508         NECKO_PROTOCOLS=""
8509     elif test "$option" = "default"; then
8510         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8511     elif test `echo "$option" | grep -c \^-` != 0; then
8512         option=`echo $option | sed 's/^-//'`
8513         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8514     else
8515         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8516     fi
8517 done],
8518     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8519 dnl Remove dupes
8520 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8521 AC_SUBST(NECKO_PROTOCOLS)
8522 for p in $NECKO_PROTOCOLS; do
8523     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8524 done
8527 dnl option to disable necko's disk cache
8529 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8530 [  --disable-necko-disk-cache
8531                           Disable necko disk cache],
8532     NECKO_DISK_CACHE=,
8533     NECKO_DISK_CACHE=1)
8534 AC_SUBST(NECKO_DISK_CACHE)
8535 if test "$NECKO_DISK_CACHE"; then
8536     AC_DEFINE(NECKO_DISK_CACHE)
8540 dnl option to disable necko's wifi scanner
8542 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8543 [  --disable-necko-wifi    Disable necko wifi scanner],
8544     NECKO_WIFI=,
8545     NECKO_WIFI=1)
8547 if test "$OS_ARCH" = "OS2"; then
8548   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8549   NECKO_WIFI=
8551 if test "$NECKO_WIFI" -a \
8552         "$OS_ARCH" != "Linux" -a \
8553         "$OS_ARCH" != "Darwin" -a \
8554         "$OS_ARCH" != "SunOS" -a \
8555         "$OS_ARCH" != "WINNT" -a \
8556         "$OS_ARCH" != "WINCE"; then
8557   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8560 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8561 then
8562   AC_CHECK_HEADER([iwlib.h])
8563   if test "$ac_cv_header_iwlib_h" != "yes"; then
8564     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])
8565   fi
8568 if test "$NECKO_WIFI"; then
8569   AC_DEFINE(NECKO_WIFI)
8571 AC_SUBST(NECKO_WIFI)
8574 dnl option to disable cookies
8576 MOZ_ARG_DISABLE_BOOL(cookies,
8577 [  --disable-cookies       Disable cookie support],
8578     NECKO_COOKIES=,
8579     NECKO_COOKIES=1)
8580 AC_SUBST(NECKO_COOKIES)
8581 if test "$NECKO_COOKIES"; then
8582     AC_DEFINE(NECKO_COOKIES)
8586 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8588 MOZ_ARG_DISABLE_BOOL(ctypes,
8589 [  --disable-ctypes        Disable js-ctypes],
8590     BUILD_CTYPES=,
8591     BUILD_CTYPES=1)
8592 AC_SUBST(BUILD_CTYPES)
8593 if test "$BUILD_CTYPES"; then
8594   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8595     # Disable ctypes for arm/wince.
8596     BUILD_CTYPES=
8597   else
8598     AC_DEFINE(BUILD_CTYPES)
8599   fi
8602 dnl NECKO_ configuration options are not global
8603 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8605 dnl Only build Mork if it's required
8606 AC_SUBST(MOZ_MORK)
8607 if test "$MOZ_MORK"; then
8608   AC_DEFINE(MOZ_MORK)
8611 dnl Build the lightweight Mork reader if required
8612 AC_SUBST(MOZ_MORKREADER)
8613 if test "$MOZ_MORKREADER"; then
8614   AC_DEFINE(MOZ_MORKREADER)
8617 dnl Build Places if required
8618 if test "$MOZ_PLACES"; then
8619   AC_DEFINE(MOZ_PLACES)
8622 dnl Build Sync Services if required
8623 AC_SUBST(MOZ_SERVICES_SYNC)
8624 if test -n "$MOZ_SERVICES_SYNC"; then
8625   AC_DEFINE(MOZ_SERVICES_SYNC)
8628 dnl ========================================================
8629 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8630     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8633 dnl ========================================================
8634 dnl =
8635 dnl = Maintainer debug option (no --enable equivalent)
8636 dnl =
8637 dnl ========================================================
8639 AC_SUBST(AR)
8640 AC_SUBST(AR_FLAGS)
8641 AC_SUBST(AR_LIST)
8642 AC_SUBST(AR_EXTRACT)
8643 AC_SUBST(AR_DELETE)
8644 AC_SUBST(AS)
8645 AC_SUBST(ASFLAGS)
8646 AC_SUBST(AS_DASH_C_FLAG)
8647 AC_SUBST(LD)
8648 AC_SUBST(RC)
8649 AC_SUBST(RCFLAGS)
8650 AC_SUBST(WINDRES)
8651 AC_SUBST(IMPLIB)
8652 AC_SUBST(FILTER)
8653 AC_SUBST(BIN_FLAGS)
8654 AC_SUBST(NS_USE_NATIVE)
8655 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8656 AC_SUBST(MOZ_UPDATE_XTERM)
8657 AC_SUBST(MINIMO)
8658 AC_SUBST(MOZ_PLATFORM_MAEMO)
8659 AC_SUBST(MOZ_AUTH_EXTENSION)
8660 AC_SUBST(MOZ_MATHML)
8661 AC_SUBST(MOZ_PERMISSIONS)
8662 AC_SUBST(MOZ_XTF)
8663 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8664 AC_SUBST(MOZ_PREF_EXTENSIONS)
8665 AC_SUBST(MOZ_SVG)
8666 AC_SUBST(MOZ_SMIL)
8667 AC_SUBST(MOZ_XSLT_STANDALONE)
8668 AC_SUBST(MOZ_JS_LIBS)
8669 AC_SUBST(MOZ_PSM)
8670 AC_SUBST(MOZ_DEBUG)
8671 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8672 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8673 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8674 AC_SUBST(MOZ_DEBUG_FLAGS)
8675 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8676 AC_SUBST(WARNINGS_AS_ERRORS)
8677 AC_SUBST(MOZ_EXTENSIONS)
8678 AC_SUBST(MOZ_IMG_DECODERS)
8679 AC_SUBST(MOZ_IMG_ENCODERS)
8680 AC_SUBST(MOZ_JSDEBUGGER)
8681 AC_SUBST(MOZ_PLUGINS)
8682 AC_SUBST(MOZ_LOG_REFCNT)
8683 AC_SUBST(MOZ_LEAKY)
8684 AC_SUBST(MOZ_JPROF)
8685 AC_SUBST(MOZ_SHARK)
8686 AC_SUBST(MOZ_CALLGRIND)
8687 AC_SUBST(MOZ_VTUNE)
8688 AC_SUBST(MOZ_JSLOADER)
8689 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8690 AC_SUBST(MOZ_QUANTIFY)
8691 AC_SUBST(LIBICONV)
8692 AC_SUBST(MOZ_PLACES)
8693 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8694 AC_SUBST(MOZ_STORAGE)
8695 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8696 AC_SUBST(MOZ_FEEDS)
8697 AC_SUBST(NS_PRINTING)
8698 AC_SUBST(MOZ_WEBGL)
8699 AC_SUBST(MOZ_HELP_VIEWER)
8701 AC_SUBST(MOZ_JAVAXPCOM)
8702 AC_SUBST(JAVA_INCLUDE_PATH)
8703 AC_SUBST(JAVA)
8704 AC_SUBST(JAVAC)
8705 AC_SUBST(JAR)
8707 AC_SUBST(MOZ_PROFILELOCKING)
8709 AC_SUBST(HAVE_XIE)
8710 AC_SUBST(MOZ_XIE_LIBS)
8712 AC_SUBST(BUILD_STATIC_LIBS)
8713 AC_SUBST(MOZ_ENABLE_LIBXUL)
8714 AC_SUBST(ENABLE_TESTS)
8715 AC_SUBST(IBMBIDI)
8716 AC_SUBST(MOZ_UNIVERSALCHARDET)
8717 AC_SUBST(ACCESSIBILITY)
8718 AC_SUBST(MOZ_VIEW_SOURCE)
8719 AC_SUBST(MOZ_SPELLCHECK)
8720 AC_SUBST(MOZ_USER_DIR)
8721 AC_SUBST(MOZ_CRASHREPORTER)
8722 AC_SUBST(MOZ_UPDATER)
8724 AC_SUBST(ENABLE_STRIP)
8725 AC_SUBST(PKG_SKIP_STRIP)
8726 AC_SUBST(USE_ELF_DYNSTR_GC)
8727 AC_SUBST(INCREMENTAL_LINKER)
8728 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8729 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8731 AC_SUBST(MOZ_FIX_LINK_PATHS)
8732 AC_SUBST(XPCOM_LIBS)
8733 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8734 AC_SUBST(XPCOM_GLUE_LDOPTS)
8735 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8737 AC_SUBST(USE_DEPENDENT_LIBS)
8739 AC_SUBST(MOZ_BUILD_ROOT)
8740 AC_SUBST(MOZ_OS2_TOOLS)
8741 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8743 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8744 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8745 AC_SUBST(MOZ_TIMELINE)
8746 AC_SUBST(OGLES_SDK_DIR)
8748 AC_SUBST(MOZ_APP_NAME)
8749 AC_SUBST(MOZ_APP_DISPLAYNAME)
8750 AC_SUBST(MOZ_APP_VERSION)
8751 AC_SUBST(MOZ_APP_UA_EXTRA)
8752 AC_SUBST(FIREFOX_VERSION)
8754 AC_SUBST(MOZ_PKG_SPECIAL)
8756 AC_SUBST(MOZILLA_OFFICIAL)
8758 dnl win32 options
8759 AC_SUBST(MOZ_MAPINFO)
8760 AC_SUBST(MOZ_BROWSE_INFO)
8761 AC_SUBST(MOZ_TOOLS_DIR)
8762 AC_SUBST(CYGWIN_WRAPPER)
8763 AC_SUBST(AS_PERL)
8764 AC_SUBST(WIN32_REDIST_DIR)
8765 AC_SUBST(PYTHON)
8766 AC_SUBST(MAKENSISU)
8768 AC_SUBST(WINCE)
8769 AC_SUBST(WINCE_SDK_DIR)
8770 AC_SUBST(WINCE_WINDOWS_MOBILE)
8772 dnl Echo the CFLAGS to remove extra whitespace.
8773 CFLAGS=`echo \
8774         $_WARNINGS_CFLAGS \
8775         $CFLAGS`
8777 CXXFLAGS=`echo \
8778         $_MOZ_RTTI_FLAGS \
8779         $_MOZ_EXCEPTIONS_FLAGS \
8780         $_WARNINGS_CXXFLAGS \
8781         $CXXFLAGS`
8783 COMPILE_CFLAGS=`echo \
8784     $_DEFINES_CFLAGS \
8785         $_DEPEND_CFLAGS \
8786     $COMPILE_CFLAGS`
8788 COMPILE_CXXFLAGS=`echo \
8789     $_DEFINES_CXXFLAGS \
8790         $_DEPEND_CFLAGS \
8791     $COMPILE_CXXFLAGS`
8793 AC_SUBST(SYSTEM_MAKEDEPEND)
8794 AC_SUBST(SYSTEM_LIBXUL)
8795 AC_SUBST(SYSTEM_JPEG)
8796 AC_SUBST(SYSTEM_PNG)
8797 AC_SUBST(SYSTEM_ZLIB)
8798 AC_SUBST(SYSTEM_BZ2)
8800 AC_SUBST(JPEG_CFLAGS)
8801 AC_SUBST(JPEG_LIBS)
8802 AC_SUBST(ZLIB_CFLAGS)
8803 AC_SUBST(ZLIB_LIBS)
8804 AC_SUBST(BZ2_CFLAGS)
8805 AC_SUBST(BZ2_LIBS)
8806 AC_SUBST(PNG_CFLAGS)
8807 AC_SUBST(PNG_LIBS)
8809 AC_SUBST(MOZ_JPEG_CFLAGS)
8810 AC_SUBST(MOZ_JPEG_LIBS)
8811 AC_SUBST(MOZ_ZLIB_CFLAGS)
8812 AC_SUBST(MOZ_ZLIB_LIBS)
8813 AC_SUBST(MOZ_BZ2_CFLAGS)
8814 AC_SUBST(MOZ_BZ2_LIBS)
8815 AC_SUBST(MOZ_PNG_CFLAGS)
8816 AC_SUBST(MOZ_PNG_LIBS)
8818 AC_SUBST(NSPR_CFLAGS)
8819 AC_SUBST(NSPR_LIBS)
8820 AC_SUBST(MOZ_NATIVE_NSPR)
8822 AC_SUBST(NSS_CFLAGS)
8823 AC_SUBST(NSS_LIBS)
8824 AC_SUBST(NSS_DEP_LIBS)
8825 AC_SUBST(MOZ_NATIVE_NSS)
8826 AC_SUBST(NSS_DISABLE_DBM)
8828 AC_SUBST(CFLAGS)
8829 AC_SUBST(CXXFLAGS)
8830 AC_SUBST(CPPFLAGS)
8831 AC_SUBST(COMPILE_CFLAGS)
8832 AC_SUBST(COMPILE_CXXFLAGS)
8833 AC_SUBST(LDFLAGS)
8834 AC_SUBST(LIBS)
8835 AC_SUBST(CROSS_COMPILE)
8836 AC_SUBST(WCHAR_CFLAGS)
8838 AC_SUBST(HOST_CC)
8839 AC_SUBST(HOST_CXX)
8840 AC_SUBST(HOST_CFLAGS)
8841 AC_SUBST(HOST_CXXFLAGS)
8842 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8843 AC_SUBST(HOST_AR)
8844 AC_SUBST(HOST_AR_FLAGS)
8845 AC_SUBST(HOST_LD)
8846 AC_SUBST(HOST_RANLIB)
8847 AC_SUBST(HOST_NSPR_MDCPUCFG)
8848 AC_SUBST(HOST_BIN_SUFFIX)
8849 AC_SUBST(HOST_OS_ARCH)
8851 AC_SUBST(TARGET_CPU)
8852 AC_SUBST(TARGET_VENDOR)
8853 AC_SUBST(TARGET_OS)
8854 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8855 AC_SUBST(TARGET_MD_ARCH)
8856 AC_SUBST(TARGET_XPCOM_ABI)
8857 AC_SUBST(OS_TARGET)
8858 AC_SUBST(OS_ARCH)
8859 AC_SUBST(OS_RELEASE)
8860 AC_SUBST(OS_TEST)
8862 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8863 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8865 AC_SUBST(WRAP_MALLOC_CFLAGS)
8866 AC_SUBST(WRAP_MALLOC_LIB)
8867 AC_SUBST(MKSHLIB)
8868 AC_SUBST(MKCSHLIB)
8869 AC_SUBST(MKSHLIB_FORCE_ALL)
8870 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8871 AC_SUBST(DSO_CFLAGS)
8872 AC_SUBST(DSO_PIC_CFLAGS)
8873 AC_SUBST(DSO_LDOPTS)
8874 AC_SUBST(LIB_PREFIX)
8875 AC_SUBST(DLL_PREFIX)
8876 AC_SUBST(DLL_SUFFIX)
8877 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8878 AC_SUBST(LIB_SUFFIX)
8879 AC_SUBST(OBJ_SUFFIX)
8880 AC_SUBST(BIN_SUFFIX)
8881 AC_SUBST(ASM_SUFFIX)
8882 AC_SUBST(IMPORT_LIB_SUFFIX)
8883 AC_SUBST(USE_N32)
8884 AC_SUBST(CC_VERSION)
8885 AC_SUBST(CXX_VERSION)
8886 AC_SUBST(MSMANIFEST_TOOL)
8887 AC_SUBST(NS_ENABLE_TSF)
8888 AC_SUBST(MOZ_NSS_PATCH)
8890 AC_SUBST(MOZ_MEDIA)
8891 AC_SUBST(MOZ_SYDNEYAUDIO)
8892 AC_SUBST(MOZ_WAVE)
8893 AC_SUBST(MOZ_VORBIS)
8894 AC_SUBST(MOZ_WEBM)
8895 AC_SUBST(MOZ_OGG)
8896 AC_SUBST(MOZ_ALSA_LIBS)
8897 AC_SUBST(VPX_AS)
8898 AC_SUBST(VPX_ASFLAGS)
8899 AC_SUBST(VPX_X86_ASM)
8901 if test "$USING_HCC"; then
8902    CC='${topsrcdir}/build/hcc'
8903    CC="$CC '$_OLDCC'"
8904    CXX='${topsrcdir}/build/hcpp'
8905    CXX="$CXX '$_OLDCXX'"
8906    AC_SUBST(CC)
8907    AC_SUBST(CXX)
8910 dnl Check for missing components
8911 if test "$COMPILE_ENVIRONMENT"; then
8912 if test "$MOZ_X11"; then
8913     dnl ====================================================
8914     dnl = Check if X headers exist
8915     dnl ====================================================
8916     _SAVE_CFLAGS=$CFLAGS
8917     CFLAGS="$CFLAGS $XCFLAGS"
8918     AC_TRY_COMPILE([
8919         #include <stdio.h>
8920         #include <stdlib.h>
8921         #include <X11/Xlib.h>
8922         #include <X11/Intrinsic.h>
8923     ],
8924     [
8925         Display *dpy = 0;
8926         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8927             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8928             exit(1);
8929         }
8930     ], [], 
8931     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8932     CFLAGS="$_SAVE_CFLAGS"
8934     if test ! -z "$MISSING_X"; then
8935         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8936     fi
8938 fi # MOZ_X11
8940 dnl Check for headers, etc. needed by WebGL.
8941 if test -n "$MOZ_WEBGL_GLX"; then
8942     AC_CHECK_HEADER(GL/glx.h)
8943     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8944         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8945     fi
8946 fi # MOZ_WEBGL_GLX
8947 fi # COMPILE_ENVIRONMENT
8949 if test "$USE_FC_FREETYPE"; then
8950     if test "$COMPILE_ENVIRONMENT"; then
8951         _SAVE_CPPFLAGS="$CPPFLAGS"
8952         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8953         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8954             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8955         CPPFLAGS="$_SAVE_CPPFLAGS"
8956     else
8957         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8958     fi
8961 dnl Set various defines and substitutions
8962 dnl ========================================================
8964 if test "$OS_ARCH" = "BeOS"; then
8965   AC_DEFINE(XP_BEOS)
8966 elif test "$OS_ARCH" = "Darwin"; then
8967   AC_DEFINE(XP_UNIX)
8968   AC_DEFINE(UNIX_ASYNC_DNS)
8969 elif test "$OS_ARCH" = "OpenVMS"; then
8970   AC_DEFINE(XP_UNIX)
8971 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8972   AC_DEFINE(XP_UNIX)
8973   AC_DEFINE(UNIX_ASYNC_DNS)
8976 if test "$MOZ_DEBUG"; then
8977     AC_DEFINE(MOZ_REFLOW_PERF)
8978     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8981 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8982     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8983     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8984     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8985     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8986     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8987     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8988     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8989     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8992 dnl ========================================================
8993 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8994 dnl ========================================================
8995 case "$host_os" in
8996 mingw*)
8997     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8998     ;;
8999 cygwin*|msvc*|mks*)
9000     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9001     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9002     CC="\$(CYGWIN_WRAPPER) $CC"
9003     CXX="\$(CYGWIN_WRAPPER) $CXX"
9004     CPP="\$(CYGWIN_WRAPPER) $CPP"
9005     LD="\$(CYGWIN_WRAPPER) $LD"
9006     AS="\$(CYGWIN_WRAPPER) $AS"
9007     RC="\$(CYGWIN_WRAPPER) $RC"
9008     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9009     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9010     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9011     ;;
9012 esac
9014 AC_SUBST(CYGDRIVE_MOUNT)
9015 AC_SUBST(WIN_TOP_SRC)
9017 AC_SUBST(MOZILLA_VERSION)
9019 AC_SUBST(ac_configure_args)
9021 dnl Spit out some output
9022 dnl ========================================================
9024 dnl The following defines are used by xpcom
9025 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9026 CPP_THROW_NEW
9027 HAVE_CPP_2BYTE_WCHAR_T
9028 HAVE_CPP_ACCESS_CHANGING_USING
9029 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9030 HAVE_CPP_BOOL
9031 HAVE_CPP_CHAR16_T
9032 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9033 HAVE_CPP_EXPLICIT
9034 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9035 HAVE_CPP_NAMESPACE_STD
9036 HAVE_CPP_NEW_CASTS
9037 HAVE_CPP_PARTIAL_SPECIALIZATION
9038 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9039 HAVE_CPP_TYPENAME
9040 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9041 HAVE_STATVFS
9042 NEED_CPP_UNUSED_IMPLEMENTATIONS
9043 NEW_H
9044 HAVE_GETPAGESIZE
9045 HAVE_ICONV
9046 HAVE_ICONV_WITH_CONST_INPUT
9047 HAVE_MBRTOWC
9048 HAVE_SYS_MOUNT_H
9049 HAVE_SYS_VFS_H
9050 HAVE_WCRTOMB
9053 AC_CONFIG_HEADER(
9054 netwerk/necko-config.h
9055 xpcom/xpcom-config.h
9056 xpcom/xpcom-private.h
9059 # Save the defines header file before autoconf removes it.
9060 # (Do not add AC_DEFINE calls after this line.)
9061   _CONFIG_TMP=confdefs-tmp.h
9062   _CONFIG_DEFS_H=mozilla-config.h
9064   cat > $_CONFIG_TMP <<\EOF
9065 /* List of defines generated by configure. Included with preprocessor flag,
9066  * -include, to avoid long list of -D defines on the compile command-line.
9067  * Do not edit.
9068  */
9070 #ifndef _MOZILLA_CONFIG_H_
9071 #define _MOZILLA_CONFIG_H_
9074 _EGREP_PATTERN='^#define ('
9075 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9076     for f in $_NON_GLOBAL_ACDEFINES; do
9077         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9078     done
9080 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9082   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9084   cat >> $_CONFIG_TMP <<\EOF
9086 #endif /* _MOZILLA_CONFIG_H_ */
9090   # Only write mozilla-config.h when something changes (or it doesn't exist)
9091   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9092     rm $_CONFIG_TMP
9093   else
9094     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9095     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9097     echo ==== $_CONFIG_DEFS_H =================================
9098     cat $_CONFIG_DEFS_H
9099   fi
9101 dnl Probably shouldn't call this manually but we always want the output of DEFS
9102 rm -f confdefs.h.save
9103 mv confdefs.h confdefs.h.save
9104 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9105 AC_OUTPUT_MAKE_DEFS()
9106 MOZ_DEFINES=$DEFS
9107 AC_SUBST(MOZ_DEFINES)
9108 rm -f confdefs.h
9109 mv confdefs.h.save confdefs.h
9111 dnl Load the list of Makefiles to generate.
9112 dnl   To add new Makefiles, edit allmakefiles.sh.
9113 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9114 . ${srcdir}/allmakefiles.sh
9115 dnl 
9116 dnl Run a perl script to quickly create the makefiles.
9117 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9118 dnl   for the files it cannot handle correctly. This way, config.status
9119 dnl   will handle these files.
9120 dnl If it fails, nothing is set and config.status will run as usual.
9122 dnl This does not change the $MAKEFILES variable.
9124 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9126 if test -z "${AS_PERL}"; then
9127 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9128 else
9129 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9131 . ./conftest.sh
9132 rm conftest.sh
9134 echo $MAKEFILES > unallmakefiles
9136 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9138 AC_OUTPUT($MAKEFILES)
9140 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9141 if test "$CAIRO_FEATURES_H"; then
9142   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9143     echo "$CAIRO_FEATURES_H is unchanged"
9144     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9145   else
9146     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9147   fi
9150 dnl ========================================================
9151 dnl = Setup a nice relatively clean build environment for
9152 dnl = sub-configures.
9153 dnl ========================================================
9154 CC="$_SUBDIR_CC" 
9155 CXX="$_SUBDIR_CXX" 
9156 CFLAGS="$_SUBDIR_CFLAGS" 
9157 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9158 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9159 LDFLAGS="$_SUBDIR_LDFLAGS"
9160 HOST_CC="$_SUBDIR_HOST_CC" 
9161 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9162 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9165 unset MAKEFILES
9166 unset CONFIG_FILES
9168 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9169 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9171 if test -n "$MOZ_THUMB2"; then
9172   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9174 if test -n "$_WRAP_MALLOC"; then
9175   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9178 if test -z "$MOZ_NATIVE_NSPR"; then
9179     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9180     if test -z "$MOZ_DEBUG"; then
9181         ac_configure_args="$ac_configure_args --disable-debug"
9182     fi
9183     if test "$MOZ_OPTIMIZE" = "1"; then
9184         ac_configure_args="$ac_configure_args --enable-optimize"
9185     fi
9186     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
9187        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9188     fi
9189     if test -n "$HAVE_64BIT_OS"; then
9190         ac_configure_args="$ac_configure_args --enable-64bit"
9191     fi
9192     if test -n "$USE_ARM_KUSER"; then
9193         ac_configure_args="$ac_configure_args --with-arm-kuser"
9194     fi
9195     AC_OUTPUT_SUBDIRS(nsprpub)
9196     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9199 if test -z "$MOZ_NATIVE_NSPR"; then
9200     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9201     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9202     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
9203        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9204        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9205        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9206        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9207     fi
9208     rm -f config/autoconf.mk.bak
9211 # Run the SpiderMonkey 'configure' script.
9212 dist=$MOZ_BUILD_ROOT/dist
9213 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9214 ac_configure_args="$ac_configure_args --enable-threadsafe"
9215 if test "$BUILD_CTYPES"; then
9216     # Build js-ctypes on the platforms we can.
9217     ac_configure_args="$ac_configure_args --enable-ctypes"
9219 if test -z "$MOZ_NATIVE_NSPR"; then
9220     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9221     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9223 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9224 ac_configure_args="$ac_configure_args --prefix=$dist"
9225 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9226 if test "$MOZ_MEMORY"; then
9227    ac_configure_args="$ac_configure_args --enable-jemalloc"
9228    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9229      export MOZ_MEMORY_LDFLAGS
9230    fi
9232 AC_OUTPUT_SUBDIRS(js/src)
9233 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9235 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9237 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9238 dnl Needs to be at the end to respect possible changes from NSPR configure
9239 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9240   echo "config/autoconf.mk is unchanged"
9241   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9242 else
9243   rm -f config/autoconf.mk.orig 2> /dev/null