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