Bug 574821 - Add titlebar margin to browser-aero css for maximized windows - addresse...
[mozilla-central.git] / configure.in
blobcc30a2bc09c1f96c4297645f3afd4325f05662b2
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 MOZ_ENABLE_POSTSCRIPT=1 
1237 if test -n "$CROSS_COMPILE"; then
1238     OS_TARGET="${target_os}"
1239     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1240     OS_RELEASE=
1241     case "${target_os}" in
1242         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1243         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1244         gnu*)         OS_ARCH=GNU ;;
1245         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1246         mingw*)       OS_ARCH=WINNT ;;
1247         wince*)       OS_ARCH=WINCE ;;
1248         winmo*)       OS_ARCH=WINCE ;;
1249         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1250     esac
1251     case "${target}" in
1252         arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1253     esac
1254 else
1255     OS_TARGET=`uname -s`
1256     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1257     OS_RELEASE=`uname -r`
1260 # Before this used `uname -m` when not cross compiling
1261 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1262 OS_TEST="${target_cpu}"
1264 _COMPILER_PREFIX=
1266 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1268 #######################################################################
1269 # Master "Core Components" macros for getting the OS target           #
1270 #######################################################################
1273 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1274 # cross-compilation.
1278 # Define and override various archtecture-specific variables, including
1279 # HOST_OS_ARCH
1280 # OS_ARCH
1281 # OS_TEST
1282 # OS_TARGET
1283 # OS_RELEASE
1284 # OS_MINOR_RELEASE
1287 case "$HOST_OS_ARCH" in
1288 cygwin*|mingw*|mks*|msvc*)
1289     HOST_OS_ARCH=WINNT
1290     ;;
1291 darwin*)
1292     HOST_OS_ARCH=Darwin
1293     ;;
1294 linux*)
1295     HOST_OS_ARCH=Linux
1296     ;;
1297 solaris*)
1298     HOST_OS_ARCH=SunOS
1299     SOLARIS_SUNPRO_CC=
1300     SOLARIS_SUNPRO_CXX=
1301     if test -z "$GNU_CC"; then
1302         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1303             SOLARIS_SUNPRO_CC=1
1304        fi
1305     fi
1307     if test -z "$GNU_CXX"; then
1308        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1309            SOLARIS_SUNPRO_CXX=1
1310        fi
1311     fi
1312     AC_SUBST(SOLARIS_SUNPRO_CC)
1313     AC_SUBST(SOLARIS_SUNPRO_CXX)
1314     ;;
1315 BSD_386)
1316     HOST_OS_ARCH=BSD
1317     ;;
1318 dgux)
1319     HOST_OS_ARCH=DGUX
1320     ;;
1321 IRIX64)
1322     HOST_OS_ARCH=IRIX
1323     ;;
1324 UNIX_SV)
1325     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1326         HOST_OS_ARCH=NCR
1327     else
1328         HOST_OS_ARCH=UNIXWARE
1329     fi
1330     ;;
1331 ncr)
1332     HOST_OS_ARCH=NCR
1333     ;;
1334 UNIX_SYSTEM_V)
1335     HOST_OS_ARCH=NEC
1336     ;;
1337 OSF1)
1338     ;;
1339 *OpenVMS*)
1340     HOST_OS_ARCH=OpenVMS
1341     ;;
1342 OS_2)
1343     HOST_OS_ARCH=OS2
1344     ;;
1345 QNX)
1346     ;;
1347 SCO_SV)
1348     HOST_OS_ARCH=SCOOS
1349     ;;
1350 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1351     HOST_OS_ARCH=SINIX
1352     ;;
1353 UnixWare)
1354     HOST_OS_ARCH=UNIXWARE
1355     ;;
1356 esac
1358 case "$OS_ARCH" in
1359 WINNT)
1360     if test -z "$CROSS_COMPILE" ; then
1361         OS_TEST=`uname -p`
1362     fi
1363     ;;
1364 Windows_NT)
1366 # If uname -s returns "Windows_NT", we assume that we are using
1367 # the uname.exe in MKS toolkit.
1369 # The -r option of MKS uname only returns the major version number.
1370 # So we need to use its -v option to get the minor version number.
1371 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1373     OS_ARCH=WINNT
1374     OS_TARGET=WINNT
1375     OS_MINOR_RELEASE=`uname -v`
1376     if test "$OS_MINOR_RELEASE" = "00"; then
1377         OS_MINOR_RELEASE=0
1378     fi
1379     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1380     ;;
1381 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1383 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1384 # the uname.exe in the Cygwin tools.
1385 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1386 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1387 # the uname.exe in the GNU-Win32 tools.
1388 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1389 # the uname.exe in the MSYS tools.
1391     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1392     OS_ARCH=WINNT
1393     OS_TARGET=WINNT
1394     ;;
1395 AIX)
1396     OS_RELEASE=`uname -v`.`uname -r`
1397     OS_TEST=${target_cpu}
1398     ;;
1399 BSD_386)
1400     OS_ARCH=BSD
1401     ;;
1402 dgux)
1403     OS_ARCH=DGUX
1404     ;;
1405 IRIX64)
1406     OS_ARCH=IRIX
1407     ;;
1408 UNIX_SV)
1409     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1410         OS_ARCH=NCR
1411     else
1412         OS_ARCH=UNIXWARE
1413         OS_RELEASE=`uname -v`
1414     fi
1415     ;;
1416 ncr)
1417     OS_ARCH=NCR
1418     ;;
1419 UNIX_SYSTEM_V)
1420     OS_ARCH=NEC
1421     ;;
1422 OSF1)
1423     case `uname -v` in
1424     148)
1425         OS_RELEASE=V3.2C
1426         ;;
1427     564)
1428         OS_RELEASE=V4.0B
1429         ;;
1430     878)
1431         OS_RELEASE=V4.0D
1432         ;;
1433     esac
1434     ;;
1435 *OpenVMS*)
1436     OS_ARCH=OpenVMS
1437     OS_RELEASE=`uname -v`
1438     OS_TEST=`uname -p`
1439     ;;
1440 OS_2)
1441     OS_ARCH=OS2
1442     OS_TARGET=OS2
1443     OS_RELEASE=`uname -v`
1444     ;;
1445 QNX)
1446     if test "$OS_TARGET" != "NTO"; then
1447         changequote(,)
1448         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1449         changequote([,])
1450     fi
1451     OS_TEST=x86
1452     ;;
1453 SCO_SV)
1454     OS_ARCH=SCOOS
1455     OS_RELEASE=5.0
1456     ;;
1457 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1458     OS_ARCH=SINIX
1459     OS_TEST=`uname -p`
1460     ;;
1461 UnixWare)
1462     OS_ARCH=UNIXWARE
1463     OS_RELEASE=`uname -v`
1464     ;;
1465 WINCE)
1466     OS_ARCH=WINCE
1467     case "${target_os}" in
1468     *winmo)
1469         OS_TARGET=WINMO
1470         WINCE_WINDOWS_MOBILE=1
1471         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1472         ;;
1473     *)
1474         OS_TARGET=WINCE
1475         ;;
1476     esac
1477     ;;
1478 Darwin)
1479     case "${target_cpu}" in
1480     powerpc*)
1481         OS_TEST=ppc
1482         ;;
1483     i*86*)
1484         OS_TEST=i386 
1485         ;;
1486     x86_64)
1487         OS_TEST=x86_64
1488         ;;
1489     *)
1490         if test -z "$CROSS_COMPILE" ; then
1491             OS_TEST=`uname -p`
1492         fi
1493         ;;
1494     esac
1495     ;;
1496 esac
1498 if test "$OS_ARCH" = "NCR"; then
1499     changequote(,)
1500     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1501     changequote([,])
1504 # Only set CPU_ARCH if we recognize the value of OS_TEST
1506 case "$OS_TEST" in
1507 *86 | i86pc)
1508     CPU_ARCH=x86
1509     ;;
1511 powerpc64 | ppc64)
1512     CPU_ARCH=ppc64
1513     ;;
1515 powerpc | ppc | rs6000)
1516     CPU_ARCH=ppc
1517     ;;
1519 Alpha | alpha | ALPHA)
1520     CPU_ARCH=Alpha
1521     ;;
1523 s390)
1524     CPU_ARCH=s390
1525     ;;
1527 s390x)
1528     CPU_ARCH=s390x
1529     ;;
1531 hppa* | parisc)
1532     CPU_ARCH=hppa
1533     ;;
1535 sun4u | sparc*)
1536     CPU_ARCH=sparc
1537     ;;
1539 x86_64 | ia64)
1540     CPU_ARCH="$OS_TEST"
1541     ;;
1543 arm)
1544     CPU_ARCH=arm
1545     ;;
1546 esac
1548 if test -z "$OS_TARGET"; then
1549     OS_TARGET=$OS_ARCH
1551 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1553 dnl ========================================================
1554 dnl GNU specific defaults
1555 dnl ========================================================
1556 if test "$GNU_CC"; then
1557     # FIXME: Let us build with strict aliasing. bug 414641.
1558     CFLAGS="$CFLAGS -fno-strict-aliasing"
1559     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1560     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1561     DSO_LDOPTS='-shared'
1562     if test "$GCC_USE_GNU_LD"; then
1563         # Don't allow undefined symbols in libraries
1564         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1565     fi
1566     WARNINGS_AS_ERRORS='-Werror'
1567     DSO_CFLAGS=''
1568     DSO_PIC_CFLAGS='-fPIC'
1569     ASFLAGS="$ASFLAGS -fPIC"
1570     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1571     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1572     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1573     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1575     # Turn on GNU specific features
1576     # -Wall - turn on all warnings
1577     # -pedantic - make compiler warn about non-ANSI stuff, and
1578     #             be a little bit stricter
1579     # Warnings slamm took out for now (these were giving more noise than help):
1580     # -Wbad-function-cast - warns when casting a function to a new return type
1581     # -Wshadow - removed because it generates more noise than help --pete
1582     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1583     if test -z "$INTEL_CC"; then
1584        # Don't use -Wcast-align with ICC
1585        case "$CPU_ARCH" in
1586            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1587            hppa | ia64 | sparc | arm)
1588            ;;
1589            *)
1590         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1591            ;;
1592        esac
1593     fi
1595     dnl Turn pedantic on but disable the warnings for long long
1596     _PEDANTIC=1
1598     if test -z "$INTEL_CC"; then
1599       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1600     fi
1602     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1603     _USE_CPP_INCLUDE_FLAG=1
1604 elif test "$SOLARIS_SUNPRO_CC"; then
1605     DSO_CFLAGS=''
1606     if test "$CPU_ARCH" = "sparc"; then
1607         # for Sun Studio on Solaris/SPARC
1608         DSO_PIC_CFLAGS='-xcode=pic32'
1609     else
1610         DSO_PIC_CFLAGS='-KPIC'
1611     fi
1612     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1613 else
1614     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1615     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1617     DSO_LDOPTS='-shared'
1618     if test "$GNU_LD"; then
1619         # Don't allow undefined symbols in libraries
1620         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1621     fi
1623     DSO_CFLAGS=''
1624     DSO_PIC_CFLAGS='-KPIC'
1625     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1628 if test "$GNU_CXX"; then
1629     # FIXME: Let us build with strict aliasing. bug 414641.
1630     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1631     # Turn on GNU specific features
1632     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1633     if test -z "$INTEL_CC"; then
1634        # Don't use -Wcast-align with ICC
1635        case "$CPU_ARCH" in
1636            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1637            hppa | ia64 | sparc | arm)
1638            ;;
1639            *)
1640         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1641            ;;
1642        esac
1643     fi
1645     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1646     _USE_CPP_INCLUDE_FLAG=1
1648     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1649                    ac_has_wno_invalid_offsetof,
1650         [
1651             AC_LANG_SAVE
1652             AC_LANG_CPLUSPLUS
1653             _SAVE_CXXFLAGS="$CXXFLAGS"
1654             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1655             AC_TRY_COMPILE([],
1656                            [return(0);],
1657                            ac_has_wno_invalid_offsetof="yes",
1658                            ac_has_wno_invalid_offsetof="no")
1659             CXXFLAGS="$_SAVE_CXXFLAGS"
1660             AC_LANG_RESTORE
1661         ])
1662     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1663         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1664     fi
1666     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1667                    ac_has_wno_variadic_macros,
1668         [
1669             AC_LANG_SAVE
1670             AC_LANG_CPLUSPLUS
1671             _SAVE_CXXFLAGS="$CXXFLAGS"
1672             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1673             AC_TRY_COMPILE([],
1674                            [return(0);],
1675                            ac_has_wno_variadic_macros="yes",
1676                            ac_has_wno_variadic_macros="no")
1677             CXXFLAGS="$_SAVE_CXXFLAGS"
1678             AC_LANG_RESTORE
1679         ])
1680     if test "$ac_has_wno_variadic_macros" = "yes"; then
1681         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1682     fi
1684     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1685                    ac_has_werror_return_type,
1686         [
1687             AC_LANG_SAVE
1688             AC_LANG_CPLUSPLUS
1689             _SAVE_CXXFLAGS="$CXXFLAGS"
1690             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1691             AC_TRY_COMPILE([],
1692                            [return(0);],
1693                            ac_has_werror_return_type="yes",
1694                            ac_has_werror_return_type="no")
1695             CXXFLAGS="$_SAVE_CXXFLAGS"
1696             AC_LANG_RESTORE
1697         ])
1698     if test "$ac_has_werror_return_type" = "yes"; then
1699         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1700     fi
1702 else
1703     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1706 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1707 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1708 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1709 dnl normal behavior.
1710 dnl ========================================================
1711 MKSHLIB_FORCE_ALL=
1712 MKSHLIB_UNFORCE_ALL=
1714 if test "$COMPILE_ENVIRONMENT"; then
1715 if test "$GNU_CC"; then
1716   AC_MSG_CHECKING(whether ld has archive extraction flags)
1717   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1718    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1719     ac_cv_mkshlib_force_and_unforce="no"
1720     exec 3<&0 <<LOOP_INPUT
1721         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1722         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1723         force="-Wl,-all";              unforce="-Wl,-none"
1724 LOOP_INPUT
1725     while read line
1726     do
1727       eval $line
1728       LDFLAGS=$force
1729       LIBS=$unforce
1730       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1731     done
1732     exec 0<&3 3<&-
1733     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1734    ])
1735   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1736     AC_MSG_RESULT(no)
1737   else
1738     AC_MSG_RESULT(yes)
1739     eval $ac_cv_mkshlib_force_and_unforce
1740     MKSHLIB_FORCE_ALL=$force
1741     MKSHLIB_UNFORCE_ALL=$unforce
1742   fi
1743 fi # GNU_CC
1744 fi # COMPILE_ENVIRONMENT
1746 dnl =================================================================
1747 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1748 dnl which is bad when cross compiling.
1749 dnl =================================================================
1750 if test "$COMPILE_ENVIRONMENT"; then
1751 configure_static_assert_macros='
1752 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1753 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1754 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1757 dnl test that the macros actually work:
1758 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1759 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1760  [AC_LANG_SAVE
1761   AC_LANG_C
1762   ac_cv_static_assertion_macros_work="yes"
1763   AC_TRY_COMPILE([$configure_static_assert_macros],
1764                  [CONFIGURE_STATIC_ASSERT(1)],
1765                  ,
1766                  ac_cv_static_assertion_macros_work="no")
1767   AC_TRY_COMPILE([$configure_static_assert_macros],
1768                  [CONFIGURE_STATIC_ASSERT(0)],
1769                  ac_cv_static_assertion_macros_work="no",
1770                  )
1771   AC_LANG_CPLUSPLUS
1772   AC_TRY_COMPILE([$configure_static_assert_macros],
1773                  [CONFIGURE_STATIC_ASSERT(1)],
1774                  ,
1775                  ac_cv_static_assertion_macros_work="no")
1776   AC_TRY_COMPILE([$configure_static_assert_macros],
1777                  [CONFIGURE_STATIC_ASSERT(0)],
1778                  ac_cv_static_assertion_macros_work="no",
1779                  )
1780   AC_LANG_RESTORE
1781  ])
1782 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1783 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1784     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1786 fi # COMPILE_ENVIRONMENT
1788 dnl ========================================================
1789 dnl Checking for 64-bit OS
1790 dnl ========================================================
1791 if test "$COMPILE_ENVIRONMENT"; then
1792 AC_LANG_SAVE
1793 AC_LANG_C
1794 AC_MSG_CHECKING(for 64-bit OS)
1795 AC_TRY_COMPILE([$configure_static_assert_macros],
1796                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1797                result="yes", result="no")
1798 AC_MSG_RESULT("$result")
1799 if test "$result" = "yes"; then
1800     AC_DEFINE(HAVE_64BIT_OS)
1801     HAVE_64BIT_OS=1
1803 AC_SUBST(HAVE_64BIT_OS)
1804 AC_LANG_RESTORE
1805 fi # COMPILE_ENVIRONMENT
1807 dnl ========================================================
1808 dnl Enable high-memory support on OS/2 by default.
1809 dnl ========================================================
1810 MOZ_OS2_HIGH_MEMORY=1
1811 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1812 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1813     MOZ_OS2_HIGH_MEMORY=,
1814     MOZ_OS2_HIGH_MEMORY=1 )
1815 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1817 dnl ========================================================
1818 dnl System overrides of the defaults for host
1819 dnl ========================================================
1820 case "$host" in
1821 *-beos*)
1822     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1823     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1824     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1825     ;;
1827 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1828     # we need Python 2.5 on Windows
1829     PYTHON_VERSION=2.5
1830     if test -n "$_WIN32_MSVC"; then
1831         HOST_AR=lib
1832         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1833         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1834         HOST_RANLIB='echo ranlib'
1835     else
1836         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1837     fi
1838     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1839     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1840     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1841     HOST_BIN_SUFFIX=.exe
1842     case "$host" in
1843     *mingw*)
1844     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1845         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1846         ;;
1847     *)
1848         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1849         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1850             _pwd=`pwd`
1851             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1852         fi
1853         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1854             AS_PERL=1
1855             PERL="${CYGWIN_WRAPPER} $PERL"
1856         fi
1858         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1859             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1860         fi
1861         ;;
1862     esac
1864     case "${host_cpu}" in
1865     x86_64)
1866         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1867         ;;
1868     esac
1869     ;;
1871 *-darwin*)
1872     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1873     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1874     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1875     ;;
1877 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1878     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1879     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1880     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1881     ;;
1883 *os2*)
1884     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1885     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1886     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1887     HOST_BIN_SUFFIX=.exe
1888     MOZ_FIX_LINK_PATHS=
1889     ;;
1891 *-osf*)
1892     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1893     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1894     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1895     ;;
1898     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1899     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1900     ;;
1901 esac
1903 dnl We require version 2.4 or newer of Python to build,
1904 dnl and 2.5 or newer on Windows.
1905 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1906 changequote(,)
1907 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1908 _python_res=$?
1909 changequote([,])
1910 if test "$_python_res" != 0; then
1911     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1913 AC_MSG_RESULT([yes])
1915 dnl Get mozilla version from central milestone file
1916 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1918 dnl Get version of various core apps from the version files.
1919 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1921 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1922 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1924 dnl ========================================================
1925 dnl System overrides of the defaults for target
1926 dnl ========================================================
1928 case "$target" in
1929 *-aix*)
1930     AC_DEFINE(AIX)
1931     if test ! "$GNU_CC"; then
1932         if test ! "$HAVE_64BIT_OS"; then
1933             # Compiling with Visual Age C++ object model compat is the
1934             # default. To compile with object model ibm, add 
1935             # AIX_OBJMODEL=ibm to .mozconfig.
1936             if test "$AIX_OBJMODEL" = "ibm"; then
1937                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1938             else
1939                 AIX_OBJMODEL=compat
1940             fi
1941         else
1942             AIX_OBJMODEL=compat
1943         fi
1944         AC_SUBST(AIX_OBJMODEL)
1945         DSO_LDOPTS='-qmkshrobj=1'
1946         DSO_CFLAGS='-qflag=w:w'
1947         DSO_PIC_CFLAGS=
1948         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1949         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1950         MOZ_FIX_LINK_PATHS=
1951         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1952         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1953         if test "$COMPILE_ENVIRONMENT"; then
1954             AC_LANG_SAVE
1955             AC_LANG_CPLUSPLUS
1956             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1957             AC_TRY_COMPILE([],
1958                 [#if (__IBMCPP__ < 600)
1959                  #error "Bad compiler"
1960                  #endif],
1961                 _BAD_COMPILER=,_BAD_COMPILER=1)
1962             if test -n "$_BAD_COMPILER"; then
1963                 AC_MSG_RESULT([no])    
1964                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1965             else
1966                 AC_MSG_RESULT([yes])    
1967             fi
1968             AC_LANG_RESTORE
1969             TARGET_COMPILER_ABI="ibmc"
1970             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1971             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1972         fi
1973     fi
1974     case "${target_os}" in
1975     aix4.1*)
1976         DLL_SUFFIX='_shr.a'
1977         ;;
1978     esac
1979     if test "$COMPILE_ENVIRONMENT"; then
1980         AC_CHECK_HEADERS(sys/inttypes.h)
1981     fi
1982     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1983     ;;
1985 *-beos*)
1986     no_x=yes
1987     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1988     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1989     DSO_LDOPTS='-nostart'
1990     TK_LIBS='-lbe -lroot'
1991     LIBS="$LIBS -lbe"
1992     if test "$COMPILE_ENVIRONMENT"; then
1993         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1994         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1995     fi
1996     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1997     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1998     _MOZ_USE_RTTI=1
1999     USE_DEPENDENT_LIBS=
2000     MOZ_USER_DIR="Mozilla"
2001     ;;
2003 *-bsdi*)
2004     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2005     _PEDANTIC=
2006     case $OS_RELEASE in
2007         4.*|5.*)
2008             STRIP="$STRIP -d"
2009             ;;
2010         *)
2011             DSO_CFLAGS=''
2012             DSO_LDOPTS='-r'
2013             _WARNINGS_CFLAGS="-Wall"
2014             _WARNINGS_CXXFLAGS="-Wall"
2015             # The test above doesn't work properly, at least on 3.1.
2016             MKSHLIB_FORCE_ALL=''
2017             MKSHLIB_UNFORCE_ALL=''
2018         ;;
2019     esac
2020     ;;
2022 *-darwin*) 
2023     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2024     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2025     MOZ_OPTIMIZE_FLAGS="-O3"
2026     _PEDANTIC=
2027     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2028     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2029     DLL_SUFFIX=".dylib"
2030     DSO_LDOPTS=''
2031     STRIP="$STRIP -x -S"
2032     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2033     MOZ_ENABLE_POSTSCRIPT=
2034     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2035     # The ExceptionHandling framework is needed for Objective-C exception
2036     # logging code in nsObjCExceptions.h. Currently we only use that in debug
2037     # builds.
2038     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2040     dnl DTrace and -dead_strip don't interact well. See bug 403132.
2041     dnl ===================================================================
2042     if test "x$enable_dtrace" = "xyes"; then
2043         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2044     else
2045         dnl check for the presence of the -dead_strip linker flag
2046         AC_MSG_CHECKING([for -dead_strip option to ld])
2047         _SAVE_LDFLAGS=$LDFLAGS
2048         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2049         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2050         if test -n "$_HAVE_DEAD_STRIP" ; then
2051             AC_MSG_RESULT([yes])
2052             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2053         else
2054             AC_MSG_RESULT([no])
2055         fi
2056         
2057         LDFLAGS=$_SAVE_LDFLAGS
2058     fi
2059     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2060     ;;
2062 *-freebsd*)
2063     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2064         DLL_SUFFIX=".so.1.0"
2065         DSO_LDOPTS="-shared"
2066     fi
2067     if test ! "$GNU_CC"; then
2068         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2069     fi
2070 # Can't have force w/o an unforce.
2071 #    # Hack for FreeBSD 2.2
2072 #    if test -z "$MKSHLIB_FORCE_ALL"; then
2073 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
2074 #       MKSHLIB_UNFORCE_ALL=''
2075 #    fi
2076     ;; 
2078 ia64*-hpux*)
2079     DLL_SUFFIX=".so"
2080     if test ! "$GNU_CC"; then
2081        DSO_LDOPTS='-b'
2082        DSO_CFLAGS=""
2083        DSO_PIC_CFLAGS=
2084        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2085        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2086        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2087     else
2088        DSO_LDOPTS='-b -E'
2089        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2090        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2091     fi
2092     MOZ_FIX_LINK_PATHS=
2093     SYSTEM_MAKEDEPEND=
2094     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2095     AC_DEFINE(_LARGEFILE64_SOURCE)
2096     ;;
2098 *-hpux*)
2099     DLL_SUFFIX=".sl"
2100     if test ! "$GNU_CC"; then
2101         DSO_LDOPTS='-b -Wl,+s'
2102         DSO_CFLAGS=""
2103         DSO_PIC_CFLAGS="+Z"
2104         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2105         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2106         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2107     else
2108         DSO_LDOPTS='-b -E +s'
2109         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2110         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2111     fi
2112     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2113     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2114     ;;
2116 *-irix5*)
2117     AC_DEFINE(IRIX)
2118     DSO_LDOPTS='-elf -shared'
2120     if test "$GNU_CC"; then
2121        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2122        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2123        MKSHLIB_FORCE_ALL='-Wl,-all'
2124        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2125        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2126     else
2127        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2128        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2129        MKSHLIB_FORCE_ALL='-all'
2130        MKSHLIB_UNFORCE_ALL='-none'
2131     fi
2132     ;;
2134 *-irix6*)
2135     AC_DEFINE(IRIX)
2136     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
2137     dnl compile and link using -n32
2138     USE_N32=1
2139     TARGET_COMPILER_ABI=n32
2140     DSO_LDOPTS='-elf -shared'
2141     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2142     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2143     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2144     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2145     if test "$GNU_CC"; then
2146        MKSHLIB_FORCE_ALL='-Wl,-all'
2147        MKSHLIB_UNFORCE_ALL='-Wl,-none'
2148        _WARNINGS_CFLAGS="-Wall"
2149        _WARNINGS_CXXFLAGS="-Wall"
2150        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2151     else
2152        MKSHLIB_FORCE_ALL='-all'
2153        MKSHLIB_UNFORCE_ALL='-none'
2154            AR_LIST="$AR t"
2155            AR_EXTRACT="$AR x"
2156            AR_DELETE="$AR d"
2157            AR='$(CXX) -ar'
2158            AR_FLAGS='-o $@'
2159        CFLAGS="$CFLAGS -woff 3262 -G 4"
2160        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2161        if test -n "$USE_N32"; then
2162            ASFLAGS="$ASFLAGS -n32"
2163            CFLAGS="$CFLAGS -n32"
2164            CXXFLAGS="$CXXFLAGS -n32"
2165            LDFLAGS="$LDFLAGS -n32"
2166        fi
2167        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2168        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2169        MOZ_FIX_LINK_PATHS=
2170     fi
2171     if test -z "$GNU_CXX"; then
2172       MIPSPRO_CXX=1
2173     fi
2174     ;;
2176 *-*linux*)
2177     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2178     # Similarly for GNU_CXX and INTEL_CXX.
2179     if test "$INTEL_CC" || test "$INTEL_CXX"; then
2180         # -Os has been broken on Intel's C/C++ compilers for quite a
2181         # while; Intel recommends against using it.
2182         MOZ_OPTIMIZE_FLAGS="-O2"
2183         MOZ_DEBUG_FLAGS="-g"
2184     elif test "$GNU_CC" || test "$GNU_CXX"; then
2185         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2186         case $GCC_VERSION in
2187         4.1.*|4.2.*)
2188             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2189             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2190         esac
2191         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2192         MOZ_DEBUG_FLAGS="-g"
2193     fi
2195     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2197     MOZ_MEMORY=1
2199     case "${target_cpu}" in
2200     alpha*)
2201         CFLAGS="$CFLAGS -mieee"
2202         CXXFLAGS="$CXXFLAGS -mieee"
2203     ;;
2204     i*86)
2205         USE_ELF_DYNSTR_GC=1
2206     ;;
2207     mips*)
2208         MOZ_DEBUG_FLAGS="-g" # We want inlining
2209     ;;
2210     esac
2211     ;;
2213 *-wince*|*-winmo*)
2214     TARGET_COMPILER_ABI=msvc
2215     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2216     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2217     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2218     AR_LIST="$AR -list"
2219     AR_EXTRACT="$AR -extract"
2220     AR_DELETE="$AR d"
2221     AR_FLAGS='-OUT:"$@"'
2222     MOZ_MEMORY=1
2223     NSS_DISABLE_DBM=1
2224     MOZ_OGG=
2225     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2227     if test "$AS_BIN"; then
2228         AS="$AS_BIN"
2229     fi
2230     DSO_CFLAGS=
2231     DSO_PIC_CFLAGS=
2232     DLL_SUFFIX=.dll
2233     BIN_SUFFIX='.exe'
2234     if test -z "$RC"; then 
2235         RC=rc.exe  
2236     fi
2237     # certain versions of cygwin's makedepend barf on the 
2238     # #include <string> vs -I./dist/include/string issue so don't use it
2239     SYSTEM_MAKEDEPEND=
2241     HOST_CC=cl
2242     HOST_CXX=cl
2243     HOST_LD=link
2244     HOST_AR='lib -OUT:$@'
2245     HOST_RANLIB='echo ranlib'
2246     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2247         
2248         
2249     WARNINGS_AS_ERRORS='-WX'
2250     MOZ_OPTIMIZE_FLAGS='-Ox'
2251     AR_FLAGS='-NOLOGO -OUT:"$@"'
2252     ASM_SUFFIX=asm
2253     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2254     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2255     DLL_PREFIX=
2256     DOXYGEN=:
2257     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2258     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2259     GARBAGE=
2260     IMPORT_LIB_SUFFIX=lib
2261     dnl Need to force-link against mozalloc because it's used in the shunt
2262     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2263     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2264     LIB_PREFIX=
2265     LIB_SUFFIX=lib 
2266     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2267     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2268     MKSHLIB_FORCE_ALL=
2269     MKSHLIB_UNFORCE_ALL=
2270     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2271     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2272     MOZ_DEBUG_FLAGS='-Zi'
2273     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2274     MOZ_FIX_LINK_PATHS=
2275     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2276     OBJ_SUFFIX=obj
2277     RANLIB='echo not_ranlib'
2278     STRIP='echo not_strip'
2279     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2280     UNZIP=unzip
2281     XARGS=xargs
2282     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2283     ZIP=zip
2284     MOZ_TREE_FREETYPE=1
2286     AC_DEFINE(HAVE_SNPRINTF)
2287     AC_DEFINE(_WINDOWS)
2288     AC_DEFINE(WIN32)
2289     AC_DEFINE(XP_WIN)
2290     AC_DEFINE(XP_WIN32)
2291     AC_DEFINE(HW_THREADS)
2292     AC_DEFINE(STDC_HEADERS)
2293     AC_DEFINE(NEW_H, <new>)
2294     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2295     AC_DEFINE(HAVE_LOCALTIME_R)
2297     TARGET_MD_ARCH=win32
2298     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2299     BIN_SUFFIX='.exe'
2300     MOZ_ENABLE_POSTSCRIPT=
2301     MOZ_USER_DIR="Mozilla"
2303     MOZ_GFX_OPTIMIZE_MOBILE=1
2305     # Sanity check for WINCE_WINDOWS_MOBILE
2306     # XXX disabled until we can fix the mobile tinderbox
2307     ##if test "$WINCE_WINDOWS_MOBILE"; then
2308     ##   AC_CHECK_HEADER(tpcshell.h, [],
2309     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2310     ##fi
2314 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2315     DSO_CFLAGS=
2316     DSO_PIC_CFLAGS=
2317     DLL_SUFFIX=.dll
2318     RC=rc.exe
2319     # certain versions of cygwin's makedepend barf on the 
2320     # #include <string> vs -I./dist/include/string issue so don't use it
2321     SYSTEM_MAKEDEPEND=
2322     if test -n "$GNU_CC"; then
2323         CC="$CC -mno-cygwin"
2324         CXX="$CXX -mno-cygwin"
2325         CPP="$CPP -mno-cygwin"
2326         CFLAGS="$CFLAGS -mms-bitfields"
2327         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2328         DSO_LDOPTS='-shared'
2329         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2330         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2331         RC='$(WINDRES)'
2332         # Use temp file for windres (bug 213281)
2333         RCFLAGS='-O coff --use-temp-file'
2334         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2335         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2336         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2337         MOZ_FIX_LINK_PATHS=
2338         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2339         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2340         DLL_PREFIX=
2341         IMPORT_LIB_SUFFIX=dll.a
2342         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2343     else
2344         TARGET_COMPILER_ABI=msvc
2345         HOST_CC='$(CC)'
2346         HOST_CXX='$(CXX)'
2347         HOST_LD='$(LD)'
2348         if test "$AS_BIN"; then
2349             AS="$(basename "$AS_BIN")"
2350         fi
2351         AR='lib -NOLOGO -OUT:"$@"'
2352         AR_FLAGS=
2353         RANLIB='echo not_ranlib'
2354         STRIP='echo not_strip'
2355         XARGS=xargs
2356         ZIP=zip
2357         UNZIP=unzip
2358         DOXYGEN=:
2359         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2360         ASM_SUFFIX=asm
2361         OBJ_SUFFIX=obj
2362         LIB_SUFFIX=lib
2363         DLL_PREFIX=
2364         LIB_PREFIX=
2365         IMPORT_LIB_SUFFIX=lib
2366         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2367         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2368         MKSHLIB_FORCE_ALL=
2369         MKSHLIB_UNFORCE_ALL=
2370         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2371         _USE_CPP_INCLUDE_FLAG=1
2372         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2373         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2374         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2375         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2376         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2377         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2378         MOZ_DEBUG_FLAGS='-Zi'
2379         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2380         WARNINGS_AS_ERRORS='-WX'
2381         MOZ_OPTIMIZE_FLAGS='-O1'
2382         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2383         MOZ_FIX_LINK_PATHS=
2384         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2385         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2386         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2387         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2388         if test $_MSC_VER -ge 1400; then
2389             LDFLAGS="$LDFLAGS -NXCOMPAT"
2390             dnl For profile-guided optimization
2391             PROFILE_GEN_CFLAGS="-GL"
2392             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2393             dnl XXX: PGO builds can fail with warnings treated as errors,
2394             dnl specifically "no profile data available" appears to be
2395             dnl treated as an error sometimes. This might be a consequence
2396             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2397             dnl with the linker doing most of the work in the whole-program
2398             dnl optimization/PGO case. I think it's probably a compiler bug,
2399             dnl but we work around it here.
2400             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2401             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2402             dnl Probably also a compiler bug, but what can you do?
2403             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2404             if test -n "$_USE_DYNAMICBASE"; then
2405                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2406             fi
2407         fi
2408     fi
2409     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2410     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2411     AC_DEFINE(HAVE_SNPRINTF)
2412     AC_DEFINE(_WINDOWS)
2413     AC_DEFINE(WIN32)
2414     AC_DEFINE(XP_WIN)
2415     AC_DEFINE(XP_WIN32)
2416     AC_DEFINE(HW_THREADS)
2417     AC_DEFINE(STDC_HEADERS)
2418     AC_DEFINE(NEW_H, <new>)
2419     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2420     TARGET_MD_ARCH=win32
2421     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2422     BIN_SUFFIX='.exe'
2423     MOZ_ENABLE_POSTSCRIPT=
2424     MOZ_USER_DIR="Mozilla"
2426     dnl Hardcode to win95 for now - cls
2427     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2429     dnl set NO_X11 defines here as the general check is skipped on win32
2430     no_x=yes
2431     AC_DEFINE(NO_X11)
2433     dnl MinGW/MSYS doesn't provide or need cygpath
2434     case "$host" in
2435     *-mingw*)
2436         CYGPATH_W=echo
2437         CYGPATH_S=cat
2438         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2439         ;;
2440     *-cygwin*|*-msvc*|*-mks*)
2441         CYGPATH_W="cygpath -a -w"
2442         CYGPATH_S="sed -e s|\\\\|/|g"
2443         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2444         ;;
2445     esac
2446     case "$host" in
2447     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2449     if test -z "$MOZ_TOOLS"; then
2450         AC_MSG_ERROR([MOZ_TOOLS is not set])
2451     fi
2453     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2454     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2455         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2456     fi
2457     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2458     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2459         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2460     fi
2461     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2462     ;;
2463     esac 
2466     case "$host_os" in
2467     cygwin*|msvc*|mks*)
2468         AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites])
2469         ;;
2471     *)
2472         AC_CHECK_HEADERS(oleacc.idl)
2474         AC_LANG_SAVE
2475         AC_LANG_CPLUSPLUS
2476         AC_CHECK_HEADERS(atlbase.h)
2477         AC_LANG_RESTORE
2478         ;;
2479     esac
2481     case "$target" in
2482     i*86-*)
2483         if test "$HAVE_64BIT_OS"; then
2484             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2485         fi
2487         if test $_MSC_VER -ge 1400; then
2488             LDFLAGS="$LDFLAGS -SAFESEH"
2489         fi
2490         AC_CHECK_HEADERS(mmintrin.h)
2491         AC_DEFINE(_X86_)
2492         ;;
2493     alpha-*)
2494         AC_DEFINE(_ALPHA_)
2495         ;;
2496     mips-*)
2497         AC_DEFINE(_MIPS_)
2498         ;;
2499     x86_64-*)
2500         AC_DEFINE(_AMD64_)
2501         ;;
2502     *)
2503         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2504         ;;
2505     esac
2507     if test "$HAVE_64BIT_OS"; then
2508         AC_DEFINE(_WIN64)
2509     fi
2510     ;;
2512 *-netbsd*)
2513     DSO_CFLAGS=''
2514     CFLAGS="$CFLAGS -Dunix"
2515     CXXFLAGS="$CXXFLAGS -Dunix"
2516     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2517         DLL_SUFFIX=".so"
2518         DSO_PIC_CFLAGS='-fPIC -DPIC'
2519         DSO_LDOPTS='-shared'
2520         BIN_FLAGS='-Wl,--export-dynamic'
2521     else
2522         DSO_PIC_CFLAGS='-fPIC -DPIC'
2523         DLL_SUFFIX=".so.1.0"
2524         DSO_LDOPTS='-shared'
2525     fi
2526     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2527     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2528     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2529     if test "$LIBRUNPATH"; then
2530         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2531     fi
2532     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2533     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2534     ;;
2536 *-nto*) 
2537         AC_DEFINE(NTO)  
2538         AC_DEFINE(_QNX_SOURCE)
2539         AC_DEFINE(_i386)
2540         OS_TARGET=NTO
2541         WARNINGS_AS_ERRORS=''
2542         MOZ_OPTIMIZE_FLAGS="-O"
2543         MOZ_DEBUG_FLAGS="-gstabs"
2544         USE_PTHREADS=1
2545         _PEDANTIC=
2546         LIBS="$LIBS -lsocket -lstdc++"
2547         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2548         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2549         if test "$with_x" != "yes"
2550         then
2551                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2552             TK_CFLAGS='-I/usr/include/photon'
2553                 TK_LIBS='-lph'
2554         fi
2555         case "${target_cpu}" in
2556         ppc*)
2557         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2558         ;;
2559         esac
2560         case "${host_cpu}" in
2561         i*86)
2562         USE_ELF_DYNSTR_GC=1
2563         ;;
2564         esac
2565         ;;
2567 *-openbsd*)
2568     DLL_SUFFIX=".so.1.0"
2569     DSO_CFLAGS=''
2570     DSO_PIC_CFLAGS='-fPIC'
2571     DSO_LDOPTS='-shared -fPIC'
2572     if test "$LIBRUNPATH"; then
2573         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2574     fi
2575     ;;
2577 *-openvms*) 
2578     AC_DEFINE(NO_PW_GECOS)
2579     AC_DEFINE(NO_UDSOCK)
2580     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2581     USE_PTHREADS=1
2582     MKSHLIB_FORCE_ALL='-all'
2583     MKSHLIB_UNFORCE_ALL='-none'
2584     AS='as'
2585     AS_DASH_C_FLAG='-Wc/names=as_is'
2586     AR_FLAGS='c $@'
2587     DSO_LDOPTS='-shared -auto_symvec'
2588     DSO_PIC_CFLAGS=
2589     MOZ_DEBUG_LDFLAGS='-g'
2590     COMPAQ_CXX=1
2591     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2592     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2593     ;;
2596 *-os2*)
2597     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2598     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2599     AC_DEFINE(OS2)
2600     AC_DEFINE(XP_OS2)
2601     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2602     AC_DEFINE(TCPV40HDRS)
2603     DLL_PREFIX=
2604     LIB_PREFIX=
2605     LIB_SUFFIX=lib
2606     BIN_SUFFIX=".exe"
2607     DLL_SUFFIX=".dll"
2608     IMPORT_LIB_SUFFIX=lib
2609     DSO_PIC_CFLAGS=
2610     AR=emxomfar
2611     AR_FLAGS='r $@'
2612     CFLAGS="$CFLAGS -Zomf"
2613     CXXFLAGS="$CXXFLAGS -Zomf"
2614     DSO_LDOPTS='-Zdll'
2615     BIN_FLAGS='-Zlinker /ST:0x100000'
2616     IMPLIB='emximp -o'
2617     FILTER='emxexp -o'
2618     LDFLAGS='-Zmap'
2619     WARNINGS_AS_ERRORS='-Werror'
2620     MOZ_DEBUG_FLAGS="-g -fno-inline"
2621     MOZ_OPTIMIZE_FLAGS="-O2"
2622     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2623     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2624     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2625     TARGET_MD_ARCH=os2
2626     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2627     MOZ_ENABLE_POSTSCRIPT=
2628     RC=rc.exe
2629     RCFLAGS='-n'
2630     MOZ_USER_DIR="Mozilla"
2632     if test "$MOZTOOLS"; then
2633         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2634     else
2635         AC_MSG_ERROR([MOZTOOLS is not set])
2636     fi
2637     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2638         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2639         LDFLAGS="$LDFLAGS -Zhigh-mem"
2640         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2641         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2642     fi
2644     # GCC for OS/2 currently predefines these, but we don't want them
2645     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2646     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2648     AC_CACHE_CHECK(for __declspec(dllexport),
2649         ac_os2_declspec,
2650         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2651                         [return 0;],
2652                         ac_os2_declspec="yes",
2653                         ac_os2_declspec="no")])
2654     if test "$ac_os2_declspec" = "yes"; then
2655         FILTER='true'
2656         MOZ_OS2_USE_DECLSPEC='1'
2657     fi
2658     ;;
2660 alpha*-*-osf*)
2661     if test "$GNU_CC"; then
2662       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2663       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2665     else
2666         MOZ_DEBUG_FLAGS='-g'
2667         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2668         CFLAGS="$CFLAGS -ieee"
2669         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2670         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2671         DSO_CFLAGS=
2672         DSO_PIC_CFLAGS=
2673         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2674         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2675         MKSHLIB_FORCE_ALL='-all'
2676         MKSHLIB_UNFORCE_ALL='-none'
2677         dnl Might fix the libxpcom.so breakage on this platform as well....
2678         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2679         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2680     fi
2681     if test -z "$GNU_CXX"; then
2682       COMPAQ_CXX=1
2683     fi
2684     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2685     ;;
2687 *-qnx*) 
2688     DIRENT_INO=d_stat.st_ino
2689     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2690     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2691     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2692     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2693     AC_DEFINE(STDC_HEADERS)
2694     if test "$no_x" = "yes"; then
2695             _PLATFORM_DEFAULT_TOOLKIT='photon'
2696             TK_CFLAGS='-I/usr/nto/include/photon'
2697             TK_LIBS='-lphoton -lphrender'
2698     fi
2699     ;;
2701 *-sco*) 
2702     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2703     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2704     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2705     if test ! "$GNU_CC"; then
2706        DSO_LDOPTS='-G'
2707     fi
2708     ;;
2710 *-solaris*) 
2711     AC_DEFINE(SOLARIS)
2712     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2713     SYSTEM_MAKEDEPEND=
2714     MOZ_FIX_LINK_PATHS=
2715     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2716     # libraries one level up (e.g. libnspr4.so)
2717     if test "$SOLARIS_SUNPRO_CC"; then
2718        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2719        LIBS="-lCrun -lCstd -lc $LIBS"
2720        NS_USE_NATIVE=1
2721        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2722        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2723        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__"
2724        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2725        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2726        LDFLAGS="-xildoff $LDFLAGS"
2727        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2728            _SAVE_LDFLAGS=$LDFLAGS
2729            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2730            AC_TRY_LINK([#include <stdio.h>],
2731                        [printf("Hello World\n");],
2732                        ,
2733                        [LDFLAGS=$_SAVE_LDFLAGS])
2734        fi
2735        WARNINGS_AS_ERRORS='-Werror'
2736        MOZ_OPTIMIZE_FLAGS="-xO4"
2737        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2738        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2739        MKSHLIB_FORCE_ALL='-z allextract'
2740        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2741        DSO_LDOPTS='-G'
2742        AR_LIST="$AR t"
2743        AR_EXTRACT="$AR x"
2744        AR_DELETE="$AR d"
2745        AR='$(CXX) -xar'
2746        AR_FLAGS='-o $@'
2747        AS='/usr/ccs/bin/as'
2748        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2749        AS_DASH_C_FLAG=''
2750        TARGET_COMPILER_ABI="sunc"
2751        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2752        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2753        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2754        AC_LANG_SAVE
2755        AC_LANG_CPLUSPLUS
2756        AC_TRY_COMPILE([],
2757            [#if (__SUNPRO_CC < 0x590)
2758            #error "Denied"
2759            #endif],
2760            _BAD_COMPILER=,_BAD_COMPILER=1)
2761        if test -n "$_BAD_COMPILER"; then
2762            _res="no"
2763            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2764        else
2765            _res="yes"
2766        fi
2767        AC_TRY_COMPILE([],
2768            [#if (__SUNPRO_CC >= 0x5100)
2769            #error "Sun C++ 5.10 or above"
2770            #endif],
2771            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2772        if test "$_ABOVE_SS12U1"; then
2773            # disable xannotate
2774            CXXFLAGS="$CXXFLAGS -xannotate=no"
2775        fi
2776        AC_MSG_RESULT([$_res])
2777        AC_LANG_RESTORE
2778     else
2779        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2780        LIBS="-lc $LIBS"
2781        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2782        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2783        ASFLAGS="$ASFLAGS -fPIC"
2784        DSO_LDOPTS='-shared'
2785        _WARNINGS_CFLAGS=''
2786        _WARNINGS_CXXFLAGS=''
2787        if test "$OS_RELEASE" = "5.3"; then
2788            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2789        fi
2790     fi
2791     if test "$OS_RELEASE" = "5.5.1"; then
2792         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2793     fi
2794     ;;
2796 *-sunos*) 
2797     DSO_LDOPTS='-Bdynamic'
2798     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2799     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2800     AC_DEFINE(SUNOS4)
2801     AC_DEFINE(SPRINTF_RETURNS_STRING)
2802     case "$(target_os)" in
2803     sunos4.1*)
2804         DLL_SUFFIX='.so.1.0'
2805         ;;
2806     esac
2807     ;;
2809 *-sysv4.2uw7*) 
2810         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2811     ;;
2813 *-os2*)
2814     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2815     ;;
2817 *-android*)
2818     AC_DEFINE(NO_PW_GECOS)
2819     no_x=yes
2820     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2821     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2823     MOZ_GFX_OPTIMIZE_MOBILE=1
2824     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2825     ;;
2827 esac
2829 dnl Only one oddball right now (QNX), but this gives us flexibility
2830 dnl if any other platforms need to override this in the future.
2831 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2833 dnl ========================================================
2834 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2835 dnl by now will not have any way to link most binaries (tests
2836 dnl as well as viewer, apprunner, etc.), because some symbols
2837 dnl will be left out of the "composite" .so's by ld as unneeded.
2838 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2839 dnl they can link in the static libs that provide the missing
2840 dnl symbols.
2841 dnl ========================================================
2842 NO_LD_ARCHIVE_FLAGS=
2843 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2844     NO_LD_ARCHIVE_FLAGS=1
2846 case "$target" in
2847 *-os2*)
2848     NO_LD_ARCHIVE_FLAGS=
2849     ;;
2850 *-aix4.3*|*-aix5*)
2851     NO_LD_ARCHIVE_FLAGS=
2852     ;;
2853 *-openvms*)
2854     NO_LD_ARCHIVE_FLAGS=
2855     ;;
2856 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2857     if test -z "$GNU_CC"; then
2858         NO_LD_ARCHIVE_FLAGS=
2859     fi
2860     ;;
2861 esac
2862 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2864 dnl ========================================================
2865 dnl = Flags to strip unused symbols from .so components
2866 dnl ========================================================
2867 case "$target" in
2868     *-linux*|*-kfreebsd*-gnu|*-gnu*)
2869         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2870         ;;
2871     *-solaris*)
2872         if test -z "$GNU_CC"; then
2873          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2874         else
2875          if test -z "$GCC_USE_GNU_LD"; then
2876           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2877          else
2878           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2879          fi
2880         fi
2881         ;;
2882     *-nto*) 
2883         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2884         ;;
2885     *-darwin*)
2886         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2887         ;;
2888     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2889         if test -n "$GNU_CC"; then
2890            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2891         fi
2892         ;;
2893 esac
2895 if test -z "$COMPILE_ENVIRONMENT"; then
2896     SKIP_COMPILER_CHECKS=1
2897     SKIP_LIBRARY_CHECKS=1
2900 if test -z "$SKIP_COMPILER_CHECKS"; then
2901 dnl Checks for typedefs, structures, and compiler characteristics.
2902 dnl ========================================================
2903 AC_HEADER_STDC
2904 AC_C_CONST
2905 AC_TYPE_MODE_T
2906 AC_TYPE_OFF_T
2907 AC_TYPE_PID_T
2908 AC_TYPE_SIZE_T
2909 AC_LANG_CPLUSPLUS
2910 AC_MSG_CHECKING(for __stdcall)
2911 AC_CACHE_VAL(ac_cv___stdcall,
2912  [AC_TRY_COMPILE([template <typename Method> struct foo;
2913                   template <> struct foo<void (*)()> {};
2914                   template <> struct foo<void (__stdcall*)()> {};],
2915                  [],
2916                  [ac_cv___stdcall=true],
2917                  [ac_cv___stdcall=false])])
2918 if test "$ac_cv___stdcall" = true ; then
2919   AC_DEFINE(HAVE_STDCALL)
2920   AC_MSG_RESULT(yes)
2921 else
2922   AC_MSG_RESULT(no)
2924 AC_LANG_C
2925 AC_MSG_CHECKING(for ssize_t)
2926 AC_CACHE_VAL(ac_cv_type_ssize_t,
2927  [AC_TRY_COMPILE([#include <stdio.h>
2928                   #include <sys/types.h>],
2929                  [ssize_t foo = 0;],
2930                  [ac_cv_type_ssize_t=true],
2931                  [ac_cv_type_ssize_t=false])])
2932 if test "$ac_cv_type_ssize_t" = true ; then
2933   AC_DEFINE(HAVE_SSIZE_T)
2934   AC_MSG_RESULT(yes)
2935 else
2936   AC_MSG_RESULT(no)
2938 AC_STRUCT_ST_BLKSIZE
2939 AC_MSG_CHECKING(for siginfo_t)
2940 AC_CACHE_VAL(ac_cv_siginfo_t,
2941  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2942                   #include <signal.h>],
2943                  [siginfo_t* info;],
2944                  [ac_cv_siginfo_t=true],
2945                  [ac_cv_siginfo_t=false])])
2946 if test "$ac_cv_siginfo_t" = true ; then
2947   AC_DEFINE(HAVE_SIGINFO_T)
2948   AC_MSG_RESULT(yes)
2949 else
2950   AC_MSG_RESULT(no)
2953 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2954 dnl ========================================================
2955 AC_MSG_CHECKING(for int16_t)
2956 AC_CACHE_VAL(ac_cv_int16_t,
2957  [AC_TRY_COMPILE([#include <stdio.h>
2958                   #include <sys/types.h>],
2959                  [int16_t foo = 0;],
2960                  [ac_cv_int16_t=true],
2961                  [ac_cv_int16_t=false])])
2962 if test "$ac_cv_int16_t" = true ; then
2963   AC_DEFINE(HAVE_INT16_T)
2964   AC_MSG_RESULT(yes)
2965 else
2966   AC_MSG_RESULT(no)
2968 AC_MSG_CHECKING(for int32_t)
2969 AC_CACHE_VAL(ac_cv_int32_t,
2970  [AC_TRY_COMPILE([#include <stdio.h>
2971                   #include <sys/types.h>],
2972                  [int32_t foo = 0;],
2973                  [ac_cv_int32_t=true],
2974                  [ac_cv_int32_t=false])])
2975 if test "$ac_cv_int32_t" = true ; then
2976   AC_DEFINE(HAVE_INT32_T)
2977   AC_MSG_RESULT(yes)
2978 else
2979   AC_MSG_RESULT(no)
2981 AC_MSG_CHECKING(for int64_t)
2982 AC_CACHE_VAL(ac_cv_int64_t,
2983  [AC_TRY_COMPILE([#include <stdio.h>
2984                   #include <sys/types.h>],
2985                  [int64_t foo = 0;],
2986                  [ac_cv_int64_t=true],
2987                  [ac_cv_int64_t=false])])
2988 if test "$ac_cv_int64_t" = true ; then
2989   AC_DEFINE(HAVE_INT64_T)
2990   AC_MSG_RESULT(yes)
2991 else
2992   AC_MSG_RESULT(no)
2994 AC_MSG_CHECKING(for int64)
2995 AC_CACHE_VAL(ac_cv_int64,
2996  [AC_TRY_COMPILE([#include <stdio.h>
2997                   #include <sys/types.h>],
2998                  [int64 foo = 0;],
2999                  [ac_cv_int64=true],
3000                  [ac_cv_int64=false])])
3001 if test "$ac_cv_int64" = true ; then
3002   AC_DEFINE(HAVE_INT64)
3003   AC_MSG_RESULT(yes)
3004 else
3005   AC_MSG_RESULT(no)
3007 AC_MSG_CHECKING(for uint)
3008 AC_CACHE_VAL(ac_cv_uint,
3009  [AC_TRY_COMPILE([#include <stdio.h>
3010                   #include <sys/types.h>],
3011                  [uint foo = 0;],
3012                  [ac_cv_uint=true],
3013                  [ac_cv_uint=false])])
3014 if test "$ac_cv_uint" = true ; then
3015   AC_DEFINE(HAVE_UINT)
3016   AC_MSG_RESULT(yes)
3017 else
3018   AC_MSG_RESULT(no)
3020 AC_MSG_CHECKING(for uint_t)
3021 AC_CACHE_VAL(ac_cv_uint_t,
3022  [AC_TRY_COMPILE([#include <stdio.h>
3023                   #include <sys/types.h>],
3024                  [uint_t foo = 0;],
3025                  [ac_cv_uint_t=true],
3026                  [ac_cv_uint_t=false])])
3027 if test "$ac_cv_uint_t" = true ; then
3028   AC_DEFINE(HAVE_UINT_T)
3029   AC_MSG_RESULT(yes)
3030 else
3031   AC_MSG_RESULT(no)
3033 AC_MSG_CHECKING(for uint16_t)
3034 AC_CACHE_VAL(ac_cv_uint16_t,
3035  [AC_TRY_COMPILE([#include <stdio.h>
3036                   #include <sys/types.h>],
3037                  [uint16_t foo = 0;],
3038                  [ac_cv_uint16_t=true],
3039                  [ac_cv_uint16_t=false])])
3040 if test "$ac_cv_uint16_t" = true ; then
3041   AC_DEFINE(HAVE_UINT16_T)
3042   AC_MSG_RESULT(yes)
3043 else
3044   AC_MSG_RESULT(no)
3047 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3048 dnl are defined when compiling C++ but not C.  Since the result of this
3049 dnl test is used only in C++, do it in C++.
3050 AC_LANG_CPLUSPLUS
3052 AC_MSG_CHECKING(for uname.domainname)
3053 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3054     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3055         [ struct utsname *res; char *domain; 
3056             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
3057         [ac_cv_have_uname_domainname_field=true],
3058         [ac_cv_have_uname_domainname_field=false])])
3060 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3061     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3062     AC_MSG_RESULT(yes)
3063 else
3064     AC_MSG_RESULT(no)
3067 AC_MSG_CHECKING(for uname.__domainname)
3068 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3069     [AC_TRY_COMPILE([#include <sys/utsname.h>],
3070         [ struct utsname *res; char *domain; 
3071             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
3072         [ac_cv_have_uname_us_domainname_field=true],
3073         [ac_cv_have_uname_us_domainname_field=false])])
3075 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3076     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3077     AC_MSG_RESULT(yes)
3078 else
3079     AC_MSG_RESULT(no)
3082 AC_LANG_CPLUSPLUS
3084 dnl Check for usable char16_t (2 bytes, unsigned)
3085 dnl (we might not need the unsignedness check anymore)
3086 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3087     ac_cv_have_usable_char16_t,
3088     [AC_TRY_COMPILE([$configure_static_assert_macros],
3089                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3090                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3091                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3092                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3093                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3094                     ac_cv_have_usable_char16_t="yes",
3095                     ac_cv_have_usable_char16_t="no")])
3096 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3097     AC_DEFINE(HAVE_CPP_CHAR16_T)
3098     HAVE_CPP_CHAR16_T=1
3101 dnl Check for usable wchar_t (2 bytes, unsigned)
3102 dnl (we really don't need the unsignedness check anymore)
3103 dnl ========================================================
3105 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3106     ac_cv_have_usable_wchar_v2,
3107     [AC_TRY_COMPILE([#include <stddef.h>
3108                      $configure_static_assert_macros],
3109                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3110                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3111                     ac_cv_have_usable_wchar_v2="yes",
3112                     ac_cv_have_usable_wchar_v2="no")])
3113 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3114     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3115     HAVE_CPP_2BYTE_WCHAR_T=1
3116 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3117 dnl This is really gcc-only
3118 dnl Do this test using CXX only since some versions of gcc
3119 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3120 dnl only have short-wchar support for c++.
3121 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3123     _SAVE_CXXFLAGS=$CXXFLAGS
3124     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3126     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3127         ac_cv_have_usable_wchar_option_v2,
3128         [AC_TRY_LINK([#include <stddef.h>
3129                       $configure_static_assert_macros],
3130                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3131                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3132                      ac_cv_have_usable_wchar_option_v2="yes",
3133                      ac_cv_have_usable_wchar_option_v2="no")])
3135     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3136         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3137         HAVE_CPP_2BYTE_WCHAR_T=1
3138         WCHAR_CFLAGS="-fshort-wchar"
3139     else    
3140         CXXFLAGS=$_SAVE_CXXFLAGS
3141     fi
3144 AC_LANG_C
3146 dnl Check for .hidden assembler directive and visibility attribute.
3147 dnl Borrowed from glibc configure.in
3148 dnl ===============================================================
3149 if test "$GNU_CC"; then
3150   AC_CACHE_CHECK(for visibility(hidden) attribute,
3151                  ac_cv_visibility_hidden,
3152                  [cat > conftest.c <<EOF
3153                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3155                   ac_cv_visibility_hidden=no
3156                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3157                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3158                       ac_cv_visibility_hidden=yes
3159                     fi
3160                   fi
3161                   rm -f conftest.[cs]
3162                  ])
3163   if test "$ac_cv_visibility_hidden" = "yes"; then
3164     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3166     AC_CACHE_CHECK(for visibility(default) attribute,
3167                    ac_cv_visibility_default,
3168                    [cat > conftest.c <<EOF
3169                     int foo __attribute__ ((visibility ("default"))) = 1;
3171                     ac_cv_visibility_default=no
3172                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3173                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3174                         ac_cv_visibility_default=yes
3175                       fi
3176                     fi
3177                     rm -f conftest.[cs]
3178                    ])
3179     if test "$ac_cv_visibility_default" = "yes"; then
3180       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3182       AC_CACHE_CHECK(for visibility pragma support,
3183                      ac_cv_visibility_pragma,
3184                      [cat > conftest.c <<EOF
3185 #pragma GCC visibility push(hidden)
3186                       int foo_hidden = 1;
3187 #pragma GCC visibility push(default)
3188                       int foo_default = 1;
3190                       ac_cv_visibility_pragma=no
3191                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3192                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3193                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3194                             ac_cv_visibility_pragma=yes
3195                           fi
3196                         fi
3197                       fi
3198                       rm -f conftest.[cs]
3199                     ])
3200       if test "$ac_cv_visibility_pragma" = "yes"; then
3201         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3202                        ac_cv_have_visibility_class_bug,
3203                        [cat > conftest.c <<EOF
3204 #pragma GCC visibility push(hidden)
3205 struct __attribute__ ((visibility ("default"))) TestStruct {
3206   static void Init();
3208 __attribute__ ((visibility ("default"))) void TestFunc() {
3209   TestStruct::Init();
3212                        ac_cv_have_visibility_class_bug=no
3213                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3214                          ac_cv_have_visibility_class_bug=yes
3215                        else
3216                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3217                            ac_cv_have_visibility_class_bug=yes
3218                          fi
3219                        fi
3220                        rm -rf conftest.{c,S}
3221                        ])
3223         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3224                        ac_cv_have_visibility_builtin_bug,
3225                        [cat > conftest.c <<EOF
3226 #pragma GCC visibility push(hidden)
3227 #pragma GCC visibility push(default)
3228 #include <string.h>
3229 #pragma GCC visibility pop
3231 __attribute__ ((visibility ("default"))) void Func() {
3232   char c[[100]];
3233   memset(c, 0, sizeof(c));
3236                        ac_cv_have_visibility_builtin_bug=no
3237                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3238                          ac_cv_have_visibility_builtin_bug=yes
3239                        else
3240                          if test `grep -c "@PLT" conftest.S` = 0; then
3241                            ac_cv_visibility_builtin_bug=yes
3242                          fi
3243                        fi
3244                        rm -f conftest.{c,S}
3245                        ])
3246         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3247                 "$ac_cv_have_visibility_class_bug" = "no"; then
3248           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3249           WRAP_SYSTEM_INCLUDES=1
3250           STL_FLAGS='-I$(DIST)/stl_wrappers'
3251           WRAP_STL_INCLUDES=1
3252         else
3253           VISIBILITY_FLAGS='-fvisibility=hidden'
3254         fi # have visibility pragma bug
3255       fi   # have visibility pragma
3256     fi     # have visibility(default) attribute
3257   fi       # have visibility(hidden) attribute
3258 fi         # GNU_CC
3260 # visibility hidden flag for Sun Studio on Solaris
3261 if test "$SOLARIS_SUNPRO_CC"; then
3262 VISIBILITY_FLAGS='-xldscope=hidden'
3263 fi         # Sun Studio on Solaris
3265 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3266 AC_SUBST(VISIBILITY_FLAGS)
3268 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3269 dnl ========================================================
3270 if test "$GNU_CC"; then
3271   CFLAGS_save="${CFLAGS}"
3272   CFLAGS="${CFLAGS} -Werror"
3273   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3274                  ac_cv_force_align_arg_pointer,
3275                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3276                                  [],
3277                                  ac_cv_force_align_arg_pointer="yes",
3278                                  ac_cv_force_align_arg_pointer="no")])
3279   CFLAGS="${CFLAGS_save}"
3280   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3281     HAVE_GCC_ALIGN_ARG_POINTER=1
3282   else
3283     HAVE_GCC_ALIGN_ARG_POINTER=
3284   fi
3286 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3288 dnl Checks for header files.
3289 dnl ========================================================
3290 AC_HEADER_DIRENT
3291 case "$target_os" in
3292 freebsd*)
3293 # for stuff like -lXshm
3294     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3295     ;;
3296 esac
3297 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3298 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3299 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3300 AC_CHECK_HEADERS(malloc.h)
3301 AC_CHECK_HEADERS(X11/XKBlib.h)
3302 AC_CHECK_HEADERS(io.h)
3304 dnl These are all the places some variant of statfs can be hiding.
3305 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3307 dnl Quota support
3308 AC_CHECK_HEADERS(sys/quota.h)
3309 AC_CHECK_HEADERS(linux/quota.h)
3311 dnl Try for MMX support
3312 dnl NB - later gcc versions require -mmmx for this header to be successfully
3313 dnl included (or another option which implies it, such as -march=pentium-mmx)
3314 AC_CHECK_HEADERS(mmintrin.h)
3316 dnl Check whether the compiler supports the new-style C++ standard
3317 dnl library headers (i.e. <new>) or needs the old "new.h"
3318 AC_LANG_CPLUSPLUS
3319 NEW_H=new.h
3320 AC_CHECK_HEADER(new, [NEW_H=new])
3321 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3322 AC_LANG_C
3324 AC_ARG_ENABLE(dtrace,
3325               [  --enable-dtrace         build with dtrace support if available (default=no)],
3326               [enable_dtrace="yes"],)
3327 if test "x$enable_dtrace" = "xyes"; then
3328   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3329   if test -n "$HAVE_DTRACE"; then
3330       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3331   else
3332       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3333   fi
3335 AC_SUBST(HAVE_DTRACE)
3337 case $target in
3338 *-aix4.3*|*-aix5*)
3339         ;;
3341         AC_CHECK_HEADERS(sys/cdefs.h)
3342         ;;
3343 esac
3345 dnl Checks for libraries.
3346 dnl ========================================================
3347 case $target in
3348 *-hpux11.*)
3349         ;;
3351         AC_CHECK_LIB(c_r, gethostbyname_r)
3352         ;;
3353 esac
3355 dnl We don't want to link with libdl even if it's present on OS X, since
3356 dnl it's not used and not part of the default installation.
3357 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3358 dnl We don't want to link against libm or libpthread on Darwin since
3359 dnl they both are just symlinks to libSystem and explicitly linking
3360 dnl against libSystem causes issues when debugging (see bug 299601).
3361 case $target in
3362 *-darwin*)
3363     ;;
3364 *-beos*)
3365     ;;
3366 *-os2*)
3367     ;;
3369     AC_CHECK_LIB(m, atan)
3370     AC_CHECK_LIB(dl, dlopen,
3371     AC_CHECK_HEADER(dlfcn.h, 
3372         LIBS="-ldl $LIBS"
3373         AC_DEFINE(HAVE_LIBDL)))
3374     ;;
3375 esac
3377 _SAVE_CFLAGS="$CFLAGS"
3378 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3379 AC_CHECK_FUNCS(dladdr)
3380 CFLAGS="$_SAVE_CFLAGS"
3382 if test ! "$GNU_CXX"; then
3384     case $target in
3385     *-aix*)
3386         AC_CHECK_LIB(C_r, demangle)
3387         ;;
3388      *)
3389         AC_CHECK_LIB(C, demangle)
3390         ;;
3391      esac
3394 dnl OS/2 has socket in libc.
3395 case $target in
3396 *-os2*)
3397     ;;
3399     AC_CHECK_LIB(socket, socket)
3400 esac
3402 dnl ========================================================
3403 dnl Check whether we can compile code for Core Text
3404 dnl (available on Mac OS X 10.5 or later)
3405 dnl ========================================================
3406 case "$target" in
3407 *-darwin*)
3408   AC_MSG_CHECKING([for Core Text])
3409   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3410                  [CTLineRef lineRef;],
3411                   ac_cv_have_core_text="yes",
3412                   ac_cv_have_core_text="no")
3413   AC_MSG_RESULT([$ac_cv_have_core_text])
3415   if test "$ac_cv_have_core_text" = "no"; then
3416     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3417   fi
3418   ;;
3419 esac
3421 XLDFLAGS="$X_LIBS"
3422 XLIBS="$X_EXTRA_LIBS"
3424 dnl ========================================================
3425 dnl Checks for X libraries.
3426 dnl Ordering is important.
3427 dnl Xt is dependent upon SM as of X11R6
3428 dnl ========================================================
3429 if test "$no_x" = "yes"; then
3430     AC_DEFINE(NO_X11)
3431 else
3432     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3433         XLIBS="-lX11 $XLIBS"
3434         _SAVE_LDFLAGS="$LDFLAGS"
3435         LDFLAGS="$XLDFLAGS $LDFLAGS"
3436         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3437                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3438         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3439                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3440      
3441         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3442         unset ac_cv_lib_Xt_XtFree
3443             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3444             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3445         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3446                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3447         ])
3449     # AIX needs the motif library linked before libXt to prevent
3450     # crashes in plugins linked against Motif - Bug #98892
3451     case "${target_os}" in
3452     aix*)
3453         XT_LIBS="-lXm $XT_LIBS"
3454         ;;
3455     esac
3457     dnl ========================================================
3458     dnl = Check for XShm
3459     dnl ========================================================
3460     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3461         $XLIBS $XEXT_LIBS)
3462     AC_CHECK_HEADER(X11/extensions/XShm.h)
3463     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3464         test -n "$_HAVE_XSHM_XEXT"; then
3465         AC_DEFINE(HAVE_XSHM)
3466     fi
3468     dnl ========================================================
3469     dnl = Check for XIE
3470     dnl ========================================================
3471     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3472         $XLIBS $XEXT_LIBS)
3473     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3475     if test "$MOZ_XIE_LIBS"; then
3476         dnl ====================================================
3477         dnl = If XIE is present and is desired, turn it on
3478         dnl ====================================================
3479         case $target in
3480             *-hpux*)
3481                 ;;
3482             *)
3483                 HAVE_XIE=1
3484                 ;;
3485         esac
3486     fi
3488         LDFLAGS="$_SAVE_LDFLAGS"
3490     dnl ========================================================
3491     dnl = Check for freetype2 and its functionality
3492     dnl ========================================================
3493     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3495     if test "$_HAVE_FREETYPE2"; then
3496         _SAVE_LIBS="$LIBS"
3497         _SAVE_CFLAGS="$CFLAGS"
3498         LIBS="$LIBS $FT2_LIBS"
3499         CFLAGS="$CFLAGS $FT2_CFLAGS"
3501         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3502             ac_cv_member_FT_Bitmap_Size_y_ppem,
3503             [AC_TRY_COMPILE([#include <ft2build.h>
3504                              #include FT_FREETYPE_H],
3505                             [FT_Bitmap_Size s;
3506                              if (sizeof s.y_ppem) return 0;
3507                              return 1],
3508                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3509                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3510         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3511             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3512         else
3513             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3514         fi
3515         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3516                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3517                            [FT_Bitmap_Size structure includes y_ppem field])
3519         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3521         LIBS="$_SAVE_LIBS"
3522         CFLAGS="$_SAVE_CFLAGS"
3523     fi
3525 fi # $no_x
3527 AC_SUBST(XCFLAGS)
3528 AC_SUBST(XLDFLAGS)
3529 AC_SUBST(XLIBS)
3530 AC_SUBST(XEXT_LIBS)
3531 AC_SUBST(XT_LIBS)
3533 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3534 AC_TRY_COMPILE([],
3535                [asm("uqadd8 r1, r1, r2");],
3536                result="yes", result="no")
3537 AC_MSG_RESULT("$result")
3538 if test "$result" = "yes"; then
3539     AC_DEFINE(HAVE_ARM_SIMD)
3540     HAVE_ARM_SIMD=1
3542 AC_SUBST(HAVE_ARM_SIMD)
3544 AC_MSG_CHECKING(for ARM NEON support in compiler)
3545 _SAVE_CFLAGS="$CFLAGS"
3546 if test "$GNU_CC"; then
3547   # gcc needs -mfpu=neon to recognize NEON instructions
3548   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3550 AC_TRY_COMPILE([],
3551                [asm("vadd.i8 d0, d0, d0");],
3552                result="yes", result="no")
3553 AC_MSG_RESULT("$result")
3554 if test "$result" = "yes"; then
3555     AC_DEFINE(HAVE_ARM_NEON)
3556     HAVE_ARM_NEON=1
3558 CFLAGS="$_SAVE_CFLAGS"
3559 AC_SUBST(HAVE_ARM_NEON)
3561 dnl ========================================================
3562 dnl = pthread support
3563 dnl = Start by checking whether the system support pthreads
3564 dnl ========================================================
3565 case "$target_os" in
3566 darwin*)
3567     USE_PTHREADS=1
3568     ;;
3570     MOZ_CHECK_PTHREADS(pthreads,
3571         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3572         MOZ_CHECK_PTHREADS(pthread,
3573             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3574             MOZ_CHECK_PTHREADS(c_r,
3575                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3576                 MOZ_CHECK_PTHREADS(c,
3577                     USE_PTHREADS=1
3578                 )
3579             )
3580         )
3581     )
3582     ;;
3583 esac
3585 dnl ========================================================
3586 dnl Check the command line for --with-pthreads 
3587 dnl ========================================================
3588 MOZ_ARG_WITH_BOOL(pthreads,
3589 [  --with-pthreads         Force use of system pthread library with NSPR ],
3590 [ if test "$USE_PTHREADS"x = x; then
3591     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3592 fi],
3593     USE_PTHREADS=
3594     _PTHREAD_LDFLAGS=
3597 dnl ========================================================
3598 dnl Do the platform specific pthread hackery
3599 dnl ========================================================
3600 if test "$USE_PTHREADS"x != x
3601 then
3602         dnl
3603         dnl See if -pthread is supported.
3604         dnl
3605         rm -f conftest*
3606         ac_cv_have_dash_pthread=no
3607         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3608         echo 'int main() { return 0; }' | cat > conftest.c
3609         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3610         if test $? -eq 0; then
3611                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3612                         ac_cv_have_dash_pthread=yes
3613                 case "$target_os" in
3614                 freebsd*)
3615 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3616                 ;;
3617                 *)
3618                             CFLAGS="$CFLAGS -pthread"
3619                             CXXFLAGS="$CXXFLAGS -pthread"
3620                 ;;
3621                 esac
3622                 fi
3623         fi
3624         rm -f conftest*
3625     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3627         dnl
3628         dnl See if -pthreads is supported.
3629         dnl
3630     ac_cv_have_dash_pthreads=no
3631     if test "$ac_cv_have_dash_pthread" = "no"; then
3632             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3633         echo 'int main() { return 0; }' | cat > conftest.c
3634             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3635         if test $? -eq 0; then
3636                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3637                             ac_cv_have_dash_pthreads=yes
3638                             CFLAGS="$CFLAGS -pthreads"
3639                             CXXFLAGS="$CXXFLAGS -pthreads"
3640                     fi
3641             fi
3642             rm -f conftest*
3643         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3644     fi
3646         case "$target" in
3647             *-*-freebsd*)
3648                         AC_DEFINE(_REENTRANT)
3649                         AC_DEFINE(_THREAD_SAFE)
3650                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3651                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3652                                 _PTHREAD_LDFLAGS="-pthread"
3653                         else
3654                                 _PTHREAD_LDFLAGS="-lc_r"
3655                         fi
3656                         ;;
3658             *-*-openbsd*|*-*-bsdi*)
3659                         AC_DEFINE(_REENTRANT)
3660                         AC_DEFINE(_THREAD_SAFE)
3661                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3662                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3663                 _PTHREAD_LDFLAGS="-pthread"
3664                         fi
3665                         ;;
3667             *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3668                         AC_DEFINE(_REENTRANT) 
3669                         ;;
3671             *-*-nto*) 
3672                         AC_DEFINE(_REENTRANT) 
3673                         ;;
3675             *-aix4.3*|*-aix5*)
3676                         AC_DEFINE(_REENTRANT) 
3677                         ;;
3679             *-hpux11.*)
3680                         AC_DEFINE(_REENTRANT) 
3681                         ;;
3683             alpha*-*-osf*)
3684                         AC_DEFINE(_REENTRANT)
3685                         ;;
3687             *-*-solaris*) 
3688                         AC_DEFINE(_REENTRANT)
3689                         if test "$SOLARIS_SUNPRO_CC"; then
3690                                 CFLAGS="$CFLAGS -mt" 
3691                                 CXXFLAGS="$CXXFLAGS -mt" 
3692                         fi
3693                         ;;
3694         esac
3695     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3698 dnl ========================================================
3699 dnl See if mmap sees writes
3700 dnl For cross compiling, just define it as no, which is a safe default
3701 dnl ========================================================
3702 AC_MSG_CHECKING(whether mmap() sees write()s)
3704 changequote(,)
3705 mmap_test_prog='
3706     #include <stdlib.h>
3707     #include <unistd.h>
3708     #include <sys/mman.h>
3709     #include <sys/types.h>
3710     #include <sys/stat.h>
3711     #include <fcntl.h>
3713     char fname[] = "conftest.file";
3714     char zbuff[1024]; /* Fractional page is probably worst case */
3716     int main() {
3717         char *map;
3718         int fd;
3719         int i;
3720         unlink(fname);
3721         fd = open(fname, O_RDWR | O_CREAT, 0660);
3722         if(fd<0) return 1;
3723         unlink(fname);
3724         write(fd, zbuff, sizeof(zbuff));
3725         lseek(fd, 0, SEEK_SET);
3726         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3727         if(map==(char*)-1) return 2;
3728         for(i=0; fname[i]; i++) {
3729             int rc = write(fd, &fname[i], 1);
3730             if(map[i]!=fname[i]) return 4;
3731         }
3732         return 0;
3733     }
3735 changequote([,])
3737 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3739 AC_MSG_RESULT("$result")
3741 if test "$result" = "no"; then
3742     AC_DEFINE(MMAP_MISSES_WRITES)
3746 dnl Checks for library functions.
3747 dnl ========================================================
3748 AC_PROG_GCC_TRADITIONAL
3749 AC_FUNC_MEMCMP
3750 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3751 AC_CHECK_FUNCS(flockfile getpagesize)
3752 AC_CHECK_FUNCS(localtime_r strtok_r)
3754 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3755 _SAVE_LDFLAGS=$LDFLAGS
3756 LDFLAGS="$LDFLAGS -lrt"
3757 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3758                ac_cv_have_clock_monotonic,
3759                [AC_TRY_LINK([#include <time.h>],
3760                             [ struct timespec ts;
3761                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3762                             ac_cv_have_clock_monotonic=yes,
3763                             ac_cv_have_clock_monotonic=no)])
3764 LDFLAGS=$_SAVE_LDFLAGS
3765 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3766     HAVE_CLOCK_MONOTONIC=1
3767     REALTIME_LIBS=-lrt
3768     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3769     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3770     AC_SUBST(REALTIME_LIBS)
3773 dnl check for wcrtomb/mbrtowc
3774 dnl =======================================================================
3775 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3776 AC_LANG_SAVE
3777 AC_LANG_CPLUSPLUS
3778 AC_CACHE_CHECK(for wcrtomb,
3779     ac_cv_have_wcrtomb,
3780     [AC_TRY_LINK([#include <wchar.h>],
3781                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3782                  ac_cv_have_wcrtomb="yes",
3783                  ac_cv_have_wcrtomb="no")])
3784 if test "$ac_cv_have_wcrtomb" = "yes"; then
3785     AC_DEFINE(HAVE_WCRTOMB)
3787 AC_CACHE_CHECK(for mbrtowc,
3788     ac_cv_have_mbrtowc,
3789     [AC_TRY_LINK([#include <wchar.h>],
3790                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3791                  ac_cv_have_mbrtowc="yes",
3792                  ac_cv_have_mbrtowc="no")])
3793 if test "$ac_cv_have_mbrtowc" = "yes"; then
3794     AC_DEFINE(HAVE_MBRTOWC)
3796 AC_LANG_RESTORE
3799 AC_CACHE_CHECK(
3800     [for res_ninit()],
3801     ac_cv_func_res_ninit,
3802     [AC_TRY_LINK([
3803         #ifdef linux
3804         #define _BSD_SOURCE 1
3805         #endif
3806         #include <resolv.h>
3807         ],
3808         [int foo = res_ninit(&_res);],
3809         [ac_cv_func_res_ninit=yes],
3810         [ac_cv_func_res_ninit=no])
3811     ])
3813 if test "$ac_cv_func_res_ninit" = "yes"; then
3814     AC_DEFINE(HAVE_RES_NINIT)
3815 dnl must add the link line we do something as foolish as this... dougt
3816 dnl else
3817 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3818 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3821 AC_LANG_CPLUSPLUS
3822 AC_CACHE_CHECK(
3823     [for gnu_get_libc_version()],
3824     ac_cv_func_gnu_get_libc_version,
3825     [AC_TRY_LINK([
3826         #ifdef HAVE_GNU_LIBC_VERSION_H
3827         #include <gnu/libc-version.h>
3828         #endif
3829         ],
3830         [const char *glibc_version = gnu_get_libc_version();],
3831         [ac_cv_func_gnu_get_libc_version=yes],
3832         [ac_cv_func_gnu_get_libc_version=no] 
3833         )]
3834     )
3836 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3837     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3840 case $target_os in
3841     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3842         ;;
3843     *)
3844     
3845 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3846     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3847         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3848 _SAVE_LIBS=$LIBS
3849 LIBS="$LIBS $_ICONV_LIBS"
3850 AC_CACHE_CHECK(
3851     [for iconv()],
3852     ac_cv_func_iconv,
3853     [AC_TRY_LINK([
3854         #include <stdlib.h>
3855         #include <iconv.h>
3856         ],
3857         [
3858             iconv_t h = iconv_open("", "");
3859             iconv(h, NULL, NULL, NULL, NULL);
3860             iconv_close(h);
3861         ],
3862         [ac_cv_func_iconv=yes],
3863         [ac_cv_func_iconv=no] 
3864         )]
3865     )
3866 if test "$ac_cv_func_iconv" = "yes"; then
3867     AC_DEFINE(HAVE_ICONV)
3868     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3869     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3870     LIBICONV="$_ICONV_LIBS"
3871     AC_CACHE_CHECK(
3872         [for iconv() with const input],
3873         ac_cv_func_const_iconv,
3874         [AC_TRY_COMPILE([
3875             #include <stdlib.h>
3876             #include <iconv.h>
3877             ],
3878             [
3879                 const char *input = "testing";
3880                 iconv_t h = iconv_open("", "");
3881                 iconv(h, &input, NULL, NULL, NULL);
3882                 iconv_close(h);
3883             ],
3884             [ac_cv_func_const_iconv=yes],
3885             [ac_cv_func_const_iconv=no] 
3886             )]
3887         )
3888     if test "$ac_cv_func_const_iconv" = "yes"; then
3889         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3890     fi
3892 LIBS=$_SAVE_LIBS
3894     ;;
3895 esac
3897 AM_LANGINFO_CODESET
3899 AC_LANG_C
3901 dnl **********************
3902 dnl *** va_copy checks ***
3903 dnl **********************
3904 dnl we currently check for all three va_copy possibilities, so we get
3905 dnl all results in config.log for bug reports.
3906 AC_MSG_CHECKING(for an implementation of va_copy())
3907 AC_CACHE_VAL(ac_cv_va_copy,[
3908     AC_TRY_RUN([
3909         #include <stdarg.h>
3910         void f (int i, ...) {
3911             va_list args1, args2;
3912             va_start (args1, i);
3913             va_copy (args2, args1);
3914             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3915                 exit (1);
3916             va_end (args1); va_end (args2);
3917         }
3918         int main() { f (0, 42); return 0; }],
3919         ac_cv_va_copy=yes,
3920         ac_cv_va_copy=no,
3921         ac_cv_va_copy=no
3922     )
3924 AC_MSG_RESULT($ac_cv_va_copy)
3925 AC_MSG_CHECKING(for an implementation of __va_copy())
3926 AC_CACHE_VAL(ac_cv___va_copy,[
3927     AC_TRY_RUN([
3928         #include <stdarg.h>
3929         void f (int i, ...) {
3930             va_list args1, args2;
3931             va_start (args1, i);
3932             __va_copy (args2, args1);
3933             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3934                 exit (1);
3935             va_end (args1); va_end (args2);
3936         }
3937         int main() { f (0, 42); return 0; }],
3938         ac_cv___va_copy=yes,
3939         ac_cv___va_copy=no,
3940         ac_cv___va_copy=no
3941     )
3943 AC_MSG_RESULT($ac_cv___va_copy)
3944 AC_MSG_CHECKING(whether va_lists can be copied by value)
3945 AC_CACHE_VAL(ac_cv_va_val_copy,[
3946     AC_TRY_RUN([
3947         #include <stdarg.h>
3948         void f (int i, ...) {
3949             va_list args1, args2;
3950             va_start (args1, i);
3951             args2 = args1;
3952             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3953                 exit (1);
3954             va_end (args1); va_end (args2);
3955         }
3956         int main() { f (0, 42); return 0; }],
3957         ac_cv_va_val_copy=yes,
3958         ac_cv_va_val_copy=no,
3959         ac_cv_va_val_copy=yes
3960     )
3962 if test "x$ac_cv_va_copy" = "xyes"; then
3963     AC_DEFINE(VA_COPY, va_copy)
3964     AC_DEFINE(HAVE_VA_COPY)
3965 elif test "x$ac_cv___va_copy" = "xyes"; then
3966     AC_DEFINE(VA_COPY, __va_copy)
3967     AC_DEFINE(HAVE_VA_COPY)
3970 if test "x$ac_cv_va_val_copy" = "xno"; then
3971    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3973 AC_MSG_RESULT($ac_cv_va_val_copy)
3975 dnl Check for dll-challenged libc's.
3976 dnl This check is apparently only needed for Linux.
3977 case "$target" in
3978         *-linux*)
3979             dnl ===================================================================
3980             _curdir=`pwd`
3981             export _curdir
3982             rm -rf conftest* _conftest
3983             mkdir _conftest
3984             cat >> conftest.C <<\EOF
3985 #include <stdio.h>
3986 #include <link.h>
3987 #include <dlfcn.h>
3988 #ifdef _dl_loaded
3989 void __dump_link_map(void) {
3990   struct link_map *map = _dl_loaded;
3991   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3993 int main() {
3994   dlopen("./conftest1.so",RTLD_LAZY);
3995   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3996   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3997   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3998   __dump_link_map();
4000 #else
4001 /* _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).*/
4002 int main() { printf("./conftest1.so\n"); }
4003 #endif
4006             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4008             cat >> conftest1.C <<\EOF
4009 #include <stdio.h>
4010 void foo(void) {printf("foo in dll called\n");}
4012             ${CXX-g++} -fPIC -c -g conftest1.C
4013             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4014             ${CXX-g++} -g conftest.C -o conftest -ldl
4015             cp -f conftest1.so conftest _conftest
4016             cd _conftest
4017             if test `./conftest | grep conftest1.so | wc -l` -gt 1
4018             then
4019                 echo
4020                 echo "*** Your libc has a bug that can result in loading the same dynamic"
4021                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
4022                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
4023                 echo "*** will be excessive memory usage at runtime."
4024                 echo
4025             fi
4026             cd ${_curdir}
4027             rm -rf conftest* _conftest
4028             dnl ===================================================================
4029             ;;
4030 esac
4032 dnl ===================================================================
4033 dnl ========================================================
4034 dnl By default, turn rtti and exceptions off on g++/egcs
4035 dnl ========================================================
4036 if test "$GNU_CXX"; then
4038   AC_MSG_CHECKING(for C++ exceptions flag)
4040   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
4041   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
4042   [echo "int main() { return 0; }" | cat > conftest.C
4044   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
4046   if egrep "warning.*renamed" conftest.out >/dev/null; then
4047     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
4048   else
4049     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
4050   fi
4052   rm -f conftest*])
4054   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
4055   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
4056   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
4059 dnl ========================================================
4060 dnl Put your C++ language/feature checks below
4061 dnl ========================================================
4062 AC_LANG_CPLUSPLUS
4064 ARM_ABI_PREFIX=
4065 HAVE_GCC3_ABI=
4066 if test "$GNU_CC"; then
4067   if test "$CPU_ARCH" = "arm" ; then
4068     AC_CACHE_CHECK(for ARM EABI,
4069         ac_cv_gcc_arm_eabi,
4070         [AC_TRY_COMPILE([],
4071                         [
4072 #if defined(__ARM_EABI__)
4073   return 0;
4074 #else
4075 #error Not ARM EABI.
4076 #endif
4077                         ],
4078                         ac_cv_gcc_arm_eabi="yes",
4079                         ac_cv_gcc_arm_eabi="no")])
4080     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4081         HAVE_ARM_EABI=1
4082         ARM_ABI_PREFIX=eabi-
4083     else
4084         ARM_ABI_PREFIX=oabi-
4085     fi
4086   fi
4088   AC_CACHE_CHECK(for gcc 3.0 ABI,
4089       ac_cv_gcc_three_abi,
4090       [AC_TRY_COMPILE([],
4091                       [
4092 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4093   return 0;
4094 #else
4095 #error Not gcc3.
4096 #endif
4097                       ],
4098                       ac_cv_gcc_three_abi="yes",
4099                       ac_cv_gcc_three_abi="no")])
4100   if test "$ac_cv_gcc_three_abi" = "yes"; then
4101       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4102       HAVE_GCC3_ABI=1
4103   else
4104       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4105   fi
4107 AC_SUBST(HAVE_GCC3_ABI)
4110 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4111                ac_cv_cpp_explicit,
4112                [AC_TRY_COMPILE(class X {
4113                                public: explicit X(int i) : i_(i) {}
4114                                private: int i_;
4115                                };,
4116                                X x(3);,
4117                                ac_cv_cpp_explicit=yes,
4118                                ac_cv_cpp_explicit=no)])
4119 if test "$ac_cv_cpp_explicit" = yes ; then
4120    AC_DEFINE(HAVE_CPP_EXPLICIT)
4123 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4124                ac_cv_cpp_typename,
4125                [AC_TRY_COMPILE(class param {
4126                                public:
4127                                    typedef unsigned long num_type;
4128                                };
4130                                template <class T> class tplt {
4131                                public:
4132                                    typedef typename T::num_type t_num_type;
4133                                    t_num_type foo(typename T::num_type num) {
4134                                        return num;
4135                                    }
4136                                };,
4137                                tplt<param> A;
4138                                A.foo(0);,
4139                                ac_cv_cpp_typename=yes,
4140                                ac_cv_cpp_typename=no)])
4141 if test "$ac_cv_cpp_typename" = yes ; then
4142    AC_DEFINE(HAVE_CPP_TYPENAME)
4145 dnl Check for support of modern template specialization syntax
4146 dnl Test code and requirement from scc@netscape.com.
4147 dnl Autoconf cut-and-paste job by waterson@netscape.com
4148 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4149                ac_cv_cpp_modern_specialize_template_syntax,
4150                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4151                                class Y {};
4152                                template <> struct X<Y> { double a; };,
4153                                X<int> int_x;
4154                                X<Y> y_x;,
4155                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4156                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4157 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4158   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4162 dnl Some compilers support only full specialization, and some don't.
4163 AC_CACHE_CHECK(whether partial template specialization works,
4164                ac_cv_cpp_partial_specialization,
4165                [AC_TRY_COMPILE(template <class T> class Foo {};
4166                                template <class T> class Foo<T*> {};,
4167                                return 0;,
4168                                ac_cv_cpp_partial_specialization=yes,
4169                                ac_cv_cpp_partial_specialization=no)])
4170 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4171   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4174 dnl Some compilers have limited support for operators with templates;
4175 dnl specifically, it is necessary to define derived operators when a base
4176 dnl class's operator declaration should suffice.
4177 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4178                ac_cv_need_derived_template_operators,
4179                [AC_TRY_COMPILE([template <class T> class Base { };
4180                                 template <class T>
4181                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4182                                 template <class T> class Derived : public Base<T> { };],
4183                                [Derived<char> a, b;
4184                                 Base<char> c = a + b;
4185                                 return 0;],
4186                                ac_cv_need_derived_template_operators=no,
4187                                ac_cv_need_derived_template_operators=yes)])
4188 if test "$ac_cv_need_derived_template_operators" = yes ; then
4189   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4193 dnl Some compilers have trouble detecting that a template class
4194 dnl that derives from another template is actually an instance
4195 dnl of the base class. This test checks for that.
4196 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4197                ac_cv_need_cpp_template_cast_to_base,
4198                [AC_TRY_COMPILE([template <class T> class Base { };
4199                                 template <class T> class Derived : public Base<T> { };
4200                                 template <class T> int foo(const Base<T>&) { return 0; }],
4201                                [Derived<char> bar; return foo(bar);],
4202                                ac_cv_need_cpp_template_cast_to_base=no,
4203                                ac_cv_need_cpp_template_cast_to_base=yes)])
4204 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4205   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4208 dnl Some compilers have trouble resolving the ambiguity between two
4209 dnl functions whose arguments differ only by cv-qualifications.
4210 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4211                ac_cv_can_resolve_const_ambiguity,
4212                [AC_TRY_COMPILE([
4213                                 template <class T> class ptrClass {
4214                                   public: T* ptr;
4215                                 };
4217                                 template <class T> T* a(ptrClass<T> *arg) {
4218                                   return arg->ptr;
4219                                 }
4221                                 template <class T>
4222                                 const T* a(const ptrClass<T> *arg) {
4223                                   return arg->ptr;
4224                                 }
4225                                ],
4226                                [ ptrClass<int> i;
4227                                  a(&i); ],
4228                                ac_cv_can_resolve_const_ambiguity=yes,
4229                                ac_cv_can_resolve_const_ambiguity=no)])
4230 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4231   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4235 dnl We don't do exceptions on unix.  The only reason this used to be here
4236 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4237 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4238 dnl So im commenting this out until someone writes some artificial 
4239 dnl intelligence to detect not only if the compiler has exceptions, but if 
4240 dnl they are enabled as well.
4241 dnl 
4242 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4243 dnl                ac_cv_cpp_exceptions,
4244 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4245 dnl                                static void F() { throw X(); },
4246 dnl                                try { F(); } catch(X & e) { },
4247 dnl                                ac_cv_cpp_exceptions=yes,
4248 dnl                                ac_cv_cpp_exceptions=no)])
4249 dnl if test $ac_cv_cpp_exceptions = yes ; then
4250 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4251 dnl fi
4253 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4254 dnl supports it well enough to allow us to use it to change access, but not
4255 dnl to resolve ambiguity. The next two tests determine how well the |using|
4256 dnl keyword is supported.
4258 dnl Check to see if we can change access with |using|.  Test both a
4259 dnl legal and an illegal example.
4260 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4261                ac_cv_cpp_access_changing_using2,
4262                [AC_TRY_COMPILE(
4263                    class A { protected: int foo() { return 0; } };
4264                    class B : public A { public: using A::foo; };,
4265                    B b; return b.foo();,
4266                    [AC_TRY_COMPILE(
4267                        class A { public: int foo() { return 1; } };
4268                        class B : public A { private: using A::foo; };,
4269                        B b; return b.foo();,
4270                        ac_cv_cpp_access_changing_using2=no,
4271                        ac_cv_cpp_access_changing_using2=yes)],
4272                    ac_cv_cpp_access_changing_using2=no)])
4273 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4274    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4277 dnl Check to see if we can resolve ambiguity with |using|.
4278 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4279                ac_cv_cpp_ambiguity_resolving_using,
4280                [AC_TRY_COMPILE(class X { 
4281                                  public: int go(const X&) {return 3;}
4282                                          int jo(const X&) {return 3;}
4283                                };
4284                                class Y : public X {
4285                                  public:  int go(int) {return 2;}
4286                                           int jo(int) {return 2;}
4287                                           using X::jo;
4288                                  private: using X::go;
4289                                };,
4290                                X x; Y y; y.jo(x);,
4291                                ac_cv_cpp_ambiguity_resolving_using=yes,
4292                                ac_cv_cpp_ambiguity_resolving_using=no)])
4293 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4294    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4297 dnl Check to see if the |std| namespace is supported. If so, we'll want
4298 dnl to qualify any standard library calls with "std::" to ensure that
4299 dnl those functions can be resolved.
4300 AC_CACHE_CHECK(for \"std::\" namespace,
4301                ac_cv_cpp_namespace_std,
4302                [AC_TRY_COMPILE([#include <algorithm>],
4303                                [return std::min(0, 1);],
4304                                ac_cv_cpp_namespace_std=yes,
4305                                ac_cv_cpp_namespace_std=no)])
4306 if test "$ac_cv_cpp_namespace_std" = yes ; then
4307    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4310 dnl Older compilers are overly ambitious with respect to using the standard
4311 dnl template library's |operator!=()| when |operator==()| is defined. In
4312 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4313 dnl ambiguity at compile-time. This test checks for that case.
4314 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4315                ac_cv_cpp_unambiguous_std_notequal,
4316                [AC_TRY_COMPILE([#include <algorithm>
4317                                 struct T1 {};
4318                                 int operator==(const T1&, const T1&) { return 0; }
4319                                 int operator!=(const T1&, const T1&) { return 0; }],
4320                                [T1 a,b; return a != b;],
4321                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4322                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4323 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4324   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4328 AC_CACHE_CHECK(for C++ reinterpret_cast,
4329                ac_cv_cpp_reinterpret_cast,
4330                [AC_TRY_COMPILE(struct X { int i; };
4331                                struct Y { int i; };,
4332                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4333                                ac_cv_cpp_reinterpret_cast=yes,
4334                                ac_cv_cpp_reinterpret_cast=no)])
4335 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4336    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4339 dnl See if a dynamic_cast to void* gives the most derived object.
4340 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4341                ac_cv_cpp_dynamic_cast_void_ptr,
4342                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4343                             class Y { int j; public: virtual ~Y() { } };
4344                             class Z : public X, public Y { int k; };
4346                             int main() {
4347                                  Z mdo;
4348                                  X *subx = (X*)&mdo;
4349                                  Y *suby = (Y*)&mdo;
4350                                  return !((((void*)&mdo != (void*)subx) &&
4351                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4352                                           (((void*)&mdo != (void*)suby) &&
4353                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4354                             }],
4355                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4356                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4357                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4358 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4359    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4363 dnl note that this one is reversed - if the test fails, then
4364 dnl we require implementations of unused virtual methods. Which
4365 dnl really blows because it means we'll have useless vtable
4366 dnl bloat.
4367 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4368                ac_cv_cpp_unused_required,
4369                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4370                                X x;,
4371                                ac_cv_cpp_unused_required=no,
4372                                ac_cv_cpp_unused_required=yes)])
4373 if test "$ac_cv_cpp_unused_required" = yes ; then
4374    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4378 dnl Some compilers have trouble comparing a constant reference to a templatized
4379 dnl class to zero, and require an explicit operator==() to be defined that takes
4380 dnl an int. This test separates the strong from the weak.
4382 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4383                ac_cv_trouble_comparing_to_zero,
4384                [AC_TRY_COMPILE([#include <algorithm>
4385                                 template <class T> class Foo {};
4386                                 class T2;
4387                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4388                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4389                                [Foo<int> f; return (0 != f);],
4390                                ac_cv_trouble_comparing_to_zero=no,
4391                                ac_cv_trouble_comparing_to_zero=yes)])
4392 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4393   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4396 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4397 _SAVE_LDFLAGS=$LDFLAGS
4398 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4399 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4400                ac_cv_thread_keyword,
4401                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4402                             [return tlsIsMainThread;],
4403                             ac_cv_thread_keyword=yes,
4404                             ac_cv_thread_keyword=no)])
4405 LDFLAGS=$_SAVE_LDFLAGS
4406 if test "$ac_cv_thread_keyword" = yes; then
4407   # mips builds fail with TLS variables because of a binutils bug.
4408   # See bug 528687
4409   case "${target}" in
4410     mips*-*)
4411       :
4412       ;;
4413     *-android*)
4414       :
4415       ;;
4416     *)
4417       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4418       ;;
4419   esac
4422 dnl Check for the existence of various allocation headers/functions
4424 MALLOC_H=
4425 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4426 if test "$MALLOC_H" = ""; then
4427   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4428   if test "$MALLOC_H" = ""; then
4429     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4430   fi
4432 if test "$MALLOC_H" != ""; then
4433    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4436 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4437 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4439 dnl See if compiler supports some gcc-style attributes
4441 AC_CACHE_CHECK(for __attribute__((always_inline)),
4442                ac_cv_attribute_always_inline,
4443                [AC_TRY_COMPILE([],
4444                                [inline void f(void) __attribute__((always_inline));],
4445                                ac_cv_attribute_always_inline=yes,
4446                                ac_cv_attribute_always_inline=no)])
4448 AC_CACHE_CHECK(for __attribute__((malloc)),
4449                ac_cv_attribute_malloc,
4450                [AC_TRY_COMPILE([],
4451                                [void* f(int) __attribute__((malloc));],
4452                                ac_cv_attribute_malloc=yes,
4453                                ac_cv_attribute_malloc=no)])
4455 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4456                ac_cv_attribute_warn_unused,
4457                [AC_TRY_COMPILE([],
4458                                [int f(void) __attribute__((warn_unused_result));],
4459                                ac_cv_attribute_warn_unused=yes,
4460                                ac_cv_attribute_warn_unused=no)])
4462 AC_CACHE_CHECK(for __attribute__((noreturn)),
4463                ac_cv_attribute_noreturn,
4464                [AC_TRY_COMPILE([],
4465                                [void f(void) __attribute__((noreturn));],
4466                                ac_cv_attribute_noreturn=yes,
4467                                ac_cv_attribute_noreturn=no)])
4469 dnl End of C++ language/feature checks
4470 AC_LANG_C
4472 dnl ========================================================
4473 dnl =  Internationalization checks
4474 dnl ========================================================
4476 dnl Internationalization and Locale support is different
4477 dnl on various UNIX platforms.  Checks for specific i18n
4478 dnl features go here.
4480 dnl check for LC_MESSAGES
4481 AC_CACHE_CHECK(for LC_MESSAGES,
4482                 ac_cv_i18n_lc_messages,
4483                 [AC_TRY_COMPILE([#include <locale.h>],
4484                                 [int category = LC_MESSAGES;],
4485                                 ac_cv_i18n_lc_messages=yes,
4486                                 ac_cv_i18n_lc_messages=no)])
4487 if test "$ac_cv_i18n_lc_messages" = yes; then
4488    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4491 AC_HAVE_FUNCS(localeconv)
4493 fi # SKIP_COMPILER_CHECKS
4495 TARGET_XPCOM_ABI=
4496 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4497     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4500 dnl Mozilla specific options
4501 dnl ========================================================
4502 dnl The macros used for command line options
4503 dnl are defined in build/autoconf/altoptions.m4.
4505 dnl If the compiler supports these attributes, define them as
4506 dnl convenience macros.
4507 if test "$ac_cv_attribute_always_inline" = yes ; then
4508   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4509 else
4510   AC_DEFINE(NS_ALWAYS_INLINE,)
4513 if test "$ac_cv_attribute_malloc" = yes ; then
4514   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4515 else
4516   AC_DEFINE(NS_ATTR_MALLOC,)
4519 if test "$ac_cv_attribute_warn_unused" = yes ; then
4520   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4521 else
4522   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4525 if test "$ac_cv_attribute_noreturn" = yes ; then
4526   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4527 else
4528   AC_DEFINE(NS_NORETURN,)
4531 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4532 dnl features that Windows actually does support.
4534 if test -n "$SKIP_COMPILER_CHECKS"; then
4535    dnl Windows has malloc.h
4536    AC_DEFINE(MALLOC_H, [<malloc.h>])
4537    AC_DEFINE(HAVE_FORCEINLINE)
4538    AC_DEFINE(HAVE_LOCALECONV)
4539 fi # SKIP_COMPILER_CHECKS
4541 dnl ========================================================
4542 dnl =
4543 dnl = Check for external package dependencies
4544 dnl =
4545 dnl ========================================================
4546 MOZ_ARG_HEADER(External Packages)
4548 MOZ_ENABLE_LIBXUL=1
4550 MOZ_ARG_WITH_STRING(libxul-sdk,
4551 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4552   LIBXUL_SDK_DIR=$withval)
4554 if test "$LIBXUL_SDK_DIR" = "yes"; then
4555     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4556 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4557     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4559     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4560         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4561     fi
4563     MOZ_ENABLE_LIBXUL=1
4565 AC_SUBST(LIBXUL_SDK)
4567 if test -n "$LIBXUL_SDK"; then
4568     LIBXUL_DIST="$LIBXUL_SDK"
4569 else
4570     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4572 AC_SUBST(LIBXUL_DIST)
4574 SYSTEM_LIBXUL=
4576 MOZ_ARG_WITH_BOOL(system-libxul,
4577 [  --with-system-libxul    Use system installed libxul SDK],
4578     SYSTEM_LIBXUL=1)
4580 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4581     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4584 dnl ========================================================
4585 dnl = If NSPR was not detected in the system, 
4586 dnl = use the one in the source tree (mozilla/nsprpub)
4587 dnl ========================================================
4588 MOZ_ARG_WITH_BOOL(system-nspr,
4589 [  --with-system-nspr      Use system installed NSPR],
4590     _USE_SYSTEM_NSPR=1 )
4592 if test -n "$_USE_SYSTEM_NSPR"; then
4593     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4596 if test -n "$MOZ_NATIVE_NSPR"; then
4597     _SAVE_CFLAGS=$CFLAGS
4598     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4599     AC_TRY_COMPILE([#include "prtypes.h"],
4600                 [#ifndef PR_STATIC_ASSERT
4601                  #error PR_STATIC_ASSERT not defined or requires including prlog.h
4602                  #endif],
4603                 [MOZ_NATIVE_NSPR=1],
4604                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4605     CFLAGS=$_SAVE_CFLAGS
4606 else
4607     if test "$OS_ARCH" = "WINCE"; then
4608         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
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     elif test "$OS_ARCH" = "WINNT"; then
4611         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4612         if test -n "$GNU_CC"; then
4613             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4614         else
4615             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4616         fi
4617     else
4618         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4619         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4620     fi
4623 dnl system libevent Support
4624 dnl ========================================================
4625 MOZ_ARG_WITH_STRING(system-libevent,
4626 [  --with-system-libevent=[PFX]
4627                           Use system libevent [installed at prefix PFX]],
4628     LIBEVENT_DIR=$withval)
4630 _SAVE_CFLAGS=$CFLAGS
4631 _SAVE_LDFLAGS=$LDFLAGS
4632 _SAVE_LIBS=$LIBS
4633 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4634     MOZ_NATIVE_LIBEVENT=
4635 else
4636     if test "${LIBEVENT_DIR}" = "yes"; then
4637         LIBEVENT_DIR=/usr
4638     fi
4639     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4640     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4641     AC_CHECK_HEADER(event.h,
4642                     [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4643                          AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4644                      fi],
4645                     AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4646     AC_CHECK_LIB(event, event_init,
4647                  [MOZ_NATIVE_LIBEVENT=1
4648                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4649                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4650                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4652 CFLAGS=$_SAVE_CFLAGS
4653 LDFLAGS=$_SAVE_LDFLAGS
4654 LIBS=$_SAVE_LIBS
4656 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4657 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4658 AC_SUBST(MOZ_LIBEVENT_LIBS)
4660 dnl ========================================================
4661 dnl = If NSS was not detected in the system, 
4662 dnl = use the one in the source tree (mozilla/security/nss)
4663 dnl ========================================================
4665 MOZ_ARG_WITH_BOOL(system-nss,
4666 [  --with-system-nss       Use system installed NSS],
4667     _USE_SYSTEM_NSS=1 )
4669 if test -n "$_USE_SYSTEM_NSS"; then
4670     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4673 if test -n "$MOZ_NATIVE_NSS"; then
4674    NSS_LIBS="$NSS_LIBS -lcrmf"
4675 else
4676    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4677    NSS_DEP_LIBS="\
4678         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4679         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4680         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4681         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4682         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4684    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4685        NSS_LIBS="\
4686         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4687         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4688         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4689         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4690         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4691    else
4692        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4693    fi
4696 if test -z "$SKIP_LIBRARY_CHECKS"; then
4697 dnl system JPEG support
4698 dnl ========================================================
4699 MOZ_ARG_WITH_STRING(system-jpeg,
4700 [  --with-system-jpeg[=PFX]
4701                           Use system libjpeg [installed at prefix PFX]],
4702     JPEG_DIR=$withval)
4704 _SAVE_CFLAGS=$CFLAGS
4705 _SAVE_LDFLAGS=$LDFLAGS
4706 _SAVE_LIBS=$LIBS
4707 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4708     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4709     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4711 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4712     SYSTEM_JPEG=
4713 else
4714     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4717 if test "$SYSTEM_JPEG" = 1; then
4718     LIBS="$JPEG_LIBS $LIBS"
4719     AC_TRY_COMPILE([ #include <stdio.h>
4720                      #include <sys/types.h>
4721                      #include <jpeglib.h> ],
4722                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4723                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4724                      #endif ],
4725                    SYSTEM_JPEG=1,
4726                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4727 fi 
4728 CFLAGS=$_SAVE_CFLAGS
4729 LDFLAGS=$_SAVE_LDFLAGS
4730 LIBS=$_SAVE_LIBS
4732 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4733     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4734     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4737 dnl system ZLIB support
4738 dnl ========================================================
4739 MOZ_ARG_WITH_STRING(system-zlib,
4740 [  --with-system-zlib[=PFX]
4741                           Use system libz [installed at prefix PFX]],
4742     ZLIB_DIR=$withval)
4744 _SAVE_CFLAGS=$CFLAGS
4745 _SAVE_LDFLAGS=$LDFLAGS
4746 _SAVE_LIBS=$LIBS
4747 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4748     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4749     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4751 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4752     SYSTEM_ZLIB=
4753 else
4754     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4755         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4757 if test "$SYSTEM_ZLIB" = 1; then
4758     LIBS="$ZLIB_LIBS $LIBS"
4759     AC_TRY_COMPILE([ #include <stdio.h>
4760                      #include <string.h>
4761                      #include <zlib.h> ],
4762                    [ #if ZLIB_VERNUM < $MOZZLIB 
4763                      #error "Insufficient zlib version ($MOZZLIB required)."
4764                      #endif ],
4765                    SYSTEM_ZLIB=1,
4766                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4768 CFLAGS=$_SAVE_CFLAGS
4769 LDFLAGS=$_SAVE_LDFLAGS
4770 LIBS=$_SAVE_LIBS
4772 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4773     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4774     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4777 dnl system BZIP2 Support
4778 dnl ========================================================
4779 MOZ_ARG_WITH_STRING(system-bz2,
4780 [  --with-system-bz2[=PFX]
4781                           Use system libbz2 [installed at prefix PFX]],
4782     BZ2_DIR=$withval)
4784 _SAVE_CFLAGS=$CFLAGS
4785 _SAVE_LDFLAGS=$LDFLAGS
4786 _SAVE_LIBS=$LIBS
4787 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4788     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4789     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4791 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4792     SYSTEM_BZ2=
4793 else
4794     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4795         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4797 CFLAGS=$_SAVE_CFLAGS
4798 LDFLAGS=$_SAVE_LDFLAGS
4799 LIBS=$_SAVE_LIBS
4801 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4802     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4803     BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4806 dnl system PNG Support
4807 dnl ========================================================
4808 MOZ_ARG_WITH_STRING(system-png, 
4809 [  --with-system-png[=PFX]
4810                           Use system libpng [installed at prefix PFX]],
4811     PNG_DIR=$withval)
4813 _SAVE_CFLAGS=$CFLAGS
4814 _SAVE_LDFLAGS=$LDFLAGS
4815 _SAVE_LIBS=$LIBS
4816 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4817 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4818 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4819     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4820     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4822 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4823     SYSTEM_PNG=
4824 else
4825     _SAVE_PNG_LIBS=$PNG_LIBS
4826     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4827                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4828                  $PNG_LIBS)
4829     AC_CHECK_LIB(png, png_get_acTL, ,
4830                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4831                  $_SAVE_PNG_LIBS)
4833 if test "$SYSTEM_PNG" = 1; then
4834     LIBS="$PNG_LIBS $LIBS"
4835     AC_TRY_COMPILE([ #include <stdio.h>
4836                      #include <sys/types.h>
4837                      #include <png.h> ],
4838                    [ #if PNG_LIBPNG_VER < $MOZPNG
4839                      #error "Insufficient libpng version ($MOZPNG required)."
4840                      #endif
4841                      #ifndef PNG_UINT_31_MAX
4842                      #error "Insufficient libpng version."
4843                      #endif ],
4844                    SYSTEM_PNG=1,
4845                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4847 CFLAGS=$_SAVE_CFLAGS
4848 LDFLAGS=$_SAVE_LDFLAGS
4849 LIBS=$_SAVE_LIBS
4851 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4852     PNG_CFLAGS="-I${PNG_DIR}/include"
4853     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4856 fi # SKIP_LIBRARY_CHECKS
4858 dnl system HunSpell Support
4859 dnl ========================================================
4860 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4861 [  --enable-system-hunspell
4862                           Use system hunspell (located with pkgconfig)],
4863     SYSTEM_HUNSPELL=1 )
4865 if test -n "$SYSTEM_HUNSPELL"; then
4866     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4869 AC_SUBST(SYSTEM_HUNSPELL)
4871 dnl ========================================================
4872 dnl Java SDK support
4873 dnl ========================================================
4874 JAVA_INCLUDE_PATH=
4875 MOZ_ARG_WITH_STRING(java-include-path,
4876 [  --with-java-include-path=dir
4877                           Location of Java SDK headers],
4878     JAVA_INCLUDE_PATH=$withval)
4880 JAVA_BIN_PATH=
4881 MOZ_ARG_WITH_STRING(java-bin-path,
4882 [  --with-java-bin-path=dir
4883                           Location of Java binaries (java, javac, jar)],
4884     JAVA_BIN_PATH=$withval)
4886 dnl ========================================================
4887 dnl =
4888 dnl = Application
4889 dnl =
4890 dnl ========================================================
4892 MOZ_ARG_HEADER(Application)
4894 BUILD_STATIC_LIBS=
4895 ENABLE_TESTS=1
4896 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4897 MOZ_BRANDING_DIRECTORY=
4898 MOZ_OFFICIAL_BRANDING=
4899 MOZ_FEEDS=1
4900 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4901 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4902 MOZ_INSTALLER=1
4903 MOZ_IPC=1
4904 MOZ_JAVAXPCOM=
4905 MOZ_JSDEBUGGER=1
4906 MOZ_JSLOADER=1
4907 MOZ_MATHML=1
4908 MOZ_MORK=
4909 MOZ_MORKREADER=1
4910 MOZ_AUTH_EXTENSION=1
4911 MOZ_NO_ACTIVEX_SUPPORT=1
4912 MOZ_NO_INSPECTOR_APIS=
4913 MOZ_NO_FAST_LOAD=
4914 MOZ_OGG=1
4915 MOZ_SYDNEYAUDIO=
4916 MOZ_VORBIS=
4917 MOZ_WAVE=1
4918 MOZ_MEDIA=
4919 MOZ_WEBM=1
4920 VPX_AS=
4921 VPX_ASFLAGS=
4922 VPX_X86_ASM=
4923 MOZ_PANGO=1
4924 MOZ_PERMISSIONS=1
4925 MOZ_PLACES=1
4926 MOZ_PLAINTEXT_EDITOR_ONLY=
4927 MOZ_PLUGINS=1
4928 MOZ_PREF_EXTENSIONS=1
4929 MOZ_PROFILELOCKING=1
4930 MOZ_PSM=1
4931 MOZ_RDF=1
4932 MOZ_REFLOW_PERF=
4933 MOZ_SAFE_BROWSING=
4934 MOZ_FASTSTART=
4935 MOZ_HELP_VIEWER=
4936 MOZ_SPELLCHECK=1
4937 MOZ_SPLASHSCREEN=
4938 MOZ_STORAGE=1
4939 MOZ_SVG=1
4940 MOZ_THUMB2=
4941 MOZ_TIMELINE=
4942 MOZ_TOOLKIT_SEARCH=1
4943 MOZ_UI_LOCALE=en-US
4944 MOZ_UNIVERSALCHARDET=1
4945 MOZ_URL_CLASSIFIER=
4946 MOZ_USE_NATIVE_UCONV=
4947 MOZ_VIEW_SOURCE=1
4948 MOZ_XSLT_STANDALONE=
4949 MOZ_XTF=1
4950 MOZ_XUL=1
4951 MOZ_ZIPWRITER=1
4952 NS_PRINTING=1
4953 NSS_DISABLE_DBM=
4954 NECKO_WIFI=1
4955 NECKO_COOKIES=1
4956 NECKO_DISK_CACHE=1
4957 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource"
4958 USE_ARM_KUSER=
4959 BUILD_CTYPES=1
4960 XPC_IDISPATCH_SUPPORT=
4963 case "$target_os" in
4964 darwin*|*wince*|*winmo*)
4965     ACCESSIBILITY=
4966     ;;
4968     ACCESSIBILITY=1
4969     ;;
4970 esac
4972 case "$target_os" in
4973     msvc*|mks*|cygwin*|mingw*)
4974         NS_ENABLE_TSF=1
4975         if test -z "$GNU_CC"; then 
4976             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4977                 NS_ENABLE_TSF=
4978             fi
4979         fi
4980         if test -n "$NS_ENABLE_TSF"; then
4981             AC_DEFINE(NS_ENABLE_TSF)
4982         fi
4983         ;;
4984 esac
4986 case "${target}" in
4987     arm-android-eabi)
4988         NSS_DISABLE_DBM=1
4989         USE_ARM_KUSER=1
4990         MOZ_INSTALLER=
4991         MOZ_CRASHREPORTER=
4992         NS_PRINTING=
4993         NECKO_WIFI=
4994         MOZ_PLUGINS=
4995         MOZ_THUMB2=1
4996         MOZ_THEME_FASTSTRIPE=1
4997         MOZ_TREE_FREETYPE=1
4998         MOZ_MEMORY=1
4999         ;;
5000 esac
5002 MOZ_ARG_ENABLE_STRING(application,
5003 [  --enable-application=APP
5004                           Options include:
5005                             browser (Firefox)
5006                             xulrunner
5007                             content/xslt (Standalone Transformiix XSLT)
5008                             netwerk (Standalone Necko)
5009                             tools/update-packaging (AUS-related packaging tools)
5010                             standalone (use this for standalone
5011                               xpcom/xpconnect or to manually drive a build)],
5012 [ MOZ_BUILD_APP=$enableval ] )
5014 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5015 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
5016   XULRUNNER_STUB_NAME=$withval)
5018 if test -z "$XULRUNNER_STUB_NAME"; then
5019   case "$target_os" in
5020   darwin*)
5021     XULRUNNER_STUB_NAME=xulrunner
5022     ;;
5023   *)
5024     XULRUNNER_STUB_NAME=xulrunner-stub
5025   esac
5027 AC_SUBST(XULRUNNER_STUB_NAME)
5029 if test -z "$MOZ_BUILD_APP"; then
5030   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5031 else
5032   # We have a valid application only if it has a build.mk file in its top
5033   # directory.
5034   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5035     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5036   fi
5039 # Allow the application to influence configure with a confvars.sh script.
5041 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5042 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5043   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5044   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5045 else
5046   AC_MSG_RESULT([no])
5049 # Now is a good time to test for logic errors, define mismatches, etc.
5050 case "$MOZ_BUILD_APP" in
5051 xulrunner)
5052   if test "$LIBXUL_SDK"; then
5053     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5054   fi
5055   ;;
5056 esac
5058 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5059 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5060 # MOZ_BUILD_APP.
5061 case "$MOZ_BUILD_APP" in
5062 browser)
5063   AC_DEFINE(MOZ_PHOENIX)
5064   ;;
5066 xulrunner)
5067   AC_DEFINE(MOZ_XULRUNNER)
5068   ;;
5070 content/xslt)
5071   AC_DEFINE(TX_EXE)
5072   ;;
5074 standalone) 
5075   MOZ_APP_NAME=mozilla
5076   MOZ_APP_DISPLAYNAME=Mozilla
5077   MOZ_APP_VERSION=$MOZILLA_VERSION
5078   ;;
5080 esac
5082 AC_SUBST(MOZ_BUILD_APP)
5083 AC_SUBST(MOZ_PHOENIX)
5084 AC_SUBST(MOZ_XULRUNNER)
5086 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5088 dnl ========================================================
5089 dnl = 
5090 dnl = Toolkit Options
5091 dnl = 
5092 dnl ========================================================
5093 MOZ_ARG_HEADER(Toolkit Options)
5095     dnl ========================================================
5096     dnl = Select the default toolkit
5097     dnl ========================================================
5098         MOZ_ARG_ENABLE_STRING(default-toolkit,
5099         [  --enable-default-toolkit=TK
5100                           Select default toolkit
5101                           Platform specific defaults:
5102                             BeOS - cairo-beos
5103                             Mac OS X - cairo-cocoa
5104                             Neutrino/QNX - photon
5105                             OS/2 - cairo-os2
5106                             Win32/WinCE - cairo-windows
5107                             Gtk2 with DirectFB - cairo-gtk2-dfb
5108                             * - cairo-gtk2
5109                             * - cairo-qt],
5110     [ _DEFAULT_TOOLKIT=$enableval ],
5111     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5113     if test "$_DEFAULT_TOOLKIT" = "photon" \
5114         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5115         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5116         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5117         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5118         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5119         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5120         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5121         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5122         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5123     then
5124         dnl nglayout only supports building with one toolkit,
5125         dnl so ignore everything after the first comma (",").
5126         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5127     else
5128         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5129     fi
5131 dnl ========================================================
5132 dnl = Enable the toolkit as needed                         =
5133 dnl ========================================================
5135 case "$MOZ_WIDGET_TOOLKIT" in
5136 photon)
5137         MOZ_ENABLE_PHOTON=1
5138         AC_DEFINE(MOZ_WIDGET_PHOTON)
5139     ;;
5141 cairo-windows)
5142     MOZ_WIDGET_TOOLKIT=windows
5143     MOZ_WEBGL=1
5144     case "${target}" in
5145     *-wince*)
5146         NS_PRINTING=
5147         ;;
5148     esac
5149     ;;
5151 cairo-gtk2|cairo-gtk2-x11)
5152     MOZ_WIDGET_TOOLKIT=gtk2
5153     MOZ_ENABLE_GTK2=1
5154     MOZ_ENABLE_XREMOTE=1
5155     MOZ_WEBGL=1
5156     MOZ_WEBGL_GLX=1
5158     AC_DEFINE(MOZ_X11)
5159     MOZ_X11=1
5160     USE_FC_FREETYPE=1
5162     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5163     TK_LIBS='$(MOZ_GTK2_LIBS)'
5164     AC_DEFINE(MOZ_WIDGET_GTK2)
5165     ;;
5167 cairo-gtk2-dfb)
5168     MOZ_WIDGET_TOOLKIT=gtk2
5169     MOZ_ENABLE_GTK2=1
5170     MOZ_WEBGL=
5172     AC_DEFINE(MOZ_DFB)
5173     MOZ_DFB=1
5175     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5176     TK_LIBS='$(MOZ_GTK2_LIBS)'
5177     AC_DEFINE(MOZ_WIDGET_GTK2)
5178     if test "$no_x" != "yes"; then
5179         AC_MSG_WARN([Disabling X when DirectFB is specified.])
5180         no_x=yes
5181     fi
5182     ;;
5184 cairo-qt)
5185     MOZ_WIDGET_TOOLKIT=qt
5186     MOZ_ENABLE_QT=1
5187     MOZ_ENABLE_XREMOTE=1
5188     MOZ_WEBGL=1
5189     MOZ_WEBGL_GLX=1
5190     USE_ELF_DYNSTR_GC=
5191     NS_PRINTING=
5193     AC_DEFINE(MOZ_X11)
5194     MOZ_X11=1
5195     USE_FC_FREETYPE=1
5197     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5198     TK_LIBS='$(MOZ_QT_LIBS)'
5199     AC_DEFINE(MOZ_WIDGET_QT)
5200     ;;
5202 cairo-beos)
5203     MOZ_WIDGET_TOOLKIT=beos
5204     USE_FC_FREETYPE=1
5205     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5206     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5207     ;;
5209 cairo-os2)
5210     MOZ_WIDGET_TOOLKIT=os2
5211     USE_FC_FREETYPE=1
5212     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5213     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5214     ;;
5216 cairo-cocoa)
5217     MOZ_WIDGET_TOOLKIT=cocoa
5218     AC_DEFINE(MOZ_WIDGET_COCOA)
5219     MOZ_USER_DIR="Mozilla"
5220     AC_DEFINE(XP_MACOSX)
5221     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5222     TK_CFLAGS="-DNO_X11"
5223     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5224     CFLAGS="$CFLAGS $TK_CFLAGS"
5225     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5226     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5227     MOZ_FS_LAYOUT=bundle
5228     MOZ_WEBGL=1
5229     ;;
5231 cairo-android)
5232     AC_DEFINE(MOZ_WIDGET_ANDROID)
5233     MOZ_WIDGET_TOOLKIT=android
5234     MOZ_WEBGL=
5235     ;;
5237 esac
5239 if test "$MOZ_ENABLE_XREMOTE"; then
5240     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5243 if test "$COMPILE_ENVIRONMENT"; then
5244   if test "$MOZ_ENABLE_GTK2"; then
5245     if test "$MOZ_X11"; then
5246       GDK_PACKAGES=gdk-x11-2.0
5247     elif test "$MOZ_DFB"; then
5248       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5249       GDK_PACKAGES=directfb
5250     fi
5252     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5253   fi
5255 fi # COMPILE_ENVIRONMENT
5257 AC_SUBST(MOZ_FS_LAYOUT)
5259 dnl ========================================================
5260 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5261 dnl their usage and use them in spidermonkey.
5262 dnl ========================================================
5263 MOZ_ARG_WITH_BOOL(arm-kuser,
5264 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5265     USE_ARM_KUSER=1,)
5266 if test -n "$USE_ARM_KUSER"; then
5267    AC_DEFINE(USE_ARM_KUSER)
5270 dnl ========================================================
5271 dnl = startup-notification support module
5272 dnl ========================================================
5274 if test "$MOZ_ENABLE_GTK2"
5275 then
5276     MOZ_ENABLE_STARTUP_NOTIFICATION=
5278     MOZ_ARG_ENABLE_BOOL(startup-notification,
5279     [  --enable-startup-notification
5280                           Enable startup-notification support (default: disabled) ],
5281         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5282         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5283     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5284     then
5285         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5286                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5287         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5288             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5289             then
5290                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5291             fi
5292             MOZ_ENABLE_STARTUP_NOTIFICATION=
5293         ])
5294     fi
5296     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5297         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5298     fi
5300     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5302 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5303 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5304 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5306 dnl ========================================================
5307 dnl = QT support
5308 dnl ========================================================
5309 if test "$MOZ_ENABLE_QT"
5310 then
5311     MOZ_ARG_WITH_STRING(qtdir,
5312     [  --with-qtdir=\$dir       Specify Qt directory ],
5313     [ QTDIR=$withval])
5315     if test -z "$QTDIR"; then
5316         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5317         AC_CHECK_PROGS(HOST_MOC, moc, "")
5318     else
5319         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5321         MOZ_QT_CFLAGS="-DQT_SHARED"
5322         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5323         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5324         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5325         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5326         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5327         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5328         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5329         HOST_MOC="$QTDIR/bin/moc"
5330     fi
5331     if test -z "$HOST_MOC"; then
5332         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5333 incorrect])
5334     fi
5335     MOC=$HOST_MOC
5338 AC_SUBST(GTK_CONFIG)
5339 AC_SUBST(TK_CFLAGS)
5340 AC_SUBST(TK_LIBS)
5342 AC_SUBST(MOZ_ENABLE_GTK2)
5343 AC_SUBST(MOZ_ENABLE_PHOTON)
5344 AC_SUBST(MOZ_ENABLE_QT)
5345 AC_SUBST(MOZ_ENABLE_XREMOTE)
5346 AC_SUBST(MOZ_GTK2_CFLAGS)
5347 AC_SUBST(MOZ_GTK2_LIBS)
5348 AC_SUBST(MOZ_QT_CFLAGS)
5349 AC_SUBST(MOZ_QT_LIBS)
5351 AC_SUBST(MOC)
5353 AC_SUBST(MOZ_DFB)
5354 AC_SUBST(MOZ_X11)
5356 dnl ========================================================
5357 dnl =
5358 dnl = Components & Features
5359 dnl = 
5360 dnl ========================================================
5361 MOZ_ARG_HEADER(Components and Features)
5363 dnl ========================================================
5364 dnl = Localization
5365 dnl ========================================================
5366 MOZ_ARG_ENABLE_STRING(ui-locale,
5367 [  --enable-ui-locale=ab-CD
5368                           Select the user interface locale (default: en-US)],
5369     MOZ_UI_LOCALE=$enableval )
5370 AC_SUBST(MOZ_UI_LOCALE)
5372 dnl ========================================================
5373 dnl = Trademarked Branding 
5374 dnl ========================================================
5375 MOZ_ARG_ENABLE_BOOL(official-branding,
5376 [  --enable-official-branding
5377                           Enable Official mozilla.org Branding
5378                           Do not distribute builds with
5379                           --enable-official-branding unless you have
5380                           permission to use trademarks per
5381                           http://www.mozilla.org/foundation/trademarks/ .],
5383   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5384     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5385   else
5386     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5387     MOZ_OFFICIAL_BRANDING=1
5388   fi
5389 ], MOZ_OFFICIAL_BRANDING=)
5391 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5392 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5393   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5396 MOZ_ARG_WITH_STRING(branding,
5397 [  --with-branding=dir     Use branding from the specified directory.],
5398     MOZ_BRANDING_DIRECTORY=$withval)
5400 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5401 if test -z "$REAL_BRANDING_DIRECTORY"; then
5402   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5405 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5406   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5409 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5411 dnl ========================================================
5412 dnl = Distribution ID
5413 dnl ========================================================
5414 MOZ_ARG_WITH_STRING(distribution-id,
5415 [  --with-distribution-id=ID
5416                           Set distribution-specific id (default=org.mozilla)],
5417 [ val=`echo $withval`
5418     MOZ_DISTRIBUTION_ID="$val"])
5420 if test -z "$MOZ_DISTRIBUTION_ID"; then
5421    MOZ_DISTRIBUTION_ID="org.mozilla"
5424 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5425 AC_SUBST(MOZ_DISTRIBUTION_ID)
5428 dnl ========================================================
5429 dnl complex text support off by default
5430 dnl ========================================================
5431 MOZ_ARG_DISABLE_BOOL(pango,
5432 [  --disable-pango         Disable usage of Pango ],
5433     MOZ_PANGO=,
5434     MOZ_PANGO=1)
5436 dnl ========================================================
5437 dnl = Pango
5438 dnl ========================================================
5439 if test "$MOZ_ENABLE_GTK2"
5440 then
5441     AC_SUBST(MOZ_PANGO)
5443     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5445     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5446     AC_SUBST(MOZ_PANGO_CFLAGS)
5447     AC_SUBST(MOZ_PANGO_LIBS)
5448     if test "$MOZ_PANGO"
5449     then
5450         AC_DEFINE(MOZ_PANGO)
5451     else
5452         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5453         AC_SUBST(FT2_CFLAGS)
5454         AC_SUBST(FT2_LIBS)
5455     fi
5458 if test "$MOZ_ENABLE_QT"
5459 then
5460     if test "$MOZ_PANGO"
5461     then
5462         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5463         [
5464             AC_SUBST(MOZ_PANGO_CFLAGS)
5465             AC_SUBST(MOZ_PANGO_LIBS)
5466             AC_DEFINE(MOZ_PANGO)
5467         ],
5468         [
5469             echo "Pango library not found, will use FT2 font engine"
5470             MOZ_PANGO=
5471         ])
5472     fi
5473     AC_SUBST(MOZ_PANGO)
5476 dnl ========================================================
5477 dnl = GnomeVFS, GIO and GConf support module
5478 dnl ========================================================
5480 if test "$MOZ_X11"
5481 then
5482     dnl build the gnomevfs extension by default only when the
5483     dnl GTK2 toolkit is in use.
5484     if test "$MOZ_ENABLE_GTK2"
5485     then
5486         MOZ_ENABLE_GNOMEVFS=1
5487         MOZ_ENABLE_GCONF=1
5488     fi
5490     dnl ========================================================
5491     dnl = GnomeVFS support module
5492     dnl ========================================================
5493     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5494     [  --disable-gnomevfs      Disable GnomeVFS support ],
5495         MOZ_ENABLE_GNOMEVFS=,
5496         MOZ_ENABLE_GNOMEVFS=force)
5498     if test "$MOZ_ENABLE_GNOMEVFS"
5499     then
5500         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5501             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5502             MOZ_ENABLE_GNOMEVFS=1
5503             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5504         ],[
5505             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5506             then
5507                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5508             fi
5509             MOZ_ENABLE_GNOMEVFS=
5510         ])
5511     else
5512         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5513             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5514               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5515             ])
5516         fi
5517     fi
5519     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5520     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5521     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5523     dnl ========================================================
5524     dnl = GIO support module
5525     dnl ========================================================
5526     MOZ_ARG_ENABLE_BOOL(gio,
5527     [  --enable-gio            Enable GIO support (default: disabled)],
5528         MOZ_ENABLE_GIO=force,
5529         MOZ_ENABLE_GIO=)
5531     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5532     then
5533         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5534             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5535             MOZ_ENABLE_GIO=1
5536             AC_DEFINE(MOZ_ENABLE_GIO)
5537         ],[
5538             if test "$MOZ_ENABLE_GIO" = "force"
5539             then
5540                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5541             fi
5542             MOZ_ENABLE_GIO=
5543         ])
5544     fi
5546     AC_SUBST(MOZ_ENABLE_GIO)
5547     AC_SUBST(MOZ_GIO_CFLAGS)
5548     AC_SUBST(MOZ_GIO_LIBS)
5549    
5550     dnl ========================================================
5551     dnl = GConf support module
5552     dnl ========================================================
5553     if test "$MOZ_ENABLE_GCONF"
5554     then
5555         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5556             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5557             MOZ_ENABLE_GCONF=1
5558         ],[
5559             if test "$MOZ_ENABLE_GCONF" = "force"
5560             then
5561                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5562             fi
5563             MOZ_ENABLE_GCONF=
5564         ])
5565     fi
5567     if test "$MOZ_ENABLE_GCONF"; then
5568         AC_DEFINE(MOZ_ENABLE_GCONF)
5569     fi
5571     AC_SUBST(MOZ_ENABLE_GCONF)
5572     AC_SUBST(MOZ_GCONF_CFLAGS)
5573     AC_SUBST(MOZ_GCONF_LIBS)
5576 dnl ========================================================
5577 dnl = libnotify support
5578 dnl ========================================================
5580 if test "$MOZ_ENABLE_GTK2"
5581 then
5582     MOZ_ENABLE_LIBNOTIFY=1
5584     MOZ_ARG_DISABLE_BOOL(libnotify,
5585     [  --disable-libnotify     Disable libnotify support ],
5586     MOZ_ENABLE_LIBNOTIFY=,
5587     MOZ_ENABLE_LIBNOTIFY=1)
5589     if test "$MOZ_ENABLE_LIBNOTIFY"
5590     then
5591         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5592     fi
5595 if test -z "$SKIP_LIBRARY_CHECKS"
5596 then
5597     if test "$MOZ_ENABLE_GTK2"
5598     then
5599         if test "$MOZ_ENABLE_LIBNOTIFY"
5600         then
5601             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5602         fi
5603     fi
5605 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5606 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5607 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5609 dnl ========================================================
5610 dnl = GNOME component (mozgnome)
5611 dnl ========================================================
5613 # The GNOME component is built if one of 
5614 # gnome-vfs, gio, gconf or libnotify is available.
5615 if test "$MOZ_ENABLE_GCONF" || \
5616    test "$MOZ_ENABLE_GNOMEVFS" || \
5617    test "$MOZ_ENABLE_GIO" || \
5618    test "$MOZ_ENABLE_LIBNOTIFY"; then
5619     MOZ_ENABLE_GNOME_COMPONENT=1
5620 else
5621     MOZ_ENABLE_GNOME_COMPONENT=
5623 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5625 dnl ========================================================
5626 dnl = libgnomeui support module
5627 dnl ========================================================
5629 if test "$MOZ_ENABLE_GTK2"
5630 then
5631     MOZ_ENABLE_GNOMEUI=1
5633     MOZ_ARG_DISABLE_BOOL(gnomeui,
5634     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5635         MOZ_ENABLE_GNOMEUI=,
5636         MOZ_ENABLE_GNOMEUI=force)
5638     if test "$MOZ_ENABLE_GNOMEUI"
5639     then
5640         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5641         [
5642             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5643             MOZ_ENABLE_GNOMEUI=1
5644         ],[
5645             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5646             then
5647                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5648             fi
5649             MOZ_ENABLE_GNOMEUI=
5650         ])
5651     fi
5653     if test "$MOZ_ENABLE_GNOMEUI"; then
5654         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5655     fi
5658 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5659 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5660 AC_SUBST(MOZ_GNOMEUI_LIBS)
5662 dnl ========================================================
5663 dnl = dbus support
5664 dnl ========================================================
5666 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5667 then
5668     MOZ_ENABLE_DBUS=1
5670     MOZ_ARG_DISABLE_BOOL(dbus,
5671     [  --disable-dbus          Disable dbus support ],
5672         MOZ_ENABLE_DBUS=,
5673         MOZ_ENABLE_DBUS=1)
5675     if test "$MOZ_ENABLE_DBUS"
5676     then
5677         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5678         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5679         AC_DEFINE(MOZ_ENABLE_DBUS)
5680     fi
5682 AC_SUBST(MOZ_ENABLE_DBUS)
5683 AC_SUBST(MOZ_DBUS_CFLAGS)
5684 AC_SUBST(MOZ_DBUS_LIBS)
5685 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5686 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5688 dnl ========================================================
5689 dnl = Build Personal Security Manager
5690 dnl ========================================================
5691 MOZ_ARG_DISABLE_BOOL(crypto,
5692 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5693     MOZ_PSM=,
5694     MOZ_PSM=1 )
5696 dnl ========================================================
5697 dnl = JS Debugger XPCOM component (js/jsd)
5698 dnl ========================================================
5699 MOZ_ARG_DISABLE_BOOL(jsd,
5700 [  --disable-jsd           Disable JavaScript debug library],
5701     MOZ_JSDEBUGGER=,
5702     MOZ_JSDEBUGGER=1)
5705 dnl ========================================================
5706 dnl = Disable IPC support for tabs and plugins
5707 dnl ========================================================
5708 case "${target}" in
5709 *-wince*|*-android*)
5710     MOZ_IPC=
5711     ;;
5712 esac
5714 MOZ_ARG_DISABLE_BOOL(ipc,
5715 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5716     MOZ_IPC=,
5717     MOZ_IPC=1)
5719 if test -n "$MOZ_IPC"; then
5720     AC_DEFINE(MOZ_IPC)
5723 AC_SUBST(MOZ_IPC)
5725 dnl ========================================================
5726 dnl = Enable IPDL's "expensive" unit tests
5727 dnl ========================================================
5728 MOZ_IPDL_TESTS=
5730 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5731 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5732     MOZ_IPDL_TESTS=1,
5733     MOZ_IPDL_TESTS=)
5735 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5736     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5739 if test -n "$MOZ_IPDL_TESTS"; then
5740     AC_DEFINE(MOZ_IPDL_TESTS)
5743 AC_SUBST(MOZ_IPDL_TESTS)
5745 dnl ========================================================
5746 dnl = Disable plugin support
5747 dnl ========================================================
5748 MOZ_ARG_DISABLE_BOOL(plugins,
5749 [  --disable-plugins       Disable plugins support],
5750     MOZ_PLUGINS=,
5751     MOZ_PLUGINS=1)
5753 dnl ========================================================
5754 dnl = Disable building dbm
5755 dnl ========================================================
5756 MOZ_ARG_DISABLE_BOOL(dbm,
5757 [  --disable-dbm       Disable building dbm],
5758     NSS_DISABLE_DBM=1,
5759     NSS_DISABLE_DBM=)
5761 dnl bi-directional support always on
5762 IBMBIDI=1
5763 AC_DEFINE(IBMBIDI)
5765 dnl ========================================================
5766 dnl view source support on by default
5767 dnl ========================================================
5768 if test "$MOZ_VIEW_SOURCE"; then
5769     AC_DEFINE(MOZ_VIEW_SOURCE)
5772 dnl ========================================================
5773 dnl accessibility support on by default on all platforms 
5774 dnl except OS X.
5775 dnl ========================================================
5776 MOZ_ARG_DISABLE_BOOL(accessibility,
5777 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5778     ACCESSIBILITY=,
5779     ACCESSIBILITY=1 )
5780 if test "$ACCESSIBILITY"; then
5781     AC_DEFINE(ACCESSIBILITY)
5784 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5785 case "$target" in
5786 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5787     if test "$ac_cv_header_atlbase_h" = "no"; then
5788         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.])
5789     fi
5790     if test "$ac_cv_header_oleacc_idl" = "no"; then
5791         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.])
5792     fi
5793     ;;
5794 esac
5797 dnl ========================================================
5798 dnl xpcom js loader support on by default
5799 dnl ========================================================
5800 if test "$MOZ_JSLOADER"; then
5801     AC_DEFINE(MOZ_JSLOADER)
5804 dnl ========================================================
5805 dnl Disable printing
5806 dnl ========================================================
5807 MOZ_ARG_DISABLE_BOOL(printing,
5808 [  --disable-printing      Disable printing support],
5809     NS_PRINTING=,
5810     NS_PRINTING=1)
5812 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5813     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5814     NS_PRINTING=
5817 if test "$NS_PRINTING"; then
5818     AC_DEFINE(NS_PRINTING)
5819     AC_DEFINE(NS_PRINT_PREVIEW)
5821 dnl ========================================================
5822 dnl use native unicode converters
5823 dnl ========================================================
5824 MOZ_ARG_ENABLE_BOOL(native-uconv,
5825 [  --enable-native-uconv   Enable iconv support],
5826     MOZ_USE_NATIVE_UCONV=1,
5827     MOZ_USE_NATIVE_UCONV= )
5828 if test "$MOZ_USE_NATIVE_UCONV"; then
5829     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5831 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5832     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5836 dnl ========================================================
5837 dnl Libeditor can be build as plaintext-only,
5838 dnl or as a full html and text editing component.
5839 dnl We build both by default.
5840 dnl ========================================================
5841 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5842 [  --enable-plaintext-editor-only
5843                           Allow only plaintext editing],
5844     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5845     MOZ_PLAINTEXT_EDITOR_ONLY= )
5846 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5847 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5849 dnl ========================================================
5850 dnl = Disable Fast Load
5851 dnl ========================================================
5852 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5853 [  --disable-xpcom-fastload
5854                           Disable XPCOM fastload support],
5855     MOZ_NO_FAST_LOAD=1,
5856     MOZ_NO_FAST_LOAD=)
5858 AC_SUBST(MOZ_NO_FAST_LOAD)
5860 if test -n "$MOZ_NO_FAST_LOAD"; then
5861     AC_DEFINE(MOZ_NO_FAST_LOAD)
5864 dnl ========================================================
5865 dnl = Disable Ogg Codecs
5866 dnl ========================================================
5867 MOZ_ARG_DISABLE_BOOL(ogg,
5868 [  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
5869     MOZ_OGG=,
5870     MOZ_OGG=1)
5872 if test -n "$MOZ_OGG"; then
5873     AC_DEFINE(MOZ_OGG)
5874     MOZ_SYDNEYAUDIO=1
5875     MOZ_MEDIA=1
5876     MOZ_VORBIS=1
5878     dnl Checks for __attribute__(aligned()) directive
5879     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5880         [ac_cv_c_attribute_aligned],
5881         [ac_cv_c_attribute_aligned=0
5882          CFLAGS_save="${CFLAGS}"
5883          CFLAGS="${CFLAGS} -Werror"
5884          for ac_cv_c_attr_align_try in 64 32 16 8; do
5885            echo "trying $ac_cv_c_attr_align_try"
5886            AC_TRY_COMPILE([],
5887                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5888                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5889            if test "$ac_cv_c_attribute_aligned" != 0; then
5890              break;
5891            fi
5892          done
5893            CFLAGS="${CFLAGS_save}"])
5894     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5895       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5896                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5897     fi
5900 dnl ========================================================
5901 dnl = Disable VP8 decoder support
5902 dnl ========================================================
5903 MOZ_ARG_DISABLE_BOOL(webm,
5904 [  --disable-webm         Disable support for WebM media (VP8 video and Vorbis audio)],
5905     MOZ_WEBM=,
5906     MOZ_WEBM=1)
5908 if test -n "$MOZ_WEBM"; then
5909     AC_DEFINE(MOZ_WEBM)
5910     MOZ_SYDNEYAUDIO=1
5911     MOZ_MEDIA=1
5912     MOZ_VORBIS=1
5914     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5915     dnl For Win32 (MSVC) we must use MASM.
5916     if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" = "x86" -a -z "$GNU_CC"; then
5917         AC_MSG_CHECKING([for MASM assembler])
5918         AC_CHECK_PROGS(VPX_AS, ml, "")
5919         if test -n "$VPX_AS"; then
5920           VPX_X86_ASM=1
5921           VPX_AS='sh $(topsrcdir)/media/libvpx/yasm2masm-as.sh'
5922         else
5923             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])
5924         fi
5925     else 
5927       dnl For Darwin x86, Darwin x86_64, Linux x86, and WINNT x86_64
5928       dnl we can use YASM.
5929       AC_MSG_CHECKING([for YASM assembler])
5930       AC_CHECK_PROGS(VPX_AS, yasm, "")
5931       if test -n "$VPX_AS"; then
5932         dnl We have YASM, see if we have assembly on this platform.  
5933         case "$OS_ARCH:$OS_TEST" in
5934         Linux:x86|Linux:i?86)
5935           VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5936           VPX_X86_ASM=1
5937         ;;
5938         Linux:x86_64)
5939           VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5940           VPX_X86_ASM=1
5941         ;;
5942         SunOS:i?86)
5943           VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5944           VPX_X86_ASM=1
5945         ;;
5946         SunOS:x86_64)
5947           VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5948           VPX_X86_ASM=1
5949         ;;
5950         Darwin:i?86)
5951           VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5952           VPX_X86_ASM=1
5953         ;;
5954         Darwin:x86_64)
5955           VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5956           VPX_X86_ASM=1
5957         ;;
5958         WINNT:x86_64)
5959           if test -z "$GNU_CC"; then
5960             VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5961             VPX_X86_ASM=1
5962           fi
5963         ;;
5964         esac
5965       fi # end have YASM
5966     fi # end !WINNT_x86_MSVC
5968     if test -n "$VPX_X86_ASM"; then
5969       AC_DEFINE(VPX_X86_ASM)
5970     else
5971       AC_MSG_WARN([No assembler or assembly support for libvpx, using unoptimized C routines.])
5972     fi
5975 dnl ========================================================
5976 dnl = Disable Wave decoder support
5977 dnl ========================================================
5978 MOZ_ARG_DISABLE_BOOL(wave,
5979 [  --disable-wave          Disable Wave decoder support],
5980     MOZ_WAVE=,
5981     MOZ_WAVE=1)
5983 if test -n "$MOZ_WAVE"; then
5984     AC_DEFINE(MOZ_WAVE)
5985     MOZ_SYDNEYAUDIO=1
5986     MOZ_MEDIA=1
5989 dnl ========================================================
5990 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5991 dnl ========================================================
5993 if test -n "$MOZ_SYDNEYAUDIO"; then
5994     AC_DEFINE(MOZ_SYDNEYAUDIO)
5997 if test -n "$MOZ_MEDIA"; then
5998     AC_DEFINE(MOZ_MEDIA)
6001 if test -n "$MOZ_VORBIS"; then
6002     AC_DEFINE(MOZ_VORBIS)
6005 dnl ========================================================
6006 dnl = Check alsa availability on Linux if using sydneyaudio
6007 dnl ========================================================
6009 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6010 if test -n "$MOZ_SYDNEYAUDIO"; then
6011    case "$target_os" in
6012 linux*)
6013       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6014          [echo "$MOZ_ALSA_PKG_ERRORS"
6015           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.)])])
6016       ;;
6017    esac
6020 dnl ========================================================
6021 dnl Splashscreen
6022 dnl ========================================================
6023 AC_ARG_ENABLE(splashscreen,
6024               [  --enable-splashscreen   display splashscreen while loading (default=no)],
6025               [enable_splash="yes"],[enable_splash=""])
6026 if test "x$enable_splash" = "xyes"; then
6027   MOZ_SPLASHSCREEN=1
6028   AC_DEFINE(MOZ_SPLASHSCREEN)
6030 AC_SUBST(MOZ_SPLASHSCREEN)
6032 dnl ========================================================
6033 dnl Permissions System
6034 dnl ========================================================
6035 MOZ_ARG_DISABLE_BOOL(permissions,
6036 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
6037     MOZ_PERMISSIONS=,
6038     MOZ_PERMISSIONS=1
6041 dnl ========================================================
6042 dnl NegotiateAuth
6043 dnl ========================================================
6044 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6045 [  --disable-negotiateauth Disable GSS-API negotiation ],
6046     MOZ_AUTH_EXTENSION=,
6047     MOZ_AUTH_EXTENSION=1 )
6049 dnl ========================================================
6050 dnl XTF
6051 dnl ========================================================
6052 MOZ_ARG_DISABLE_BOOL(xtf,
6053 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
6054     MOZ_XTF=,
6055     MOZ_XTF=1 )
6056 if test "$MOZ_XTF"; then
6057   AC_DEFINE(MOZ_XTF)
6060 dnl ========================================================
6061 dnl Pref extensions (autoconfig and system-pref)
6062 dnl ========================================================
6063 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6064 [  --disable-pref-extensions
6065                           Disable pref extensions such as autoconfig and
6066                           system-pref],
6067   MOZ_PREF_EXTENSIONS=,
6068   MOZ_PREF_EXTENSIONS=1 )
6070 dnl ========================================================
6071 dnl = Universalchardet
6072 dnl ========================================================
6073 MOZ_ARG_DISABLE_BOOL(universalchardet,
6074 [  --disable-universalchardet
6075                           Disable universal encoding detection],
6076   MOZ_UNIVERSALCHARDET=,
6077   MOZ_UNIVERSALCHARDET=1 )
6079 dnl ========================================================
6080 dnl JavaXPCOM
6081 dnl ========================================================
6082 case "${target}" in
6083 *-wince*)
6084     MOZ_JAVAXPCOM=
6085     ;;
6086 esac
6088 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6089 [  --enable-javaxpcom
6090                           Enable Java-XPCOM bridge],
6091     MOZ_JAVAXPCOM=1,
6092     MOZ_JAVAXPCOM=)
6094 case "$host_os" in
6095   cygwin*|msvc*|mks*)
6096     if test -n "$JAVA_HOME"; then
6097       JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6098     fi
6099     ;;
6100   *mingw*)
6101     if test -n "$JAVA_HOME"; then
6102       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6103     fi
6104     ;;
6105 esac
6107 if test -n "${JAVA_BIN_PATH}"; then
6108   dnl Look for javac and jar in the specified path.
6109   JAVA_PATH="$JAVA_BIN_PATH"
6110 else
6111   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6112   JAVA_PATH="$JAVA_HOME/bin:$PATH"
6115 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6116 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6117 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6119 if test -n "${JAVA_BIN_PATH}" || test "$OS_TARGET" = Android; then
6120   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
6121     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}])
6122   fi
6125 if test -n "${MOZ_JAVAXPCOM}"; then
6126   if test -n "${JAVA_INCLUDE_PATH}"; then
6127     dnl Make sure jni.h exists in the given include path.
6128     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6129       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6130     fi
6131   else
6132     case "$target_os" in
6133       darwin*)
6134         dnl Default to java system location
6135         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6136         ;;
6137       *)
6138         dnl Try $JAVA_HOME
6139         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6140         ;;
6141     esac
6142     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6143       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.])
6144     fi
6145   fi
6148 dnl ========================================================
6149 dnl = Breakpad crash reporting (on by default on supported platforms)
6150 dnl ========================================================
6152 case $target in
6153 i?86-*-mingw*)
6154   MOZ_CRASHREPORTER=1
6155   ;;
6156 i?86-apple-darwin*|powerpc-apple-darwin*)
6157   MOZ_CRASHREPORTER=1
6158   ;;
6159 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6160   MOZ_CRASHREPORTER=1
6161   ;;
6162 *solaris*)
6163   MOZ_CRASHREPORTER=1
6164   ;;
6165 esac
6167 MOZ_ARG_DISABLE_BOOL(crashreporter,
6168 [  --disable-crashreporter Disable breakpad crash reporting],
6169     MOZ_CRASHREPORTER=,
6170     MOZ_CRASHREPORTER=1)
6172 if test -n "$MOZ_CRASHREPORTER"; then
6173    AC_DEFINE(MOZ_CRASHREPORTER)
6175   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
6176     test -z "$SKIP_LIBRARY_CHECKS"; then
6177     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6178     AC_SUBST(MOZ_GTHREAD_CFLAGS)
6179     AC_SUBST(MOZ_GTHREAD_LIBS)
6181     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.])])
6182   fi
6185 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6186 [  --with-crashreporter-enable-percent=NN
6187                           Enable sending crash reports by default on NN% of users. (default=100)],
6188 [ val=`echo $withval | sed 's/[^0-9]//g'`
6189     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6191 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6192    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6194 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6196 dnl ========================================================
6197 dnl = Enable compilation of specific extension modules
6198 dnl ========================================================
6200 MOZ_ARG_ENABLE_STRING(extensions,
6201 [  --enable-extensions     Enable extensions],
6202 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6203     if test "$option" = "yes" || test "$option" = "all"; then
6204         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6205     elif test "$option" = "no" || test "$option" = "none"; then
6206         MOZ_EXTENSIONS=""
6207     elif test "$option" = "default"; then
6208         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6209     elif test `echo "$option" | grep -c \^-` != 0; then
6210         option=`echo $option | sed 's/^-//'`
6211         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6212     else
6213         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6214     fi
6215 done],
6216     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6218 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6219     # Suppress warning on non-X11 platforms
6220     if test -n "$MOZ_X11"; then
6221         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6222     fi
6223     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6226 dnl Do not build gnomevfs with libxul based apps
6227 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6228     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6231 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6232     # Suppress warning on non-X11 platforms
6233     if test -n "$MOZ_X11"; then
6234         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6235     fi
6236     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6239 dnl Do not build gio with libxul based apps
6240 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6241     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6244 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6245     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6246     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6249 dnl This might be temporary: build tridentprofile only on Windows
6250 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6251     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6252     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6255 dnl cookie must be built before tridentprofile. put it at list's end.
6256 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6257   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6258   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6261 dnl xforms requires xtf and schema-validation
6262 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6263     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
6264     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6266 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6267     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
6268     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6271 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6272     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6273     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6276 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6277     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6278     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6281 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6282     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6283     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6286 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6287     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6288     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6291 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6292     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6293     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6296 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6297     AC_MSG_WARN([spellcheck is no longer an extension.])
6298     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6301 dnl Remove dupes
6302 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6304 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6305 dnl when trying to build a nonexistent extension.
6306 for extension in $MOZ_EXTENSIONS; do
6307     if test ! -d "${srcdir}/extensions/${extension}"; then
6308         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6309     fi
6310 done
6313 dnl ========================================================
6314 dnl Image decoders
6315 dnl ========================================================
6316 case "$MOZ_WIDGET_TOOLKIT" in
6317 beos|windows|os2|mac|cocoa)
6318     ;;
6320     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6321        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6322     fi
6323     ;;
6324 esac
6326 MOZ_ARG_ENABLE_STRING(image-decoders,
6327 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
6328                           Enable specific image decoders],
6329 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6330     if test "$option" = "yes" || test "$option" = "all"; then
6331         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6332     elif test "$option" = "no" || test "$option" = "none"; then
6333         MOZ_IMG_DECODERS=""
6334     elif test "$option" = "default"; then
6335         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6336     elif test `echo "$option" | grep -c \^-` != 0; then
6337         option=`echo $option | sed 's/^-//'`
6338         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6339     else
6340         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6341     fi
6342 done],
6343     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6345 dnl Dupes are removed in the encoder section because it will also add decoders
6347 dnl ========================================================
6348 dnl Image encoders
6349 dnl ========================================================
6350 MOZ_ARG_ENABLE_STRING(image-encoders,
6351 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6352                           Enable specific image encoders],
6353 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6354     if test "$option" = "yes" || test "$option" = "all"; then
6355         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6356     elif test "$option" = "no" || test "$option" = "none"; then
6357         MOZ_IMG_ENCODERS=""
6358         addencoder=""
6359     elif test "$option" = "default"; then
6360         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6361     elif test `echo "$option" | grep -c \^-` != 0; then
6362         option=`echo $option | sed 's/^-//'`
6363         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6364     else
6365         addencoder="$option"
6366     fi
6367     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6368 done],
6369     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6371 dnl Remove dupes
6372 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6373 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6375 dnl ========================================================
6376 dnl MathML on by default
6377 dnl ========================================================
6378 MOZ_ARG_DISABLE_BOOL(mathml,
6379 [  --disable-mathml        Disable MathML support],
6380     MOZ_MATHML=,
6381     MOZ_MATHML=1 )
6382 if test "$MOZ_MATHML"; then
6383   AC_DEFINE(MOZ_MATHML)
6386 dnl ========================================================
6387 dnl SVG
6388 dnl ========================================================
6389 MOZ_ARG_DISABLE_BOOL(svg,
6390 [  --disable-svg           Disable SVG support],
6391     MOZ_SVG=,
6392     MOZ_SVG=1 )
6393 if test -n "$MOZ_SVG"; then
6394   AC_DEFINE(MOZ_SVG)
6397 dnl ========================================================
6398 dnl SMIL
6399 dnl ========================================================
6400 MOZ_SMIL=1
6401 MOZ_ARG_DISABLE_BOOL(smil,
6402 [  --disable-smil          Disable SMIL animation support],
6403     MOZ_SMIL=,
6404     MOZ_SMIL=1 )
6405 # Automatically disable SMIL if SVG is disabled
6406 if test -z "$MOZ_SVG"; then
6407   MOZ_SMIL=
6409 if test -n "$MOZ_SMIL"; then
6410   AC_DEFINE(MOZ_SMIL)
6413 dnl ========================================================
6414 dnl Build Freetype in the tree
6415 dnl ========================================================
6416 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6417 [  --enable-tree-freetype  Enable Tree FreeType],
6418     MOZ_TREE_FREETYPE=1,
6419     MOZ_TREE_FREETYPE= )
6420 if test -n "$MOZ_TREE_FREETYPE"; then
6421    AC_DEFINE(MOZ_TREE_FREETYPE)
6422    AC_SUBST(MOZ_TREE_FREETYPE)
6423    MOZ_ENABLE_CAIRO_FT=1       
6424    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6425    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6426    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6427    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6428    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6429    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6430    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6431    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6432    AC_SUBST(CAIRO_FT_CFLAGS)
6436 dnl ========================================================
6437 dnl Installer
6438 dnl ========================================================
6439 case "$target_os" in
6440     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6441         MOZ_INSTALLER=1
6442         ;;
6443 esac
6445 MOZ_ARG_DISABLE_BOOL(installer,
6446 [  --disable-installer     Disable building of installer],
6447     MOZ_INSTALLER=,
6448     MOZ_INSTALLER=1)
6449 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6450     # Disable installer for Windows builds that use the new toolkit if the
6451     # required major version and minimum minor version of Unicode NSIS isn't in
6452     # the path.
6453     REQ_NSIS_MAJOR_VER=2
6454     MIN_NSIS_MINOR_VER=33
6455     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6456     if test -z "$MAKENSISU" || test "$MAKENSISU" = ":"; then
6457         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.])
6458     fi
6459     changequote(,)
6460     MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6461     changequote([,])
6462     if test ! "$MAKENSISU_VER" == ""; then
6463         MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6464         MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6465     fi
6466     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6467     if test "$MAKENSISU_VER" == "" ||
6468        test ! "$MAKENSISU_MAJOR_VER" == "$REQ_NSIS_MAJOR_VER" ||
6469        test ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6470         AC_MSG_RESULT([no])
6471         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.])
6472     fi
6473     AC_MSG_RESULT([yes])
6474     MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6476     # The Windows build for NSIS requires the iconv command line utility to
6477     # convert the charset of the locale files.
6478     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6479     if test -z "$HOST_ICONV"; then
6480         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6481     fi
6484 AC_SUBST(MOZ_INSTALLER)
6486 AC_MSG_CHECKING([for tar archiver])
6487 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6488 if test -z "$TAR"; then
6489     AC_MSG_ERROR([no tar archiver found in \$PATH])
6491 AC_MSG_RESULT([$TAR])
6492 AC_SUBST(TAR)
6494 AC_MSG_CHECKING([for wget])
6495 AC_CHECK_PROGS(WGET, wget, "")
6496 AC_MSG_RESULT([$WGET])
6497 AC_SUBST(WGET)
6499 dnl ========================================================
6500 dnl Updater
6501 dnl ========================================================
6503 MOZ_ARG_DISABLE_BOOL(updater,
6504 [  --disable-updater       Disable building of updater],
6505     MOZ_UPDATER=,
6506     MOZ_UPDATER=1 )
6508 if test -n "$MOZ_UPDATER"; then
6509     AC_DEFINE(MOZ_UPDATER)
6512 # app update channel is 'default' when not supplied.
6513 MOZ_ARG_ENABLE_STRING([update-channel],
6514 [  --enable-update-channel=CHANNEL
6515                           Select application update channel (default=default)],
6516     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6518 if test -z "$MOZ_UPDATE_CHANNEL"; then
6519     MOZ_UPDATE_CHANNEL=default
6521 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6522 AC_SUBST(MOZ_UPDATE_CHANNEL)
6524 # tools/update-packaging is not checked out by default.
6525 MOZ_ARG_ENABLE_BOOL(update-packaging,
6526 [  --enable-update-packaging
6527                           Enable tools/update-packaging],
6528     MOZ_UPDATE_PACKAGING=1,
6529     MOZ_UPDATE_PACKAGING= )
6530 AC_SUBST(MOZ_UPDATE_PACKAGING)
6532 dnl ========================================================
6533 dnl ActiveX
6534 dnl ========================================================
6536 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6537 [  --disable-xpconnect-idispatch
6538                           Disable building of xpconnect support for IDispatch
6539                           (win32 only)],
6540     XPC_IDISPATCH_SUPPORT=,
6541     XPC_IDISPATCH_SUPPORT=1)
6542 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6544 MOZ_ARG_DISABLE_BOOL(activex,
6545 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6546     MOZ_NO_ACTIVEX_SUPPORT=1,
6547     MOZ_NO_ACTIVEX_SUPPORT= )
6548 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6550 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6551 [  --enable-activex-scripting
6552                           Enable building of ActiveX scripting support (win32)],
6553     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6554     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6555 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6557 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6558 then
6559     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6562 if test "$COMPILE_ENVIRONMENT" = "1"; then
6563 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6564 case "$target" in
6565 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6566     if test "$ac_cv_header_atlbase_h" = "no"; then
6567         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.])
6568     fi
6569     ;;
6570 esac
6574 dnl ========================================================
6575 dnl leaky
6576 dnl ========================================================
6577 MOZ_ARG_ENABLE_BOOL(leaky,
6578 [  --enable-leaky          Build leaky memory tool],
6579     MOZ_LEAKY=1,
6580     MOZ_LEAKY=)
6583 dnl ========================================================
6584 dnl build the tests by default
6585 dnl ========================================================
6586 MOZ_ARG_DISABLE_BOOL(tests,
6587 [  --disable-tests         Do not build test libraries & programs],
6588     ENABLE_TESTS=,
6589     ENABLE_TESTS=1 )
6591 dnl ========================================================
6592 dnl parental controls (for Windows Vista)
6593 dnl ========================================================
6594 MOZ_ARG_DISABLE_BOOL(parental-controls,
6595 [  --disable-parental-controls
6596                           Do not build parental controls],
6597    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6598    MOZ_DISABLE_PARENTAL_CONTROLS=)
6599 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6600     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6603 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6605 dnl ========================================================
6606 dnl =
6607 dnl = Module specific options
6608 dnl =
6609 dnl ========================================================
6610 MOZ_ARG_HEADER(Individual module options)
6612 dnl ========================================================
6613 dnl = Disable feed handling components
6614 dnl ========================================================
6615 MOZ_ARG_DISABLE_BOOL(feeds,
6616 [  --disable-feeds         Disable feed handling and processing components],
6617     MOZ_FEEDS=,
6618     MOZ_FEEDS=1 )
6619 if test -n "$MOZ_FEEDS"; then
6620     AC_DEFINE(MOZ_FEEDS)
6621 else
6622     if test "$MOZ_BUILD_APP" = "browser"; then
6623         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6624     fi
6627 dnl ========================================================
6628 dnl = Enable mozStorage
6629 dnl ========================================================
6630 dnl Implicitly enabled by default if building calendar or places
6631 MOZ_ARG_ENABLE_BOOL(storage,
6632 [  --enable-storage        Enable mozStorage module and related components],
6633     MOZ_STORAGE=1,
6634     MOZ_STORAGE= )
6635 if test -n "$MOZ_STORAGE"; then
6636     AC_DEFINE(MOZ_STORAGE)
6639 dnl ========================================================
6640 dnl Check for sqlite
6641 dnl ========================================================
6643 MOZ_NATIVE_SQLITE=
6644 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6645 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6646 MOZ_NATIVE_SQLITE=1,
6647 MOZ_NATIVE_SQLITE= )
6649 if test -z "$MOZ_NATIVE_SQLITE"
6650 then
6651     SQLITE_CFLAGS=
6652     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6653 else
6654     dnl ============================
6655     dnl === SQLite Version check ===
6656     dnl ============================
6657     dnl Check to see if the system SQLite package is new enough.
6658     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6660     dnl ==================================
6661     dnl === SQLITE_SECURE_DELETE check ===
6662     dnl ==================================
6663     dnl Check to see if the system SQLite package is compiled with
6664     dnl SQLITE_SECURE_DELETE enabled.
6665     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6666     _SAVE_CFLAGS="$CFLAGS"
6667     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6668     _SAVE_LIBS="$LIBS"
6669     LIBS="$LIBS $SQLITE_LIBS"
6670     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6671         AC_TRY_RUN([
6672             #include "sqlite3.h"
6674             int main(int argc, char **argv){
6675               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6676             }],
6677             ac_cv_sqlite_secure_delete=yes,
6678             ac_cv_sqlite_secure_delete=no,
6679             ac_cv_sqlite_secure_delete=no
6680         )
6681     ])
6682     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6683     CFLAGS="$_SAVE_CFLAGS"
6684     LIBS="$_SAVE_LIBS"
6685     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6686         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6687     fi
6689     dnl ===============================
6690     dnl === SQLITE_THREADSAFE check ===
6691     dnl ===============================
6692     dnl Check to see if the system SQLite package is compiled with
6693     dnl SQLITE_THREADSAFE enabled.
6694     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6695     _SAVE_CFLAGS="$CFLAGS"
6696     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6697     _SAVE_LIBS="$LIBS"
6698     LIBS="$LIBS $SQLITE_LIBS"
6699     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6700         AC_TRY_RUN([
6701             #include "sqlite3.h"
6703             int main(int argc, char **argv){
6704               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6705             }],
6706             ac_cv_sqlite_threadsafe=yes,
6707             ac_cv_sqlite_threadsafe=no,
6708             ac_cv_sqlite_threadsafe=no
6709         )
6710     ])
6711     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6712     CFLAGS="$_SAVE_CFLAGS"
6713     LIBS="$_SAVE_LIBS"
6714     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6715         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6716     fi
6718     dnl ================================
6719     dnl === SQLITE_ENABLE_FTS3 check ===
6720     dnl ================================
6721     dnl check to see if the system SQLite package is compiled with
6722     dnl SQLITE_ENABLE_FTS3 enabled.
6723     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6724     _SAVE_CFLAGS="$CFLAGS"
6725     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6726     _SAVE_LIBS="$LIBS"
6727     LIBS="$LIBS $SQLITE_LIBS"
6728     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6729         AC_TRY_RUN([
6730             #include "sqlite3.h"
6732             int main(int argc, char **argv){
6733               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6734             }],
6735             ac_cv_sqlite_enable_fts3=yes,
6736             ac_cv_sqlite_enable_fts3=no,
6737             ac_cv_sqlite_enable_fts3=no
6738         )
6739     ])
6740     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6741     CFLAGS="$_SAVE_CFLAGS"
6742     LIBS="$_SAVE_LIBS"
6743     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6744         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6745     fi
6747     dnl =========================================
6748     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6749     dnl =========================================
6750     dnl check to see if the system SQLite package is compiled with
6751     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6752     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6753     _SAVE_CFLAGS="$CFLAGS"
6754     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6755     _SAVE_LIBS="$LIBS"
6756     LIBS="$LIBS $SQLITE_LIBS"
6757     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6758         AC_TRY_RUN([
6759             #include "sqlite3.h"
6761             int main(int argc, char **argv){
6762               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6763             }],
6764             ac_cv_sqlite_enable_unlock_notify=yes,
6765             ac_cv_sqlite_enable_unlock_notify=no,
6766             ac_cv_sqlite_enable_unlock_notify=no
6767         )
6768     ])
6769     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6770     CFLAGS="$_SAVE_CFLAGS"
6771     LIBS="$_SAVE_LIBS"
6772     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6773         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6774     fi
6777 AC_SUBST(MOZ_NATIVE_SQLITE)
6779 dnl ========================================================
6780 dnl = Enable help viewer (off by default)
6781 dnl ========================================================
6782 if test -n "$MOZ_HELP_VIEWER"; then
6783      dnl Do this if defined in confvars.sh
6784      AC_DEFINE(MOZ_HELP_VIEWER)
6787 dnl ========================================================
6788 dnl = Enable safe browsing (anti-phishing)
6789 dnl ========================================================
6790 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6791 [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
6792     MOZ_SAFE_BROWSING=1,
6793     MOZ_SAFE_BROWSING= )
6794 if test -n "$MOZ_SAFE_BROWSING"; then
6795     AC_DEFINE(MOZ_SAFE_BROWSING)
6797 AC_SUBST(MOZ_SAFE_BROWSING)
6799 dnl ========================================================
6800 dnl = Enable faststart component
6801 dnl ========================================================
6802 MOZ_ARG_ENABLE_BOOL(faststart,
6803 [  --enable-faststart      Enable the faststart component],
6804     MOZ_FASTSTART=1,
6805     MOZ_FASTSTART= )
6806 if test -n "$MOZ_FASTSTART"; then
6807     AC_DEFINE(MOZ_FASTSTART)
6809 AC_SUBST(MOZ_FASTSTART)
6811 dnl ========================================================
6812 dnl = Enable url-classifier
6813 dnl ========================================================
6814 dnl Implicitly enabled by default if building with safe-browsing
6815 if test -n "$MOZ_SAFE_BROWSING"; then
6816     MOZ_URL_CLASSIFIER=1
6818 MOZ_ARG_ENABLE_BOOL(url-classifier,
6819 [  --enable-url-classifier Enable url classifier module],
6820     MOZ_URL_CLASSIFIER=1,
6821     MOZ_URL_CLASSIFIER= )
6822 if test -n "$MOZ_URL_CLASSIFIER"; then
6823     AC_DEFINE(MOZ_URL_CLASSIFIER)
6825 AC_SUBST(MOZ_URL_CLASSIFIER)
6827 dnl ========================================================
6828 dnl = Disable zipwriter
6829 dnl ========================================================
6830 MOZ_ARG_DISABLE_BOOL(zipwriter,
6831 [  --disable-zipwriter     Disable zipwriter component],
6832     MOZ_ZIPWRITER=,
6833     MOZ_ZIPWRITER=1 )
6834 AC_SUBST(MOZ_ZIPWRITER)
6836 dnl ========================================================
6837 dnl = Disable libconic
6838 dnl ========================================================
6839 MOZ_ENABLE_LIBCONIC=1
6840 MOZ_ARG_DISABLE_BOOL(libconic,
6841 [  --disable-libconic      Disable libconic],
6842     MOZ_ENABLE_LIBCONIC=,
6843     MOZ_ENABLE_LIBCONIC=1 )
6845 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6846     PKG_CHECK_MODULES(LIBCONIC, conic,
6847                       MOZ_ENABLE_LIBCONIC=1,
6848                       MOZ_ENABLE_LIBCONIC=)
6850 if test "$MOZ_ENABLE_LIBCONIC"; then
6851     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6854 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6855 AC_SUBST(LIBCONIC_CFLAGS)
6856 AC_SUBST(LIBCONIC_LIBS)
6858 dnl ========================================================
6859 dnl = Maemo checks
6860 dnl ========================================================
6862 MAEMO_SDK_TARGET_VER=-1
6864 MOZ_ARG_WITH_STRING(maemo-version,
6865 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6866                           Maemo SDK Version],
6867   MAEMO_SDK_TARGET_VER=$withval)
6869 case "$MAEMO_SDK_TARGET_VER" in
6871     MOZ_PLATFORM_MAEMO=5
6872     ;;
6875     MOZ_PLATFORM_MAEMO=6
6876     ;;
6879     dnl We aren't compiling for Maemo, move on.
6880     ;;
6882     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6883     ;;
6884 esac
6886 if test $MOZ_PLATFORM_MAEMO; then
6887    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6889    if test -z "$MOZ_ENABLE_DBUS"; then
6890        AC_MSG_ERROR([DBus is required when building for Maemo])
6891    fi
6893    MOZ_GFX_OPTIMIZE_MOBILE=1
6894    MOZ_WEBGL_GLX=
6895    MOZ_MAEMO_LIBLOCATION=
6897    if test $MOZ_PLATFORM_MAEMO = 5; then
6898       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6899       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6900                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6901       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6902                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6904       AC_SUBST(XCOMPOSITE_LIBS)
6906       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6907       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6908       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6909       if test -z "$_LIB_FOUND"; then
6910          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6911       fi
6914       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6915       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6916       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6917       if test -z "$_LIB_FOUND"; then
6918          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6919       fi
6921       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6922       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6923       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6924       if test -z "$_LIB_FOUND"; then
6925          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6926       fi
6928    fi
6930    if test "$MOZ_PLATFORM_MAEMO" -gt 5; then
6931      MOZ_THUMB2=1
6932    fi
6934    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6935    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6936    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6937    if test "$_LIB_FOUND"; then
6938       MOZ_MAEMO_LIBLOCATION=1
6939       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6940    else
6941       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6942    fi
6943    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6945    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6946    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6949 dnl ========================================================
6950 dnl = Enable building the Thumb2 instruction set
6951 dnl ========================================================
6952 MOZ_ARG_ENABLE_BOOL(thumb2,
6953  [  --enable-thumb2         Enable Thumb2 instruction set],
6954     MOZ_THUMB2=1,
6955     MOZ_THUMB2=)
6957 if test -n "$MOZ_THUMB2"; then
6958   case "$target_cpu" in
6959     arm*)
6960       if test "$GNU_CC"; then
6961         CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6962         CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
6963         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
6964       else
6965         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
6966       fi
6967     ;;
6968     *)
6969       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
6970     ;;
6971   esac
6974 dnl ========================================================
6975 dnl = faststripe theme
6976 dnl ========================================================
6977 MOZ_ARG_ENABLE_BOOL(faststripe,
6978 [  --enable-faststripe     Use faststripe theme],
6979     MOZ_THEME_FASTSTRIPE=1,
6980     MOZ_THEME_FASTSTRIPE= )
6981 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6983 dnl ========================================================
6984 dnl =
6985 dnl = Feature options that require extra sources to be pulled
6986 dnl =
6987 dnl ========================================================
6988 dnl MOZ_ARG_HEADER(Features that require extra sources)
6990 dnl ========================================================
6991 dnl =
6992 dnl = Debugging Options
6993 dnl = 
6994 dnl ========================================================
6995 MOZ_ARG_HEADER(Debugging and Optimizations)
6997 dnl ========================================================
6998 dnl = Disable building with debug info.
6999 dnl = Debugging is OFF by default
7000 dnl ========================================================
7001 if test -z "$MOZ_DEBUG_FLAGS"
7002 then
7003     case "$target" in
7004     *-irix*)
7005         if test "$GNU_CC"; then
7006             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
7007             case "$GCC_VERSION" in
7008             2.95.*)
7009                 MOZ_DEBUG_FLAGS=""
7010                 ;;
7011             *)
7012                 MOZ_DEBUG_FLAGS="-g"
7013                 ;;
7014             esac
7015         else
7016             MOZ_DEBUG_FLAGS="-g"
7017         fi
7018         ;;
7019     *)
7020         MOZ_DEBUG_FLAGS="-g"
7021         ;;
7022     esac
7025 MOZ_ARG_ENABLE_STRING(debug,
7026 [  --enable-debug[=DBG]    Enable building with developer debug info
7027                            (using compiler flags DBG)],
7028 [ if test "$enableval" != "no"; then
7029     MOZ_DEBUG=1
7030     if test -n "$enableval" -a "$enableval" != "yes"; then
7031         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7032         _MOZ_DEBUG_FLAGS_SET=1
7033     fi
7034   else
7035     MOZ_DEBUG=
7036   fi ],
7037   MOZ_DEBUG=)
7039 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7040 MOZ_ARG_WITH_STRING(debug-label,
7041 [  --with-debug-label=LABELS
7042                           Define DEBUG_<value> for each comma-separated
7043                           value given.],
7044 [ for option in `echo $withval | sed 's/,/ /g'`; do
7045     MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7046 done])
7048 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7050 if test -n "$MOZ_DEBUG"; then
7051     AC_MSG_CHECKING([for valid debug flags])
7052     _SAVE_CFLAGS=$CFLAGS
7053     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7054     AC_TRY_COMPILE([#include <stdio.h>], 
7055         [printf("Hello World\n");],
7056         _results=yes,
7057         _results=no)
7058     AC_MSG_RESULT([$_results])
7059     if test "$_results" = "no"; then
7060         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7061     fi
7062     CFLAGS=$_SAVE_CFLAGS
7065 dnl ========================================================
7066 dnl enable mobile optimizations
7067 dnl ========================================================
7068 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7069 [  --enable-mobile-optimize
7070                           Enable mobile optimizations],
7071     MOZ_GFX_OPTIMIZE_MOBILE=1)
7073 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7075 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7076     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7079 dnl ========================================================
7080 dnl = Enable code optimization. ON by default.
7081 dnl ========================================================
7082 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7083         MOZ_OPTIMIZE_FLAGS="-O"
7086 MOZ_ARG_ENABLE_STRING(optimize,
7087 [  --disable-optimize      Disable compiler optimization
7088   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7089 [ if test "$enableval" != "no"; then
7090     MOZ_OPTIMIZE=1
7091     if test -n "$enableval" && test "$enableval" != "yes"; then
7092         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7093         MOZ_OPTIMIZE=2
7094     fi
7095 else
7096     MOZ_OPTIMIZE=
7097 fi ], MOZ_OPTIMIZE=1)
7099 if test "$COMPILE_ENVIRONMENT"; then
7100 if test -n "$MOZ_OPTIMIZE"; then
7101     AC_MSG_CHECKING([for valid optimization flags])
7102     _SAVE_CFLAGS=$CFLAGS
7103     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7104     AC_TRY_COMPILE([#include <stdio.h>], 
7105         [printf("Hello World\n");],
7106         _results=yes,
7107         _results=no)
7108     AC_MSG_RESULT([$_results])
7109     if test "$_results" = "no"; then
7110         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7111     fi
7112     CFLAGS=$_SAVE_CFLAGS
7114 fi # COMPILE_ENVIRONMENT
7116 AC_SUBST(MOZ_OPTIMIZE)
7117 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7118 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7119 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7121 dnl ========================================================
7122 dnl = (Deprecated) generation of debugger info for specific modules
7123 dnl ========================================================
7124 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7125 [  --enable-debugger-info-modules
7126                           Enable/disable debugger info for specific modules],
7127 [ if test "$enableval" != "no"; then
7128     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7129     MOZ_DEBUG_SYMBOLS=1
7130   fi ])
7132 dnl ========================================================
7133 dnl = Enable generation of debug symbols
7134 dnl ========================================================
7135 MOZ_ARG_ENABLE_STRING(debug-symbols,
7136 [  --enable-debug-symbols[=DBG]
7137                           Enable debugging symbols (using compiler flags DBG)],
7138 [ if test "$enableval" != "no"; then
7139       MOZ_DEBUG_SYMBOLS=1
7140       if test -n "$enableval" -a "$enableval" != "yes"; then
7141           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7142               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7143           else
7144               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7145           fi
7146       fi
7147   fi ])
7149 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7150     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7151     export MOZ_DEBUG_SYMBOLS
7154 dnl ========================================================
7155 dnl = Disable any treating of compile warnings as errors
7156 dnl ========================================================
7157 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7158 [  --disable-warnings-as-errors
7159                           Disable treating of warnings as errors],
7160     MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7161     MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7162 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7163    WARNINGS_AS_ERRORS=''
7166 dnl ========================================================
7167 dnl = Disable runtime logging checks
7168 dnl ========================================================
7169 MOZ_ARG_DISABLE_BOOL(logging,
7170 [  --disable-logging       Disable logging facilities],
7171     NS_DISABLE_LOGGING=1,
7172     NS_DISABLE_LOGGING= )
7173 if test "$NS_DISABLE_LOGGING"; then
7174     AC_DEFINE(NS_DISABLE_LOGGING)
7175 else
7176     AC_DEFINE(MOZ_LOGGING)
7179 dnl ========================================================
7180 dnl = This will enable logging of addref, release, ctor, dtor.
7181 dnl ========================================================
7182 _ENABLE_LOGREFCNT=42
7183 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7184 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
7185     _ENABLE_LOGREFCNT=1,
7186     _ENABLE_LOGREFCNT= )
7187 if test "$_ENABLE_LOGREFCNT" = "1"; then
7188     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7189 elif test -z "$_ENABLE_LOGREFCNT"; then
7190     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7193 dnl ========================================================
7194 dnl = Enable trace malloc
7195 dnl ========================================================
7196 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7197 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7198 [  --enable-trace-malloc   Enable malloc tracing],
7199     NS_TRACE_MALLOC=1,
7200     NS_TRACE_MALLOC= )
7201 if test "$NS_TRACE_MALLOC"; then
7202   # Please, Mr. Linker Man, don't take away our symbol names
7203   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7204   USE_ELF_DYNSTR_GC=
7205   AC_DEFINE(NS_TRACE_MALLOC)
7207 AC_SUBST(NS_TRACE_MALLOC)
7209 dnl ========================================================
7210 dnl = Enable jemalloc
7211 dnl ========================================================
7212 MOZ_ARG_ENABLE_BOOL(jemalloc,
7213 [  --enable-jemalloc       Replace memory allocator with jemalloc],
7214     MOZ_MEMORY=1,
7215     MOZ_MEMORY=)
7217 if test "$NS_TRACE_MALLOC"; then
7218     MOZ_MEMORY=
7221 if test "$MOZ_MEMORY"; then
7223   dnl Don't try to run compiler tests on Windows  
7224   if test "$OS_ARCH" = "WINNT"; then
7225     if test -z "$HAVE_64BIT_OS"; then
7226       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7227     else
7228       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7229     fi
7230   else
7231     AC_CHECK_SIZEOF([int *], [4])
7232     case "${ac_cv_sizeof_int_p}" in
7233     4)
7234       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7235       ;;
7236     8)
7237       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7238       ;;
7239     *)
7240       AC_MSG_ERROR([Unexpected pointer size])
7241       ;;
7242     esac
7243   fi
7245   AC_DEFINE(MOZ_MEMORY)
7246   if test "x$MOZ_DEBUG" = "x1"; then
7247     AC_DEFINE(MOZ_MEMORY_DEBUG)
7248   fi
7249   dnl The generic feature tests that determine how to compute ncpus are long and
7250   dnl complicated.  Therefore, simply define special cpp variables for the
7251   dnl platforms we have special knowledge of.
7252   case "${target}" in
7253   *-darwin*)
7254     AC_DEFINE(MOZ_MEMORY_DARWIN)
7255     ;;
7256   *-*freebsd*)
7257     AC_DEFINE(MOZ_MEMORY_BSD)
7258     ;;
7259   *-*linux*)
7260     AC_DEFINE(MOZ_MEMORY_LINUX)
7261     ;;
7262   *-netbsd*)
7263     AC_DEFINE(MOZ_MEMORY_BSD)
7264     ;;
7265   *-solaris*)
7266     AC_DEFINE(MOZ_MEMORY_SOLARIS)
7267     ;;
7268   *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7269     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7270     dnl This is sort of awful. Will revisit if we add support for more versions
7271     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7272         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7273     fi
7274     if test -z "$WIN32_CRT_SRC_DIR"; then
7275       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7276         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).])
7277       else
7278         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7279       fi
7280     fi
7281     dnl cpu check
7282     case "${target_cpu}" in
7283     i*86)
7284       MOZ_CRT_CPU_ARCH=intel
7285       ;;
7286     x86_64)
7287       MOZ_CRT_CPU_ARCH=amd64
7288       ;;
7289     *)
7290       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7291       ;;
7292     esac
7294     AC_SUBST(MOZ_CRT_CPU_ARCH)
7296     if test ! -d "$WIN32_CRT_SRC_DIR"; then
7297       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7298     fi
7299     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7300     _objdir_win=`pwd -W`
7301     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7302     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7303     dnl Also pass this to NSPR/NSS
7304     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7305     export DLLFLAGS
7306     ;;
7307   *-*wince)
7308     AC_DEFINE(MOZ_MEMORY_WINCE)
7309     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7310     if test -z "$WINCE_WINDOWS_MOBILE"; then
7311       AC_DEFINE(MOZ_MEMORY_WINCE6)
7312     fi
7313     ;;
7314   *-*winmo)
7315     AC_DEFINE(MOZ_MEMORY_WINCE)
7316     AC_DEFINE(MOZ_MEMORY_WINDOWS)
7317     ;;
7318   *-android*)
7319     AC_DEFINE(MOZ_MEMORY_LINUX)
7320     AC_DEFINE(MOZ_MEMORY_ANDROID)
7321     _WRAP_MALLOC=1
7322     export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc"
7323     ;;
7324   *)
7325     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7326     ;;
7327   esac
7329   if test "$OS_ARCH" != "Darwin"; then
7330     dnl NB: this must be kept in sync with jemalloc.h
7331     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7332     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7333     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7334   fi
7336 AC_SUBST(MOZ_MEMORY)
7337 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7338 AC_SUBST(WIN32_CRT_SRC_DIR)
7339 dnl Need to set this for make because NSS doesn't have configure
7340 AC_SUBST(DLLFLAGS)
7342 dnl ========================================================
7343 dnl = Use malloc wrapper lib
7344 dnl ========================================================
7345 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7346 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
7347     _WRAP_MALLOC=1,
7348     _WRAP_MALLOC= )
7350 if test -n "$_WRAP_MALLOC"; then
7351     if test "$GNU_CC"; then
7352     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"
7353     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7354     fi
7357 dnl ========================================================
7358 dnl = Location of malloc wrapper lib
7359 dnl ========================================================
7360 MOZ_ARG_WITH_STRING(wrap-malloc,
7361 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
7362     WRAP_MALLOC_LIB=$withval)
7364 dnl ========================================================
7365 dnl = Use TraceVis
7366 dnl ========================================================
7367 MOZ_ARG_ENABLE_BOOL(tracevis,
7368 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
7369     MOZ_TRACEVIS=1,
7370     MOZ_TRACEVIS= )
7371 if test -n "$MOZ_TRACEVIS"; then
7372     AC_DEFINE(MOZ_TRACEVIS)
7375 dnl ========================================================
7376 dnl = Use GCTimer
7377 dnl ========================================================
7378 MOZ_ARG_ENABLE_BOOL(gctimer,
7379 [  --enable-gctimer        Enable GC timer (default=no)],
7380     MOZ_GCTIMER=1,
7381     MOZ_GCTIMER= )
7382 if test -n "$MOZ_GCTIMER"; then
7383     AC_DEFINE(MOZ_GCTIMER)
7386 dnl ========================================================
7387 dnl = Use Valgrind
7388 dnl ========================================================
7389 MOZ_ARG_ENABLE_BOOL(valgrind,
7390 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7391     MOZ_VALGRIND=1,
7392     MOZ_VALGRIND= )
7393 if test -n "$MOZ_VALGRIND"; then
7394     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7395         AC_MSG_ERROR(
7396             [--enable-valgrind specified but Valgrind is not installed]))
7397     AC_DEFINE(MOZ_VALGRIND)
7400 dnl ========================================================
7401 dnl jprof
7402 dnl ========================================================
7403 MOZ_ARG_ENABLE_BOOL(jprof,
7404 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7405     MOZ_JPROF=1,
7406     MOZ_JPROF= )
7407 if test -n "$MOZ_JPROF"; then
7408     AC_DEFINE(MOZ_JPROF)
7411 dnl ========================================================
7412 dnl shark
7413 dnl ========================================================
7414 MOZ_ARG_ENABLE_BOOL(shark,
7415 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7416     MOZ_SHARK=1,
7417     MOZ_SHARK= )
7418 if test -n "$MOZ_SHARK"; then
7419     AC_DEFINE(MOZ_SHARK)
7422 dnl ========================================================
7423 dnl callgrind
7424 dnl ========================================================
7425 MOZ_ARG_ENABLE_BOOL(callgrind,
7426 [  --enable-callgrind      Enable callgrind profiling],
7427     MOZ_CALLGRIND=1,
7428     MOZ_CALLGRIND= )
7429 if test -n "$MOZ_CALLGRIND"; then
7430     AC_DEFINE(MOZ_CALLGRIND)
7433 dnl ========================================================
7434 dnl vtune
7435 dnl ========================================================
7436 MOZ_ARG_ENABLE_BOOL(vtune,
7437 [  --enable-vtune          Enable vtune profiling],
7438     MOZ_VTUNE=1,
7439     MOZ_VTUNE= )
7440 if test -n "$MOZ_VTUNE"; then
7441     AC_DEFINE(MOZ_VTUNE)
7444 dnl ========================================================
7445 dnl Zealous JavaScript GC
7446 dnl ========================================================
7447 MOZ_ARG_ENABLE_BOOL(gczeal,
7448 [  --enable-gczeal         Enable zealous JavaScript GCing],
7449     JS_GC_ZEAL=1,
7450     JS_GC_ZEAL= )
7451 if test -n "$JS_GC_ZEAL"; then
7452     AC_DEFINE(JS_GC_ZEAL)
7455 dnl ========================================================
7456 dnl = Enable static checking using gcc-dehydra
7457 dnl ========================================================
7459 MOZ_ARG_WITH_STRING(static-checking,
7460 [  --with-static-checking=path/to/gcc_dehydra.so
7461                           Enable static checking of code using GCC-dehydra],
7462     DEHYDRA_PATH=$withval,
7463     DEHYDRA_PATH= )
7465 if test -n "$DEHYDRA_PATH"; then
7466     if test ! -f "$DEHYDRA_PATH"; then
7467         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7468     fi
7469     AC_DEFINE(NS_STATIC_CHECKING)
7471 AC_SUBST(DEHYDRA_PATH)
7473 dnl ========================================================
7474 dnl = Enable stripping of libs & executables
7475 dnl ========================================================
7476 MOZ_ARG_ENABLE_BOOL(strip,
7477 [  --enable-strip          Enable stripping of libs & executables ],
7478     ENABLE_STRIP=1,
7479     ENABLE_STRIP= )
7481 dnl ========================================================
7482 dnl = Enable stripping of libs & executables when packaging
7483 dnl ========================================================
7484 MOZ_ARG_ENABLE_BOOL(install-strip,
7485 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7486     PKG_SKIP_STRIP= ,
7487     PKG_SKIP_STRIP=1)
7489 dnl ========================================================
7490 dnl = --enable-elf-dynstr-gc
7491 dnl ========================================================
7492 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7493 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7494     USE_ELF_DYNSTR_GC=1,
7495     USE_ELF_DYNSTR_GC= )
7497 dnl ========================================================
7498 dnl = 
7499 dnl = Profiling and Instrumenting
7500 dnl = 
7501 dnl ========================================================
7502 MOZ_ARG_HEADER(Profiling and Instrumenting)
7504 dnl ========================================================
7505 dnl = Enable timeline service, which provides lightweight
7506 dnl = instrumentation of mozilla for performance measurement.
7507 dnl = Timeline is off by default.
7508 dnl ========================================================
7509 MOZ_ARG_ENABLE_BOOL(timeline,
7510 [  --enable-timeline       Enable timeline services ],
7511     MOZ_TIMELINE=1,
7512     MOZ_TIMELINE= )
7513 if test -n "$MOZ_TIMELINE"; then
7514     AC_DEFINE(MOZ_TIMELINE)
7517 dnl ========================================================
7518 dnl = Enable NS_FUNCTION_TIMER, which provides Function 
7519 dnl = timing for identifying code bottlenecks 
7520 dnl = NS_FUNCTION_TIMER is off by default.
7521 dnl ========================================================
7522 MOZ_ARG_ENABLE_BOOL(functiontimer,
7523 [  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
7524     NS_FUNCTION_TIMER=1,
7525     NS_FUNCTION_TIMER= )
7526 if test -n "$NS_FUNCTION_TIMER"; then
7527     AC_DEFINE(NS_FUNCTION_TIMER)
7530 dnl ========================================================
7531 dnl Turn on reflow counting
7532 dnl ========================================================
7533 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7534 [  --enable-reflow-perf    Enable reflow performance tracing],
7535     MOZ_REFLOW_PERF=1,
7536     MOZ_REFLOW_PERF= )
7537 if test -n "$MOZ_REFLOW_PERF"; then
7538     AC_DEFINE(MOZ_REFLOW_PERF)
7541 dnl ========================================================
7542 dnl Enable code size metrics.
7543 dnl ========================================================
7544 MOZ_ARG_ENABLE_BOOL(codesighs,
7545 [  --enable-codesighs      Enable code size analysis tools],
7546     _ENABLE_CODESIGHS=1,
7547     _ENABLE_CODESIGHS= )
7548 if test -n "$_ENABLE_CODESIGHS"; then
7549     if test -d $srcdir/tools/codesighs; then 
7550         MOZ_MAPINFO=1
7551     else
7552         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7553     fi
7556 dnl ========================================================
7557 dnl = Support for Quantify (Windows)
7558 dnl ========================================================
7559 MOZ_ARG_ENABLE_BOOL(quantify,
7560 [  --enable-quantify       Enable Quantify support (Windows only) ],
7561     MOZ_QUANTIFY=1,
7562     MOZ_QUANTIFY= )
7564 dnl ========================================================
7565 dnl = Support for demangling undefined symbols
7566 dnl ========================================================
7567 if test -z "$SKIP_LIBRARY_CHECKS"; then
7568     AC_LANG_SAVE
7569     AC_LANG_CPLUSPLUS
7570     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7571     AC_LANG_RESTORE
7574 # Demangle only for debug or trace-malloc builds
7575 MOZ_DEMANGLE_SYMBOLS=
7576 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7577     MOZ_DEMANGLE_SYMBOLS=1
7578     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7580 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7582 dnl ========================================================
7583 dnl = Support for gcc stack unwinding (from gcc 3.3)
7584 dnl ========================================================
7585 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7586     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7589 dnl ========================================================
7590 dnl =
7591 dnl = Misc. Options
7592 dnl = 
7593 dnl ========================================================
7594 MOZ_ARG_HEADER(Misc. Options)
7596 dnl ========================================================
7597 dnl update xterm title
7598 dnl ========================================================
7599 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7600 [  --enable-xterm-updates  Update XTERM titles with current command.],
7601     MOZ_UPDATE_XTERM=1,
7602     MOZ_UPDATE_XTERM= )
7604 dnl =========================================================
7605 dnl = Chrome format
7606 dnl =========================================================
7607 MOZ_ARG_ENABLE_STRING([chrome-format],
7608 [  --enable-chrome-format=jar|flat|both|symlink|omni
7609                           Select FORMAT of chrome files (default=jar)],
7610     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7612 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7613     MOZ_CHROME_FILE_FORMAT=jar
7616 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7617     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7618     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7619     test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7620     test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7621     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7624 dnl =========================================================
7625 dnl Omnijar packaging (bug 552121)
7626 dnl =========================================================
7627 dnl Omnijar packaging is compatible with flat packaging.
7628 dnl In unpackaged builds, omnijar looks for files as if
7629 dnl things were flat packaged. After packaging, all files
7630 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7631 dnl is set to flat since putting files into jars is only
7632 dnl done during packaging with omnijar.
7633 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7634     MOZ_OMNIJAR=1
7635     AC_DEFINE(MOZ_OMNIJAR)
7636     MOZ_CHROME_FILE_FORMAT=flat
7637 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7638     AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7641 AC_SUBST(MOZ_OMNIJAR)
7643 dnl ========================================================
7644 dnl = Define default location for MOZILLA_FIVE_HOME
7645 dnl ========================================================
7646 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7647 [  --with-default-mozilla-five-home
7648                           Set the default value for MOZILLA_FIVE_HOME],
7649 [ val=`echo $withval`
7650   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7652 dnl ========================================================
7653 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7654 dnl ========================================================
7655 MOZ_ARG_WITH_STRING(user-appdir,
7656 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7657 [ val=`echo $withval`
7658 if echo "$val" | grep "\/" >/dev/null; then
7659     AC_MSG_ERROR("Homedir must be single relative path.")
7660 else 
7661     MOZ_USER_DIR="$val"
7662 fi])
7664 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7666 dnl ========================================================
7667 dnl = Doxygen configuration
7668 dnl ========================================================
7669 dnl Use commas to specify multiple dirs to this arg
7670 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7671 MOZ_ARG_WITH_STRING(doc-input-dirs,
7672 [  --with-doc-input-dirs=DIRS
7673                           Header/idl dirs to create docs from],
7674 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7675 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7677 dnl Use commas to specify multiple dirs to this arg
7678 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7679 MOZ_ARG_WITH_STRING(doc-include-dirs,
7680 [  --with-doc-include-dirs=DIRS  
7681                           Include dirs to preprocess doc headers],
7682 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7683 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7685 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7686 MOZ_ARG_WITH_STRING(doc-output-dir,
7687 [  --with-doc-output-dir=DIR
7688                           Dir to generate docs into],
7689 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7690 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7692 if test -z "$SKIP_COMPILER_CHECKS"; then
7693 dnl ========================================================
7694 dnl =
7695 dnl = Compiler Options
7696 dnl = 
7697 dnl ========================================================
7698 MOZ_ARG_HEADER(Compiler Options)
7700 dnl ========================================================
7701 dnl Check for gcc -pipe support
7702 dnl ========================================================
7703 AC_MSG_CHECKING([for gcc -pipe support])
7704 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7705     echo '#include <stdio.h>' > dummy-hello.c
7706     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7707     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7708     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7709     if test $? = 0; then
7710         _res_as_stdin="yes"
7711     else
7712         _res_as_stdin="no"
7713     fi
7714     if test "$_res_as_stdin" = "yes"; then
7715         _SAVE_CFLAGS=$CFLAGS
7716         CFLAGS="$CFLAGS -pipe"
7717         AC_TRY_COMPILE( [ #include <stdio.h> ],
7718             [printf("Hello World\n");],
7719             [_res_gcc_pipe="yes"],
7720             [_res_gcc_pipe="no"] )
7721         CFLAGS=$_SAVE_CFLAGS
7722     fi
7723     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7724         _res="yes";
7725         CFLAGS="$CFLAGS -pipe"
7726         CXXFLAGS="$CXXFLAGS -pipe"
7727     else
7728         _res="no"
7729     fi
7730     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7731     AC_MSG_RESULT([$_res])
7732 else
7733     AC_MSG_RESULT([no])
7736 dnl ========================================================
7737 dnl Profile guided optimization
7738 dnl ========================================================
7739 dnl Test for profiling options
7740 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7741 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7743 dnl Provide a switch to disable PGO even when called via profiledbuild.
7744 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7745 [  --disable-profile-guided-optimization
7746                           Don't build with PGO even if called via make profiledbuild],
7747 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7748 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7750 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7752 _SAVE_CFLAGS="$CFLAGS"
7753 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7755 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7756 AC_TRY_COMPILE([], [return 0;],
7757                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7758                  result="yes" ], result="no")
7759 AC_MSG_RESULT([$result])
7761 if test $result = "yes"; then
7762   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7763   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7764   PROFILE_USE_LDFLAGS="-fprofile-use"
7765 else
7766   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7767   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7768   AC_TRY_COMPILE([], [return 0;],
7769                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7770                    result="yes" ], result="no")
7771   AC_MSG_RESULT([$result])
7772   if test $result = "yes"; then
7773     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7774   fi
7775   # don't really care, this is an old GCC
7776   PROFILE_GEN_LDFLAGS=
7777   PROFILE_USE_LDFLAGS=
7780 CFLAGS="$_SAVE_CFLAGS"
7782 if test -n "$INTEL_CC"; then
7783   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7784   PROFILE_GEN_LDFLAGS=
7785   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7786   PROFILE_USE_LDFLAGS=
7789 dnl Sun Studio on Solaris
7790 if test "$SOLARIS_SUNPRO_CC"; then
7791   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7792   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7793   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7794   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7797 AC_SUBST(PROFILE_GEN_CFLAGS)
7798 AC_SUBST(PROFILE_GEN_LDFLAGS)
7799 AC_SUBST(PROFILE_USE_CFLAGS)
7800 AC_SUBST(PROFILE_USE_LDFLAGS)
7802 AC_LANG_CPLUSPLUS
7804 dnl ========================================================
7805 dnl Test for -pedantic bustage
7806 dnl ========================================================
7807 MOZ_ARG_DISABLE_BOOL(pedantic,
7808 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7809 _PEDANTIC= )
7810 if test "$_PEDANTIC"; then
7811     _SAVE_CXXFLAGS=$CXXFLAGS
7812     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7813     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7814     AC_TRY_COMPILE([$configure_static_assert_macros],
7815                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7816                    result="no", result="yes" )
7817     AC_MSG_RESULT([$result])
7818     CXXFLAGS="$_SAVE_CXXFLAGS"
7820     case "$result" in
7821     no)
7822         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7823         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7824         ;;
7825     yes)
7826         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7827         ;;
7828     esac
7831 dnl ========================================================
7832 dnl Test for correct temporary object destruction order
7833 dnl ========================================================
7834 dnl We want to make sure the compiler follows the C++ spec here as 
7835 dnl xpcom and the string classes depend on it (bug 235381).
7836 AC_MSG_CHECKING([for correct temporary object destruction order])
7837 AC_TRY_RUN([ class A {
7838              public:  A(int& x) : mValue(x) {}
7839                       ~A() { mValue--; }
7840                       operator char**() { return 0; }
7841              private:  int& mValue;
7842              };
7843              void func(char **arg) {}
7844              int m=2;
7845              void test() {
7846                   func(A(m));
7847                   if (m==1) m = 0;
7848              }
7849              int main() {
7850                  test();
7851                  return(m);
7852              }
7853              ],
7854      result="yes", result="no", result="maybe")
7855 AC_MSG_RESULT([$result])
7857 if test "$result" = "no"; then
7858     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7861 dnl ========================================================
7862 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7863 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7864 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7865 dnl ========================================================
7866 _SAVE_CXXFLAGS=$CXXFLAGS
7867 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7868 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7869     ac_nscap_nonconst_opeq_bug,
7870     [AC_TRY_COMPILE([
7871                       template <class T>
7872                       class Pointer
7873                         {
7874                         public:
7875                           T* myPtr;
7876                         };
7877                       
7878                       template <class T, class U>
7879                       int operator==(const Pointer<T>& rhs, U* lhs)
7880                         {
7881                           return rhs.myPtr == lhs;
7882                         }
7883                       
7884                       template <class T, class U>
7885                       int operator==(const Pointer<T>& rhs, const U* lhs)
7886                         {
7887                           return rhs.myPtr == lhs;
7888                         }
7889                     ],
7890                     [
7891                       Pointer<int> foo;
7892                       const int* bar;
7893                       return foo == bar;
7894                     ],
7895                     ac_nscap_nonconst_opeq_bug="no",
7896                     ac_nscap_nonconst_opeq_bug="yes")])
7897 CXXFLAGS="$_SAVE_CXXFLAGS"
7899 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7900     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7902 fi # SKIP_COMPILER_CHECKS
7904 dnl ========================================================
7905 dnl C++ rtti
7906 dnl Should be smarter and check that the compiler does indeed have rtti
7907 dnl ========================================================
7909 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7910 [  --enable-cpp-rtti       Enable C++ RTTI ],
7911 [ _MOZ_USE_RTTI=1 ],
7912 [ _MOZ_USE_RTTI= ])
7914 if test "$_MOZ_USE_RTTI"; then
7915    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7916 else
7917    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7920 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7922 dnl ========================================================
7923 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7924 dnl Should be smarter and check that the compiler does indeed have exceptions
7925 dnl ========================================================
7926 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7927 [  --enable-cpp-exceptions Enable C++ exceptions ],
7928 [ _MOZ_CPP_EXCEPTIONS=1 ],
7929 [ _MOZ_CPP_EXCEPTIONS= ])
7931 if test "$_MOZ_CPP_EXCEPTIONS"; then
7932     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7933     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7934 else
7935     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7938 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7940 # Irix & OSF native compilers do not like exception declarations 
7941 # when exceptions are disabled
7942 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7943     AC_DEFINE(CPP_THROW_NEW, [])
7944 else
7945     AC_DEFINE(CPP_THROW_NEW, [throw()])
7947 AC_LANG_C
7949 dnl ========================================================
7950 dnl =
7951 dnl = Build depencency options
7952 dnl =
7953 dnl ========================================================
7954 MOZ_ARG_HEADER(Build dependencies)
7956 dnl ========================================================
7957 dnl = Do not auto generate dependency info
7958 dnl ========================================================
7959 MOZ_AUTO_DEPS=1
7960 MOZ_ARG_DISABLE_BOOL(auto-deps,
7961 [  --disable-auto-deps     Do not automatically generate dependency info],
7962     MOZ_AUTO_DEPS=,
7963     MOZ_AUTO_DEPS=1)
7965 if test -n "$MOZ_AUTO_DEPS"; then
7966 dnl ========================================================
7967 dnl = Use mkdepend instead of $CC -MD for dependency generation
7968 dnl ========================================================
7969 _cpp_md_flag=
7970 MOZ_ARG_DISABLE_BOOL(md,
7971 [  --disable-md            Do not use compiler-based dependencies ],
7972   [_cpp_md_flag=],
7973   [_cpp_md_flag=1],
7974   [dnl Default is to turn on -MD if using GNU-compatible compilers
7975    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7976      _cpp_md_flag=1
7977    fi
7978   dnl Default is to use -xM if using Sun Studio on Solaris
7979    if test "$SOLARIS_SUNPRO_CC"; then
7980      _cpp_md_flag=1
7981    fi])
7982 if test "$_cpp_md_flag"; then
7983   COMPILER_DEPEND=1
7984   if test "$OS_ARCH" = "OpenVMS"; then
7985     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7986   else
7987     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7988   fi
7989   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7990   if test "$SOLARIS_SUNPRO_CC"; then
7991     _DEPEND_CFLAGS=
7992   fi
7993 else
7994   COMPILER_DEPEND=
7995   dnl Don't override this for MSVC
7996   if test -z "$_WIN32_MSVC"; then
7997     _USE_CPP_INCLUDE_FLAG=
7998     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7999     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8000   fi
8002 fi # MOZ_AUTO_DEPS
8003 MDDEPDIR='.deps'
8004 AC_SUBST(MOZ_AUTO_DEPS)
8005 AC_SUBST(COMPILER_DEPEND)
8006 AC_SUBST(MDDEPDIR)
8009 dnl ========================================================
8010 dnl =
8011 dnl = Static Build Options
8012 dnl =
8013 dnl ========================================================
8014 MOZ_ARG_HEADER(Static build options)
8016 MOZ_ARG_ENABLE_BOOL(static,
8017 [  --enable-static         Enable building of internal static libs],
8018     BUILD_STATIC_LIBS=1,
8019     BUILD_STATIC_LIBS=)
8021 MOZ_ARG_ENABLE_BOOL(libxul,
8022 [  --enable-libxul         Enable building of libxul],
8023     MOZ_ENABLE_LIBXUL=1,
8024     MOZ_ENABLE_LIBXUL=)
8026 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8027         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8030 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8031         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8034 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8035     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8038 AC_SUBST(LIBXUL_LIBS)
8040 if test -n "$MOZ_ENABLE_LIBXUL"; then
8041     XPCOM_LIBS="$LIBXUL_LIBS"
8042     AC_DEFINE(MOZ_ENABLE_LIBXUL)
8043 else
8044     if test -n "$BUILD_STATIC_LIBS"; then
8045         AC_DEFINE(MOZ_STATIC_BUILD)
8046     fi
8047     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8050 dnl ========================================================
8051 dnl =
8052 dnl = Standalone module options
8053 dnl = 
8054 dnl ========================================================
8055 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8057 dnl Check for GLib and libIDL.
8058 dnl ========================================================
8059 SKIP_IDL_CHECK="no"
8061 if test -z "$COMPILE_ENVIRONMENT"; then
8062     SKIP_IDL_CHECK="yes"
8065 dnl = Allow users to disable libIDL checking for standalone modules
8066 MOZ_ARG_WITHOUT_BOOL(libIDL,
8067 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
8068         SKIP_IDL_CHECK="yes")
8070 if test -z "$CROSS_COMPILE"; then
8071     if test -z "$HOST_LIBIDL_CONFIG"; then
8072         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8073     fi
8074     if test -z "$HOST_LIBIDL_PREFIX"; then
8075         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8076     fi
8079 if test "$SKIP_IDL_CHECK" = "no"
8080 then
8081     _LIBIDL_FOUND=
8082     case "$host" in
8083     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8084         if test -n "$GLIB_PREFIX"; then
8085             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8086             if test "$?" = "0"; then
8087                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8088                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8089                 fi
8090                 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8091             else
8092                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8093             fi
8094         else
8095             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8096         fi
8097         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8098             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8099         fi
8100         GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8101         if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8102             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8103         elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8104             GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8105         else
8106             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8107         fi
8109         if test -n "$HOST_LIBIDL_PREFIX"; then
8110             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8111             if test "$?" = "0"; then
8112                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8113                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8114                 fi
8115                 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8116             else
8117                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8118             fi
8119         else
8120             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8121         fi        
8122         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8123             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8124         fi
8125         HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8126         if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8127             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8128             STATIC_LIBIDL=1
8129         elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8130             HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8131         else
8132             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8133         fi
8134         HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8135         _LIBIDL_FOUND=1
8136         ;;
8137     esac
8139     if test -z "$_LIBIDL_FOUND"; then
8140         if test "$MACOS_SDK_DIR"; then 
8141             dnl xpidl, and therefore libIDL, is only needed on the build host.
8142             dnl Don't build it against the SDK, as that causes problems.
8143             _MACSAVE_CFLAGS="$CFLAGS"
8144             _MACSAVE_LIBS="$LIBS"
8145             _MACSAVE_LDFLAGS="$LDFLAGS"
8146             _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8147           changequote(,)
8148           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"`
8149           LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8150           LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8151           changequote([,])
8152           unset NEXT_ROOT
8153         fi
8155         PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8156     fi
8158     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8159     dnl to either libIDL1 or libIDL2.
8160     if test -z "$_LIBIDL_FOUND"; then
8161         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8162         if test -z "$_LIBIDL_FOUND"; then
8163             PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8164         fi
8165     fi
8166     dnl
8167     dnl If we don't have a libIDL config program & not cross-compiling, 
8168     dnl     look for orbit-config instead.
8169     dnl
8170     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
8171         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8172         if test -n "$ORBIT_CONFIG"; then
8173             AC_MSG_CHECKING([for ORBit libIDL usability])
8174                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8175             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8176             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8177             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8178             HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8179             HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8180             HOST_LIBIDL_CONFIG=
8181             _SAVE_CFLAGS="$CFLAGS"
8182             _SAVE_LIBS="$LIBS"
8183             CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8184             LIBS="$HOST_LIBIDL_LIBS $LIBS"
8185             AC_TRY_RUN([
8186 #include <stdlib.h>
8187 #include <libIDL/IDL.h>
8188 int main() {
8189   char *s;
8190   s=strdup(IDL_get_libver_string());
8191   if(s==NULL) {
8192     exit(1);
8193   }
8194   exit(0);
8196             ], [_LIBIDL_FOUND=1
8197                 result="yes"],
8198                [HOST_LIBIDL_CFLAGS=
8199                 HOST_LIBIDL_LIBS=
8200                 result="no"],
8201                [_LIBIDL_FOUND=1
8202                 result="maybe"] )
8203             AC_MSG_RESULT($result)
8204             CFLAGS="$_SAVE_CFLAGS"
8205             LIBS="$_SAVE_LIBS"
8206         fi
8207     fi
8208     if test -z "$_LIBIDL_FOUND"; then
8209         AC_MSG_ERROR([libIDL not found.
8210         libIDL $LIBIDL_VERSION or higher is required.])
8211     fi
8212     if test "$MACOS_SDK_DIR"; then
8213       CFLAGS="$_MACSAVE_CFLAGS"
8214       LIBS="$_MACSAVE_LIBS"
8215       LDFLAGS="$_MACSAVE_LDFLAGS"
8216       if test -n "$_MACSAVE_NEXT_ROOT" ; then
8217         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8218       fi
8219     fi
8222 if test -n "$CROSS_COMPILE"; then
8223     case "$target" in
8224     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8225         if test -n "$GLIB_PREFIX"; then
8226             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8227             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8228                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8229             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8230                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8231             else
8232                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8233             fi
8234         fi
8236         if test -n "$LIBIDL_PREFIX"; then
8237             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8238             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8239                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8240                 STATIC_LIBIDL=1
8241             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8242                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8243             else
8244                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8245             fi
8246         fi
8247         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8248         ;;
8249     *)
8250         if test -n "LIBIDL_CONFIG" && test "LIBIDL_CONFIG" != "no"; then
8251             LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8252             LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8253         fi
8254         ;;
8255     esac
8256 else
8257     LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8258     LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8261 if test -z "$SKIP_PATH_CHECKS"; then
8262 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
8263     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
8264         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8265     else
8266         AM_PATH_GLIB(${GLIB_VERSION})
8267     fi
8271 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8272     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8275 AC_SUBST(LIBIDL_CFLAGS)
8276 AC_SUBST(LIBIDL_LIBS)
8277 AC_SUBST(STATIC_LIBIDL)
8278 AC_SUBST(GLIB_CFLAGS)
8279 AC_SUBST(GLIB_LIBS)
8280 AC_SUBST(GLIB_GMODULE_LIBS)
8281 AC_SUBST(HOST_LIBIDL_CONFIG)
8282 AC_SUBST(HOST_LIBIDL_CFLAGS)
8283 AC_SUBST(HOST_LIBIDL_LIBS)
8285 dnl ========================================================
8286 dnl Check for cairo
8287 dnl ========================================================
8288 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8290 MOZ_TREE_CAIRO=1
8291 MOZ_ARG_ENABLE_BOOL(system-cairo,
8292 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
8293 MOZ_TREE_CAIRO=,
8294 MOZ_TREE_CAIRO=1 )
8296 # Check for headers defining standard int types.
8297 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8299 if test "$MOZ_TREE_CAIRO"; then
8300     AC_DEFINE(MOZ_TREE_CAIRO)
8302     # For now we assume that we will have a uint64_t available through
8303     # one of the above headers or mozstdint.h.
8304     AC_DEFINE(HAVE_UINT64_T)
8306     # Define macros for cairo-features.h
8307     if test "$MOZ_X11"; then
8308         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8309         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8310         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8311         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8312         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8313         MOZ_ENABLE_CAIRO_FT=1
8314         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8315     fi
8316     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8317         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8318     fi
8319     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8320         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8321         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8322         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8323     fi
8324     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8325         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8326         if test -z "$WINCE"; then
8327             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8328             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8329                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8330                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8331                 MOZ_ENABLE_D2D_SURFACE=1
8332                 MOZ_ENABLE_DWRITE_FONT=1
8333             else
8334                 WIN32_DWRITE_FONT_FEATURE=
8335                 WIN32_D2D_SURFACE_FEATURE=
8336             fi
8337         else
8338             WIN32_FONT_FEATURE=
8339             WIN32_DWRITE_FONT_FEATURE=
8340             WIN32_D2D_SURFACE_FEATURE=
8341         fi
8343         AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8345         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8346         if test -z "$HAS_DDRAW"; then
8347             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.])
8348             DDRAW_SURFACE_FEATURE=
8349         else
8350             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8351         fi
8353         if test -z "$OGLES_SDK_DIR"; then
8354             OGLES_SURFACE_FEATURE=
8355         else
8356             AC_TRY_COMPILE([
8357               #include <EGL/egl.h>
8358               #include <EGL/eglext.h>
8359               #include <GLES2/gl2.h>
8360               #include <GLES2/gl2ext.h>
8361             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8362             if test -z "$HAS_OGLES"; then
8363               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8364               OGLES_SURFACE_FEATURE=
8365             else
8366               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8367             fi
8368         fi
8370         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8371     fi
8372     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8373         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8374         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8375         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8376         MOZ_ENABLE_CAIRO_FT=1
8377         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8378         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8379     fi
8380     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8381         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8382         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8383         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8384         MOZ_ENABLE_CAIRO_FT=1
8385     fi
8386     if test "$USE_FC_FREETYPE"; then
8387         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8388     fi
8389     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8390     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8391     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8392     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8393     AC_SUBST(CAIRO_FT_CFLAGS)
8394     AC_SUBST(HAS_OGLES)
8396     if test "$MOZ_DEBUG"; then
8397       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8398     else
8399       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8400     fi
8402     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8404     AC_SUBST(PS_SURFACE_FEATURE)
8405     AC_SUBST(PDF_SURFACE_FEATURE)
8406     AC_SUBST(SVG_SURFACE_FEATURE)
8407     AC_SUBST(XLIB_SURFACE_FEATURE)
8408     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8409     AC_SUBST(QUARTZ_SURFACE_FEATURE)
8410     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8411     AC_SUBST(XCB_SURFACE_FEATURE)
8412     AC_SUBST(WIN32_SURFACE_FEATURE)
8413     AC_SUBST(DDRAW_SURFACE_FEATURE)
8414     AC_SUBST(OGLES_SURFACE_FEATURE)    
8415     AC_SUBST(OS2_SURFACE_FEATURE)
8416     AC_SUBST(BEOS_SURFACE_FEATURE)
8417     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8418     AC_SUBST(FT_FONT_FEATURE)
8419     AC_SUBST(FC_FONT_FEATURE)
8420     AC_SUBST(WIN32_FONT_FEATURE)
8421     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8422     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8423     AC_SUBST(QUARTZ_FONT_FEATURE)
8424     AC_SUBST(PNG_FUNCTIONS_FEATURE)
8425     AC_SUBST(QT_SURFACE_FEATURE)
8427     if test "$_WIN32_MSVC"; then
8428         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
8429     else
8430         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"
8432         if test "$MOZ_X11"; then
8433             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8434         fi
8435     fi
8437     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8438     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8440 else
8441    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8442    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8443    MOZ_CAIRO_LIBS=$CAIRO_LIBS
8444    if test "$MOZ_X11"; then
8445         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8446         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8447         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8448    fi
8451 AC_SUBST(MOZ_TREE_CAIRO)
8452 AC_SUBST(MOZ_CAIRO_CFLAGS)
8453 AC_SUBST(MOZ_CAIRO_LIBS)
8455 dnl ========================================================
8456 dnl qcms
8457 dnl ========================================================
8459 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8460 AC_SUBST(QCMS_LIBS)
8462 dnl ========================================================
8463 dnl HarfBuzz
8464 dnl ========================================================
8465 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8466 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8468 dnl ========================================================
8469 dnl disable xul
8470 dnl ========================================================
8471 MOZ_ARG_DISABLE_BOOL(xul,
8472 [  --disable-xul           Disable XUL],
8473     MOZ_XUL= )
8474 if test "$MOZ_XUL"; then
8475   AC_DEFINE(MOZ_XUL)
8476 else
8477   dnl remove extensions that require XUL
8478   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8481 AC_SUBST(MOZ_XUL)
8483 dnl ========================================================
8484 dnl disable profile locking
8485 dnl   do no use this in applications that can have more than
8486 dnl   one process accessing the profile directory.
8487 dnl ========================================================
8488 MOZ_ARG_DISABLE_BOOL(profilelocking,
8489 [  --disable-profilelocking
8490                           Disable profile locking],
8491     MOZ_PROFILELOCKING=,
8492     MOZ_PROFILELOCKING=1 )
8493 if test "$MOZ_PROFILELOCKING"; then
8494   AC_DEFINE(MOZ_PROFILELOCKING)
8497 dnl ========================================================
8498 dnl disable rdf services
8499 dnl ========================================================
8500 MOZ_ARG_DISABLE_BOOL(rdf,
8501 [  --disable-rdf           Disable RDF],
8502     MOZ_RDF= )
8503 if test "$MOZ_RDF"; then
8504   AC_DEFINE(MOZ_RDF)
8507 AC_SUBST(MOZ_RDF)
8509 dnl ========================================================
8510 dnl necko configuration options
8511 dnl ========================================================
8514 dnl option to disable various necko protocols
8516 MOZ_ARG_ENABLE_STRING(necko-protocols,
8517 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8518                           Enable/disable specific protocol handlers],
8519 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8520     if test "$option" = "yes" || test "$option" = "all"; then
8521         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8522     elif test "$option" = "no" || test "$option" = "none"; then
8523         NECKO_PROTOCOLS=""
8524     elif test "$option" = "default"; then
8525         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8526     elif test `echo "$option" | grep -c \^-` != 0; then
8527         option=`echo $option | sed 's/^-//'`
8528         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8529     else
8530         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8531     fi
8532 done],
8533     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8534 dnl Remove dupes
8535 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8536 AC_SUBST(NECKO_PROTOCOLS)
8537 for p in $NECKO_PROTOCOLS; do
8538     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8539 done
8542 dnl option to disable necko's disk cache
8544 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8545 [  --disable-necko-disk-cache
8546                           Disable necko disk cache],
8547     NECKO_DISK_CACHE=,
8548     NECKO_DISK_CACHE=1)
8549 AC_SUBST(NECKO_DISK_CACHE)
8550 if test "$NECKO_DISK_CACHE"; then
8551     AC_DEFINE(NECKO_DISK_CACHE)
8555 dnl option to disable necko's wifi scanner
8557 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8558 [  --disable-necko-wifi    Disable necko wifi scanner],
8559     NECKO_WIFI=,
8560     NECKO_WIFI=1)
8562 if test "$OS_ARCH" = "OS2"; then
8563   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8564   NECKO_WIFI=
8566 if test "$NECKO_WIFI" -a \
8567         "$OS_ARCH" != "Linux" -a \
8568         "$OS_ARCH" != "Darwin" -a \
8569         "$OS_ARCH" != "SunOS" -a \
8570         "$OS_ARCH" != "WINNT" -a \
8571         "$OS_ARCH" != "WINCE"; then
8572   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8575 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8576 then
8577   AC_CHECK_HEADER([iwlib.h])
8578   if test "$ac_cv_header_iwlib_h" != "yes"; then
8579     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])
8580   fi
8583 if test "$NECKO_WIFI"; then
8584   AC_DEFINE(NECKO_WIFI)
8586 AC_SUBST(NECKO_WIFI)
8589 dnl option to disable cookies
8591 MOZ_ARG_DISABLE_BOOL(cookies,
8592 [  --disable-cookies       Disable cookie support],
8593     NECKO_COOKIES=,
8594     NECKO_COOKIES=1)
8595 AC_SUBST(NECKO_COOKIES)
8596 if test "$NECKO_COOKIES"; then
8597     AC_DEFINE(NECKO_COOKIES)
8601 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8603 MOZ_ARG_DISABLE_BOOL(ctypes,
8604 [  --disable-ctypes        Disable js-ctypes],
8605     BUILD_CTYPES=,
8606     BUILD_CTYPES=1)
8607 AC_SUBST(BUILD_CTYPES)
8608 if test "$BUILD_CTYPES"; then
8609   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8610     # Disable ctypes for arm/wince.
8611     BUILD_CTYPES=
8612   else
8613     AC_DEFINE(BUILD_CTYPES)
8614   fi
8617 dnl NECKO_ configuration options are not global
8618 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8620 dnl Only build Mork if it's required
8621 AC_SUBST(MOZ_MORK)
8622 if test "$MOZ_MORK"; then
8623   AC_DEFINE(MOZ_MORK)
8626 dnl Build the lightweight Mork reader if required
8627 AC_SUBST(MOZ_MORKREADER)
8628 if test "$MOZ_MORKREADER"; then
8629   AC_DEFINE(MOZ_MORKREADER)
8632 dnl Build Places if required
8633 if test "$MOZ_PLACES"; then
8634   AC_DEFINE(MOZ_PLACES)
8637 dnl Build Sync Services if required
8638 AC_SUBST(MOZ_SERVICES_SYNC)
8639 if test -n "$MOZ_SERVICES_SYNC"; then
8640   AC_DEFINE(MOZ_SERVICES_SYNC)
8643 dnl ========================================================
8644 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8645     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8648 dnl ========================================================
8649 dnl =
8650 dnl = Maintainer debug option (no --enable equivalent)
8651 dnl =
8652 dnl ========================================================
8654 AC_SUBST(AR)
8655 AC_SUBST(AR_FLAGS)
8656 AC_SUBST(AR_LIST)
8657 AC_SUBST(AR_EXTRACT)
8658 AC_SUBST(AR_DELETE)
8659 AC_SUBST(AS)
8660 AC_SUBST(ASFLAGS)
8661 AC_SUBST(AS_DASH_C_FLAG)
8662 AC_SUBST(LD)
8663 AC_SUBST(RC)
8664 AC_SUBST(RCFLAGS)
8665 AC_SUBST(WINDRES)
8666 AC_SUBST(IMPLIB)
8667 AC_SUBST(FILTER)
8668 AC_SUBST(BIN_FLAGS)
8669 AC_SUBST(NS_USE_NATIVE)
8670 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8671 AC_SUBST(MOZ_UPDATE_XTERM)
8672 AC_SUBST(MINIMO)
8673 AC_SUBST(MOZ_PLATFORM_MAEMO)
8674 AC_SUBST(MOZ_AUTH_EXTENSION)
8675 AC_SUBST(MOZ_MATHML)
8676 AC_SUBST(MOZ_PERMISSIONS)
8677 AC_SUBST(MOZ_XTF)
8678 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8679 AC_SUBST(MOZ_PREF_EXTENSIONS)
8680 AC_SUBST(MOZ_SVG)
8681 AC_SUBST(MOZ_SMIL)
8682 AC_SUBST(MOZ_XSLT_STANDALONE)
8683 AC_SUBST(MOZ_JS_LIBS)
8684 AC_SUBST(MOZ_PSM)
8685 AC_SUBST(MOZ_DEBUG)
8686 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8687 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8688 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8689 AC_SUBST(MOZ_DEBUG_FLAGS)
8690 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8691 AC_SUBST(WARNINGS_AS_ERRORS)
8692 AC_SUBST(MOZ_EXTENSIONS)
8693 AC_SUBST(MOZ_IMG_DECODERS)
8694 AC_SUBST(MOZ_IMG_ENCODERS)
8695 AC_SUBST(MOZ_JSDEBUGGER)
8696 AC_SUBST(MOZ_PLUGINS)
8697 AC_SUBST(MOZ_LOG_REFCNT)
8698 AC_SUBST(MOZ_LEAKY)
8699 AC_SUBST(MOZ_JPROF)
8700 AC_SUBST(MOZ_SHARK)
8701 AC_SUBST(MOZ_CALLGRIND)
8702 AC_SUBST(MOZ_VTUNE)
8703 AC_SUBST(MOZ_JSLOADER)
8704 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8705 AC_SUBST(MOZ_QUANTIFY)
8706 AC_SUBST(LIBICONV)
8707 AC_SUBST(MOZ_PLACES)
8708 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8709 AC_SUBST(MOZ_STORAGE)
8710 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8711 AC_SUBST(MOZ_FEEDS)
8712 AC_SUBST(NS_PRINTING)
8713 AC_SUBST(MOZ_WEBGL)
8714 AC_SUBST(MOZ_HELP_VIEWER)
8716 AC_SUBST(MOZ_JAVAXPCOM)
8717 AC_SUBST(JAVA_INCLUDE_PATH)
8718 AC_SUBST(JAVA)
8719 AC_SUBST(JAVAC)
8720 AC_SUBST(JAR)
8722 AC_SUBST(MOZ_PROFILELOCKING)
8724 AC_SUBST(HAVE_XIE)
8725 AC_SUBST(MOZ_XIE_LIBS)
8726 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8728 AC_SUBST(BUILD_STATIC_LIBS)
8729 AC_SUBST(MOZ_ENABLE_LIBXUL)
8730 AC_SUBST(ENABLE_TESTS)
8731 AC_SUBST(IBMBIDI)
8732 AC_SUBST(MOZ_UNIVERSALCHARDET)
8733 AC_SUBST(ACCESSIBILITY)
8734 AC_SUBST(MOZ_VIEW_SOURCE)
8735 AC_SUBST(MOZ_SPELLCHECK)
8736 AC_SUBST(MOZ_USER_DIR)
8737 AC_SUBST(MOZ_CRASHREPORTER)
8738 AC_SUBST(MOZ_UPDATER)
8740 AC_SUBST(ENABLE_STRIP)
8741 AC_SUBST(PKG_SKIP_STRIP)
8742 AC_SUBST(USE_ELF_DYNSTR_GC)
8743 AC_SUBST(INCREMENTAL_LINKER)
8744 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8745 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8747 AC_SUBST(MOZ_FIX_LINK_PATHS)
8748 AC_SUBST(XPCOM_LIBS)
8749 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8750 AC_SUBST(XPCOM_GLUE_LDOPTS)
8751 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8753 AC_SUBST(USE_DEPENDENT_LIBS)
8755 AC_SUBST(MOZ_BUILD_ROOT)
8756 AC_SUBST(MOZ_OS2_TOOLS)
8757 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8759 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8760 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8761 AC_SUBST(MOZ_TIMELINE)
8762 AC_SUBST(OGLES_SDK_DIR)
8764 AC_SUBST(MOZ_APP_NAME)
8765 AC_SUBST(MOZ_APP_DISPLAYNAME)
8766 AC_SUBST(MOZ_APP_VERSION)
8767 AC_SUBST(MOZ_APP_UA_EXTRA)
8768 AC_SUBST(FIREFOX_VERSION)
8770 AC_SUBST(MOZ_PKG_SPECIAL)
8772 AC_SUBST(MOZILLA_OFFICIAL)
8774 dnl win32 options
8775 AC_SUBST(MOZ_MAPINFO)
8776 AC_SUBST(MOZ_BROWSE_INFO)
8777 AC_SUBST(MOZ_TOOLS_DIR)
8778 AC_SUBST(CYGWIN_WRAPPER)
8779 AC_SUBST(AS_PERL)
8780 AC_SUBST(WIN32_REDIST_DIR)
8781 AC_SUBST(PYTHON)
8782 AC_SUBST(MAKENSISU)
8784 AC_SUBST(WINCE)
8785 AC_SUBST(WINCE_SDK_DIR)
8786 AC_SUBST(WINCE_WINDOWS_MOBILE)
8788 dnl Echo the CFLAGS to remove extra whitespace.
8789 CFLAGS=`echo \
8790         $_WARNINGS_CFLAGS \
8791         $CFLAGS`
8793 CXXFLAGS=`echo \
8794         $_MOZ_RTTI_FLAGS \
8795         $_MOZ_EXCEPTIONS_FLAGS \
8796         $_WARNINGS_CXXFLAGS \
8797         $CXXFLAGS`
8799 COMPILE_CFLAGS=`echo \
8800     $_DEFINES_CFLAGS \
8801         $_DEPEND_CFLAGS \
8802     $COMPILE_CFLAGS`
8804 COMPILE_CXXFLAGS=`echo \
8805     $_DEFINES_CXXFLAGS \
8806         $_DEPEND_CFLAGS \
8807     $COMPILE_CXXFLAGS`
8809 AC_SUBST(SYSTEM_MAKEDEPEND)
8810 AC_SUBST(SYSTEM_LIBXUL)
8811 AC_SUBST(SYSTEM_JPEG)
8812 AC_SUBST(SYSTEM_PNG)
8813 AC_SUBST(SYSTEM_ZLIB)
8814 AC_SUBST(SYSTEM_BZ2)
8816 AC_SUBST(JPEG_CFLAGS)
8817 AC_SUBST(JPEG_LIBS)
8818 AC_SUBST(ZLIB_CFLAGS)
8819 AC_SUBST(ZLIB_LIBS)
8820 AC_SUBST(BZ2_CFLAGS)
8821 AC_SUBST(BZ2_LIBS)
8822 AC_SUBST(PNG_CFLAGS)
8823 AC_SUBST(PNG_LIBS)
8825 AC_SUBST(MOZ_JPEG_CFLAGS)
8826 AC_SUBST(MOZ_JPEG_LIBS)
8827 AC_SUBST(MOZ_ZLIB_CFLAGS)
8828 AC_SUBST(MOZ_ZLIB_LIBS)
8829 AC_SUBST(MOZ_BZ2_CFLAGS)
8830 AC_SUBST(MOZ_BZ2_LIBS)
8831 AC_SUBST(MOZ_PNG_CFLAGS)
8832 AC_SUBST(MOZ_PNG_LIBS)
8834 AC_SUBST(NSPR_CFLAGS)
8835 AC_SUBST(NSPR_LIBS)
8836 AC_SUBST(MOZ_NATIVE_NSPR)
8838 AC_SUBST(NSS_CFLAGS)
8839 AC_SUBST(NSS_LIBS)
8840 AC_SUBST(NSS_DEP_LIBS)
8841 AC_SUBST(MOZ_NATIVE_NSS)
8842 AC_SUBST(NSS_DISABLE_DBM)
8844 AC_SUBST(CFLAGS)
8845 AC_SUBST(CXXFLAGS)
8846 AC_SUBST(CPPFLAGS)
8847 AC_SUBST(COMPILE_CFLAGS)
8848 AC_SUBST(COMPILE_CXXFLAGS)
8849 AC_SUBST(LDFLAGS)
8850 AC_SUBST(LIBS)
8851 AC_SUBST(CROSS_COMPILE)
8852 AC_SUBST(WCHAR_CFLAGS)
8854 AC_SUBST(HOST_CC)
8855 AC_SUBST(HOST_CXX)
8856 AC_SUBST(HOST_CFLAGS)
8857 AC_SUBST(HOST_CXXFLAGS)
8858 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8859 AC_SUBST(HOST_AR)
8860 AC_SUBST(HOST_AR_FLAGS)
8861 AC_SUBST(HOST_LD)
8862 AC_SUBST(HOST_RANLIB)
8863 AC_SUBST(HOST_NSPR_MDCPUCFG)
8864 AC_SUBST(HOST_BIN_SUFFIX)
8865 AC_SUBST(HOST_OS_ARCH)
8867 AC_SUBST(TARGET_CPU)
8868 AC_SUBST(TARGET_VENDOR)
8869 AC_SUBST(TARGET_OS)
8870 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8871 AC_SUBST(TARGET_MD_ARCH)
8872 AC_SUBST(TARGET_XPCOM_ABI)
8873 AC_SUBST(OS_TARGET)
8874 AC_SUBST(OS_ARCH)
8875 AC_SUBST(OS_RELEASE)
8876 AC_SUBST(OS_TEST)
8878 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8879 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8881 AC_SUBST(WRAP_MALLOC_CFLAGS)
8882 AC_SUBST(WRAP_MALLOC_LIB)
8883 AC_SUBST(MKSHLIB)
8884 AC_SUBST(MKCSHLIB)
8885 AC_SUBST(MKSHLIB_FORCE_ALL)
8886 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8887 AC_SUBST(DSO_CFLAGS)
8888 AC_SUBST(DSO_PIC_CFLAGS)
8889 AC_SUBST(DSO_LDOPTS)
8890 AC_SUBST(LIB_PREFIX)
8891 AC_SUBST(DLL_PREFIX)
8892 AC_SUBST(DLL_SUFFIX)
8893 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8894 AC_SUBST(LIB_SUFFIX)
8895 AC_SUBST(OBJ_SUFFIX)
8896 AC_SUBST(BIN_SUFFIX)
8897 AC_SUBST(ASM_SUFFIX)
8898 AC_SUBST(IMPORT_LIB_SUFFIX)
8899 AC_SUBST(USE_N32)
8900 AC_SUBST(CC_VERSION)
8901 AC_SUBST(CXX_VERSION)
8902 AC_SUBST(MSMANIFEST_TOOL)
8903 AC_SUBST(NS_ENABLE_TSF)
8904 AC_SUBST(MOZ_NSS_PATCH)
8906 AC_SUBST(MOZ_MEDIA)
8907 AC_SUBST(MOZ_SYDNEYAUDIO)
8908 AC_SUBST(MOZ_WAVE)
8909 AC_SUBST(MOZ_VORBIS)
8910 AC_SUBST(MOZ_WEBM)
8911 AC_SUBST(MOZ_OGG)
8912 AC_SUBST(MOZ_ALSA_LIBS)
8913 AC_SUBST(VPX_AS)
8914 AC_SUBST(VPX_ASFLAGS)
8915 AC_SUBST(VPX_X86_ASM)
8917 if test "$USING_HCC"; then
8918    CC='${topsrcdir}/build/hcc'
8919    CC="$CC '$_OLDCC'"
8920    CXX='${topsrcdir}/build/hcpp'
8921    CXX="$CXX '$_OLDCXX'"
8922    AC_SUBST(CC)
8923    AC_SUBST(CXX)
8926 dnl Check for missing components
8927 if test "$COMPILE_ENVIRONMENT"; then
8928 if test "$MOZ_X11"; then
8929     dnl ====================================================
8930     dnl = Check if X headers exist
8931     dnl ====================================================
8932     _SAVE_CFLAGS=$CFLAGS
8933     CFLAGS="$CFLAGS $XCFLAGS"
8934     AC_TRY_COMPILE([
8935         #include <stdio.h>
8936         #include <stdlib.h>
8937         #include <X11/Xlib.h>
8938         #include <X11/Intrinsic.h>
8939     ],
8940     [
8941         Display *dpy = 0;
8942         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8943             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8944             exit(1);
8945         }
8946     ], [], 
8947     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8948     CFLAGS="$_SAVE_CFLAGS"
8950     if test ! -z "$MISSING_X"; then
8951         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8952     fi
8954 fi # MOZ_X11
8956 dnl Check for headers, etc. needed by WebGL.
8957 if test -n "$MOZ_WEBGL_GLX"; then
8958     AC_CHECK_HEADER(GL/glx.h)
8959     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8960         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8961     fi
8962 fi # MOZ_WEBGL_GLX
8963 fi # COMPILE_ENVIRONMENT
8965 if test "$USE_FC_FREETYPE"; then
8966     if test "$COMPILE_ENVIRONMENT"; then
8967         _SAVE_CPPFLAGS="$CPPFLAGS"
8968         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8969         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8970             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8971         CPPFLAGS="$_SAVE_CPPFLAGS"
8972     else
8973         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8974     fi
8977 dnl Set various defines and substitutions
8978 dnl ========================================================
8980 if test "$OS_ARCH" = "BeOS"; then
8981   AC_DEFINE(XP_BEOS)
8982 elif test "$OS_ARCH" = "Darwin"; then
8983   AC_DEFINE(XP_UNIX)
8984   AC_DEFINE(UNIX_ASYNC_DNS)
8985 elif test "$OS_ARCH" = "OpenVMS"; then
8986   AC_DEFINE(XP_UNIX)
8987 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8988   AC_DEFINE(XP_UNIX)
8989   AC_DEFINE(UNIX_ASYNC_DNS)
8992 if test "$MOZ_DEBUG"; then
8993     AC_DEFINE(MOZ_REFLOW_PERF)
8994     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8997 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8998     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8999     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9000     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9001     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9002     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9003     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9004     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9005     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9008 dnl ========================================================
9009 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9010 dnl ========================================================
9011 case "$host_os" in
9012 mingw*)
9013     WIN_TOP_SRC=`cd $srcdir; pwd -W`
9014     ;;
9015 cygwin*|msvc*|mks*)
9016     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9017     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9018     CC="\$(CYGWIN_WRAPPER) $CC"
9019     CXX="\$(CYGWIN_WRAPPER) $CXX"
9020     CPP="\$(CYGWIN_WRAPPER) $CPP"
9021     LD="\$(CYGWIN_WRAPPER) $LD"
9022     AS="\$(CYGWIN_WRAPPER) $AS"
9023     RC="\$(CYGWIN_WRAPPER) $RC"
9024     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9025     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9026     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9027     ;;
9028 esac
9030 AC_SUBST(CYGDRIVE_MOUNT)
9031 AC_SUBST(WIN_TOP_SRC)
9033 AC_SUBST(MOZILLA_VERSION)
9035 AC_SUBST(ac_configure_args)
9037 dnl Spit out some output
9038 dnl ========================================================
9040 dnl The following defines are used by xpcom
9041 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9042 CPP_THROW_NEW
9043 HAVE_CPP_2BYTE_WCHAR_T
9044 HAVE_CPP_ACCESS_CHANGING_USING
9045 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9046 HAVE_CPP_BOOL
9047 HAVE_CPP_CHAR16_T
9048 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9049 HAVE_CPP_EXPLICIT
9050 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9051 HAVE_CPP_NAMESPACE_STD
9052 HAVE_CPP_NEW_CASTS
9053 HAVE_CPP_PARTIAL_SPECIALIZATION
9054 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9055 HAVE_CPP_TYPENAME
9056 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9057 HAVE_STATVFS
9058 NEED_CPP_UNUSED_IMPLEMENTATIONS
9059 NEW_H
9060 HAVE_GETPAGESIZE
9061 HAVE_ICONV
9062 HAVE_ICONV_WITH_CONST_INPUT
9063 HAVE_MBRTOWC
9064 HAVE_SYS_MOUNT_H
9065 HAVE_SYS_VFS_H
9066 HAVE_WCRTOMB
9069 AC_CONFIG_HEADER(
9070 netwerk/necko-config.h
9071 xpcom/xpcom-config.h
9072 xpcom/xpcom-private.h
9075 # Save the defines header file before autoconf removes it.
9076 # (Do not add AC_DEFINE calls after this line.)
9077   _CONFIG_TMP=confdefs-tmp.h
9078   _CONFIG_DEFS_H=mozilla-config.h
9080   cat > $_CONFIG_TMP <<\EOF
9081 /* List of defines generated by configure. Included with preprocessor flag,
9082  * -include, to avoid long list of -D defines on the compile command-line.
9083  * Do not edit.
9084  */
9086 #ifndef _MOZILLA_CONFIG_H_
9087 #define _MOZILLA_CONFIG_H_
9090 _EGREP_PATTERN='^#define ('
9091 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9092     for f in $_NON_GLOBAL_ACDEFINES; do
9093         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9094     done
9096 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9098   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9100   cat >> $_CONFIG_TMP <<\EOF
9102 #endif /* _MOZILLA_CONFIG_H_ */
9106   # Only write mozilla-config.h when something changes (or it doesn't exist)
9107   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9108     rm $_CONFIG_TMP
9109   else
9110     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9111     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9113     echo ==== $_CONFIG_DEFS_H =================================
9114     cat $_CONFIG_DEFS_H
9115   fi
9117 dnl Probably shouldn't call this manually but we always want the output of DEFS
9118 rm -f confdefs.h.save
9119 mv confdefs.h confdefs.h.save
9120 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9121 AC_OUTPUT_MAKE_DEFS()
9122 MOZ_DEFINES=$DEFS
9123 AC_SUBST(MOZ_DEFINES)
9124 rm -f confdefs.h
9125 mv confdefs.h.save confdefs.h
9127 dnl Load the list of Makefiles to generate.
9128 dnl   To add new Makefiles, edit allmakefiles.sh.
9129 dnl   allmakefiles.sh sets the variable, MAKEFILES.
9130 . ${srcdir}/allmakefiles.sh
9131 dnl 
9132 dnl Run a perl script to quickly create the makefiles.
9133 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9134 dnl   for the files it cannot handle correctly. This way, config.status
9135 dnl   will handle these files.
9136 dnl If it fails, nothing is set and config.status will run as usual.
9138 dnl This does not change the $MAKEFILES variable.
9140 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9142 if test -z "${AS_PERL}"; then
9143 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9144 else
9145 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9147 . ./conftest.sh
9148 rm conftest.sh
9150 echo $MAKEFILES > unallmakefiles
9152 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9154 AC_OUTPUT($MAKEFILES)
9156 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9157 if test "$CAIRO_FEATURES_H"; then
9158   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9159     echo "$CAIRO_FEATURES_H is unchanged"
9160     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9161   else
9162     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9163   fi
9166 dnl ========================================================
9167 dnl = Setup a nice relatively clean build environment for
9168 dnl = sub-configures.
9169 dnl ========================================================
9170 CC="$_SUBDIR_CC" 
9171 CXX="$_SUBDIR_CXX" 
9172 CFLAGS="$_SUBDIR_CFLAGS" 
9173 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9174 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9175 LDFLAGS="$_SUBDIR_LDFLAGS"
9176 HOST_CC="$_SUBDIR_HOST_CC" 
9177 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9178 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9181 unset MAKEFILES
9182 unset CONFIG_FILES
9184 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9185 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9187 if test -n "$MOZ_THUMB2"; then
9188   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9190 if test -n "$_WRAP_MALLOC"; then
9191   _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9194 if test -z "$MOZ_NATIVE_NSPR"; then
9195     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9196     if test -z "$MOZ_DEBUG"; then
9197         ac_configure_args="$ac_configure_args --disable-debug"
9198     fi
9199     if test "$MOZ_OPTIMIZE" = "1"; then
9200         ac_configure_args="$ac_configure_args --enable-optimize"
9201     fi
9202     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
9203        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9204     fi
9205     if test -n "$HAVE_64BIT_OS"; then
9206         ac_configure_args="$ac_configure_args --enable-64bit"
9207     fi
9208     if test -n "$USE_ARM_KUSER"; then
9209         ac_configure_args="$ac_configure_args --with-arm-kuser"
9210     fi
9211     AC_OUTPUT_SUBDIRS(nsprpub)
9212     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9215 if test -z "$MOZ_NATIVE_NSPR"; then
9216     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9217     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9218     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
9219        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9220        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9221        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9222        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9223     fi
9224     rm -f config/autoconf.mk.bak
9227 # Run the SpiderMonkey 'configure' script.
9228 dist=$MOZ_BUILD_ROOT/dist
9229 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9230 ac_configure_args="$ac_configure_args --enable-threadsafe"
9231 if test "$BUILD_CTYPES"; then
9232     # Build js-ctypes on the platforms we can.
9233     ac_configure_args="$ac_configure_args --enable-ctypes"
9235 if test -z "$MOZ_NATIVE_NSPR"; then
9236     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9237     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9239 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9240 ac_configure_args="$ac_configure_args --prefix=$dist"
9241 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9242 if test "$MOZ_MEMORY"; then
9243    ac_configure_args="$ac_configure_args --enable-jemalloc"
9244    if test -n "$MOZ_MEMORY_LDFLAGS"; then
9245      export MOZ_MEMORY_LDFLAGS
9246    fi
9248 AC_OUTPUT_SUBDIRS(js/src)
9249 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9251 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9253 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9254 dnl Needs to be at the end to respect possible changes from NSPR configure
9255 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9256   echo "config/autoconf.mk is unchanged"
9257   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9258 else
9259   rm -f config/autoconf.mk.orig 2> /dev/null