Bug 559943 - cleanup of existing reply message handlers and add wm_contextmenu to...
[mozilla-central.git] / configure.in
blob74d907953f01f6af3262ae7c6c7bf7444faedd7e
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=10400
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 Checks for compilers.
244 dnl ========================================================
245 dnl Set CROSS_COMPILE in the environment when running configure
246 dnl to use the cross-compile setup for now
247 dnl ========================================================
249 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
250 AR_FLAGS='cr $@'
252 if test "$COMPILE_ENVIRONMENT"; then
254 dnl Do some special WinCE toolchain stuff
255 case "$target" in
256 *wince|*winmo)
258     MOZ_ARG_WITH_STRING(wince-sdk,
259     [  --with-wince-sdk=WINCE_SDK_DIR
260                         The path to the Windows CE SDK],
261     WINCE_SDK_DIR=$withval)
263     MOZ_ARG_WITH_STRING(ogles-sdk,
264     [  --with-ogles-sdk=OGLES_SDK_DIR
265                         The path to the OGLES SDK],
266     OGLES_SDK_DIR=$withval)
268     AC_DEFINE(WINCE)
269     
270     export WINCE=1
272     echo -----------------------------------------------------------------------------
273     echo Building Windows CE Shunt Library and Tool Chain
274     echo Using SDK in:
275     echo $WINCE_SDK_DIR
277     ac_exeext=.exe
279     _pwd=`pwd -W`
280     _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
281     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
282     TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
283     -C $srcdir/build/wince/tools
285     CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
286     CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
287     CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
288     CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
289     LD="$_pwd/dist/sdk/bin/$target-link.exe"
290     AR="$_pwd/dist/sdk/bin/$target-lib.exe"
291     AS="$_pwd/dist/sdk/bin/$target-as.exe"
292     RC="$_pwd/dist/sdk/bin/$target-res.exe"
295     echo -----------------------------------------------------------------------------
297     ;;
298 esac
300 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
301     echo "cross compiling from $host to $target"
302     cross_compiling=yes
304     _SAVE_CC="$CC"
305     _SAVE_CFLAGS="$CFLAGS"
306     _SAVE_LDFLAGS="$LDFLAGS"
308     AC_MSG_CHECKING([for host c compiler])
309     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
310     if test -z "$HOST_CC"; then
311         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
312     fi
313     AC_MSG_RESULT([$HOST_CC])
314     AC_MSG_CHECKING([for host c++ compiler])
315     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
316     if test -z "$HOST_CXX"; then
317         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
318     fi
319     AC_MSG_RESULT([$HOST_CXX])
321     if test -z "$HOST_CFLAGS"; then
322         HOST_CFLAGS="$CFLAGS"
323     fi
324     if test -z "$HOST_CXXFLAGS"; then
325         HOST_CXXFLAGS="$CXXFLAGS"
326     fi
327     if test -z "$HOST_LDFLAGS"; then
328         HOST_LDFLAGS="$LDFLAGS"
329     fi
330     if test -z "$HOST_AR_FLAGS"; then
331         HOST_AR_FLAGS="$AR_FLAGS"
332     fi
333     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
334     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
335     CC="$HOST_CC"
336     CFLAGS="$HOST_CFLAGS"
337     LDFLAGS="$HOST_LDFLAGS"
339     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
340     AC_TRY_COMPILE([], [return(0);], 
341         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
342         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
344     CC="$HOST_CXX"
345     CFLAGS="$HOST_CXXFLAGS"
347     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
348     AC_TRY_COMPILE([], [return(0);], 
349         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
350         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
351     
352     CC=$_SAVE_CC
353     CFLAGS=$_SAVE_CFLAGS
354     LDFLAGS=$_SAVE_LDFLAGS
356     case "$build:$target" in
357       powerpc-apple-darwin8*:i?86-apple-darwin*)
358         dnl The Darwin cross compiler doesn't necessarily point itself at a
359         dnl root that has libraries for the proper architecture, it defaults
360         dnl to the system root.  The libraries in the system root on current
361         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
362         dnl checks will fail.  Fake a working SDK in that case.
363         _SAVE_CFLAGS=$CFLAGS
364         _SAVE_CXXFLAGS=$CXXLAGS
365         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
366         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
367         ;;
368     esac
370     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
371     unset ac_cv_prog_CC
372     AC_PROG_CC
373     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
374     unset ac_cv_prog_CXX
375     AC_PROG_CXX
377     case "$build:$target" in
378       powerpc-apple-darwin8*:i?86-apple-darwin*)
379         dnl Revert the changes made above.  From this point on, the target
380         dnl compiler will never be used without applying the SDK to CFLAGS
381         dnl (see --with-macos-sdk below).
382         CFLAGS=$_SAVE_CFLAGS
383         CXXFLAGS=$_SAVE_CXXFLAGS
384         ;;
385     esac
387     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
388     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
389     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
390     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
391     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
392     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
393     AC_DEFINE(CROSS_COMPILE)
394 else
395     AC_PROG_CC
396     AC_PROG_CXX
397     AC_PROG_RANLIB
398     MOZ_PATH_PROGS(AS, $AS as, $CC)
399     AC_CHECK_PROGS(AR, ar, :)
400     AC_CHECK_PROGS(LD, ld, :)
401     AC_CHECK_PROGS(STRIP, strip, :)
402     AC_CHECK_PROGS(WINDRES, windres, :)
403     if test -z "$HOST_CC"; then
404         HOST_CC='$(CC)'
405     fi
406     if test -z "$HOST_CFLAGS"; then
407         HOST_CFLAGS='$(CFLAGS)'
408     fi
409     if test -z "$HOST_CXX"; then
410         HOST_CXX='$(CXX)'
411     fi
412     if test -z "$HOST_CXXFLAGS"; then
413         HOST_CXXFLAGS='$(CXXFLAGS)'
414     fi
415     if test -z "$HOST_LDFLAGS"; then
416         HOST_LDFLAGS='$(LDFLAGS)'
417     fi
418     if test -z "$HOST_RANLIB"; then
419         HOST_RANLIB='$(RANLIB)'
420     fi
421     if test -z "$HOST_AR"; then
422         HOST_AR='$(AR)'
423     fi
424     if test -z "$HOST_AR_FLAGS"; then
425         HOST_AR_FLAGS='$(AR_FLAGS)'
426     fi
429 GNU_AS=
430 GNU_LD=
431 GNU_CC=
432 GNU_CXX=
433 CC_VERSION='N/A'
434 CXX_VERSION='N/A'
435 if test "$GCC" = "yes"; then
436     GNU_CC=1
437     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
439 if test "$GXX" = "yes"; then
440     GNU_CXX=1
441     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
443 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
444     GNU_AS=1
446 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
447     GNU_LD=1
449 if test "$GNU_CC"; then
450     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
451         GCC_USE_GNU_LD=1
452     fi
455 INTEL_CC=
456 INTEL_CXX=
457 if test "$GCC" = yes; then
458    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
459      INTEL_CC=1
460    fi
463 if test "$GXX" = yes; then
464    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
465      INTEL_CXX=1
466    fi
469 dnl Special win32 checks
470 dnl ========================================================
471 case "$target" in
472 *-wince|*-winmo)
473     WINVER=500
474     WINSDK_TARGETVER=502
475     ;;
477     WINVER=502
478     dnl Target the Windows 7 SDK by default
479     WINSDK_TARGETVER=601
480     ;;
481 esac
484 MOZ_ARG_WITH_STRING(windows-version,
485 [  --with-windows-version=WINSDK_TARGETVER
486                           Highest Windows version to target using this SDK
487                               502: Windows Server 2003
488                               600: Windows Vista
489                               601: Windows 7],
490   WINSDK_TARGETVER=$withval)
492 case "$WINSDK_TARGETVER" in
493 502|600|601)
494     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
495     ;;
498     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
499     ;;
501 esac
503 dnl Vista SDK specific api (deprecated)
504 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
505 [  --disable-vista-sdk-requirements
506                            Do not build Vista SDK specific code],
507    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
508    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=$_PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
509 if test -n "$COMPILE_ENVIRONMENT"; then
510 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
511     AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
512     MOZ_WINSDK_TARGETVER=05020000
515 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
516     MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
517     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
518     # We can't build parental controls either
519     MOZ_DISABLE_PARENTAL_CONTROLS=1
523 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
525 case "$target" in
526 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
527     if test "$GCC" != "yes"; then
528         # Check to see if we are really running in a msvc environemnt
529         _WIN32_MSVC=1
530         AC_CHECK_PROGS(MIDL, midl)
532         # Make sure compilers are valid
533         CFLAGS="$CFLAGS -TC -nologo"
534         CXXFLAGS="$CXXFLAGS -TP -nologo"
535         AC_LANG_SAVE
536         AC_LANG_C
537         AC_TRY_COMPILE([#include <stdio.h>],
538             [ printf("Hello World\n"); ],,
539             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
541         AC_LANG_CPLUSPLUS
542         AC_TRY_COMPILE([#include <new.h>],
543             [ unsigned *test = new unsigned(42); ],,
544             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
545         AC_LANG_RESTORE
546         
547         changequote(,)
548         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
549         changequote([,])
550         
551         # Determine compiler version
552         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
553         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
554         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
555         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
556         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
557         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
559         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
562         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
563             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
564         fi
565         if test "$_CC_MAJOR_VERSION" = "13"; then
566             _CC_SUITE=7
567         elif test "$_CC_MAJOR_VERSION" = "14"; then
568             _CC_SUITE=8
569             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
570             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
571             dnl so be very specific here!
572             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
573             if test $_CC_RELEASE -gt 50727; then
574                _USE_DYNAMICBASE=1
575             elif test $_CC_BUILD -ge 762; then
576                _USE_DYNAMICBASE=1
577             fi
578             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
579             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
580         elif test "$_CC_MAJOR_VERSION" = "15"; then
581             _CC_SUITE=9
582             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
583             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
584             _USE_DYNAMICBASE=1
585             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
586             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
587         elif test "$_CC_MAJOR_VERSION" = "16"; then
588             _CC_SUITE=10
589             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
590             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
591             _USE_DYNAMICBASE=1
592             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
593             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
594         else
595             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
596         fi
598         _MOZ_RTTI_FLAGS_ON='-GR'
599         _MOZ_RTTI_FLAGS_OFF='-GR-'
600         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
601         _MOZ_EXCEPTIONS_FLAGS_OFF=''
603         if test -n "$WIN32_REDIST_DIR"; then
604             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
605         fi
606         
607         # bug #249782
608         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
609         if test "$_CC_SUITE" -ge "8"; then
610                 changequote(,)
611                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
612                 changequote([,])
614                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
615                 if test -n "$MSMT_TOOL"; then
616                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
617                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
618                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
619                         fi
620                         MSMANIFEST_TOOL=1
621                         unset MSMT_TOOL
622                 else
623                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
624                 fi
625         fi
627         # Check linker version
628         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
629         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
630         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
631             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
632         fi
633         INCREMENTAL_LINKER=1
635         # Check midl version
636         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
637         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
638         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
639         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
640         # Add flags if necessary
641         AC_MSG_CHECKING([for midl flags])
642         case "$target" in
643         i*86-*)
644             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
645                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
646                 # MIDL version 7.00.0500 or later has no problem.
647                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
648                 AC_MSG_RESULT([need -env win32])
649             else
650                 AC_MSG_RESULT([none needed])
651             fi
652             ;;
653         x86_64-*)
654             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
655             ;;
656         *)
657             AC_MSG_RESULT([none needed])
658             ;;
659         esac
661         # Identify which version of the SDK we're building with
662         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
663         # from there
664         AC_CHECK_HEADERS([winsdkver.h])
665         if test "$ac_cv_header_winsdkver_h" = "yes"; then
666             # Get the highest _WIN32_WINNT and NTDDI versions supported
667             # Take the higher of the two
668             # This is done because the Windows 7 beta SDK reports its
669             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
670             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
671                            ac_cv_winsdk_maxver,
672                            [cat > conftest.h <<EOF
673 #include <winsdkver.h>
674 #include <sdkddkver.h>
676 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
677 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
678 #else
679 #define WINSDK_MAXVER NTDDI_MAXVER
680 #endif
682 WINSDK_MAXVER
684                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
685                             rm -f conftest.h
686                            ])
687             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
688         else
689             # The Vista SDK is the only one to have sdkddkver.h but not
690             # WinSDKVer.h
691             AC_CHECK_HEADERS([sdkddkver.h])
692             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
693                 MOZ_WINSDK_MAXVER=0x06000000
694             else
695                 # Assume the Server 2003 Platform SDK
696                 MOZ_WINSDK_MAXVER=0x05020000
697             fi
698         fi
700         unset _MSVC_VER_FILTER
702     else
703         # Check w32api version
704         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
705         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
706         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
707         AC_TRY_COMPILE([#include <w32api.h>],
708             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
709                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
710                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
711                 #error "test failed."
712             #endif
713             , [ res=yes ], [ res=no ])
714         AC_MSG_RESULT([$res])
715         if test "$res" != "yes"; then
716             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
717         fi
718         # Check windres version
719         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
720         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
721         AC_MSG_RESULT([$_WINDRES_VERSION])
722         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
723         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
724         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
725         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
726         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
727         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
728         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
729                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
730                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
731                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
732                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
733                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
734         then
735             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
736         fi
738         # Server 2003 is the highest version supported
739         MOZ_WINSDK_MAXVER=0x05020000
740     fi # !GNU_CC
742     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
743     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
744     # Require OS features provided by IE 5.0
745     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
747     # If the maximum version supported by this SDK is lower than the target
748     # version, error out
749     AC_MSG_CHECKING([for Windows SDK being recent enough])
750     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
751         AC_MSG_RESULT("yes")
752     else
753         AC_MSG_RESULT("no")
754         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.])
755     fi
757     AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
758     # Definitions matching sdkddkver.h
759     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
760     AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
761     AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
763     STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
764     WRAP_STL_INCLUDES=1
765     ;;
766 esac
768 dnl Test breaks icc on OS/2 && MSVC
769 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
770     AC_PROG_CC_C_O
771     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
772         USING_HCC=1
773         _OLDCC=$CC
774         _OLDCXX=$CXX
775         CC="${srcdir}/build/hcc '$CC'"
776         CXX="${srcdir}/build/hcpp '$CXX'"
777     fi
780 AC_PROG_CPP
781 AC_PROG_CXXCPP
783 if test -n "$_WIN32_MSVC"; then
784     SKIP_PATH_CHECKS=1
785     SKIP_COMPILER_CHECKS=1
786     SKIP_LIBRARY_CHECKS=1
788     # Since we're skipping compiler and library checks, hard-code
789     # some facts here.
790     case "$target" in
791     *-wince|*-winmo)
792         ;;
793     *)
794         AC_DEFINE(HAVE_IO_H)
795         AC_DEFINE(HAVE_SETBUF)
796         AC_DEFINE(HAVE_ISATTY)
797         ;;
798     esac
801 fi # COMPILE_ENVIRONMENT
803 AC_SUBST(MIDL_FLAGS)
804 AC_SUBST(_MSC_VER)
806 AC_SUBST(GNU_AS)
807 AC_SUBST(GNU_LD)
808 AC_SUBST(GNU_CC)
809 AC_SUBST(GNU_CXX)
810 AC_SUBST(INTEL_CC)
811 AC_SUBST(INTEL_CXX)
813 AC_SUBST(STL_FLAGS)
814 AC_SUBST(WRAP_STL_INCLUDES)
816 dnl ========================================================
817 dnl Checks for programs.
818 dnl ========================================================
819 AC_PROG_INSTALL
820 AC_PROG_LN_S
822 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
823 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
824 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
825 _perl_res=$?
826 AC_MSG_RESULT([$_perl_version])
828 if test "$_perl_res" != 0; then
829     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
833 AC_MSG_CHECKING([for full perl installation])
834 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
835 _perl_res=$?
836 if test "$_perl_res" != 0; then
837     AC_MSG_RESULT([no])
838     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
839 else
840     AC_MSG_RESULT([yes])    
843 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.6 python2.5 python2.4 python)
844 if test -z "$PYTHON"; then
845     AC_MSG_ERROR([python was not found in \$PATH])
848 if test -z "$COMPILE_ENVIRONMENT"; then
849     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
851 AC_SUBST(NSINSTALL_BIN)
853 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
854 MOZ_PATH_PROG(WHOAMI, whoami, :)
855 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
856 MOZ_PATH_PROG(UNZIP, unzip, :)
857 MOZ_PATH_PROGS(ZIP, zip)
858 if test -z "$ZIP" || test "$ZIP" = ":"; then
859     AC_MSG_ERROR([zip not found in \$PATH])
861 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
862 MOZ_PATH_PROG(XARGS, xargs)
863 if test -z "$XARGS" || test "$XARGS" = ":"; then
864     AC_MSG_ERROR([xargs not found in \$PATH .])
867 if test "$COMPILE_ENVIRONMENT"; then
869 dnl ========================================================
870 dnl = Mac OS X toolchain support
871 dnl ========================================================
873 case "$target_os" in
874 darwin*)
875     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
876     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
877     dnl the environment and includedir purposes (when using an SDK, below),
878     dnl but remember the full version number for the libdir (SDK).
879     changequote(,)
880     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
881     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
882     changequote([,])
883     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
884         dnl Bug 280479, but this keeps popping up in bug 292530 too because
885         dnl 4.0.0/4061 is the default compiler in Tiger.
886         changequote(,)
887         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
888         changequote([,])
889         if test "$GCC_BUILD" = "4061" ; then
890             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
891 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
892 from building Mozilla. Upgrade to Xcode 2.1 or later.])
893         fi
894     fi
896     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
897     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
898     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
899     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
901     case "$PBBUILD" in
902       *xcodebuild*)
903         changequote(,)
904         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
905         changequote([,])
906         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
907           HAS_XCODE_2_1=1;
908         fi
909       ;;
910     esac
912     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
913     dnl it has moved into /usr/bin.
914     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
915     ;;
916 esac
918 AC_SUBST(GCC_VERSION)
919 AC_SUBST(XCODEBUILD_VERSION)
920 AC_SUBST(HAS_XCODE_2_1)
922 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
923 dnl that a universal binary is being produced.
924 AC_SUBST(UNIVERSAL_BINARY)
926 dnl ========================================================
927 dnl Check for MacOS deployment target version
928 dnl ========================================================
930 MOZ_ARG_ENABLE_STRING(macos-target,
931                       [  --enable-macos-target=VER (default=10.5)
932                           Set the minimum MacOS version needed at runtime],
933                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
935 case "$target" in
936 *-darwin*)
937     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
938         dnl Use the specified value
939         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
940         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
941     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
942         dnl No value specified on the command line or in the environment,
943         dnl use architecture minimum.
944         export MACOSX_DEPLOYMENT_TARGET=10.5
945     fi
946     ;;
947 esac
949 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
951 dnl ========================================================
952 dnl = Mac OS X SDK support
953 dnl ========================================================
954 MACOS_SDK_DIR=
955 NEXT_ROOT=
956 MOZ_ARG_WITH_STRING(macos-sdk,
957 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
958     MACOS_SDK_DIR=$withval)
960 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
961 dnl NEXT_ROOT will be set and exported only if it's needed.
962 AC_SUBST(MACOS_SDK_DIR)
963 AC_SUBST(NEXT_ROOT)
965 if test "$MACOS_SDK_DIR"; then
966   dnl Sync this section with the ones in NSPR and NSS.
967   dnl Changes to the cross environment here need to be accounted for in
968   dnl the libIDL checks (below) and xpidl build.
970   if test ! -d "$MACOS_SDK_DIR"; then
971     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
972 specify a valid SDK.  SDKs are installed when the optional cross-development
973 tools are selected during the Xcode/Developer Tools installation.])
974   fi
976   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
977   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
978     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
979   else
980     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
981     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
983     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
984     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
985     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
987     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
988       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
989       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
990       dnl be ignored and cause warnings when -syslibroot is specified.
991       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
992       dnl the -isysroot it receives, so this is only needed with 4.0.0.
993       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
994     fi
995   fi
997   AC_LANG_SAVE
998   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
999   AC_LANG_CPLUSPLUS
1000   AC_TRY_COMPILE([#include <new>
1001                  int main() { return 0; }],
1002    result=yes,
1003    result=no)
1004   AC_LANG_RESTORE
1005   AC_MSG_RESULT($result)
1007   if test "$result" = "no" ; then
1008     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1009   fi
1012 fi # COMPILE_ENVIRONMENT
1014 if test -n "$MAKE"; then
1015   if test `echo $MAKE | grep -c make.py` != 1; then
1016      NOT_PYMAKE=$MAKE
1017   fi
1020 case "$host_os" in
1021 cygwin*|mingw*|mks*|msvc*)
1022     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1023     ;;
1025     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1026     ;;
1027 esac
1028 if test "$GMAKE" = ":"; then
1029    AC_MSG_ERROR([GNU make not found])
1031 AC_SUBST(GMAKE)
1033 if test "$COMPILE_ENVIRONMENT"; then
1035 AC_PATH_XTRA
1037 XCFLAGS="$X_CFLAGS"
1039 fi # COMPILE_ENVIRONMENT
1041 dnl ========================================================
1042 dnl set the defaults first
1043 dnl ========================================================
1044 AS_BIN=$AS
1045 AR_LIST='$(AR) t'
1046 AR_EXTRACT='$(AR) x'
1047 AR_DELETE='$(AR) d'
1048 AS='$(CC)'
1049 AS_DASH_C_FLAG='-c'
1050 DLL_PREFIX=lib
1051 LIB_PREFIX=lib
1052 DLL_SUFFIX=.so
1053 OBJ_SUFFIX=o
1054 LIB_SUFFIX=a
1055 ASM_SUFFIX=s
1056 IMPORT_LIB_SUFFIX=
1057 TARGET_MD_ARCH=unix
1058 DIRENT_INO=d_ino
1059 CYGWIN_WRAPPER=
1060 WIN_TOP_SRC=
1061 MOZ_USER_DIR=".mozilla"
1063 MOZ_JPEG_CFLAGS=
1064 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1065 MOZ_ZLIB_CFLAGS=
1066 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1067 MOZ_BZ2_CFLAGS=
1068 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1069 MOZ_PNG_CFLAGS=
1070 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1072 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1073 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1074 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1075 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1076 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1077 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1078 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1080 MOZ_FS_LAYOUT=unix
1082 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1084 USE_DEPENDENT_LIBS=1
1086 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1088 MOZ_ENABLE_POSTSCRIPT=1 
1090 if test -n "$CROSS_COMPILE"; then
1091     OS_TARGET="${target_os}"
1092     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1093     OS_RELEASE=
1094     case "${target_os}" in
1095         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1096         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1097         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1098         mingw*)       OS_ARCH=WINNT ;;
1099         wince*)       OS_ARCH=WINCE ;;
1100         winmo*)       OS_ARCH=WINCE ;;
1101         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1102     esac
1103 else
1104     OS_TARGET=`uname -s`
1105     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1106     OS_RELEASE=`uname -r`
1109 # Before this used `uname -m` when not cross compiling
1110 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1111 OS_TEST="${target_cpu}"
1113 _COMPILER_PREFIX=
1115 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1117 #######################################################################
1118 # Master "Core Components" macros for getting the OS target           #
1119 #######################################################################
1122 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1123 # cross-compilation.
1127 # Define and override various archtecture-specific variables, including
1128 # HOST_OS_ARCH
1129 # OS_ARCH
1130 # OS_TEST
1131 # OS_TARGET
1132 # OS_RELEASE
1133 # OS_MINOR_RELEASE
1136 case "$HOST_OS_ARCH" in
1137 cygwin*|mingw*|mks*|msvc*)
1138     HOST_OS_ARCH=WINNT
1139     ;;
1140 darwin*)
1141     HOST_OS_ARCH=Darwin
1142     ;;
1143 linux*)
1144     HOST_OS_ARCH=Linux
1145     ;;
1146 solaris*)
1147     HOST_OS_ARCH=SunOS
1148     SOLARIS_SUNPRO_CC=
1149     SOLARIS_SUNPRO_CXX=
1150     if test -z "$GNU_CC"; then
1151         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1152             SOLARIS_SUNPRO_CC=1
1153        fi
1154     fi
1156     if test -z "$GNU_CXX"; then
1157        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1158            SOLARIS_SUNPRO_CXX=1
1159        fi
1160     fi
1161     AC_SUBST(SOLARIS_SUNPRO_CC)
1162     AC_SUBST(SOLARIS_SUNPRO_CXX)
1163     ;;
1164 BSD_386)
1165     HOST_OS_ARCH=BSD
1166     ;;
1167 dgux)
1168     HOST_OS_ARCH=DGUX
1169     ;;
1170 IRIX64)
1171     HOST_OS_ARCH=IRIX
1172     ;;
1173 UNIX_SV)
1174     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1175         HOST_OS_ARCH=NCR
1176     else
1177         HOST_OS_ARCH=UNIXWARE
1178     fi
1179     ;;
1180 ncr)
1181     HOST_OS_ARCH=NCR
1182     ;;
1183 UNIX_SYSTEM_V)
1184     HOST_OS_ARCH=NEC
1185     ;;
1186 OSF1)
1187     ;;
1188 *OpenVMS*)
1189     HOST_OS_ARCH=OpenVMS
1190     ;;
1191 OS_2)
1192     HOST_OS_ARCH=OS2
1193     ;;
1194 QNX)
1195     ;;
1196 SCO_SV)
1197     HOST_OS_ARCH=SCOOS
1198     ;;
1199 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1200     HOST_OS_ARCH=SINIX
1201     ;;
1202 UnixWare)
1203     HOST_OS_ARCH=UNIXWARE
1204     ;;
1205 esac
1207 case "$OS_ARCH" in
1208 WINNT)
1209     if test -z "$CROSS_COMPILE" ; then
1210         OS_TEST=`uname -p`
1211     fi
1212     ;;
1213 Windows_NT)
1215 # If uname -s returns "Windows_NT", we assume that we are using
1216 # the uname.exe in MKS toolkit.
1218 # The -r option of MKS uname only returns the major version number.
1219 # So we need to use its -v option to get the minor version number.
1220 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1222     OS_ARCH=WINNT
1223     OS_TARGET=WINNT
1224     OS_MINOR_RELEASE=`uname -v`
1225     if test "$OS_MINOR_RELEASE" = "00"; then
1226         OS_MINOR_RELEASE=0
1227     fi
1228     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1229     ;;
1230 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1232 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1233 # the uname.exe in the Cygwin tools.
1234 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1235 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1236 # the uname.exe in the GNU-Win32 tools.
1237 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1238 # the uname.exe in the MSYS tools.
1240     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1241     OS_ARCH=WINNT
1242     OS_TARGET=WINNT
1243     ;;
1244 AIX)
1245     OS_RELEASE=`uname -v`.`uname -r`
1246     OS_TEST=${target_cpu}
1247     ;;
1248 BSD_386)
1249     OS_ARCH=BSD
1250     ;;
1251 dgux)
1252     OS_ARCH=DGUX
1253     ;;
1254 IRIX64)
1255     OS_ARCH=IRIX
1256     ;;
1257 UNIX_SV)
1258     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1259         OS_ARCH=NCR
1260     else
1261         OS_ARCH=UNIXWARE
1262         OS_RELEASE=`uname -v`
1263     fi
1264     ;;
1265 ncr)
1266     OS_ARCH=NCR
1267     ;;
1268 UNIX_SYSTEM_V)
1269     OS_ARCH=NEC
1270     ;;
1271 OSF1)
1272     case `uname -v` in
1273     148)
1274         OS_RELEASE=V3.2C
1275         ;;
1276     564)
1277         OS_RELEASE=V4.0B
1278         ;;
1279     878)
1280         OS_RELEASE=V4.0D
1281         ;;
1282     esac
1283     ;;
1284 *OpenVMS*)
1285     OS_ARCH=OpenVMS
1286     OS_RELEASE=`uname -v`
1287     OS_TEST=`uname -p`
1288     ;;
1289 OS_2)
1290     OS_ARCH=OS2
1291     OS_TARGET=OS2
1292     OS_RELEASE=`uname -v`
1293     ;;
1294 QNX)
1295     if test "$OS_TARGET" != "NTO"; then
1296         changequote(,)
1297         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1298         changequote([,])
1299     fi
1300     OS_TEST=x86
1301     ;;
1302 SCO_SV)
1303     OS_ARCH=SCOOS
1304     OS_RELEASE=5.0
1305     ;;
1306 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1307     OS_ARCH=SINIX
1308     OS_TEST=`uname -p`
1309     ;;
1310 UnixWare)
1311     OS_ARCH=UNIXWARE
1312     OS_RELEASE=`uname -v`
1313     ;;
1314 WINCE)
1315     OS_ARCH=WINCE
1316     case "${target_os}" in
1317     *winmo)
1318         OS_TARGET=WINMO
1319         WINCE_WINDOWS_MOBILE=1
1320         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1321         ;;
1322     *)
1323         OS_TARGET=WINCE
1324         ;;
1325     esac
1326     ;;
1327 Darwin)
1328     case "${target_cpu}" in
1329     powerpc*)
1330         OS_TEST=ppc
1331         ;;
1332     i*86*)
1333         OS_TEST=i386 
1334         ;;
1335     x86_64)
1336         OS_TEST=x86_64
1337         ;;
1338     *)
1339         if test -z "$CROSS_COMPILE" ; then
1340             OS_TEST=`uname -p`
1341         fi
1342         ;;
1343     esac
1344     ;;
1345 esac
1347 if test "$OS_ARCH" = "NCR"; then
1348     changequote(,)
1349     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1350     changequote([,])
1353 # Only set CPU_ARCH if we recognize the value of OS_TEST
1355 case "$OS_TEST" in
1356 *86 | i86pc)
1357     CPU_ARCH=x86
1358     ;;
1360 powerpc64 | ppc64)
1361     CPU_ARCH=ppc64
1362     ;;
1364 powerpc | ppc | rs6000)
1365     CPU_ARCH=ppc
1366     ;;
1368 Alpha | alpha | ALPHA)
1369     CPU_ARCH=Alpha
1370     ;;
1372 s390)
1373     CPU_ARCH=s390
1374     ;;
1376 s390x)
1377     CPU_ARCH=s390x
1378     ;;
1380 hppa* | parisc)
1381     CPU_ARCH=hppa
1382     ;;
1384 sun4u | sparc*)
1385     CPU_ARCH=sparc
1386     ;;
1388 x86_64 | ia64)
1389     CPU_ARCH="$OS_TEST"
1390     ;;
1392 arm)
1393     if test "$OS_TARGET" = "WINCE"; then
1394         CPU_ARCH="$OS_TEST"
1395     fi
1396     ;;
1397 esac
1399 if test -z "$OS_TARGET"; then
1400     OS_TARGET=$OS_ARCH
1402 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1404 dnl ========================================================
1405 dnl GNU specific defaults
1406 dnl ========================================================
1407 if test "$GNU_CC"; then
1408     # FIXME: Let us build with strict aliasing. bug 414641.
1409     CFLAGS="$CFLAGS -fno-strict-aliasing"
1410     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1411     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1412     DSO_LDOPTS='-shared'
1413     if test "$GCC_USE_GNU_LD"; then
1414         # Don't allow undefined symbols in libraries
1415         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1416     fi
1417     WARNINGS_AS_ERRORS='-Werror'
1418     DSO_CFLAGS=''
1419     DSO_PIC_CFLAGS='-fPIC'
1420     ASFLAGS="$ASFLAGS -fPIC"
1421     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1422     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1423     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1424     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1426     # Turn on GNU specific features
1427     # -Wall - turn on all warnings
1428     # -pedantic - make compiler warn about non-ANSI stuff, and
1429     #             be a little bit stricter
1430     # Warnings slamm took out for now (these were giving more noise than help):
1431     # -Wbad-function-cast - warns when casting a function to a new return type
1432     # -Wshadow - removed because it generates more noise than help --pete
1433     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1434     if test -z "$INTEL_CC"; then
1435        # Don't use -Wcast-align with ICC
1436        case "$CPU_ARCH" in
1437            # And don't use it on hppa, ia64, sparc, since it's noisy there
1438            hppa | ia64 | sparc)
1439            ;;
1440            *)
1441         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1442            ;;
1443        esac
1444     fi
1446     dnl Turn pedantic on but disable the warnings for long long
1447     _PEDANTIC=1
1449     if test -z "$INTEL_CC"; then
1450       _IGNORE_LONG_LONG_WARNINGS=1
1451       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1452     else
1453       _IGNORE_LONG_LONG_WARNINGS=
1454     fi
1457     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1458     _USE_CPP_INCLUDE_FLAG=1
1459 elif test "$SOLARIS_SUNPRO_CC"; then
1460     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1461     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1463     DSO_LDOPTS='-shared'
1464     if test "$GNU_LD"; then
1465         # Don't allow undefined symbols in libraries
1466         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1467     fi
1469     DSO_CFLAGS=''
1470     if test "$CPU_ARCH" = "sparc"; then
1471         # for Sun Studio on Solaris/SPARC
1472         DSO_PIC_CFLAGS='-xcode=pic32'
1473     else
1474         DSO_PIC_CFLAGS='-KPIC'
1475     fi
1476     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1477 else
1478     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1479     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1481     DSO_LDOPTS='-shared'
1482     if test "$GNU_LD"; then
1483         # Don't allow undefined symbols in libraries
1484         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1485     fi
1487     DSO_CFLAGS=''
1488     DSO_PIC_CFLAGS='-KPIC'
1489     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1492 if test "$GNU_CXX"; then
1493     # FIXME: Let us build with strict aliasing. bug 414641.
1494     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1495     # Turn on GNU specific features
1496     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1497     if test -z "$INTEL_CC"; then
1498        # Don't use -Wcast-align with ICC
1499        case "$CPU_ARCH" in
1500            # And don't use it on hppa, ia64, sparc, since it's noisy there
1501            hppa | ia64 | sparc)
1502            ;;
1503            *)
1504         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1505            ;;
1506        esac
1507     fi
1509     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1510     _USE_CPP_INCLUDE_FLAG=1
1512     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1513                    ac_has_wno_invalid_offsetof,
1514         [
1515             AC_LANG_SAVE
1516             AC_LANG_CPLUSPLUS
1517             _SAVE_CXXFLAGS="$CXXFLAGS"
1518             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1519             AC_TRY_COMPILE([],
1520                            [return(0);],
1521                            ac_has_wno_invalid_offsetof="yes",
1522                            ac_has_wno_invalid_offsetof="no")
1523             CXXFLAGS="$_SAVE_CXXFLAGS"
1524             AC_LANG_RESTORE
1525         ])
1526     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1527         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1528     fi
1530     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1531                    ac_has_wno_variadic_macros,
1532         [
1533             AC_LANG_SAVE
1534             AC_LANG_CPLUSPLUS
1535             _SAVE_CXXFLAGS="$CXXFLAGS"
1536             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1537             AC_TRY_COMPILE([],
1538                            [return(0);],
1539                            ac_has_wno_variadic_macros="yes",
1540                            ac_has_wno_variadic_macros="no")
1541             CXXFLAGS="$_SAVE_CXXFLAGS"
1542             AC_LANG_RESTORE
1543         ])
1544     if test "$ac_has_wno_variadic_macros" = "yes"; then
1545         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1546     fi
1548     AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1549                    ac_has_werror_return_type,
1550         [
1551             AC_LANG_SAVE
1552             AC_LANG_CPLUSPLUS
1553             _SAVE_CXXFLAGS="$CXXFLAGS"
1554             CXXFLAGS="$CXXFLAGS -Werror=return-type"
1555             AC_TRY_COMPILE([],
1556                            [return(0);],
1557                            ac_has_werror_return_type="yes",
1558                            ac_has_werror_return_type="no")
1559             CXXFLAGS="$_SAVE_CXXFLAGS"
1560             AC_LANG_RESTORE
1561         ])
1562     if test "$ac_has_werror_return_type" = "yes"; then
1563         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1564     fi
1566 else
1567     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1570 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1571 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1572 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1573 dnl normal behavior.
1574 dnl ========================================================
1575 MKSHLIB_FORCE_ALL=
1576 MKSHLIB_UNFORCE_ALL=
1578 if test "$COMPILE_ENVIRONMENT"; then
1579 if test "$GNU_CC"; then
1580   AC_MSG_CHECKING(whether ld has archive extraction flags)
1581   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1582    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1583     ac_cv_mkshlib_force_and_unforce="no"
1584     exec 3<&0 <<LOOP_INPUT
1585         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1586         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1587         force="-Wl,-all";              unforce="-Wl,-none"
1588 LOOP_INPUT
1589     while read line
1590     do
1591       eval $line
1592       LDFLAGS=$force
1593       LIBS=$unforce
1594       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1595     done
1596     exec 0<&3 3<&-
1597     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1598    ])
1599   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1600     AC_MSG_RESULT(no)
1601   else
1602     AC_MSG_RESULT(yes)
1603     eval $ac_cv_mkshlib_force_and_unforce
1604     MKSHLIB_FORCE_ALL=$force
1605     MKSHLIB_UNFORCE_ALL=$unforce
1606   fi
1607 fi # GNU_CC
1608 fi # COMPILE_ENVIRONMENT
1610 dnl =================================================================
1611 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1612 dnl which is bad when cross compiling.
1613 dnl =================================================================
1614 if test "$COMPILE_ENVIRONMENT"; then
1615 configure_static_assert_macros='
1616 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1617 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1618 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1621 dnl test that the macros actually work:
1622 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1623 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1624  [AC_LANG_SAVE
1625   AC_LANG_C
1626   ac_cv_static_assertion_macros_work="yes"
1627   AC_TRY_COMPILE([$configure_static_assert_macros],
1628                  [CONFIGURE_STATIC_ASSERT(1)],
1629                  ,
1630                  ac_cv_static_assertion_macros_work="no")
1631   AC_TRY_COMPILE([$configure_static_assert_macros],
1632                  [CONFIGURE_STATIC_ASSERT(0)],
1633                  ac_cv_static_assertion_macros_work="no",
1634                  )
1635   AC_LANG_CPLUSPLUS
1636   AC_TRY_COMPILE([$configure_static_assert_macros],
1637                  [CONFIGURE_STATIC_ASSERT(1)],
1638                  ,
1639                  ac_cv_static_assertion_macros_work="no")
1640   AC_TRY_COMPILE([$configure_static_assert_macros],
1641                  [CONFIGURE_STATIC_ASSERT(0)],
1642                  ac_cv_static_assertion_macros_work="no",
1643                  )
1644   AC_LANG_RESTORE
1645  ])
1646 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1647 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1648     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1650 fi # COMPILE_ENVIRONMENT
1652 dnl ========================================================
1653 dnl Checking for 64-bit OS
1654 dnl ========================================================
1655 if test "$COMPILE_ENVIRONMENT"; then
1656 AC_LANG_SAVE
1657 AC_LANG_C
1658 AC_MSG_CHECKING(for 64-bit OS)
1659 AC_TRY_COMPILE([$configure_static_assert_macros],
1660                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1661                result="yes", result="no")
1662 AC_MSG_RESULT("$result")
1663 if test "$result" = "yes"; then
1664     AC_DEFINE(HAVE_64BIT_OS)
1665     HAVE_64BIT_OS=1
1667 AC_SUBST(HAVE_64BIT_OS)
1668 AC_LANG_RESTORE
1669 fi # COMPILE_ENVIRONMENT
1671 dnl ========================================================
1672 dnl Enable high-memory support on OS/2 by default.
1673 dnl ========================================================
1674 MOZ_OS2_HIGH_MEMORY=1
1675 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1676 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1677     MOZ_OS2_HIGH_MEMORY=,
1678     MOZ_OS2_HIGH_MEMORY=1 )
1679 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1681 dnl ========================================================
1682 dnl System overrides of the defaults for host
1683 dnl ========================================================
1684 case "$host" in
1685 *-beos*)
1686     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1687     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1688     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1689     ;;
1691 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1692     # we need Python 2.5 on Windows
1693     PYTHON_VERSION=2.5
1694     if test -n "$_WIN32_MSVC"; then
1695         HOST_AR=lib
1696         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1697         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1698         HOST_RANLIB='echo ranlib'
1699     else
1700         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1701     fi
1702     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1703     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1704     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1705     HOST_BIN_SUFFIX=.exe
1706     case "$host" in
1707     *mingw*)
1708     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1709         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1710         ;;
1711     *)
1712         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1713         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1714             _pwd=`pwd`
1715             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1716         fi
1717         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1718             AS_PERL=1
1719             PERL="${CYGWIN_WRAPPER} $PERL"
1720         fi
1722         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1723             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1724         fi
1725         ;;
1726     esac
1728     case "${host_cpu}" in
1729     x86_64)
1730         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1731         ;;
1732     esac
1733     ;;
1735 *-darwin*)
1736     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1737     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1738     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1739     ;;
1741 *-linux*|*-kfreebsd*-gnu)
1742     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1743     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1744     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1745     ;;
1747 *os2*)
1748     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1749     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1750     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1751     HOST_BIN_SUFFIX=.exe
1752     MOZ_FIX_LINK_PATHS=
1753     ;;
1755 *-osf*)
1756     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1757     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1758     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1759     ;;
1762     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1763     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1764     ;;
1765 esac
1767 dnl We require version 2.4 or newer of Python to build,
1768 dnl and 2.5 or newer on Windows.
1769 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1770 changequote(,)
1771 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1772 _python_res=$?
1773 changequote([,])
1774 if test "$_python_res" != 0; then
1775     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1777 AC_MSG_RESULT([yes])
1779 dnl Get mozilla version from central milestone file
1780 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1782 dnl Get version of various core apps from the version files.
1783 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1785 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1786 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1788 dnl ========================================================
1789 dnl System overrides of the defaults for target
1790 dnl ========================================================
1792 case "$target" in
1793 *-aix*)
1794     AC_DEFINE(AIX)
1795     if test ! "$GNU_CC"; then
1796         if test ! "$HAVE_64BIT_OS"; then
1797             # Compiling with Visual Age C++ object model compat is the
1798             # default. To compile with object model ibm, add 
1799             # AIX_OBJMODEL=ibm to .mozconfig.
1800             if test "$AIX_OBJMODEL" = "ibm"; then
1801                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1802             else
1803                 AIX_OBJMODEL=compat
1804             fi
1805         else
1806             AIX_OBJMODEL=compat
1807         fi
1808         AC_SUBST(AIX_OBJMODEL)
1809         DSO_LDOPTS='-qmkshrobj=1'
1810         DSO_CFLAGS='-qflag=w:w'
1811         DSO_PIC_CFLAGS=
1812         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1813         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1814         MOZ_FIX_LINK_PATHS=
1815         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1816         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1817         if test "$COMPILE_ENVIRONMENT"; then
1818             AC_LANG_SAVE
1819             AC_LANG_CPLUSPLUS
1820             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1821             AC_TRY_COMPILE([],
1822                 [#if (__IBMCPP__ < 600)
1823                  #error "Bad compiler"
1824                  #endif],
1825                 _BAD_COMPILER=,_BAD_COMPILER=1)
1826             if test -n "$_BAD_COMPILER"; then
1827                 AC_MSG_RESULT([no])    
1828                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1829             else
1830                 AC_MSG_RESULT([yes])    
1831             fi
1832             AC_LANG_RESTORE
1833             TARGET_COMPILER_ABI="ibmc"
1834             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1835             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1836         fi
1837     fi
1838     case "${target_os}" in
1839     aix4.1*)
1840         DLL_SUFFIX='_shr.a'
1841         ;;
1842     esac
1843     if test "$COMPILE_ENVIRONMENT"; then
1844         AC_CHECK_HEADERS(sys/inttypes.h)
1845     fi
1846     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1847     ;;
1849 *-beos*)
1850     no_x=yes
1851     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1852     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1853     DSO_LDOPTS='-nostart'
1854     TK_LIBS='-lbe -lroot'
1855     LIBS="$LIBS -lbe"
1856     if test "$COMPILE_ENVIRONMENT"; then
1857         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1858         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1859     fi
1860     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1861     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1862     _MOZ_USE_RTTI=1
1863     USE_DEPENDENT_LIBS=
1864     MOZ_USER_DIR="Mozilla"
1865     ;;
1867 *-bsdi*)
1868     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1869     _PEDANTIC=
1870     _IGNORE_LONG_LONG_WARNINGS=
1871     case $OS_RELEASE in
1872         4.*|5.*)
1873             STRIP="$STRIP -d"
1874             ;;
1875         *)
1876             DSO_CFLAGS=''
1877             DSO_LDOPTS='-r'
1878             _WARNINGS_CFLAGS="-Wall"
1879             _WARNINGS_CXXFLAGS="-Wall"
1880             # The test above doesn't work properly, at least on 3.1.
1881             MKSHLIB_FORCE_ALL=''
1882             MKSHLIB_UNFORCE_ALL=''
1883         ;;
1884     esac
1885     ;;
1887 *-darwin*) 
1888     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1889     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1890     MOZ_OPTIMIZE_FLAGS="-O3"
1891     _PEDANTIC=
1892     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1893     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1894     DLL_SUFFIX=".dylib"
1895     DSO_LDOPTS=''
1896     STRIP="$STRIP -x -S"
1897     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1898     MOZ_ENABLE_POSTSCRIPT=
1899     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1900     # The ExceptionHandling framework is needed for Objective-C exception
1901     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1902     # builds.
1903     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1905     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1906     dnl ===================================================================
1907     if test "x$enable_dtrace" = "xyes"; then
1908         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1909     else
1910         dnl check for the presence of the -dead_strip linker flag
1911         AC_MSG_CHECKING([for -dead_strip option to ld])
1912         _SAVE_LDFLAGS=$LDFLAGS
1913         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1914         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1915         if test -n "$_HAVE_DEAD_STRIP" ; then
1916             AC_MSG_RESULT([yes])
1917             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1918         else
1919             AC_MSG_RESULT([no])
1920         fi
1921         
1922         LDFLAGS=$_SAVE_LDFLAGS
1923     fi
1924     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1925     ;;
1927 *-freebsd*)
1928     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1929         DLL_SUFFIX=".so.1.0"
1930         DSO_LDOPTS="-shared"
1931     fi
1932     if test ! "$GNU_CC"; then
1933         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1934     fi
1935 # Can't have force w/o an unforce.
1936 #    # Hack for FreeBSD 2.2
1937 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1938 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1939 #       MKSHLIB_UNFORCE_ALL=''
1940 #    fi
1941     ;; 
1943 *-hpux*)
1944     DLL_SUFFIX=".sl"
1945     if test ! "$GNU_CC"; then
1946         DSO_LDOPTS='-b -Wl,+s'
1947         DSO_CFLAGS=""
1948         DSO_PIC_CFLAGS="+Z"
1949         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1950         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1951         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1952     else
1953         DSO_LDOPTS='-b -E +s'
1954         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1955         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1956     fi
1957     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1958     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1959     ;;
1961 *-irix5*)
1962     AC_DEFINE(IRIX)
1963     DSO_LDOPTS='-elf -shared'
1965     if test "$GNU_CC"; then
1966        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1967        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1968        MKSHLIB_FORCE_ALL='-Wl,-all'
1969        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1970        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1971     else
1972        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1973        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1974        MKSHLIB_FORCE_ALL='-all'
1975        MKSHLIB_UNFORCE_ALL='-none'
1976     fi
1977     ;;
1979 *-irix6*)
1980     AC_DEFINE(IRIX)
1981     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1982     dnl compile and link using -n32
1983     USE_N32=1
1984     TARGET_COMPILER_ABI=n32
1985     DSO_LDOPTS='-elf -shared'
1986     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1987     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1988     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1989     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1990     if test "$GNU_CC"; then
1991        MKSHLIB_FORCE_ALL='-Wl,-all'
1992        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1993        _WARNINGS_CFLAGS="-Wall"
1994        _WARNINGS_CXXFLAGS="-Wall"
1995        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1996     else
1997        MKSHLIB_FORCE_ALL='-all'
1998        MKSHLIB_UNFORCE_ALL='-none'
1999            AR_LIST="$AR t"
2000            AR_EXTRACT="$AR x"
2001            AR_DELETE="$AR d"
2002            AR='$(CXX) -ar'
2003            AR_FLAGS='-o $@'
2004        CFLAGS="$CFLAGS -woff 3262 -G 4"
2005        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2006        if test -n "$USE_N32"; then
2007            ASFLAGS="$ASFLAGS -n32"
2008            CFLAGS="$CFLAGS -n32"
2009            CXXFLAGS="$CXXFLAGS -n32"
2010            LDFLAGS="$LDFLAGS -n32"
2011        fi
2012        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2013        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2014        MOZ_FIX_LINK_PATHS=
2015     fi
2016     if test -z "$GNU_CXX"; then
2017       MIPSPRO_CXX=1
2018     fi
2019     ;;
2021 *-*linux*)
2022     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2023     # Similarly for GNU_CXX and INTEL_CXX.
2024     if test "$INTEL_CC" || test "$INTEL_CXX"; then
2025         # -Os has been broken on Intel's C/C++ compilers for quite a
2026         # while; Intel recommends against using it.
2027         MOZ_OPTIMIZE_FLAGS="-O2"
2028         MOZ_DEBUG_FLAGS="-g"
2029     elif test "$GNU_CC" || test "$GNU_CXX"; then
2030         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2031         case $GCC_VERSION in
2032         4.1.*|4.2.*)
2033             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2034             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2035         esac
2036         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2037         MOZ_DEBUG_FLAGS="-g"
2038     fi
2040     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2042     MOZ_MEMORY=1
2044     case "${target_cpu}" in
2045     alpha*)
2046         CFLAGS="$CFLAGS -mieee"
2047         CXXFLAGS="$CXXFLAGS -mieee"
2048     ;;
2049     i*86)
2050         USE_ELF_DYNSTR_GC=1
2051     ;;
2052     mips*)
2053         MOZ_DEBUG_FLAGS="-g" # We want inlining
2054     ;;
2055     esac
2056     ;;
2058 *-wince*|*-winmo*)
2059     TARGET_COMPILER_ABI=msvc
2060     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2061     _PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
2062     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2063     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2064     AR_LIST="$AR -list"
2065     AR_EXTRACT="$AR -extract"
2066     AR_DELETE="$AR d"
2067     AR_FLAGS='-OUT:"$@"'
2068     MOZ_MEMORY=1
2069     NSS_DISABLE_DBM=1
2070     MOZ_OGG=
2071     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2073     if test "$AS_BIN"; then
2074         AS="$AS_BIN"
2075     fi
2076     DSO_CFLAGS=
2077     DSO_PIC_CFLAGS=
2078     DLL_SUFFIX=.dll
2079     BIN_SUFFIX='.exe'
2080     if test -z "$RC"; then 
2081         RC=rc.exe  
2082     fi
2083     # certain versions of cygwin's makedepend barf on the 
2084     # #include <string> vs -I./dist/include/string issue so don't use it
2085     SYSTEM_MAKEDEPEND=
2087     HOST_CC=cl
2088     HOST_CXX=cl
2089     HOST_LD=link
2090     HOST_AR='lib -OUT:$@'
2091     HOST_RANLIB='echo ranlib'
2092     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2093         
2094         
2095     WARNINGS_AS_ERRORS='-WX'
2096     MOZ_OPTIMIZE_FLAGS='-Ox'
2097     AR_FLAGS='-NOLOGO -OUT:"$@"'
2098     ASM_SUFFIX=asm
2099     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2100     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2101     DLL_PREFIX=
2102     DOXYGEN=:
2103     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2104     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2105     GARBAGE=
2106     IMPORT_LIB_SUFFIX=lib
2107     dnl Need to force-link against mozalloc because it's used in the shunt
2108     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2109     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2110     LIB_PREFIX=
2111     LIB_SUFFIX=lib 
2112     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2113     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2114     MKSHLIB_FORCE_ALL=
2115     MKSHLIB_UNFORCE_ALL=
2116     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2117     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2118     MOZ_DEBUG_FLAGS='-Zi'
2119     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2120     MOZ_FIX_LINK_PATHS=
2121     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2122     OBJ_SUFFIX=obj
2123     RANLIB='echo not_ranlib'
2124     STRIP='echo not_strip'
2125     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2126     UNZIP=unzip
2127     XARGS=xargs
2128     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2129     ZIP=zip
2130     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2131     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2132     STATIC_LIBIDL=1
2133     MOZ_TREE_FREETYPE=1
2135     AC_DEFINE(HAVE_SNPRINTF)
2136     AC_DEFINE(_WINDOWS)
2137     AC_DEFINE(WIN32)
2138     AC_DEFINE(XP_WIN)
2139     AC_DEFINE(XP_WIN32)
2140     AC_DEFINE(HW_THREADS)
2141     AC_DEFINE(STDC_HEADERS)
2142     AC_DEFINE(NEW_H, <new>)
2143     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2144     AC_DEFINE(HAVE_LOCALTIME_R)
2146     TARGET_MD_ARCH=win32
2147     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2148     BIN_SUFFIX='.exe'
2149     MOZ_ENABLE_POSTSCRIPT=
2150     MOZ_USER_DIR="Mozilla"
2152     MOZ_GFX_OPTIMIZE_MOBILE=1
2154     # Sanity check for WINCE_WINDOWS_MOBILE
2155     # XXX disabled until we can fix the mobile tinderbox
2156     ##if test "$WINCE_WINDOWS_MOBILE"; then
2157     ##   AC_CHECK_HEADER(tpcshell.h, [],
2158     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2159     ##fi
2163 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2164     DSO_CFLAGS=
2165     DSO_PIC_CFLAGS=
2166     DLL_SUFFIX=.dll
2167     RC=rc.exe
2168     # certain versions of cygwin's makedepend barf on the 
2169     # #include <string> vs -I./dist/include/string issue so don't use it
2170     SYSTEM_MAKEDEPEND=
2171     if test -n "$GNU_CC"; then
2172         CC="$CC -mno-cygwin"
2173         CXX="$CXX -mno-cygwin"
2174         CPP="$CPP -mno-cygwin"
2175         CFLAGS="$CFLAGS -mms-bitfields"
2176         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2177         DSO_LDOPTS='-shared'
2178         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2179         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2180         RC='$(WINDRES)'
2181         # Use temp file for windres (bug 213281)
2182         RCFLAGS='-O coff --use-temp-file'
2183         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2184         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2185         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2186         MOZ_FIX_LINK_PATHS=
2187         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2188         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2189         DLL_PREFIX=
2190         IMPORT_LIB_SUFFIX=dll.a
2191     else
2192         TARGET_COMPILER_ABI=msvc
2193         HOST_CC='$(CC)'
2194         HOST_CXX='$(CXX)'
2195         HOST_LD='$(LD)'
2196         if test "$AS_BIN"; then
2197             AS="$(basename "$AS_BIN")"
2198         fi
2199         AR='lib -NOLOGO -OUT:"$@"'
2200         AR_FLAGS=
2201         RANLIB='echo not_ranlib'
2202         STRIP='echo not_strip'
2203         XARGS=xargs
2204         ZIP=zip
2205         UNZIP=unzip
2206         DOXYGEN=:
2207         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2208         ASM_SUFFIX=asm
2209         OBJ_SUFFIX=obj
2210         LIB_SUFFIX=lib
2211         DLL_PREFIX=
2212         LIB_PREFIX=
2213         IMPORT_LIB_SUFFIX=lib
2214         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2215         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2216         MKSHLIB_FORCE_ALL=
2217         MKSHLIB_UNFORCE_ALL=
2218         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2219         _USE_CPP_INCLUDE_FLAG=1
2220         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2221         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2222         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2223         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2224         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2225         MOZ_DEBUG_FLAGS='-Zi'
2226         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2227         WARNINGS_AS_ERRORS='-WX'
2228         MOZ_OPTIMIZE_FLAGS='-O1'
2229         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2230         MOZ_FIX_LINK_PATHS=
2231         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2232         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2233         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2234         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2235         if test $_MSC_VER -ge 1400; then
2236             LDFLAGS="$LDFLAGS -NXCOMPAT"
2237             dnl For profile-guided optimization
2238             PROFILE_GEN_CFLAGS="-GL"
2239             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2240             dnl XXX: PGO builds can fail with warnings treated as errors,
2241             dnl specifically "no profile data available" appears to be
2242             dnl treated as an error sometimes. This might be a consequence
2243             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2244             dnl with the linker doing most of the work in the whole-program
2245             dnl optimization/PGO case. I think it's probably a compiler bug,
2246             dnl but we work around it here.
2247             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2248             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2249             dnl Probably also a compiler bug, but what can you do?
2250             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2251             if test -n "$_USE_DYNAMICBASE"; then
2252                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2253             fi
2254         fi
2255     fi
2256     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2257     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2258     AC_DEFINE(HAVE_SNPRINTF)
2259     AC_DEFINE(_WINDOWS)
2260     AC_DEFINE(WIN32)
2261     AC_DEFINE(XP_WIN)
2262     AC_DEFINE(XP_WIN32)
2263     AC_DEFINE(HW_THREADS)
2264     AC_DEFINE(STDC_HEADERS)
2265     AC_DEFINE(NEW_H, <new>)
2266     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2267     TARGET_MD_ARCH=win32
2268     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2269     BIN_SUFFIX='.exe'
2270     MOZ_ENABLE_POSTSCRIPT=
2271     MOZ_USER_DIR="Mozilla"
2273     dnl Hardcode to win95 for now - cls
2274     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2276     dnl set NO_X11 defines here as the general check is skipped on win32
2277     no_x=yes
2278     AC_DEFINE(NO_X11)
2280     dnl MinGW/MSYS doesn't provide or need cygpath
2281     case "$host" in
2282     *-mingw*)
2283         CYGPATH_W=echo
2284         CYGPATH_S=cat
2285         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2286         ;;
2287     *-cygwin*|*-msvc*|*-mks*)
2288         CYGPATH_W="cygpath -a -w"
2289         CYGPATH_S="sed -e s|\\\\|/|g"
2290         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2291         ;;
2292     esac
2293     case "$host" in
2294     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2296     if test -z "$MOZ_TOOLS"; then
2297         AC_MSG_ERROR([MOZ_TOOLS is not set])
2298     fi
2300     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2301     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2302         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2303     fi
2304     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2305     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2306         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2307     fi
2308     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2310     if test -n "$GLIB_PREFIX"; then
2311         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2312         if test "$?" = "0"; then
2313             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2314                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2315             fi
2316             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2317         else
2318             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2319         fi
2320     else
2321         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2322     fi
2323     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2324         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2325     fi
2326     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2327     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2328         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2329     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2330         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2331     else
2332         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2333     fi
2335     if test -n "$LIBIDL_PREFIX"; then
2336         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2337         if test "$?" = "0"; then
2338             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2339                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2340             fi
2341             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2342         else
2343             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2344         fi
2345     else
2346         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2347     fi        
2348     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2349         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2350     fi
2351     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2352     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2353         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2354         STATIC_LIBIDL=1
2355     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2356         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2357     else
2358         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2359     fi
2360     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2361     ;;
2363     *) # else cross-compiling
2364         if test -n "$GLIB_PREFIX"; then
2365             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2366             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2367                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2368             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2369                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2370             else
2371                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2372             fi
2373         fi
2374         if test -n "$LIBIDL_PREFIX"; then
2375             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2376             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2377                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2378                 STATIC_LIBIDL=1
2379             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2380                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2381             else
2382                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2383             fi
2384         fi
2385         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2386         ;;
2387     esac 
2390     case "$host_os" in
2391     cygwin*|msvc*|mks*)
2392         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])
2393         ;;
2395     *)
2396         AC_CHECK_HEADERS(oleacc.idl)
2398         AC_LANG_SAVE
2399         AC_LANG_CPLUSPLUS
2400         AC_CHECK_HEADERS(atlbase.h)
2401         AC_LANG_RESTORE
2402         ;;
2403     esac
2405     case "$target" in
2406     i*86-*)
2407         if test "$HAVE_64BIT_OS"; then
2408             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2409         fi
2411         if test $_MSC_VER -ge 1400; then
2412             LDFLAGS="$LDFLAGS -SAFESEH"
2413         fi
2414         AC_CHECK_HEADERS(mmintrin.h)
2415         AC_DEFINE(_X86_)
2416         ;;
2417     alpha-*)
2418         AC_DEFINE(_ALPHA_)
2419         ;;
2420     mips-*)
2421         AC_DEFINE(_MIPS_)
2422         ;;
2423     x86_64-*)
2424         AC_DEFINE(_AMD64_)
2425         ;;
2426     *)
2427         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2428         ;;
2429     esac
2431     if test "$HAVE_64BIT_OS"; then
2432         AC_DEFINE(_WIN64)
2433     fi
2434     ;;
2436 *-netbsd*)
2437     DSO_CFLAGS=''
2438     CFLAGS="$CFLAGS -Dunix"
2439     CXXFLAGS="$CXXFLAGS -Dunix"
2440     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2441         DLL_SUFFIX=".so"
2442         DSO_PIC_CFLAGS='-fPIC -DPIC'
2443         DSO_LDOPTS='-shared'
2444         BIN_FLAGS='-Wl,--export-dynamic'
2445     else
2446         DSO_PIC_CFLAGS='-fPIC -DPIC'
2447         DLL_SUFFIX=".so.1.0"
2448         DSO_LDOPTS='-shared'
2449     fi
2450     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2451     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2452     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2453     if test "$LIBRUNPATH"; then
2454         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2455     fi
2456     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2457     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2458     ;;
2460 *-nto*) 
2461         AC_DEFINE(NTO)  
2462         AC_DEFINE(_QNX_SOURCE)
2463         AC_DEFINE(_i386)
2464         OS_TARGET=NTO
2465         WARNINGS_AS_ERRORS=''
2466         MOZ_OPTIMIZE_FLAGS="-O"
2467         MOZ_DEBUG_FLAGS="-gstabs"
2468         USE_PTHREADS=1
2469         _PEDANTIC=
2470         LIBS="$LIBS -lsocket -lstdc++"
2471         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2472         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2473         if test "$with_x" != "yes"
2474         then
2475                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2476             TK_CFLAGS='-I/usr/include/photon'
2477                 TK_LIBS='-lph'
2478         fi
2479         case "${target_cpu}" in
2480         ppc*)
2481         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2482         ;;
2483         esac
2484         case "${host_cpu}" in
2485         i*86)
2486         USE_ELF_DYNSTR_GC=1
2487         ;;
2488         esac
2489         ;;
2491 *-openbsd*)
2492     DLL_SUFFIX=".so.1.0"
2493     DSO_CFLAGS=''
2494     DSO_PIC_CFLAGS='-fPIC'
2495     DSO_LDOPTS='-shared -fPIC'
2496     if test "$LIBRUNPATH"; then
2497         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2498     fi
2499     ;;
2501 *-openvms*) 
2502     AC_DEFINE(NO_PW_GECOS)
2503     AC_DEFINE(NO_UDSOCK)
2504     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2505     USE_PTHREADS=1
2506     MKSHLIB_FORCE_ALL='-all'
2507     MKSHLIB_UNFORCE_ALL='-none'
2508     AS='as'
2509     AS_DASH_C_FLAG='-Wc/names=as_is'
2510     AR_FLAGS='c $@'
2511     DSO_LDOPTS='-shared -auto_symvec'
2512     DSO_PIC_CFLAGS=
2513     MOZ_DEBUG_LDFLAGS='-g'
2514     COMPAQ_CXX=1
2515     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2516     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2517     ;;
2520 *-os2*)
2521     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2522     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2523     AC_DEFINE(OS2)
2524     AC_DEFINE(XP_OS2)
2525     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2526     AC_DEFINE(TCPV40HDRS)
2527     DLL_PREFIX=
2528     LIB_PREFIX=
2529     LIB_SUFFIX=lib
2530     BIN_SUFFIX=".exe"
2531     DLL_SUFFIX=".dll"
2532     IMPORT_LIB_SUFFIX=lib
2533     DSO_PIC_CFLAGS=
2534     AR=emxomfar
2535     AR_FLAGS='r $@'
2536     CFLAGS="$CFLAGS -Zomf"
2537     CXXFLAGS="$CXXFLAGS -Zomf"
2538     DSO_LDOPTS='-Zdll'
2539     BIN_FLAGS='-Zlinker /ST:0x100000'
2540     IMPLIB='emximp -o'
2541     FILTER='emxexp -o'
2542     LDFLAGS='-Zmap'
2543     WARNINGS_AS_ERRORS='-Werror'
2544     MOZ_DEBUG_FLAGS="-g -fno-inline"
2545     MOZ_OPTIMIZE_FLAGS="-O2"
2546     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2547     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2548     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2549     TARGET_MD_ARCH=os2
2550     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2551     MOZ_ENABLE_POSTSCRIPT=
2552     RC=rc.exe
2553     RCFLAGS='-n'
2554     MOZ_USER_DIR="Mozilla"
2556     if test "$MOZTOOLS"; then
2557         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2558     else
2559         AC_MSG_ERROR([MOZTOOLS is not set])
2560     fi
2561     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2562         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2563         LDFLAGS="$LDFLAGS -Zhigh-mem"
2564         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2565         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2566     fi
2568     # GCC for OS/2 currently predefines these, but we don't want them
2569     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2570     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2572     AC_CACHE_CHECK(for __declspec(dllexport),
2573         ac_os2_declspec,
2574         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2575                         [return 0;],
2576                         ac_os2_declspec="yes",
2577                         ac_os2_declspec="no")])
2578     if test "$ac_os2_declspec" = "yes"; then
2579         FILTER='true'
2580         MOZ_OS2_USE_DECLSPEC='1'
2581     fi
2582     ;;
2584 alpha*-*-osf*)
2585     if test "$GNU_CC"; then
2586       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2587       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2589     else
2590         MOZ_DEBUG_FLAGS='-g'
2591         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2592         CFLAGS="$CFLAGS -ieee"
2593         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2594         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2595         DSO_CFLAGS=
2596         DSO_PIC_CFLAGS=
2597         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2598         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2599         MKSHLIB_FORCE_ALL='-all'
2600         MKSHLIB_UNFORCE_ALL='-none'
2601         dnl Might fix the libxpcom.so breakage on this platform as well....
2602         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2603         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2604     fi
2605     if test -z "$GNU_CXX"; then
2606       COMPAQ_CXX=1
2607     fi
2608     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2609     ;;
2611 *-qnx*) 
2612     DIRENT_INO=d_stat.st_ino
2613     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2614     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2615     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2616     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2617     AC_DEFINE(STDC_HEADERS)
2618     if test "$no_x" = "yes"; then
2619             _PLATFORM_DEFAULT_TOOLKIT='photon'
2620             TK_CFLAGS='-I/usr/nto/include/photon'
2621             TK_LIBS='-lphoton -lphrender'
2622     fi
2623     ;;
2625 *-sco*) 
2626     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2627     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2628     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2629     if test ! "$GNU_CC"; then
2630        DSO_LDOPTS='-G'
2631     fi
2632     ;;
2634 *-solaris*) 
2635     AC_DEFINE(SOLARIS)
2636     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2637     SYSTEM_MAKEDEPEND=
2638     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2639     # libraries one level up (e.g. libnspr4.so)
2640     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2641     MOZ_MEMORY=1
2642     if test "$SOLARIS_SUNPRO_CC"; then
2643        LIBS="-lCrun -lCstd $LIBS"
2644        NS_USE_NATIVE=1
2645        MOZ_FIX_LINK_PATHS=
2646        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2647        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2648        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
2649        _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2650        _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2651        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2652        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2653            _SAVE_LDFLAGS=$LDFLAGS
2654            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2655            AC_TRY_LINK([#include <stdio.h>],
2656                        [printf("Hello World\n");],
2657                        ,
2658                        [LDFLAGS=$_SAVE_LDFLAGS])
2659        fi
2660        WARNINGS_AS_ERRORS='-Werror'
2661        MOZ_OPTIMIZE_FLAGS="-xO4"
2662        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2663        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2664        MKSHLIB_FORCE_ALL='-z allextract'
2665        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2666        DSO_LDOPTS='-G -z muldefs'
2667        AR_LIST="$AR t"
2668        AR_EXTRACT="$AR x"
2669        AR_DELETE="$AR d"
2670        AR='$(CXX) -xar'
2671        AR_FLAGS='-o $@'
2672        AS='/usr/ccs/bin/as'
2673        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2674        AS_DASH_C_FLAG=''
2675        TARGET_COMPILER_ABI="sunc"
2676        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2677        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2678        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2679        AC_LANG_SAVE
2680        AC_LANG_CPLUSPLUS
2681        AC_TRY_COMPILE([],
2682            [#if (__SUNPRO_CC < 0x590)
2683            #error "Denied"
2684            #endif],
2685            _BAD_COMPILER=,_BAD_COMPILER=1)
2686         if test -n "$_BAD_COMPILER"; then
2687             _res="no"
2688             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2689         else
2690             _res="yes"
2691         fi
2692         AC_MSG_RESULT([$_res])
2693         AC_LANG_RESTORE
2694     else
2695        ASFLAGS="$ASFLAGS -fPIC"
2696        DSO_LDOPTS='-G'
2697        _WARNINGS_CFLAGS=''
2698        _WARNINGS_CXXFLAGS=''
2699        if test "$OS_RELEASE" = "5.3"; then
2700           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2701        fi
2702     fi
2703     if test "$OS_RELEASE" = "5.5.1"; then
2704        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2705     fi
2706     ;;
2708 *-sunos*) 
2709     DSO_LDOPTS='-Bdynamic'
2710     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2711     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2712     AC_DEFINE(SUNOS4)
2713     AC_DEFINE(SPRINTF_RETURNS_STRING)
2714     case "$(target_os)" in
2715     sunos4.1*)
2716         DLL_SUFFIX='.so.1.0'
2717         ;;
2718     esac
2719     ;;
2721 *-sysv4.2uw7*) 
2722         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2723     ;;
2725 *-os2*)
2726     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2727     ;;
2729 esac
2731 dnl Only one oddball right now (QNX), but this gives us flexibility
2732 dnl if any other platforms need to override this in the future.
2733 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2735 dnl ========================================================
2736 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2737 dnl by now will not have any way to link most binaries (tests
2738 dnl as well as viewer, apprunner, etc.), because some symbols
2739 dnl will be left out of the "composite" .so's by ld as unneeded.
2740 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2741 dnl they can link in the static libs that provide the missing
2742 dnl symbols.
2743 dnl ========================================================
2744 NO_LD_ARCHIVE_FLAGS=
2745 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2746     NO_LD_ARCHIVE_FLAGS=1
2748 case "$target" in
2749 *-os2*)
2750     NO_LD_ARCHIVE_FLAGS=
2751     ;;
2752 *-aix4.3*|*-aix5*)
2753     NO_LD_ARCHIVE_FLAGS=
2754     ;;
2755 *-openvms*)
2756     NO_LD_ARCHIVE_FLAGS=
2757     ;;
2758 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2759     if test -z "$GNU_CC"; then
2760         NO_LD_ARCHIVE_FLAGS=
2761     fi
2762     ;;
2763 esac
2764 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2766 dnl ========================================================
2767 dnl = Flags to strip unused symbols from .so components
2768 dnl ========================================================
2769 case "$target" in
2770     *-linux*|*-kfreebsd*-gnu)
2771         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2772         ;;
2773     *-solaris*)
2774         if test -z "$GNU_CC"; then
2775          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2776         else
2777          if test -z "$GCC_USE_GNU_LD"; then
2778           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2779          else
2780           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2781          fi
2782         fi
2783         ;;
2784     *-nto*) 
2785         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2786         ;;
2787     *-darwin*)
2788         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2789         ;;
2790     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2791         if test -n "$GNU_CC"; then
2792            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2793         fi
2794         ;;
2795 esac
2797 if test -z "$COMPILE_ENVIRONMENT"; then
2798     SKIP_COMPILER_CHECKS=1
2799     SKIP_LIBRARY_CHECKS=1
2802 if test -z "$SKIP_COMPILER_CHECKS"; then
2803 dnl Checks for typedefs, structures, and compiler characteristics.
2804 dnl ========================================================
2805 AC_LANG_C
2806 AC_HEADER_STDC
2807 AC_C_CONST
2808 AC_TYPE_MODE_T
2809 AC_TYPE_OFF_T
2810 AC_TYPE_PID_T
2811 AC_TYPE_SIZE_T
2812 AC_MSG_CHECKING(for ssize_t)
2813 AC_CACHE_VAL(ac_cv_type_ssize_t,
2814  [AC_TRY_COMPILE([#include <stdio.h>
2815                   #include <sys/types.h>],
2816                  [ssize_t foo = 0;],
2817                  [ac_cv_type_ssize_t=true],
2818                  [ac_cv_type_ssize_t=false])])
2819 if test "$ac_cv_type_ssize_t" = true ; then
2820   AC_DEFINE(HAVE_SSIZE_T)
2821   AC_MSG_RESULT(yes)
2822 else
2823   AC_MSG_RESULT(no)
2825 AC_STRUCT_ST_BLKSIZE
2826 AC_MSG_CHECKING(for siginfo_t)
2827 AC_CACHE_VAL(ac_cv_siginfo_t,
2828  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2829                   #include <signal.h>],
2830                  [siginfo_t* info;],
2831                  [ac_cv_siginfo_t=true],
2832                  [ac_cv_siginfo_t=false])])
2833 if test "$ac_cv_siginfo_t" = true ; then
2834   AC_DEFINE(HAVE_SIGINFO_T)
2835   AC_MSG_RESULT(yes)
2836 else
2837   AC_MSG_RESULT(no)
2840 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2841 dnl ========================================================
2842 AC_MSG_CHECKING(for int16_t)
2843 AC_CACHE_VAL(ac_cv_int16_t,
2844  [AC_TRY_COMPILE([#include <stdio.h>
2845                   #include <sys/types.h>],
2846                  [int16_t foo = 0;],
2847                  [ac_cv_int16_t=true],
2848                  [ac_cv_int16_t=false])])
2849 if test "$ac_cv_int16_t" = true ; then
2850   AC_DEFINE(HAVE_INT16_T)
2851   AC_MSG_RESULT(yes)
2852 else
2853   AC_MSG_RESULT(no)
2855 AC_MSG_CHECKING(for int32_t)
2856 AC_CACHE_VAL(ac_cv_int32_t,
2857  [AC_TRY_COMPILE([#include <stdio.h>
2858                   #include <sys/types.h>],
2859                  [int32_t foo = 0;],
2860                  [ac_cv_int32_t=true],
2861                  [ac_cv_int32_t=false])])
2862 if test "$ac_cv_int32_t" = true ; then
2863   AC_DEFINE(HAVE_INT32_T)
2864   AC_MSG_RESULT(yes)
2865 else
2866   AC_MSG_RESULT(no)
2868 AC_MSG_CHECKING(for int64_t)
2869 AC_CACHE_VAL(ac_cv_int64_t,
2870  [AC_TRY_COMPILE([#include <stdio.h>
2871                   #include <sys/types.h>],
2872                  [int64_t foo = 0;],
2873                  [ac_cv_int64_t=true],
2874                  [ac_cv_int64_t=false])])
2875 if test "$ac_cv_int64_t" = true ; then
2876   AC_DEFINE(HAVE_INT64_T)
2877   AC_MSG_RESULT(yes)
2878 else
2879   AC_MSG_RESULT(no)
2881 AC_MSG_CHECKING(for int64)
2882 AC_CACHE_VAL(ac_cv_int64,
2883  [AC_TRY_COMPILE([#include <stdio.h>
2884                   #include <sys/types.h>],
2885                  [int64 foo = 0;],
2886                  [ac_cv_int64=true],
2887                  [ac_cv_int64=false])])
2888 if test "$ac_cv_int64" = true ; then
2889   AC_DEFINE(HAVE_INT64)
2890   AC_MSG_RESULT(yes)
2891 else
2892   AC_MSG_RESULT(no)
2894 AC_MSG_CHECKING(for uint)
2895 AC_CACHE_VAL(ac_cv_uint,
2896  [AC_TRY_COMPILE([#include <stdio.h>
2897                   #include <sys/types.h>],
2898                  [uint foo = 0;],
2899                  [ac_cv_uint=true],
2900                  [ac_cv_uint=false])])
2901 if test "$ac_cv_uint" = true ; then
2902   AC_DEFINE(HAVE_UINT)
2903   AC_MSG_RESULT(yes)
2904 else
2905   AC_MSG_RESULT(no)
2907 AC_MSG_CHECKING(for uint_t)
2908 AC_CACHE_VAL(ac_cv_uint_t,
2909  [AC_TRY_COMPILE([#include <stdio.h>
2910                   #include <sys/types.h>],
2911                  [uint_t foo = 0;],
2912                  [ac_cv_uint_t=true],
2913                  [ac_cv_uint_t=false])])
2914 if test "$ac_cv_uint_t" = true ; then
2915   AC_DEFINE(HAVE_UINT_T)
2916   AC_MSG_RESULT(yes)
2917 else
2918   AC_MSG_RESULT(no)
2920 AC_MSG_CHECKING(for uint16_t)
2921 AC_CACHE_VAL(ac_cv_uint16_t,
2922  [AC_TRY_COMPILE([#include <stdio.h>
2923                   #include <sys/types.h>],
2924                  [uint16_t foo = 0;],
2925                  [ac_cv_uint16_t=true],
2926                  [ac_cv_uint16_t=false])])
2927 if test "$ac_cv_uint16_t" = true ; then
2928   AC_DEFINE(HAVE_UINT16_T)
2929   AC_MSG_RESULT(yes)
2930 else
2931   AC_MSG_RESULT(no)
2934 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2935 dnl are defined when compiling C++ but not C.  Since the result of this
2936 dnl test is used only in C++, do it in C++.
2937 AC_LANG_CPLUSPLUS
2939 AC_MSG_CHECKING(for uname.domainname)
2940 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2941     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2942         [ struct utsname *res; char *domain; 
2943             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2944         [ac_cv_have_uname_domainname_field=true],
2945         [ac_cv_have_uname_domainname_field=false])])
2947 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2948     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2949     AC_MSG_RESULT(yes)
2950 else
2951     AC_MSG_RESULT(no)
2954 AC_MSG_CHECKING(for uname.__domainname)
2955 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2956     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2957         [ struct utsname *res; char *domain; 
2958             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2959         [ac_cv_have_uname_us_domainname_field=true],
2960         [ac_cv_have_uname_us_domainname_field=false])])
2962 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2963     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2964     AC_MSG_RESULT(yes)
2965 else
2966     AC_MSG_RESULT(no)
2969 AC_LANG_CPLUSPLUS
2971 dnl Check for usable char16_t (2 bytes, unsigned)
2972 dnl (we might not need the unsignedness check anymore)
2973 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2974     ac_cv_have_usable_char16_t,
2975     [AC_TRY_COMPILE([$configure_static_assert_macros],
2976                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2977                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2978                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2979                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2980                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2981                     ac_cv_have_usable_char16_t="yes",
2982                     ac_cv_have_usable_char16_t="no")])
2983 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2984     AC_DEFINE(HAVE_CPP_CHAR16_T)
2985     HAVE_CPP_CHAR16_T=1
2988 dnl Check for usable wchar_t (2 bytes, unsigned)
2989 dnl (we really don't need the unsignedness check anymore)
2990 dnl ========================================================
2992 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2993     ac_cv_have_usable_wchar_v2,
2994     [AC_TRY_COMPILE([#include <stddef.h>
2995                      $configure_static_assert_macros],
2996                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2997                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2998                     ac_cv_have_usable_wchar_v2="yes",
2999                     ac_cv_have_usable_wchar_v2="no")])
3000 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3001     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3002     HAVE_CPP_2BYTE_WCHAR_T=1
3003 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3004 dnl This is really gcc-only
3005 dnl Do this test using CXX only since some versions of gcc
3006 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3007 dnl only have short-wchar support for c++.
3008 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3010     _SAVE_CXXFLAGS=$CXXFLAGS
3011     CXXFLAGS="$CXXFLAGS -fshort-wchar"
3013     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
3014         ac_cv_have_usable_wchar_option_v2,
3015         [AC_TRY_LINK([#include <stddef.h>
3016                       $configure_static_assert_macros],
3017                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3018                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3019                      ac_cv_have_usable_wchar_option_v2="yes",
3020                      ac_cv_have_usable_wchar_option_v2="no")])
3022     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3023         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3024         HAVE_CPP_2BYTE_WCHAR_T=1
3025         WCHAR_CFLAGS="-fshort-wchar"
3026     else    
3027         CXXFLAGS=$_SAVE_CXXFLAGS
3028     fi
3031 AC_LANG_C
3033 dnl Check for .hidden assembler directive and visibility attribute.
3034 dnl Borrowed from glibc configure.in
3035 dnl ===============================================================
3036 if test "$GNU_CC"; then
3037   AC_CACHE_CHECK(for visibility(hidden) attribute,
3038                  ac_cv_visibility_hidden,
3039                  [cat > conftest.c <<EOF
3040                   int foo __attribute__ ((visibility ("hidden"))) = 1;
3042                   ac_cv_visibility_hidden=no
3043                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3044                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3045                       ac_cv_visibility_hidden=yes
3046                     fi
3047                   fi
3048                   rm -f conftest.[cs]
3049                  ])
3050   if test "$ac_cv_visibility_hidden" = "yes"; then
3051     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3053     AC_CACHE_CHECK(for visibility(default) attribute,
3054                    ac_cv_visibility_default,
3055                    [cat > conftest.c <<EOF
3056                     int foo __attribute__ ((visibility ("default"))) = 1;
3058                     ac_cv_visibility_default=no
3059                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3060                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3061                         ac_cv_visibility_default=yes
3062                       fi
3063                     fi
3064                     rm -f conftest.[cs]
3065                    ])
3066     if test "$ac_cv_visibility_default" = "yes"; then
3067       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3069       AC_CACHE_CHECK(for visibility pragma support,
3070                      ac_cv_visibility_pragma,
3071                      [cat > conftest.c <<EOF
3072 #pragma GCC visibility push(hidden)
3073                       int foo_hidden = 1;
3074 #pragma GCC visibility push(default)
3075                       int foo_default = 1;
3077                       ac_cv_visibility_pragma=no
3078                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3079                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3080                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3081                             ac_cv_visibility_pragma=yes
3082                           fi
3083                         fi
3084                       fi
3085                       rm -f conftest.[cs]
3086                     ])
3087       if test "$ac_cv_visibility_pragma" = "yes"; then
3088         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3089                        ac_cv_have_visibility_class_bug,
3090                        [cat > conftest.c <<EOF
3091 #pragma GCC visibility push(hidden)
3092 struct __attribute__ ((visibility ("default"))) TestStruct {
3093   static void Init();
3095 __attribute__ ((visibility ("default"))) void TestFunc() {
3096   TestStruct::Init();
3099                        ac_cv_have_visibility_class_bug=no
3100                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3101                          ac_cv_have_visibility_class_bug=yes
3102                        else
3103                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3104                            ac_cv_have_visibility_class_bug=yes
3105                          fi
3106                        fi
3107                        rm -rf conftest.{c,S}
3108                        ])
3110         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3111                        ac_cv_have_visibility_builtin_bug,
3112                        [cat > conftest.c <<EOF
3113 #pragma GCC visibility push(hidden)
3114 #pragma GCC visibility push(default)
3115 #include <string.h>
3116 #pragma GCC visibility pop
3118 __attribute__ ((visibility ("default"))) void Func() {
3119   char c[[100]];
3120   memset(c, 0, sizeof(c));
3123                        ac_cv_have_visibility_builtin_bug=no
3124                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3125                          ac_cv_have_visibility_builtin_bug=yes
3126                        else
3127                          if test `grep -c "@PLT" conftest.S` = 0; then
3128                            ac_cv_visibility_builtin_bug=yes
3129                          fi
3130                        fi
3131                        rm -f conftest.{c,S}
3132                        ])
3133         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3134                 "$ac_cv_have_visibility_class_bug" = "no"; then
3135           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3136           WRAP_SYSTEM_INCLUDES=1
3137           STL_FLAGS='-I$(DIST)/stl_wrappers'
3138           WRAP_STL_INCLUDES=1
3139         else
3140           VISIBILITY_FLAGS='-fvisibility=hidden'
3141         fi # have visibility pragma bug
3142       fi   # have visibility pragma
3143     fi     # have visibility(default) attribute
3144   fi       # have visibility(hidden) attribute
3145 fi         # GNU_CC
3147 # visibility hidden flag for Sun Studio on Solaris
3148 if test "$SOLARIS_SUNPRO_CC"; then
3149 VISIBILITY_FLAGS='-xldscope=hidden'
3150 fi         # Sun Studio on Solaris
3152 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3153 AC_SUBST(VISIBILITY_FLAGS)
3155 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3156 dnl ========================================================
3157 if test "$GNU_CC"; then
3158   CFLAGS_save="${CFLAGS}"
3159   CFLAGS="${CFLAGS} -Werror"
3160   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3161                  ac_cv_force_align_arg_pointer,
3162                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3163                                  [],
3164                                  ac_cv_force_align_arg_pointer="yes",
3165                                  ac_cv_force_align_arg_pointer="no")])
3166   CFLAGS="${CFLAGS_save}"
3167   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3168     HAVE_GCC_ALIGN_ARG_POINTER=1
3169   else
3170     HAVE_GCC_ALIGN_ARG_POINTER=
3171   fi
3173 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3175 dnl Checks for header files.
3176 dnl ========================================================
3177 AC_HEADER_DIRENT
3178 case "$target_os" in
3179 freebsd*)
3180 # for stuff like -lXshm
3181     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3182     ;;
3183 esac
3184 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3185 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3186 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3187 AC_CHECK_HEADERS(malloc.h)
3188 AC_CHECK_HEADERS(X11/XKBlib.h)
3189 AC_CHECK_HEADERS(io.h)
3191 dnl These are all the places some variant of statfs can be hiding.
3192 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3194 dnl Quota support
3195 AC_CHECK_HEADERS(sys/quota.h)
3197 dnl Try for MMX support
3198 dnl NB - later gcc versions require -mmmx for this header to be successfully
3199 dnl included (or another option which implies it, such as -march=pentium-mmx)
3200 AC_CHECK_HEADERS(mmintrin.h)
3202 dnl Check whether the compiler supports the new-style C++ standard
3203 dnl library headers (i.e. <new>) or needs the old "new.h"
3204 AC_LANG_CPLUSPLUS
3205 NEW_H=new.h
3206 AC_CHECK_HEADER(new, [NEW_H=new])
3207 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3208 AC_LANG_C
3210 AC_ARG_ENABLE(dtrace,
3211               [  --enable-dtrace         build with dtrace support if available (default=no)],
3212               [enable_dtrace="yes"],)
3213 if test "x$enable_dtrace" = "xyes"; then
3214   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3215   if test -n "$HAVE_DTRACE"; then
3216       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3217   else
3218       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3219   fi
3221 AC_SUBST(HAVE_DTRACE)
3223 case $target in
3224 *-aix4.3*|*-aix5*)
3225         ;;
3227         AC_CHECK_HEADERS(sys/cdefs.h)
3228         ;;
3229 esac
3231 dnl Checks for libraries.
3232 dnl ========================================================
3233 case $target in
3234 *-hpux11.*)
3235         ;;
3237         AC_CHECK_LIB(c_r, gethostbyname_r)
3238         ;;
3239 esac
3241 dnl We don't want to link with libdl even if it's present on OS X, since
3242 dnl it's not used and not part of the default installation.
3243 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3244 dnl We don't want to link against libm or libpthread on Darwin since
3245 dnl they both are just symlinks to libSystem and explicitly linking
3246 dnl against libSystem causes issues when debugging (see bug 299601).
3247 case $target in
3248 *-darwin*)
3249     ;;
3250 *-beos*)
3251     ;;
3252 *-os2*)
3253     ;;
3255     AC_CHECK_LIB(m, atan)
3256     AC_CHECK_LIB(dl, dlopen,
3257     AC_CHECK_HEADER(dlfcn.h, 
3258         LIBS="-ldl $LIBS"
3259         AC_DEFINE(HAVE_LIBDL)))
3260     ;;
3261 esac
3263 _SAVE_CFLAGS="$CFLAGS"
3264 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3265 AC_CHECK_FUNCS(dladdr)
3266 CFLAGS="$_SAVE_CFLAGS"
3268 if test ! "$GNU_CXX"; then
3270     case $target in
3271     *-aix*)
3272         AC_CHECK_LIB(C_r, demangle)
3273         ;;
3274      *)
3275         AC_CHECK_LIB(C, demangle)
3276         ;;
3277      esac
3280 dnl OS/2 has socket in libc.
3281 case $target in
3282 *-os2*)
3283     ;;
3285     AC_CHECK_LIB(socket, socket)
3286 esac
3288 dnl ========================================================
3289 dnl Check whether we can compile code for Core Text
3290 dnl (available on Mac OS X 10.5 or later)
3291 dnl ========================================================
3292 case "$target" in
3293 *-darwin*)
3294   AC_MSG_CHECKING([for Core Text])
3295   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3296                  [CTLineRef lineRef;],
3297                   ac_cv_have_core_text="yes",
3298                   ac_cv_have_core_text="no")
3299   AC_MSG_RESULT([$ac_cv_have_core_text])
3301   if test "$ac_cv_have_core_text" = "no"; then
3302     AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3303   fi
3304   ;;
3305 esac
3307 XLDFLAGS="$X_LIBS"
3308 XLIBS="$X_EXTRA_LIBS"
3310 dnl ========================================================
3311 dnl Checks for X libraries.
3312 dnl Ordering is important.
3313 dnl Xt is dependent upon SM as of X11R6
3314 dnl ========================================================
3315 if test "$no_x" = "yes"; then
3316     AC_DEFINE(NO_X11)
3317 else
3318     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3319         XLIBS="-lX11 $XLIBS"
3320         _SAVE_LDFLAGS="$LDFLAGS"
3321         LDFLAGS="$XLDFLAGS $LDFLAGS"
3322         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3323                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3324         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3325                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3326      
3327         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3328         unset ac_cv_lib_Xt_XtFree
3329             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3330             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3331         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3332                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3333         ])
3335     # AIX needs the motif library linked before libXt to prevent
3336     # crashes in plugins linked against Motif - Bug #98892
3337     case "${target_os}" in
3338     aix*)
3339         XT_LIBS="-lXm $XT_LIBS"
3340         ;;
3341     esac
3343     dnl ========================================================
3344     dnl = Check for XShm
3345     dnl ========================================================
3346     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3347         $XLIBS $XEXT_LIBS)
3348     AC_CHECK_HEADER(X11/extensions/XShm.h)
3349     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3350         test -n "$_HAVE_XSHM_XEXT"; then
3351         AC_DEFINE(HAVE_XSHM)
3352     fi
3354     dnl ========================================================
3355     dnl = Check for XIE
3356     dnl ========================================================
3357     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3358         $XLIBS $XEXT_LIBS)
3359     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3361     if test "$MOZ_XIE_LIBS"; then
3362         dnl ====================================================
3363         dnl = If XIE is present and is desired, turn it on
3364         dnl ====================================================
3365         case $target in
3366             *-hpux*)
3367                 ;;
3368             *)
3369                 HAVE_XIE=1
3370                 ;;
3371         esac
3372     fi
3374         LDFLAGS="$_SAVE_LDFLAGS"
3376     dnl ========================================================
3377     dnl = Check for freetype2 and its functionality
3378     dnl ========================================================
3379     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3381     if test "$_HAVE_FREETYPE2"; then
3382         _SAVE_LIBS="$LIBS"
3383         _SAVE_CFLAGS="$CFLAGS"
3384         LIBS="$LIBS $FT2_LIBS"
3385         CFLAGS="$CFLAGS $FT2_CFLAGS"
3387         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3388             ac_cv_member_FT_Bitmap_Size_y_ppem,
3389             [AC_TRY_COMPILE([#include <ft2build.h>
3390                              #include FT_FREETYPE_H],
3391                             [FT_Bitmap_Size s;
3392                              if (sizeof s.y_ppem) return 0;
3393                              return 1],
3394                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3395                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3396         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3397             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3398         else
3399             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3400         fi
3401         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3402                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3403                            [FT_Bitmap_Size structure includes y_ppem field])
3405         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3407         LIBS="$_SAVE_LIBS"
3408         CFLAGS="$_SAVE_CFLAGS"
3409     fi
3411 fi # $no_x
3413 AC_SUBST(XCFLAGS)
3414 AC_SUBST(XLDFLAGS)
3415 AC_SUBST(XLIBS)
3416 AC_SUBST(XEXT_LIBS)
3417 AC_SUBST(XT_LIBS)
3419 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3420 AC_TRY_COMPILE([],
3421                [asm("uqadd8 r1, r1, r2");],
3422                result="yes", result="no")
3423 AC_MSG_RESULT("$result")
3424 if test "$result" = "yes"; then
3425     AC_DEFINE(HAVE_ARM_SIMD)
3426     HAVE_ARM_SIMD=1
3428 AC_SUBST(HAVE_ARM_SIMD)
3430 AC_MSG_CHECKING(for ARM NEON support in compiler)
3431 _SAVE_CFLAGS="$CFLAGS"
3432 if test "$GNU_CC"; then
3433   # gcc needs -mfpu=neon to recognize NEON instructions
3434   CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3436 AC_TRY_COMPILE([],
3437                [asm("vadd.i8 d0, d0, d0");],
3438                result="yes", result="no")
3439 AC_MSG_RESULT("$result")
3440 if test "$result" = "yes"; then
3441     AC_DEFINE(HAVE_ARM_NEON)
3442     HAVE_ARM_NEON=1
3444 CFLAGS="$_SAVE_CFLAGS"
3445 AC_SUBST(HAVE_ARM_NEON)
3447 dnl ========================================================
3448 dnl = pthread support
3449 dnl = Start by checking whether the system support pthreads
3450 dnl ========================================================
3451 case "$target_os" in
3452 darwin*)
3453     USE_PTHREADS=1
3454     ;;
3456     MOZ_CHECK_PTHREADS(pthreads,
3457         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3458         MOZ_CHECK_PTHREADS(pthread,
3459             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3460             MOZ_CHECK_PTHREADS(c_r,
3461                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3462                 MOZ_CHECK_PTHREADS(c,
3463                     USE_PTHREADS=1
3464                 )
3465             )
3466         )
3467     )
3468     ;;
3469 esac
3471 dnl ========================================================
3472 dnl Check the command line for --with-pthreads 
3473 dnl ========================================================
3474 MOZ_ARG_WITH_BOOL(pthreads,
3475 [  --with-pthreads         Force use of system pthread library with NSPR ],
3476 [ if test "$USE_PTHREADS"x = x; then
3477     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3478 fi],
3479     USE_PTHREADS=
3480     _PTHREAD_LDFLAGS=
3483 dnl ========================================================
3484 dnl Do the platform specific pthread hackery
3485 dnl ========================================================
3486 if test "$USE_PTHREADS"x != x
3487 then
3488         dnl
3489         dnl See if -pthread is supported.
3490         dnl
3491         rm -f conftest*
3492         ac_cv_have_dash_pthread=no
3493         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3494         echo 'int main() { return 0; }' | cat > conftest.c
3495         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3496         if test $? -eq 0; then
3497                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3498                         ac_cv_have_dash_pthread=yes
3499                 case "$target_os" in
3500                 freebsd*)
3501 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3502                 ;;
3503                 *)
3504                             CFLAGS="$CFLAGS -pthread"
3505                             CXXFLAGS="$CXXFLAGS -pthread"
3506                 ;;
3507                 esac
3508                 fi
3509         fi
3510         rm -f conftest*
3511     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3513         dnl
3514         dnl See if -pthreads is supported.
3515         dnl
3516     ac_cv_have_dash_pthreads=no
3517     if test "$ac_cv_have_dash_pthread" = "no"; then
3518             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3519         echo 'int main() { return 0; }' | cat > conftest.c
3520             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3521         if test $? -eq 0; then
3522                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3523                             ac_cv_have_dash_pthreads=yes
3524                             CFLAGS="$CFLAGS -pthreads"
3525                             CXXFLAGS="$CXXFLAGS -pthreads"
3526                     fi
3527             fi
3528             rm -f conftest*
3529         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3530     fi
3532         case "$target" in
3533             *-*-freebsd*)
3534                         AC_DEFINE(_REENTRANT)
3535                         AC_DEFINE(_THREAD_SAFE)
3536                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3537                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3538                                 _PTHREAD_LDFLAGS="-pthread"
3539                         else
3540                                 _PTHREAD_LDFLAGS="-lc_r"
3541                         fi
3542                         ;;
3544             *-*-openbsd*|*-*-bsdi*)
3545                         AC_DEFINE(_REENTRANT)
3546                         AC_DEFINE(_THREAD_SAFE)
3547                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3548                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3549                 _PTHREAD_LDFLAGS="-pthread"
3550                         fi
3551                         ;;
3553             *-*-linux*|*-*-kfreebsd*-gnu)
3554                         AC_DEFINE(_REENTRANT) 
3555                         ;;
3557             *-*-nto*) 
3558                         AC_DEFINE(_REENTRANT) 
3559                         ;;
3561             *-aix4.3*|*-aix5*)
3562                         AC_DEFINE(_REENTRANT) 
3563                         ;;
3565             *-hpux11.*)
3566                         AC_DEFINE(_REENTRANT) 
3567                         ;;
3569             alpha*-*-osf*)
3570                         AC_DEFINE(_REENTRANT)
3571                         ;;
3573             *-*-solaris*) 
3574                         AC_DEFINE(_REENTRANT)
3575                         if test "$SOLARIS_SUNPRO_CC"; then
3576                                 CFLAGS="$CFLAGS -mt" 
3577                                 CXXFLAGS="$CXXFLAGS -mt" 
3578                         fi
3579                         ;;
3580         esac
3581     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3584 dnl ========================================================
3585 dnl See if mmap sees writes
3586 dnl For cross compiling, just define it as no, which is a safe default
3587 dnl ========================================================
3588 AC_MSG_CHECKING(whether mmap() sees write()s)
3590 changequote(,)
3591 mmap_test_prog='
3592     #include <stdlib.h>
3593     #include <unistd.h>
3594     #include <sys/mman.h>
3595     #include <sys/types.h>
3596     #include <sys/stat.h>
3597     #include <fcntl.h>
3599     char fname[] = "conftest.file";
3600     char zbuff[1024]; /* Fractional page is probably worst case */
3602     int main() {
3603         char *map;
3604         int fd;
3605         int i;
3606         unlink(fname);
3607         fd = open(fname, O_RDWR | O_CREAT, 0660);
3608         if(fd<0) return 1;
3609         unlink(fname);
3610         write(fd, zbuff, sizeof(zbuff));
3611         lseek(fd, 0, SEEK_SET);
3612         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3613         if(map==(char*)-1) return 2;
3614         for(i=0; fname[i]; i++) {
3615             int rc = write(fd, &fname[i], 1);
3616             if(map[i]!=fname[i]) return 4;
3617         }
3618         return 0;
3619     }
3621 changequote([,])
3623 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3625 AC_MSG_RESULT("$result")
3627 if test "$result" = "no"; then
3628     AC_DEFINE(MMAP_MISSES_WRITES)
3632 dnl Checks for library functions.
3633 dnl ========================================================
3634 AC_PROG_GCC_TRADITIONAL
3635 AC_FUNC_MEMCMP
3636 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3637 AC_CHECK_FUNCS(flockfile getpagesize)
3638 AC_CHECK_FUNCS(localtime_r strtok_r)
3640 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3641 _SAVE_LDFLAGS=$LDFLAGS
3642 LDFLAGS="$LDFLAGS -lrt"
3643 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3644                ac_cv_have_clock_monotonic,
3645                [AC_TRY_LINK([#include <time.h>],
3646                             [ struct timespec ts;
3647                               clock_gettime(CLOCK_MONOTONIC, &ts); ],
3648                             ac_cv_have_clock_monotonic=yes,
3649                             ac_cv_have_clock_monotonic=no)])
3650 LDFLAGS=$_SAVE_LDFLAGS
3651 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3652     HAVE_CLOCK_MONOTONIC=1
3653     REALTIME_LIBS=-lrt
3654     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3655     AC_SUBST(HAVE_CLOCK_MONOTONIC)
3656     AC_SUBST(REALTIME_LIBS)
3659 dnl check for wcrtomb/mbrtowc
3660 dnl =======================================================================
3661 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3662 AC_LANG_SAVE
3663 AC_LANG_CPLUSPLUS
3664 AC_CACHE_CHECK(for wcrtomb,
3665     ac_cv_have_wcrtomb,
3666     [AC_TRY_LINK([#include <wchar.h>],
3667                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3668                  ac_cv_have_wcrtomb="yes",
3669                  ac_cv_have_wcrtomb="no")])
3670 if test "$ac_cv_have_wcrtomb" = "yes"; then
3671     AC_DEFINE(HAVE_WCRTOMB)
3673 AC_CACHE_CHECK(for mbrtowc,
3674     ac_cv_have_mbrtowc,
3675     [AC_TRY_LINK([#include <wchar.h>],
3676                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3677                  ac_cv_have_mbrtowc="yes",
3678                  ac_cv_have_mbrtowc="no")])
3679 if test "$ac_cv_have_mbrtowc" = "yes"; then
3680     AC_DEFINE(HAVE_MBRTOWC)
3682 AC_LANG_RESTORE
3685 AC_CACHE_CHECK(
3686     [for res_ninit()],
3687     ac_cv_func_res_ninit,
3688     [AC_TRY_LINK([
3689         #ifdef linux
3690         #define _BSD_SOURCE 1
3691         #endif
3692         #include <resolv.h>
3693         ],
3694         [int foo = res_ninit(&_res);],
3695         [ac_cv_func_res_ninit=yes],
3696         [ac_cv_func_res_ninit=no])
3697     ])
3699 if test "$ac_cv_func_res_ninit" = "yes"; then
3700     AC_DEFINE(HAVE_RES_NINIT)
3701 dnl must add the link line we do something as foolish as this... dougt
3702 dnl else
3703 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3704 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3707 AC_LANG_CPLUSPLUS
3708 AC_CACHE_CHECK(
3709     [for gnu_get_libc_version()],
3710     ac_cv_func_gnu_get_libc_version,
3711     [AC_TRY_LINK([
3712         #ifdef HAVE_GNU_LIBC_VERSION_H
3713         #include <gnu/libc-version.h>
3714         #endif
3715         ],
3716         [const char *glibc_version = gnu_get_libc_version();],
3717         [ac_cv_func_gnu_get_libc_version=yes],
3718         [ac_cv_func_gnu_get_libc_version=no] 
3719         )]
3720     )
3722 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3723     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3726 case $target_os in
3727     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3728         ;;
3729     *)
3730     
3731 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3732     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3733         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3734 _SAVE_LIBS=$LIBS
3735 LIBS="$LIBS $_ICONV_LIBS"
3736 AC_CACHE_CHECK(
3737     [for iconv()],
3738     ac_cv_func_iconv,
3739     [AC_TRY_LINK([
3740         #include <stdlib.h>
3741         #include <iconv.h>
3742         ],
3743         [
3744             iconv_t h = iconv_open("", "");
3745             iconv(h, NULL, NULL, NULL, NULL);
3746             iconv_close(h);
3747         ],
3748         [ac_cv_func_iconv=yes],
3749         [ac_cv_func_iconv=no] 
3750         )]
3751     )
3752 if test "$ac_cv_func_iconv" = "yes"; then
3753     AC_DEFINE(HAVE_ICONV)
3754     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3755     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3756     LIBICONV="$_ICONV_LIBS"
3757     AC_CACHE_CHECK(
3758         [for iconv() with const input],
3759         ac_cv_func_const_iconv,
3760         [AC_TRY_COMPILE([
3761             #include <stdlib.h>
3762             #include <iconv.h>
3763             ],
3764             [
3765                 const char *input = "testing";
3766                 iconv_t h = iconv_open("", "");
3767                 iconv(h, &input, NULL, NULL, NULL);
3768                 iconv_close(h);
3769             ],
3770             [ac_cv_func_const_iconv=yes],
3771             [ac_cv_func_const_iconv=no] 
3772             )]
3773         )
3774     if test "$ac_cv_func_const_iconv" = "yes"; then
3775         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3776     fi
3778 LIBS=$_SAVE_LIBS
3780     ;;
3781 esac
3783 AM_LANGINFO_CODESET
3785 AC_LANG_C
3787 dnl **********************
3788 dnl *** va_copy checks ***
3789 dnl **********************
3790 dnl we currently check for all three va_copy possibilities, so we get
3791 dnl all results in config.log for bug reports.
3792 AC_MSG_CHECKING(for an implementation of va_copy())
3793 AC_CACHE_VAL(ac_cv_va_copy,[
3794     AC_TRY_RUN([
3795         #include <stdarg.h>
3796         void f (int i, ...) {
3797             va_list args1, args2;
3798             va_start (args1, i);
3799             va_copy (args2, args1);
3800             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3801                 exit (1);
3802             va_end (args1); va_end (args2);
3803         }
3804         int main() { f (0, 42); return 0; }],
3805         ac_cv_va_copy=yes,
3806         ac_cv_va_copy=no,
3807         ac_cv_va_copy=no
3808     )
3810 AC_MSG_RESULT($ac_cv_va_copy)
3811 AC_MSG_CHECKING(for an implementation of __va_copy())
3812 AC_CACHE_VAL(ac_cv___va_copy,[
3813     AC_TRY_RUN([
3814         #include <stdarg.h>
3815         void f (int i, ...) {
3816             va_list args1, args2;
3817             va_start (args1, i);
3818             __va_copy (args2, args1);
3819             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3820                 exit (1);
3821             va_end (args1); va_end (args2);
3822         }
3823         int main() { f (0, 42); return 0; }],
3824         ac_cv___va_copy=yes,
3825         ac_cv___va_copy=no,
3826         ac_cv___va_copy=no
3827     )
3829 AC_MSG_RESULT($ac_cv___va_copy)
3830 AC_MSG_CHECKING(whether va_lists can be copied by value)
3831 AC_CACHE_VAL(ac_cv_va_val_copy,[
3832     AC_TRY_RUN([
3833         #include <stdarg.h>
3834         void f (int i, ...) {
3835             va_list args1, args2;
3836             va_start (args1, i);
3837             args2 = args1;
3838             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3839                 exit (1);
3840             va_end (args1); va_end (args2);
3841         }
3842         int main() { f (0, 42); return 0; }],
3843         ac_cv_va_val_copy=yes,
3844         ac_cv_va_val_copy=no,
3845         ac_cv_va_val_copy=yes
3846     )
3848 if test "x$ac_cv_va_copy" = "xyes"; then
3849     AC_DEFINE(VA_COPY, va_copy)
3850     AC_DEFINE(HAVE_VA_COPY)
3851 elif test "x$ac_cv___va_copy" = "xyes"; then
3852     AC_DEFINE(VA_COPY, __va_copy)
3853     AC_DEFINE(HAVE_VA_COPY)
3856 if test "x$ac_cv_va_val_copy" = "xno"; then
3857    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3859 AC_MSG_RESULT($ac_cv_va_val_copy)
3861 dnl Check for dll-challenged libc's.
3862 dnl This check is apparently only needed for Linux.
3863 case "$target" in
3864         *-linux*)
3865             dnl ===================================================================
3866             _curdir=`pwd`
3867             export _curdir
3868             rm -rf conftest* _conftest
3869             mkdir _conftest
3870             cat >> conftest.C <<\EOF
3871 #include <stdio.h>
3872 #include <link.h>
3873 #include <dlfcn.h>
3874 #ifdef _dl_loaded
3875 void __dump_link_map(void) {
3876   struct link_map *map = _dl_loaded;
3877   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3879 int main() {
3880   dlopen("./conftest1.so",RTLD_LAZY);
3881   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3882   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3883   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3884   __dump_link_map();
3886 #else
3887 /* _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).*/
3888 int main() { printf("./conftest1.so\n"); }
3889 #endif
3892             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3894             cat >> conftest1.C <<\EOF
3895 #include <stdio.h>
3896 void foo(void) {printf("foo in dll called\n");}
3898             ${CXX-g++} -fPIC -c -g conftest1.C
3899             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3900             ${CXX-g++} -g conftest.C -o conftest -ldl
3901             cp -f conftest1.so conftest _conftest
3902             cd _conftest
3903             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3904             then
3905                 echo
3906                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3907                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3908                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3909                 echo "*** will be excessive memory usage at runtime."
3910                 echo
3911             fi
3912             cd ${_curdir}
3913             rm -rf conftest* _conftest
3914             dnl ===================================================================
3915             ;;
3916 esac
3918 dnl ===================================================================
3919 dnl ========================================================
3920 dnl By default, turn rtti and exceptions off on g++/egcs
3921 dnl ========================================================
3922 if test "$GNU_CXX"; then
3924   AC_MSG_CHECKING(for C++ exceptions flag)
3926   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3927   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3928   [echo "int main() { return 0; }" | cat > conftest.C
3930   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3932   if egrep "warning.*renamed" conftest.out >/dev/null; then
3933     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3934   else
3935     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3936   fi
3938   rm -f conftest*])
3940   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3941   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3942   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3945 dnl ========================================================
3946 dnl Put your C++ language/feature checks below
3947 dnl ========================================================
3948 AC_LANG_CPLUSPLUS
3950 HAVE_GCC3_ABI=
3951 if test "$GNU_CC"; then
3952   AC_CACHE_CHECK(for gcc 3.0 ABI,
3953       ac_cv_gcc_three_abi,
3954       [AC_TRY_COMPILE([],
3955                       [
3956 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3957   return 0;
3958 #else
3959 #error Not gcc3.
3960 #endif
3961                       ],
3962                       ac_cv_gcc_three_abi="yes",
3963                       ac_cv_gcc_three_abi="no")])
3964   if test "$ac_cv_gcc_three_abi" = "yes"; then
3965       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3966       HAVE_GCC3_ABI=1
3967   else
3968       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3969   fi
3971 AC_SUBST(HAVE_GCC3_ABI)
3974 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3975                ac_cv_cpp_explicit,
3976                [AC_TRY_COMPILE(class X {
3977                                public: explicit X(int i) : i_(i) {}
3978                                private: int i_;
3979                                };,
3980                                X x(3);,
3981                                ac_cv_cpp_explicit=yes,
3982                                ac_cv_cpp_explicit=no)])
3983 if test "$ac_cv_cpp_explicit" = yes ; then
3984    AC_DEFINE(HAVE_CPP_EXPLICIT)
3987 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3988                ac_cv_cpp_typename,
3989                [AC_TRY_COMPILE(class param {
3990                                public:
3991                                    typedef unsigned long num_type;
3992                                };
3994                                template <class T> class tplt {
3995                                public:
3996                                    typedef typename T::num_type t_num_type;
3997                                    t_num_type foo(typename T::num_type num) {
3998                                        return num;
3999                                    }
4000                                };,
4001                                tplt<param> A;
4002                                A.foo(0);,
4003                                ac_cv_cpp_typename=yes,
4004                                ac_cv_cpp_typename=no)])
4005 if test "$ac_cv_cpp_typename" = yes ; then
4006    AC_DEFINE(HAVE_CPP_TYPENAME)
4009 dnl Check for support of modern template specialization syntax
4010 dnl Test code and requirement from scc@netscape.com.
4011 dnl Autoconf cut-and-paste job by waterson@netscape.com
4012 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4013                ac_cv_cpp_modern_specialize_template_syntax,
4014                [AC_TRY_COMPILE(template <class T> struct X { int a; };
4015                                class Y {};
4016                                template <> struct X<Y> { double a; };,
4017                                X<int> int_x;
4018                                X<Y> y_x;,
4019                                ac_cv_cpp_modern_specialize_template_syntax=yes,
4020                                ac_cv_cpp_modern_specialize_template_syntax=no)])
4021 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4022   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4026 dnl Some compilers support only full specialization, and some don't.
4027 AC_CACHE_CHECK(whether partial template specialization works,
4028                ac_cv_cpp_partial_specialization,
4029                [AC_TRY_COMPILE(template <class T> class Foo {};
4030                                template <class T> class Foo<T*> {};,
4031                                return 0;,
4032                                ac_cv_cpp_partial_specialization=yes,
4033                                ac_cv_cpp_partial_specialization=no)])
4034 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4035   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4038 dnl Some compilers have limited support for operators with templates;
4039 dnl specifically, it is necessary to define derived operators when a base
4040 dnl class's operator declaration should suffice.
4041 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4042                ac_cv_need_derived_template_operators,
4043                [AC_TRY_COMPILE([template <class T> class Base { };
4044                                 template <class T>
4045                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4046                                 template <class T> class Derived : public Base<T> { };],
4047                                [Derived<char> a, b;
4048                                 Base<char> c = a + b;
4049                                 return 0;],
4050                                ac_cv_need_derived_template_operators=no,
4051                                ac_cv_need_derived_template_operators=yes)])
4052 if test "$ac_cv_need_derived_template_operators" = yes ; then
4053   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4057 dnl Some compilers have trouble detecting that a template class
4058 dnl that derives from another template is actually an instance
4059 dnl of the base class. This test checks for that.
4060 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4061                ac_cv_need_cpp_template_cast_to_base,
4062                [AC_TRY_COMPILE([template <class T> class Base { };
4063                                 template <class T> class Derived : public Base<T> { };
4064                                 template <class T> int foo(const Base<T>&) { return 0; }],
4065                                [Derived<char> bar; return foo(bar);],
4066                                ac_cv_need_cpp_template_cast_to_base=no,
4067                                ac_cv_need_cpp_template_cast_to_base=yes)])
4068 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4069   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4072 dnl Some compilers have trouble resolving the ambiguity between two
4073 dnl functions whose arguments differ only by cv-qualifications.
4074 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4075                ac_cv_can_resolve_const_ambiguity,
4076                [AC_TRY_COMPILE([
4077                                 template <class T> class ptrClass {
4078                                   public: T* ptr;
4079                                 };
4081                                 template <class T> T* a(ptrClass<T> *arg) {
4082                                   return arg->ptr;
4083                                 }
4085                                 template <class T>
4086                                 const T* a(const ptrClass<T> *arg) {
4087                                   return arg->ptr;
4088                                 }
4089                                ],
4090                                [ ptrClass<int> i;
4091                                  a(&i); ],
4092                                ac_cv_can_resolve_const_ambiguity=yes,
4093                                ac_cv_can_resolve_const_ambiguity=no)])
4094 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4095   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4099 dnl We don't do exceptions on unix.  The only reason this used to be here
4100 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4101 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4102 dnl So im commenting this out until someone writes some artificial 
4103 dnl intelligence to detect not only if the compiler has exceptions, but if 
4104 dnl they are enabled as well.
4105 dnl 
4106 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4107 dnl                ac_cv_cpp_exceptions,
4108 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4109 dnl                                static void F() { throw X(); },
4110 dnl                                try { F(); } catch(X & e) { },
4111 dnl                                ac_cv_cpp_exceptions=yes,
4112 dnl                                ac_cv_cpp_exceptions=no)])
4113 dnl if test $ac_cv_cpp_exceptions = yes ; then
4114 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4115 dnl fi
4117 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4118 dnl supports it well enough to allow us to use it to change access, but not
4119 dnl to resolve ambiguity. The next two tests determine how well the |using|
4120 dnl keyword is supported.
4122 dnl Check to see if we can change access with |using|.  Test both a
4123 dnl legal and an illegal example.
4124 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4125                ac_cv_cpp_access_changing_using2,
4126                [AC_TRY_COMPILE(
4127                    class A { protected: int foo() { return 0; } };
4128                    class B : public A { public: using A::foo; };,
4129                    B b; return b.foo();,
4130                    [AC_TRY_COMPILE(
4131                        class A { public: int foo() { return 1; } };
4132                        class B : public A { private: using A::foo; };,
4133                        B b; return b.foo();,
4134                        ac_cv_cpp_access_changing_using2=no,
4135                        ac_cv_cpp_access_changing_using2=yes)],
4136                    ac_cv_cpp_access_changing_using2=no)])
4137 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4138    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4141 dnl Check to see if we can resolve ambiguity with |using|.
4142 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4143                ac_cv_cpp_ambiguity_resolving_using,
4144                [AC_TRY_COMPILE(class X { 
4145                                  public: int go(const X&) {return 3;}
4146                                          int jo(const X&) {return 3;}
4147                                };
4148                                class Y : public X {
4149                                  public:  int go(int) {return 2;}
4150                                           int jo(int) {return 2;}
4151                                           using X::jo;
4152                                  private: using X::go;
4153                                };,
4154                                X x; Y y; y.jo(x);,
4155                                ac_cv_cpp_ambiguity_resolving_using=yes,
4156                                ac_cv_cpp_ambiguity_resolving_using=no)])
4157 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4158    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4161 dnl Check to see if the |std| namespace is supported. If so, we'll want
4162 dnl to qualify any standard library calls with "std::" to ensure that
4163 dnl those functions can be resolved.
4164 AC_CACHE_CHECK(for \"std::\" namespace,
4165                ac_cv_cpp_namespace_std,
4166                [AC_TRY_COMPILE([#include <algorithm>],
4167                                [return std::min(0, 1);],
4168                                ac_cv_cpp_namespace_std=yes,
4169                                ac_cv_cpp_namespace_std=no)])
4170 if test "$ac_cv_cpp_namespace_std" = yes ; then
4171    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4174 dnl Older compilers are overly ambitious with respect to using the standard
4175 dnl template library's |operator!=()| when |operator==()| is defined. In
4176 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4177 dnl ambiguity at compile-time. This test checks for that case.
4178 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4179                ac_cv_cpp_unambiguous_std_notequal,
4180                [AC_TRY_COMPILE([#include <algorithm>
4181                                 struct T1 {};
4182                                 int operator==(const T1&, const T1&) { return 0; }
4183                                 int operator!=(const T1&, const T1&) { return 0; }],
4184                                [T1 a,b; return a != b;],
4185                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4186                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4187 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4188   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4192 AC_CACHE_CHECK(for C++ reinterpret_cast,
4193                ac_cv_cpp_reinterpret_cast,
4194                [AC_TRY_COMPILE(struct X { int i; };
4195                                struct Y { int i; };,
4196                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4197                                ac_cv_cpp_reinterpret_cast=yes,
4198                                ac_cv_cpp_reinterpret_cast=no)])
4199 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4200    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4203 dnl See if a dynamic_cast to void* gives the most derived object.
4204 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4205                ac_cv_cpp_dynamic_cast_void_ptr,
4206                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4207                             class Y { int j; public: virtual ~Y() { } };
4208                             class Z : public X, public Y { int k; };
4210                             int main() {
4211                                  Z mdo;
4212                                  X *subx = (X*)&mdo;
4213                                  Y *suby = (Y*)&mdo;
4214                                  return !((((void*)&mdo != (void*)subx) &&
4215                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4216                                           (((void*)&mdo != (void*)suby) &&
4217                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4218                             }],
4219                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4220                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4221                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4222 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4223    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4227 dnl note that this one is reversed - if the test fails, then
4228 dnl we require implementations of unused virtual methods. Which
4229 dnl really blows because it means we'll have useless vtable
4230 dnl bloat.
4231 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4232                ac_cv_cpp_unused_required,
4233                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4234                                X x;,
4235                                ac_cv_cpp_unused_required=no,
4236                                ac_cv_cpp_unused_required=yes)])
4237 if test "$ac_cv_cpp_unused_required" = yes ; then
4238    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4242 dnl Some compilers have trouble comparing a constant reference to a templatized
4243 dnl class to zero, and require an explicit operator==() to be defined that takes
4244 dnl an int. This test separates the strong from the weak.
4246 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4247                ac_cv_trouble_comparing_to_zero,
4248                [AC_TRY_COMPILE([#include <algorithm>
4249                                 template <class T> class Foo {};
4250                                 class T2;
4251                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4252                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4253                                [Foo<int> f; return (0 != f);],
4254                                ac_cv_trouble_comparing_to_zero=no,
4255                                ac_cv_trouble_comparing_to_zero=yes)])
4256 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4257   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4260 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4261 _SAVE_LDFLAGS=$LDFLAGS
4262 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4263 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4264                ac_cv_thread_keyword,
4265                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4266                             [return tlsIsMainThread;],
4267                             ac_cv_thread_keyword=yes,
4268                             ac_cv_thread_keyword=no)])
4269 LDFLAGS=$_SAVE_LDFLAGS
4270 if test "$ac_cv_thread_keyword" = yes; then
4271   AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4274 dnl Check for the existence of various allocation headers/functions
4276 MALLOC_H=
4277 AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
4278 if test "$MALLOC_H" = ""; then
4279   AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4280   if test "$MALLOC_H" = ""; then
4281     AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
4282   fi
4284 if test "$MALLOC_H" != ""; then
4285    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4288 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4289 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4291 dnl See if compiler supports some gcc-style attributes
4293 AC_CACHE_CHECK(for __attribute__((always_inline)),
4294                ac_cv_attribute_always_inline,
4295                [AC_TRY_COMPILE([],
4296                                [inline void f(void) __attribute__((always_inline));],
4297                                ac_cv_attribute_always_inline=yes,
4298                                ac_cv_attribute_always_inline=no)])
4300 AC_CACHE_CHECK(for __attribute__((malloc)),
4301                ac_cv_attribute_malloc,
4302                [AC_TRY_COMPILE([],
4303                                [void* f(int) __attribute__((malloc));],
4304                                ac_cv_attribute_malloc=yes,
4305                                ac_cv_attribute_malloc=no)])
4307 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4308                ac_cv_attribute_warn_unused,
4309                [AC_TRY_COMPILE([],
4310                                [int f(void) __attribute__((warn_unused_result));],
4311                                ac_cv_attribute_warn_unused=yes,
4312                                ac_cv_attribute_warn_unused=no)])
4314 AC_CACHE_CHECK(for __attribute__((noreturn)),
4315                ac_cv_attribute_noreturn,
4316                [AC_TRY_COMPILE([],
4317                                [void f(void) __attribute__((noreturn));],
4318                                ac_cv_attribute_noreturn=yes,
4319                                ac_cv_attribute_noreturn=no)])
4321 dnl End of C++ language/feature checks
4322 AC_LANG_C
4324 dnl ========================================================
4325 dnl =  Internationalization checks
4326 dnl ========================================================
4328 dnl Internationalization and Locale support is different
4329 dnl on various UNIX platforms.  Checks for specific i18n
4330 dnl features go here.
4332 dnl check for LC_MESSAGES
4333 AC_CACHE_CHECK(for LC_MESSAGES,
4334                 ac_cv_i18n_lc_messages,
4335                 [AC_TRY_COMPILE([#include <locale.h>],
4336                                 [int category = LC_MESSAGES;],
4337                                 ac_cv_i18n_lc_messages=yes,
4338                                 ac_cv_i18n_lc_messages=no)])
4339 if test "$ac_cv_i18n_lc_messages" = yes; then
4340    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4341 fi      
4343 fi # SKIP_COMPILER_CHECKS
4345 TARGET_XPCOM_ABI=
4346 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4347     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4350 dnl Mozilla specific options
4351 dnl ========================================================
4352 dnl The macros used for command line options
4353 dnl are defined in build/autoconf/altoptions.m4.
4355 dnl If the compiler supports these attributes, define them as
4356 dnl convenience macros.
4357 if test "$ac_cv_attribute_always_inline" = yes ; then
4358   AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4359 else
4360   AC_DEFINE(NS_ALWAYS_INLINE,)
4363 if test "$ac_cv_attribute_malloc" = yes ; then
4364   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4365 else
4366   AC_DEFINE(NS_ATTR_MALLOC,)
4369 if test "$ac_cv_attribute_warn_unused" = yes ; then
4370   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4371 else
4372   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4375 if test "$ac_cv_attribute_noreturn" = yes ; then
4376   AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4377 else
4378   AC_DEFINE(NS_NORETURN,)
4381 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4382 dnl features that Windows actually does support.
4384 if test -n "$SKIP_COMPILER_CHECKS"; then
4385    dnl Windows has malloc.h
4386    AC_DEFINE(MALLOC_H, [<malloc.h>])
4387    AC_DEFINE(HAVE_FORCEINLINE)
4388 fi # SKIP_COMPILER_CHECKS
4390 dnl ========================================================
4391 dnl =
4392 dnl = Check for external package dependencies
4393 dnl =
4394 dnl ========================================================
4395 MOZ_ARG_HEADER(External Packages)
4397 MOZ_ENABLE_LIBXUL=1
4399 MOZ_ARG_WITH_STRING(libxul-sdk,
4400 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4401   LIBXUL_SDK_DIR=$withval)
4403 if test "$LIBXUL_SDK_DIR" = "yes"; then
4404     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4405 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4406     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4408     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4409         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4410     fi
4412     MOZ_ENABLE_LIBXUL=1
4414 AC_SUBST(LIBXUL_SDK)
4416 if test -n "$LIBXUL_SDK"; then
4417     LIBXUL_DIST="$LIBXUL_SDK"
4418 else
4419     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4421 AC_SUBST(LIBXUL_DIST)
4423 SYSTEM_LIBXUL=
4425 MOZ_ARG_WITH_BOOL(system-libxul,
4426 [  --with-system-libxul   Use system installed libxul SDK],
4427     SYSTEM_LIBXUL=1)
4429 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4430     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4433 dnl ========================================================
4434 dnl = If NSPR was not detected in the system, 
4435 dnl = use the one in the source tree (mozilla/nsprpub)
4436 dnl ========================================================
4437 MOZ_ARG_WITH_BOOL(system-nspr,
4438 [  --with-system-nspr      Use system installed NSPR],
4439     _USE_SYSTEM_NSPR=1 )
4441 if test -n "$_USE_SYSTEM_NSPR"; then
4442     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4445 if test -n "$MOZ_NATIVE_NSPR"; then
4446     _SAVE_CFLAGS=$CFLAGS
4447     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4448     AC_TRY_COMPILE([#include "prlog.h"],
4449                 [#ifndef PR_STATIC_ASSERT
4450                  #error PR_STATIC_ASSERT not defined
4451                  #endif],
4452                 [MOZ_NATIVE_NSPR=1],
4453                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4454     CFLAGS=$_SAVE_CFLAGS
4455 else
4456     if test "$OS_ARCH" = "WINCE"; then
4457         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4458         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4459     elif test "$OS_ARCH" = "WINNT"; then
4460         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4461         if test -n "$GNU_CC"; then
4462             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4463         else
4464             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4465         fi
4466     else
4467         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4468         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4469     fi
4472 dnl ========================================================
4473 dnl = If NSS was not detected in the system, 
4474 dnl = use the one in the source tree (mozilla/security/nss)
4475 dnl ========================================================
4477 MOZ_ARG_WITH_BOOL(system-nss,
4478 [  --with-system-nss      Use system installed NSS],
4479     _USE_SYSTEM_NSS=1 )
4481 if test -n "$_USE_SYSTEM_NSS"; then
4482     AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4485 if test -n "$MOZ_NATIVE_NSS"; then
4486    NSS_LIBS="$NSS_LIBS -lcrmf"
4487 else
4488    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4489    NSS_DEP_LIBS="\
4490         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4491         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4492         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4493         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4494         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4496    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4497        NSS_LIBS="\
4498         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4499         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4500         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4501         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4502         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4503    else
4504        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4505    fi
4508 if test -z "$SKIP_LIBRARY_CHECKS"; then
4509 dnl system JPEG support
4510 dnl ========================================================
4511 MOZ_ARG_WITH_STRING(system-jpeg,
4512 [  --with-system-jpeg[=PFX]
4513                           Use system libjpeg [installed at prefix PFX]],
4514     JPEG_DIR=$withval)
4516 _SAVE_CFLAGS=$CFLAGS
4517 _SAVE_LDFLAGS=$LDFLAGS
4518 _SAVE_LIBS=$LIBS
4519 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4520     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4521     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4523 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4524     SYSTEM_JPEG=
4525 else
4526     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4529 if test "$SYSTEM_JPEG" = 1; then
4530     LIBS="$JPEG_LIBS $LIBS"
4531     AC_TRY_COMPILE([ #include <stdio.h>
4532                      #include <sys/types.h>
4533                      #include <jpeglib.h> ],
4534                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4535                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4536                      #endif ],
4537                    SYSTEM_JPEG=1,
4538                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4539 fi 
4540 CFLAGS=$_SAVE_CFLAGS
4541 LDFLAGS=$_SAVE_LDFLAGS
4542 LIBS=$_SAVE_LIBS
4544 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4545     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4546     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4549 dnl system ZLIB support
4550 dnl ========================================================
4551 MOZ_ARG_WITH_STRING(system-zlib,
4552 [  --with-system-zlib[=PFX]
4553                           Use system libz [installed at prefix PFX]],
4554     ZLIB_DIR=$withval)
4556 _SAVE_CFLAGS=$CFLAGS
4557 _SAVE_LDFLAGS=$LDFLAGS
4558 _SAVE_LIBS=$LIBS
4559 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4560     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4561     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4563 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4564     SYSTEM_ZLIB=
4565 else
4566     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4567         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4569 if test "$SYSTEM_ZLIB" = 1; then
4570     LIBS="$ZLIB_LIBS $LIBS"
4571     AC_TRY_COMPILE([ #include <stdio.h>
4572                      #include <string.h>
4573                      #include <zlib.h> ],
4574                    [ #if ZLIB_VERNUM < $MOZZLIB 
4575                      #error "Insufficient zlib version ($MOZZLIB required)."
4576                      #endif ],
4577                    SYSTEM_ZLIB=1,
4578                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4580 CFLAGS=$_SAVE_CFLAGS
4581 LDFLAGS=$_SAVE_LDFLAGS
4582 LIBS=$_SAVE_LIBS
4584 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4585     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4586     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4589 dnl system BZIP2 Support
4590 dnl ========================================================
4591 MOZ_ARG_WITH_STRING(system-bz2,
4592 [  --with-system-bz2[=PFX]
4593                           Use system libbz2 [installed at prefix PFX]],
4594     BZ2_DIR=$withval)
4596 _SAVE_CFLAGS=$CFLAGS
4597 _SAVE_LDFLAGS=$LDFLAGS
4598 _SAVE_LIBS=$LIBS
4599 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4600     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4601     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4603 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4604     SYSTEM_BZ2=
4605 else
4606     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4607         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4609 CFLAGS=$_SAVE_CFLAGS
4610 LDFLAGS=$_SAVE_LDFLAGS
4611 LIBS=$_SAVE_LIBS
4613 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4614     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4615     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4618 dnl system PNG Support
4619 dnl ========================================================
4620 MOZ_ARG_WITH_STRING(system-png, 
4621 [  --with-system-png[=PFX]
4622                           Use system libpng [installed at prefix PFX]],
4623     PNG_DIR=$withval)
4625 _SAVE_CFLAGS=$CFLAGS
4626 _SAVE_LDFLAGS=$LDFLAGS
4627 _SAVE_LIBS=$LIBS
4628 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4629 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4630 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4631     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4632     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4634 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4635     SYSTEM_PNG=
4636 else
4637     _SAVE_PNG_LIBS=$PNG_LIBS
4638     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4639                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4640                  $PNG_LIBS)
4641     AC_CHECK_LIB(png, png_get_acTL, ,
4642                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4643                  $_SAVE_PNG_LIBS)
4645 if test "$SYSTEM_PNG" = 1; then
4646     LIBS="$PNG_LIBS $LIBS"
4647     AC_TRY_COMPILE([ #include <stdio.h>
4648                      #include <sys/types.h>
4649                      #include <png.h> ],
4650                    [ #if PNG_LIBPNG_VER < $MOZPNG
4651                      #error "Insufficient libpng version ($MOZPNG required)."
4652                      #endif
4653                      #ifndef PNG_UINT_31_MAX
4654                      #error "Insufficient libpng version."
4655                      #endif ],
4656                    SYSTEM_PNG=1,
4657                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4659 CFLAGS=$_SAVE_CFLAGS
4660 LDFLAGS=$_SAVE_LDFLAGS
4661 LIBS=$_SAVE_LIBS
4663 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4664     PNG_CFLAGS="-I${PNG_DIR}/include"
4665     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4668 fi # SKIP_LIBRARY_CHECKS
4670 dnl system HunSpell Support
4671 dnl ========================================================
4672 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4673 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4674     SYSTEM_HUNSPELL=1 )
4676 if test -n "$SYSTEM_HUNSPELL"; then
4677     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4680 AC_SUBST(SYSTEM_HUNSPELL)
4682 dnl ========================================================
4683 dnl Java SDK support
4684 dnl ========================================================
4685 JAVA_INCLUDE_PATH=
4686 MOZ_ARG_WITH_STRING(java-include-path,
4687 [  --with-java-include-path=dir   Location of Java SDK headers],
4688     JAVA_INCLUDE_PATH=$withval)
4690 JAVA_BIN_PATH=
4691 MOZ_ARG_WITH_STRING(java-bin-path,
4692 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4693     JAVA_BIN_PATH=$withval)
4695 dnl ========================================================
4696 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4697 dnl their usage and use them in spidermonkey.
4698 dnl ========================================================
4699 MOZ_ARG_WITH_BOOL(arm-kuser,
4700 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4701     USE_ARM_KUSER=1,
4702     USE_ARM_KUSER=)
4703 if test -n "$USE_ARM_KUSER"; then
4704    AC_DEFINE(USE_ARM_KUSER)
4707 dnl ========================================================
4708 dnl =
4709 dnl = Application
4710 dnl =
4711 dnl ========================================================
4713 MOZ_ARG_HEADER(Application)
4715 BUILD_STATIC_LIBS=
4716 ENABLE_TESTS=1
4717 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4718 MOZ_BRANDING_DIRECTORY=
4719 MOZ_OFFICIAL_BRANDING=
4720 MOZ_FEEDS=1
4721 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4722 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4723 MOZ_IPC=1
4724 MOZ_JAVAXPCOM=
4725 MOZ_JSDEBUGGER=1
4726 MOZ_JSLOADER=1
4727 MOZ_MATHML=1
4728 MOZ_MORK=
4729 MOZ_MORKREADER=1
4730 MOZ_AUTH_EXTENSION=1
4731 MOZ_NO_ACTIVEX_SUPPORT=1
4732 MOZ_NO_INSPECTOR_APIS=
4733 MOZ_NO_FAST_LOAD=
4734 MOZ_OGG=1
4735 MOZ_SYDNEYAUDIO=
4736 MOZ_WAVE=1
4737 MOZ_MEDIA=
4738 MOZ_PANGO=1
4739 MOZ_PERMISSIONS=1
4740 MOZ_PLACES=1
4741 MOZ_PLAINTEXT_EDITOR_ONLY=
4742 MOZ_PLUGINS=1
4743 MOZ_PREF_EXTENSIONS=1
4744 MOZ_PROFILELOCKING=1
4745 MOZ_PSM=1
4746 MOZ_RDF=1
4747 MOZ_REFLOW_PERF=
4748 MOZ_SAFE_BROWSING=
4749 MOZ_FASTSTART=
4750 MOZ_HELP_VIEWER=
4751 MOZ_SPELLCHECK=1
4752 MOZ_SPLASHSCREEN=
4753 MOZ_STORAGE=1
4754 MOZ_SVG=1
4755 MOZ_TIMELINE=
4756 MOZ_TOOLKIT_SEARCH=1
4757 MOZ_UI_LOCALE=en-US
4758 MOZ_UNIVERSALCHARDET=1
4759 MOZ_URL_CLASSIFIER=
4760 MOZ_USE_NATIVE_UCONV=
4761 MOZ_VIEW_SOURCE=1
4762 MOZ_XPINSTALL=1
4763 MOZ_XSLT_STANDALONE=
4764 MOZ_XTF=1
4765 MOZ_XUL=1
4766 MOZ_ZIPWRITER=1
4767 NS_PRINTING=1
4768 NECKO_WIFI=1
4769 NECKO_COOKIES=1
4770 NECKO_DISK_CACHE=1
4771 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4772 NECKO_SMALL_BUFFERS=
4773 BUILD_CTYPES=1
4774 XPC_IDISPATCH_SUPPORT=
4777 case "$target_os" in
4778 darwin*|*wince*|*winmo*)
4779     ACCESSIBILITY=
4780     ;;
4782     ACCESSIBILITY=1
4783     ;;
4784 esac
4786 case "$target_os" in
4787     msvc*|mks*|cygwin*|mingw*)
4788         NS_ENABLE_TSF=1
4789         if test -z "$GNU_CC"; then 
4790             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4791                 NS_ENABLE_TSF=
4792             fi
4793             XPC_IDISPATCH_SUPPORT=1
4794             MOZ_NO_ACTIVEX_SUPPORT=
4795         fi
4796         if test -n "$NS_ENABLE_TSF"; then
4797             AC_DEFINE(NS_ENABLE_TSF)
4798         fi
4799         ;;
4800 esac
4802 MOZ_ARG_ENABLE_STRING(application,
4803 [  --enable-application=APP
4804                           Options include:
4805                             browser (Firefox)
4806                             xulrunner
4807                             content/xslt (Standalone Transformiix XSLT)
4808                             netwerk (Standalone Necko)
4809                             tools/update-packaging (AUS-related packaging tools)
4810                             standalone (use this for standalone
4811                               xpcom/xpconnect or to manually drive a build)],
4812 [ MOZ_BUILD_APP=$enableval ] )
4814 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4815 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4816   XULRUNNER_STUB_NAME=$withval)
4818 if test -z "$XULRUNNER_STUB_NAME"; then
4819   case "$target_os" in
4820   darwin*)
4821     XULRUNNER_STUB_NAME=xulrunner
4822     ;;
4823   *)
4824     XULRUNNER_STUB_NAME=xulrunner-stub
4825   esac
4827 AC_SUBST(XULRUNNER_STUB_NAME)
4829 if test -z "$MOZ_BUILD_APP"; then
4830   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4831 else
4832   # We have a valid application only if it has a build.mk file in its top
4833   # directory.
4834   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4835     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4836   fi
4839 # Allow the application to influence configure with a confvars.sh script.
4841 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4842 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4843   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4844   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4845 else
4846   AC_MSG_RESULT([no])
4849 # Now is a good time to test for logic errors, define mismatches, etc.
4850 case "$MOZ_BUILD_APP" in
4851 xulrunner)
4852   if test "$LIBXUL_SDK"; then
4853     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4854   fi
4855   ;;
4856 esac
4858 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4859 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4860 # MOZ_BUILD_APP.
4861 case "$MOZ_BUILD_APP" in
4862 browser)
4863   AC_DEFINE(MOZ_PHOENIX)
4864   ;;
4866 xulrunner)
4867   AC_DEFINE(MOZ_XULRUNNER)
4868   ;;
4870 content/xslt)
4871   AC_DEFINE(TX_EXE)
4872   ;;
4874 standalone) 
4875   MOZ_APP_NAME=mozilla
4876   MOZ_APP_DISPLAYNAME=Mozilla
4877   MOZ_APP_VERSION=$MOZILLA_VERSION
4878   ;;
4880 esac
4882 AC_SUBST(MOZ_BUILD_APP)
4883 AC_SUBST(MOZ_PHOENIX)
4884 AC_SUBST(MOZ_XULRUNNER)
4886 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4888 dnl ========================================================
4889 dnl = 
4890 dnl = Toolkit Options
4891 dnl = 
4892 dnl ========================================================
4893 MOZ_ARG_HEADER(Toolkit Options)
4895     dnl ========================================================
4896     dnl = Select the default toolkit
4897     dnl ========================================================
4898         MOZ_ARG_ENABLE_STRING(default-toolkit,
4899         [  --enable-default-toolkit=TK
4900                           Select default toolkit
4901                           Platform specific defaults:
4902                             BeOS - cairo-beos
4903                             Mac OS X - cairo-cocoa
4904                             Neutrino/QNX - photon
4905                             OS/2 - cairo-os2
4906                             Win32/WinCE - cairo-windows
4907                             Gtk2 with DirectFB - cairo-gtk2-dfb
4908                             * - cairo-gtk2
4909                             * - cairo-qt],
4910     [ _DEFAULT_TOOLKIT=$enableval ],
4911     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4913     if test "$_DEFAULT_TOOLKIT" = "photon" \
4914         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4915         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4916         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4917         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4918         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4919         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4920         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4921         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4922     then
4923         dnl nglayout only supports building with one toolkit,
4924         dnl so ignore everything after the first comma (",").
4925         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4926     else
4927         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4928     fi
4930 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4932 dnl ========================================================
4933 dnl = Enable the toolkit as needed                         =
4934 dnl ========================================================
4936 case "$MOZ_WIDGET_TOOLKIT" in
4937 photon)
4938         MOZ_ENABLE_PHOTON=1
4939         AC_DEFINE(MOZ_WIDGET_PHOTON)
4940     ;;
4942 cairo-windows)
4943     MOZ_WIDGET_TOOLKIT=windows
4944     MOZ_WEBGL=1
4945     case "${target}" in
4946     *-wince*)
4947         NS_PRINTING=
4948         ;;
4949     esac
4950     ;;
4952 cairo-gtk2|cairo-gtk2-x11)
4953     MOZ_WIDGET_TOOLKIT=gtk2
4954     MOZ_ENABLE_GTK2=1
4955     MOZ_ENABLE_XREMOTE=1
4956     MOZ_WEBGL=1
4957     MOZ_WEBGL_GLX=1
4959     AC_DEFINE(MOZ_X11)
4960     MOZ_X11=1
4961     USE_FC_FREETYPE=1
4963     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4964     TK_LIBS='$(MOZ_GTK2_LIBS)'
4965     AC_DEFINE(MOZ_WIDGET_GTK2)
4966     ;;
4968 cairo-gtk2-dfb)
4969     MOZ_WIDGET_TOOLKIT=gtk2
4970     MOZ_ENABLE_GTK2=1
4971     MOZ_WEBGL=
4973     AC_DEFINE(MOZ_DFB)
4974     MOZ_DFB=1
4976     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4977     TK_LIBS='$(MOZ_GTK2_LIBS)'
4978     AC_DEFINE(MOZ_WIDGET_GTK2)
4979     if test "$no_x" != "yes"; then
4980         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4981         no_x=yes
4982     fi
4983     ;;
4985 cairo-qt)
4986     MOZ_WIDGET_TOOLKIT=qt
4987     MOZ_ENABLE_QT=1
4988     MOZ_ENABLE_XREMOTE=1
4989     MOZ_WEBGL=1
4990     MOZ_WEBGL_GLX=1
4991     USE_ELF_DYNSTR_GC=
4992     NS_PRINTING=
4994     AC_DEFINE(MOZ_X11)
4995     MOZ_X11=1
4996     USE_FC_FREETYPE=1
4998     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4999     TK_LIBS='$(MOZ_QT_LIBS)'
5000     AC_DEFINE(MOZ_WIDGET_QT)
5001     ;;
5003 cairo-beos)
5004     MOZ_WIDGET_TOOLKIT=beos
5005     USE_FC_FREETYPE=1
5006     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5007     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5008     ;;
5010 cairo-os2)
5011     MOZ_WIDGET_TOOLKIT=os2
5012     USE_FC_FREETYPE=1
5013     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5014     TK_LIBS='$(MOZ_CAIRO_LIBS)'
5015     ;;
5017 cairo-cocoa)
5018     MOZ_WIDGET_TOOLKIT=cocoa
5019     AC_DEFINE(MOZ_WIDGET_COCOA)
5020     MOZ_USER_DIR="Mozilla"
5021     AC_DEFINE(XP_MACOSX)
5022     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
5023     TK_CFLAGS="-DNO_X11"
5024     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5025     CFLAGS="$CFLAGS $TK_CFLAGS"
5026     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5027     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5028     MOZ_FS_LAYOUT=bundle
5029     MOZ_WEBGL=1
5030     ;;
5031 esac
5033 if test "$MOZ_ENABLE_XREMOTE"; then
5034     AC_DEFINE(MOZ_ENABLE_XREMOTE)
5037 if test "$COMPILE_ENVIRONMENT"; then
5038   if test "$MOZ_ENABLE_GTK2"; then
5039     if test "$MOZ_X11"; then
5040       GDK_PACKAGES=gdk-x11-2.0
5041     elif test "$MOZ_DFB"; then
5042       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5043       GDK_PACKAGES=directfb
5044     fi
5046     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5047   fi
5049 fi # COMPILE_ENVIRONMENT
5051 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
5052 AC_SUBST(MOZ_FS_LAYOUT)
5054 dnl ========================================================
5055 dnl = startup-notification support module
5056 dnl ========================================================
5058 if test "$MOZ_ENABLE_GTK2"
5059 then
5060     MOZ_ENABLE_STARTUP_NOTIFICATION=
5062     MOZ_ARG_ENABLE_BOOL(startup-notification,
5063     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
5064         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5065         MOZ_ENABLE_STARTUP_NOTIFICATION=)
5066     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5067     then
5068         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5069                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5070         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5071             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5072             then
5073                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5074             fi
5075             MOZ_ENABLE_STARTUP_NOTIFICATION=
5076         ])
5077     fi
5079     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5080         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5081     fi
5083     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5085 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5086 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5087 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5089 dnl ========================================================
5090 dnl = QT support
5091 dnl ========================================================
5092 if test "$MOZ_ENABLE_QT"
5093 then
5094     MOZ_ARG_WITH_STRING(qtdir,
5095     [  --with-qtdir=\$dir       Specify Qt directory ],
5096     [ QTDIR=$withval])
5098     if test -z "$QTDIR"; then
5099         PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5100         AC_CHECK_PROGS(HOST_MOC, moc, "")
5101     else
5102         MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5104         MOZ_QT_CFLAGS="-DQT_SHARED"
5105         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5106         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5107         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5108         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5109         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5110         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5111         MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5112         HOST_MOC="$QTDIR/bin/moc"
5113     fi
5114     if test -z "$HOST_MOC"; then
5115         AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5116 incorrect])
5117     fi
5118     MOC=$HOST_MOC
5121 AC_SUBST(GTK_CONFIG)
5122 AC_SUBST(TK_CFLAGS)
5123 AC_SUBST(TK_LIBS)
5125 AC_SUBST(MOZ_ENABLE_GTK2)
5126 AC_SUBST(MOZ_ENABLE_PHOTON)
5127 AC_SUBST(MOZ_ENABLE_QT)
5128 AC_SUBST(MOZ_ENABLE_XREMOTE)
5129 AC_SUBST(MOZ_GTK2_CFLAGS)
5130 AC_SUBST(MOZ_GTK2_LIBS)
5131 AC_SUBST(MOZ_QT_CFLAGS)
5132 AC_SUBST(MOZ_QT_LIBS)
5134 AC_SUBST(MOC)
5136 AC_SUBST(MOZ_DFB)
5137 AC_SUBST(MOZ_X11)
5139 dnl ========================================================
5140 dnl =
5141 dnl = Components & Features
5142 dnl = 
5143 dnl ========================================================
5144 MOZ_ARG_HEADER(Components and Features)
5146 dnl ========================================================
5147 dnl = Localization
5148 dnl ========================================================
5149 MOZ_ARG_ENABLE_STRING(ui-locale,
5150 [  --enable-ui-locale=ab-CD
5151                           Select the user interface locale (default: en-US)],
5152     MOZ_UI_LOCALE=$enableval )
5153 AC_SUBST(MOZ_UI_LOCALE)
5155 dnl ========================================================
5156 dnl = Trademarked Branding 
5157 dnl ========================================================
5158 MOZ_ARG_ENABLE_BOOL(official-branding,
5159 [  --enable-official-branding Enable Official mozilla.org Branding
5160                           Do not distribute builds with
5161                           --enable-official-branding unless you have
5162                           permission to use trademarks per
5163                           http://www.mozilla.org/foundation/trademarks/ .],
5165   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5166     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5167   else
5168     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5169     MOZ_OFFICIAL_BRANDING=1
5170   fi
5171 ], MOZ_OFFICIAL_BRANDING=)
5173 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5174 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5175   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5178 MOZ_ARG_WITH_STRING(branding,
5179 [  --with-branding=dir    Use branding from the specified directory.],
5180     MOZ_BRANDING_DIRECTORY=$withval)
5182 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5183 if test -z "$REAL_BRANDING_DIRECTORY"; then
5184   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5187 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5188   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5191 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5193 dnl ========================================================
5194 dnl = Distribution ID
5195 dnl ========================================================
5196 MOZ_ARG_WITH_STRING(distribution-id,
5197 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
5198 [ val=`echo $withval`
5199     MOZ_DISTRIBUTION_ID="$val"])
5201 if test -z "$MOZ_DISTRIBUTION_ID"; then
5202    MOZ_DISTRIBUTION_ID="org.mozilla"
5205 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5206 AC_SUBST(MOZ_DISTRIBUTION_ID)
5209 dnl ========================================================
5210 dnl complex text support off by default
5211 dnl ========================================================
5212 MOZ_ARG_DISABLE_BOOL(pango,
5213 [  --disable-pango Disable usage of Pango ],
5214     MOZ_PANGO=,
5215     MOZ_PANGO=1)
5217 dnl ========================================================
5218 dnl = Pango
5219 dnl ========================================================
5220 if test "$MOZ_ENABLE_GTK2"
5221 then
5222     AC_SUBST(MOZ_PANGO)
5224     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5226     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5227     AC_SUBST(MOZ_PANGO_CFLAGS)
5228     AC_SUBST(MOZ_PANGO_LIBS)
5229     if test "$MOZ_PANGO"
5230     then
5231         AC_DEFINE(MOZ_PANGO)
5232     else
5233         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5234         AC_SUBST(FT2_CFLAGS)
5235         AC_SUBST(FT2_LIBS)
5236     fi
5239 if test "$MOZ_ENABLE_QT"
5240 then
5241     if test "$MOZ_PANGO"
5242     then
5243         PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5244         [
5245             AC_SUBST(MOZ_PANGO_CFLAGS)
5246             AC_SUBST(MOZ_PANGO_LIBS)
5247             AC_DEFINE(MOZ_PANGO)
5248         ],
5249         [
5250             echo "Pango library not found, will use FT2 font engine"
5251             MOZ_PANGO=
5252         ])
5253     fi
5254     AC_SUBST(MOZ_PANGO)
5257 dnl ========================================================
5258 dnl = GnomeVFS, GIO and GConf support module
5259 dnl ========================================================
5261 if test "$MOZ_X11"
5262 then
5263     dnl build the gnomevfs extension by default only when the
5264     dnl GTK2 toolkit is in use.
5265     if test "$MOZ_ENABLE_GTK2"
5266     then
5267         MOZ_ENABLE_GNOMEVFS=1
5268         MOZ_ENABLE_GCONF=1
5269     fi
5271     dnl ========================================================
5272     dnl = GnomeVFS support module
5273     dnl ========================================================
5274     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5275     [  --disable-gnomevfs      Disable GnomeVFS support ],
5276         MOZ_ENABLE_GNOMEVFS=,
5277         MOZ_ENABLE_GNOMEVFS=force)
5279     if test "$MOZ_ENABLE_GNOMEVFS"
5280     then
5281         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5282             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5283             MOZ_ENABLE_GNOMEVFS=1
5284             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5285         ],[
5286             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5287             then
5288                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5289             fi
5290             MOZ_ENABLE_GNOMEVFS=
5291         ])
5292     else
5293         if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5294             PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5295               MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5296             ])
5297         fi
5298     fi
5300     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5301     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5302     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5304     dnl ========================================================
5305     dnl = GIO support module
5306     dnl ========================================================
5307     MOZ_ARG_ENABLE_BOOL(gio,
5308     [  --enable-gio            Enable GIO support (default: disabled)],
5309         MOZ_ENABLE_GIO=force,
5310         MOZ_ENABLE_GIO=)
5312     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5313     then
5314         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5315             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5316             MOZ_ENABLE_GIO=1
5317             AC_DEFINE(MOZ_ENABLE_GIO)
5318         ],[
5319             if test "$MOZ_ENABLE_GIO" = "force"
5320             then
5321                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5322             fi
5323             MOZ_ENABLE_GIO=
5324         ])
5325     fi
5327     AC_SUBST(MOZ_ENABLE_GIO)
5328     AC_SUBST(MOZ_GIO_CFLAGS)
5329     AC_SUBST(MOZ_GIO_LIBS)
5330    
5331     dnl ========================================================
5332     dnl = GConf support module
5333     dnl ========================================================
5334     if test "$MOZ_ENABLE_GCONF"
5335     then
5336         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5337             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5338             MOZ_ENABLE_GCONF=1
5339         ],[
5340             if test "$MOZ_ENABLE_GCONF" = "force"
5341             then
5342                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5343             fi
5344             MOZ_ENABLE_GCONF=
5345         ])
5346     fi
5348     if test "$MOZ_ENABLE_GCONF"; then
5349         AC_DEFINE(MOZ_ENABLE_GCONF)
5350     fi
5352     AC_SUBST(MOZ_ENABLE_GCONF)
5353     AC_SUBST(MOZ_GCONF_CFLAGS)
5354     AC_SUBST(MOZ_GCONF_LIBS)
5357 dnl ========================================================
5358 dnl = libnotify support
5359 dnl ========================================================
5361 if test "$MOZ_ENABLE_GTK2"
5362 then
5363     MOZ_ENABLE_LIBNOTIFY=1
5365     MOZ_ARG_DISABLE_BOOL(libnotify,
5366     [  --disable-libnotify       Disable libnotify support ],
5367     MOZ_ENABLE_LIBNOTIFY=,
5368     MOZ_ENABLE_LIBNOTIFY=1)
5370     if test "$MOZ_ENABLE_LIBNOTIFY"
5371     then
5372         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5373     fi
5376 if test -z "$SKIP_LIBRARY_CHECKS"
5377 then
5378     if test "$MOZ_ENABLE_GTK2"
5379     then
5380         if test "$MOZ_ENABLE_LIBNOTIFY"
5381         then
5382             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5383         fi
5384     fi
5386 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5387 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5388 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5390 dnl ========================================================
5391 dnl = GNOME component (mozgnome)
5392 dnl ========================================================
5394 # The GNOME component is built if one of 
5395 # gnome-vfs, gio, gconf or libnotify is available.
5396 if test "$MOZ_ENABLE_GCONF" || \
5397    test "$MOZ_ENABLE_GNOMEVFS" || \
5398    test "$MOZ_ENABLE_GIO" || \
5399    test "$MOZ_ENABLE_LIBNOTIFY"; then
5400     MOZ_ENABLE_GNOME_COMPONENT=1
5401 else
5402     MOZ_ENABLE_GNOME_COMPONENT=
5404 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5406 dnl ========================================================
5407 dnl = libgnomeui support module
5408 dnl ========================================================
5410 if test "$MOZ_ENABLE_GTK2"
5411 then
5412     MOZ_ENABLE_GNOMEUI=1
5414     MOZ_ARG_DISABLE_BOOL(gnomeui,
5415     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5416         MOZ_ENABLE_GNOMEUI=,
5417         MOZ_ENABLE_GNOMEUI=force)
5419     if test "$MOZ_ENABLE_GNOMEUI"
5420     then
5421         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5422         [
5423             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5424             MOZ_ENABLE_GNOMEUI=1
5425         ],[
5426             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5427             then
5428                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5429             fi
5430             MOZ_ENABLE_GNOMEUI=
5431         ])
5432     fi
5434     if test "$MOZ_ENABLE_GNOMEUI"; then
5435         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5436     fi
5439 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5440 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5441 AC_SUBST(MOZ_GNOMEUI_LIBS)
5443 dnl ========================================================
5444 dnl = dbus support
5445 dnl ========================================================
5447 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5448 then
5449     MOZ_ENABLE_DBUS=1
5451     MOZ_ARG_DISABLE_BOOL(dbus,
5452     [  --disable-dbus       Disable dbus support ],
5453         MOZ_ENABLE_DBUS=,
5454         MOZ_ENABLE_DBUS=1)
5456     if test "$MOZ_ENABLE_DBUS"
5457     then
5458         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5459         AC_DEFINE(MOZ_ENABLE_DBUS)
5460     fi
5462 AC_SUBST(MOZ_ENABLE_DBUS)
5463 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5464 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5466 dnl ========================================================
5467 dnl = Build Personal Security Manager
5468 dnl ========================================================
5469 MOZ_ARG_DISABLE_BOOL(crypto,
5470 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5471     MOZ_PSM=,
5472     MOZ_PSM=1 )
5474 dnl ========================================================
5475 dnl = JS Debugger XPCOM component (js/jsd)
5476 dnl ========================================================
5477 MOZ_ARG_DISABLE_BOOL(jsd,
5478 [  --disable-jsd           Disable JavaScript debug library],
5479     MOZ_JSDEBUGGER=,
5480     MOZ_JSDEBUGGER=1)
5483 dnl ========================================================
5484 dnl = Disable IPC support for tabs and plugins
5485 dnl ========================================================
5486 case "${target}" in
5487 powerpc-apple-darwin*)
5488     MOZ_IPC=
5489     ;;
5490 *-wince*)
5491     MOZ_IPC=
5492     ;;
5493 esac
5495 MOZ_ARG_DISABLE_BOOL(ipc,
5496 [  --disable-ipc           Disable IPC supports for tabs and plugins],
5497     MOZ_IPC=,
5498     MOZ_IPC=1)
5500 if test -n "$MOZ_IPC"; then
5501     AC_DEFINE(MOZ_IPC)
5504 AC_SUBST(MOZ_IPC)
5506 dnl ========================================================
5507 dnl = Enable IPDL's "expensive" unit tests
5508 dnl ========================================================
5509 MOZ_IPDL_TESTS=
5511 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5512 [  --enable-ipdl-tests     Enable expensive IPDL tests],
5513     MOZ_IPDL_TESTS=1,
5514     MOZ_IPDL_TESTS=)
5516 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5517     AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5520 if test -n "$MOZ_IPDL_TESTS"; then
5521     AC_DEFINE(MOZ_IPDL_TESTS)
5524 AC_SUBST(MOZ_IPDL_TESTS)
5526 dnl ========================================================
5527 dnl = Disable plugin support
5528 dnl ========================================================
5529 MOZ_ARG_DISABLE_BOOL(plugins,
5530 [  --disable-plugins       Disable plugins support],
5531     MOZ_PLUGINS=,
5532     MOZ_PLUGINS=1)
5534 dnl ========================================================
5535 dnl = Disable building dbm
5536 dnl ========================================================
5537 MOZ_ARG_DISABLE_BOOL(dbm,
5538 [  --disable-dbm       Disable building dbm],
5539     NSS_DISABLE_DBM=1,
5540     NSS_DISABLE_DBM=)
5542 dnl bi-directional support always on
5543 IBMBIDI=1
5544 AC_DEFINE(IBMBIDI)
5546 dnl ========================================================
5547 dnl view source support on by default
5548 dnl ========================================================
5549 if test "$MOZ_VIEW_SOURCE"; then
5550     AC_DEFINE(MOZ_VIEW_SOURCE)
5553 dnl ========================================================
5554 dnl accessibility support on by default on all platforms 
5555 dnl except OS X.
5556 dnl ========================================================
5557 MOZ_ARG_DISABLE_BOOL(accessibility,
5558 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5559     ACCESSIBILITY=,
5560     ACCESSIBILITY=1 )
5561 if test "$ACCESSIBILITY"; then
5562     AC_DEFINE(ACCESSIBILITY)
5565 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5566 case "$target" in
5567 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5568     if test "$ac_cv_header_atlbase_h" = "no"; then
5569         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.])
5570     fi
5571     if test "$ac_cv_header_oleacc_idl" = "no"; then
5572         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.])
5573     fi
5574     ;;
5575 esac
5578 dnl ========================================================
5579 dnl xpinstall support on by default
5580 dnl ========================================================
5581 MOZ_ARG_DISABLE_BOOL(xpinstall,
5582 [  --disable-xpinstall     Disable xpinstall support],
5583     MOZ_XPINSTALL=,
5584     MOZ_XPINSTALL=1 )
5585 if test "$MOZ_XPINSTALL"; then
5586     AC_DEFINE(MOZ_XPINSTALL)
5589 dnl ========================================================
5590 dnl xpcom js loader support on by default
5591 dnl ========================================================
5592 if test "$MOZ_JSLOADER"; then
5593     AC_DEFINE(MOZ_JSLOADER)
5596 dnl ========================================================
5597 dnl Disable printing
5598 dnl ========================================================
5599 MOZ_ARG_DISABLE_BOOL(printing,
5600 [  --disable-printing  Disable printing support],
5601     NS_PRINTING=,
5602     NS_PRINTING=1 )
5604 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5605     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5606     NS_PRINTING=
5609 if test "$NS_PRINTING"; then
5610     AC_DEFINE(NS_PRINTING)
5611     AC_DEFINE(NS_PRINT_PREVIEW)
5614 dnl ========================================================
5615 dnl use native unicode converters
5616 dnl ========================================================
5617 MOZ_ARG_ENABLE_BOOL(native-uconv,
5618 [  --enable-native-uconv   Enable iconv support],
5619     MOZ_USE_NATIVE_UCONV=1,
5620     MOZ_USE_NATIVE_UCONV= )
5621 if test "$MOZ_USE_NATIVE_UCONV"; then
5622     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5624 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5625     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5629 dnl ========================================================
5630 dnl Libeditor can be build as plaintext-only,
5631 dnl or as a full html and text editing component.
5632 dnl We build both by default.
5633 dnl ========================================================
5634 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5635 [  --enable-plaintext-editor-only
5636                           Allow only plaintext editing],
5637     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5638     MOZ_PLAINTEXT_EDITOR_ONLY= )
5639 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5640 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5642 dnl ========================================================
5643 dnl = Disable Fast Load
5644 dnl ========================================================
5645 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5646 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5647     MOZ_NO_FAST_LOAD=1,
5648     MOZ_NO_FAST_LOAD=)
5650 AC_SUBST(MOZ_NO_FAST_LOAD)
5652 if test -n "$MOZ_NO_FAST_LOAD"; then
5653     AC_DEFINE(MOZ_NO_FAST_LOAD)
5656 dnl ========================================================
5657 dnl = Disable Ogg Codecs
5658 dnl ========================================================
5659 MOZ_ARG_DISABLE_BOOL(ogg,
5660 [  --disable-ogg           Disable Ogg Codec support],
5661     MOZ_OGG=,
5662     MOZ_OGG=1)
5664 AC_SUBST(MOZ_OGG)
5666 if test -n "$MOZ_OGG"; then
5667     AC_DEFINE(MOZ_OGG)
5668     MOZ_SYDNEYAUDIO=1
5669     MOZ_MEDIA=1
5671     dnl Checks for __attribute__(aligned()) directive
5672     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5673         [ac_cv_c_attribute_aligned],
5674         [ac_cv_c_attribute_aligned=0
5675          CFLAGS_save="${CFLAGS}"
5676          CFLAGS="${CFLAGS} -Werror"
5677          for ac_cv_c_attr_align_try in 64 32 16 8; do
5678            echo "trying $ac_cv_c_attr_align_try"
5679            AC_TRY_COMPILE([],
5680                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5681                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5682            if test "$ac_cv_c_attribute_aligned" != 0; then
5683              break;
5684            fi
5685          done
5686            CFLAGS="${CFLAGS_save}"])
5687     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5688       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5689                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5690     fi
5693 dnl ========================================================
5694 dnl = Disable Wave decoder support
5695 dnl ========================================================
5696 MOZ_ARG_DISABLE_BOOL(wave,
5697 [  --disable-wave          Disable Wave decoder support],
5698     MOZ_WAVE=,
5699     MOZ_WAVE=1)
5701 AC_SUBST(MOZ_WAVE)
5703 if test -n "$MOZ_WAVE"; then
5704     AC_DEFINE(MOZ_WAVE)
5705     MOZ_SYDNEYAUDIO=1
5706     MOZ_MEDIA=1
5709 dnl ========================================================
5710 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5711 dnl ========================================================
5713 AC_SUBST(MOZ_SYDNEYAUDIO)
5715 if test -n "$MOZ_SYDNEYAUDIO"; then
5716     AC_DEFINE(MOZ_SYDNEYAUDIO)
5719 AC_SUBST(MOZ_MEDIA)
5721 if test -n "$MOZ_MEDIA"; then
5722     AC_DEFINE(MOZ_MEDIA)
5725 dnl ========================================================
5726 dnl = Check alsa availability on Linux if using sydneyaudio
5727 dnl ========================================================
5729 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5730 if test -n "$MOZ_SYDNEYAUDIO"; then
5731    case "$target_os" in
5732 linux*)
5733       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5734          [echo "$MOZ_ALSA_PKG_ERRORS"
5735           AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux.  Disable with --disable-ogg --disable-wave.])])
5736       ;;
5737    esac
5739 AC_SUBST(MOZ_ALSA_LIBS)
5741 dnl ========================================================
5742 dnl Splashscreen
5743 dnl ========================================================
5744 AC_ARG_ENABLE(splashscreen,
5745               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5746               [enable_splash="yes"],[enable_splash=""])
5747 if test "x$enable_splash" = "xyes"; then
5748   MOZ_SPLASHSCREEN=1
5749   AC_DEFINE(MOZ_SPLASHSCREEN)
5751 AC_SUBST(MOZ_SPLASHSCREEN)
5753 dnl ========================================================
5754 dnl Permissions System
5755 dnl ========================================================
5756 MOZ_ARG_DISABLE_BOOL(permissions,
5757 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5758     MOZ_PERMISSIONS=,
5759     MOZ_PERMISSIONS=1
5762 dnl ========================================================
5763 dnl NegotiateAuth
5764 dnl ========================================================
5765 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5766 [  --disable-negotiateauth Disable GSS-API negotiation ],
5767     MOZ_AUTH_EXTENSION=,
5768     MOZ_AUTH_EXTENSION=1 )
5770 dnl ========================================================
5771 dnl XTF
5772 dnl ========================================================
5773 MOZ_ARG_DISABLE_BOOL(xtf,
5774 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5775     MOZ_XTF=,
5776     MOZ_XTF=1 )
5777 if test "$MOZ_XTF"; then
5778   AC_DEFINE(MOZ_XTF)
5781 dnl ========================================================
5782 dnl Pref extensions (autoconfig and system-pref)
5783 dnl ========================================================
5784 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5785 [  --disable-pref-extensions
5786                           Disable pref extensions such as autoconfig and
5787                           system-pref],
5788   MOZ_PREF_EXTENSIONS=,
5789   MOZ_PREF_EXTENSIONS=1 )
5791 dnl ========================================================
5792 dnl = Universalchardet
5793 dnl ========================================================
5794 MOZ_ARG_DISABLE_BOOL(universalchardet,
5795 [  --disable-universalchardet
5796                           Disable universal encoding detection],
5797   MOZ_UNIVERSALCHARDET=,
5798   MOZ_UNIVERSALCHARDET=1 )
5800 dnl ========================================================
5801 dnl JavaXPCOM
5802 dnl ========================================================
5803 case "${target}" in
5804 *-wince*)
5805     MOZ_JAVAXPCOM=
5806     ;;
5807 esac
5809 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5810 [  --enable-javaxpcom
5811                           Enable Java-XPCOM bridge],
5812     MOZ_JAVAXPCOM=1,
5813     MOZ_JAVAXPCOM= )
5815 if test -n "${MOZ_JAVAXPCOM}"; then
5816   case "$host_os" in
5817     cygwin*|msvc*|mks*)
5818       if test -n "$JAVA_HOME"; then
5819         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5820       fi
5821       ;;
5822     *mingw*)
5823       if test -n "$JAVA_HOME"; then
5824         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5825       fi
5826       ;;
5827   esac
5829   if test -n "${JAVA_INCLUDE_PATH}"; then
5830     dnl Make sure jni.h exists in the given include path.
5831     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5832       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5833     fi
5834   else
5835     case "$target_os" in
5836       darwin*)
5837         dnl Default to java system location
5838         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5839         ;;
5840       *)
5841         dnl Try $JAVA_HOME
5842         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5843         ;;
5844     esac
5845     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5846       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.])
5847     fi
5848   fi
5850   if test -n "${JAVA_BIN_PATH}"; then
5851     dnl Look for javac and jar in the specified path.
5852     JAVA_PATH="$JAVA_BIN_PATH"
5853   else
5854     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5855     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5856   fi
5858   MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5859   MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5860   MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5861   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5862     AC_MSG_ERROR([The programs java, javac and jar were not found.  Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
5863   fi
5866 dnl ========================================================
5867 dnl = Breakpad crash reporting (on by default on supported platforms)
5868 dnl ========================================================
5870 case $target in
5871 i?86-*-mingw*)
5872   MOZ_CRASHREPORTER=1
5873   ;;
5874 i?86-apple-darwin*|powerpc-apple-darwin*)
5875   MOZ_CRASHREPORTER=1
5876   ;;
5877 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
5878   MOZ_CRASHREPORTER=1
5879   ;;
5880 *solaris*)
5881   MOZ_CRASHREPORTER=1
5882   ;;
5883 esac
5885 MOZ_ARG_DISABLE_BOOL(crashreporter,
5886 [  --disable-crashreporter          Disable breakpad crash reporting],
5887     MOZ_CRASHREPORTER=,
5888     MOZ_CRASHREPORTER=1)
5890 if test -n "$MOZ_CRASHREPORTER"; then
5891    AC_DEFINE(MOZ_CRASHREPORTER)
5893   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5894     test -z "$SKIP_LIBRARY_CHECKS"; then
5895     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5896     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5897     AC_SUBST(MOZ_GTHREAD_LIBS)
5899     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.])])
5900   fi
5903 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5904 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5905 [ val=`echo $withval | sed 's/[^0-9]//g'`
5906     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5908 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5909    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5911 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5913 dnl ========================================================
5914 dnl = Enable compilation of specific extension modules
5915 dnl ========================================================
5917 MOZ_ARG_ENABLE_STRING(extensions,
5918 [  --enable-extensions     Enable extensions],
5919 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5920     if test "$option" = "yes" || test "$option" = "all"; then
5921         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5922     elif test "$option" = "no" || test "$option" = "none"; then
5923         MOZ_EXTENSIONS=""
5924     elif test "$option" = "default"; then
5925         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5926     elif test `echo "$option" | grep -c \^-` != 0; then
5927         option=`echo $option | sed 's/^-//'`
5928         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5929     else
5930         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5931     fi
5932 done],
5933     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5935 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5936     # Suppress warning on non-X11 platforms
5937     if test -n "$MOZ_X11"; then
5938         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5939     fi
5940     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5943 dnl Do not build gnomevfs with libxul based apps
5944 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5945     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5948 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5949     # Suppress warning on non-X11 platforms
5950     if test -n "$MOZ_X11"; then
5951         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5952     fi
5953     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5956 dnl Do not build gio with libxul based apps
5957 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5958     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5961 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5962     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5963     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5966 dnl This might be temporary: build tridentprofile only on Windows
5967 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5968     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5969     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5972 dnl cookie must be built before tridentprofile. put it at list's end.
5973 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5974   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5975   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5978 dnl xforms requires xtf and schema-validation
5979 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5980     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5981     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5983 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5984     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5985     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5988 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5989     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5990     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5993 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5994     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5995     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5998 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5999     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6000     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6003 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6004     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6005     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6008 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6009     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6010     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6013 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6014     AC_MSG_WARN([spellcheck is no longer an extension.])
6015     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6018 dnl Remove dupes
6019 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6021 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6022 dnl when trying to build a non-existent extension.
6023 for extension in $MOZ_EXTENSIONS; do
6024     if test ! -d "${srcdir}/extensions/${extension}"; then
6025         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6026     fi
6027 done
6030 dnl ========================================================
6031 dnl Image decoders
6032 dnl ========================================================
6033 case "$MOZ_WIDGET_TOOLKIT" in
6034 beos|windows|os2|mac|cocoa)
6035     ;;
6037     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6038        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6039     fi
6040     ;;
6041 esac
6043 MOZ_ARG_ENABLE_STRING(image-decoders,
6044 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
6045                           Enable specific image decoders],
6046 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6047     if test "$option" = "yes" || test "$option" = "all"; then
6048         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6049     elif test "$option" = "no" || test "$option" = "none"; then
6050         MOZ_IMG_DECODERS=""
6051     elif test "$option" = "default"; then
6052         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6053     elif test `echo "$option" | grep -c \^-` != 0; then
6054         option=`echo $option | sed 's/^-//'`
6055         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6056     else
6057         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6058     fi
6059 done],
6060     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6062 dnl Dupes are removed in the encoder section because it will also add decoders
6064 dnl ========================================================
6065 dnl Image encoders
6066 dnl ========================================================
6067 MOZ_ARG_ENABLE_STRING(image-encoders,
6068 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
6069                           Enable specific image encoders],
6070 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6071     if test "$option" = "yes" || test "$option" = "all"; then
6072         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6073     elif test "$option" = "no" || test "$option" = "none"; then
6074         MOZ_IMG_ENCODERS=""
6075         addencoder=""
6076     elif test "$option" = "default"; then
6077         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6078     elif test `echo "$option" | grep -c \^-` != 0; then
6079         option=`echo $option | sed 's/^-//'`
6080         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6081     else
6082         addencoder="$option"
6083     fi
6084     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6085 done],
6086     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6088 dnl Remove dupes
6089 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6090 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6092 dnl ========================================================
6093 dnl MathML on by default
6094 dnl ========================================================
6095 MOZ_ARG_DISABLE_BOOL(mathml,
6096 [  --disable-mathml        Disable MathML support],
6097     MOZ_MATHML=,
6098     MOZ_MATHML=1 )
6099 if test "$MOZ_MATHML"; then
6100   AC_DEFINE(MOZ_MATHML)
6103 dnl ========================================================
6104 dnl SVG
6105 dnl ========================================================
6106 MOZ_ARG_DISABLE_BOOL(svg,
6107 [  --disable-svg            Disable SVG support],
6108     MOZ_SVG=,
6109     MOZ_SVG=1 )
6110 if test -n "$MOZ_SVG"; then
6111   AC_DEFINE(MOZ_SVG)
6114 dnl ========================================================
6115 dnl SMIL
6116 dnl ========================================================
6117 MOZ_SMIL=1
6118 MOZ_ARG_DISABLE_BOOL(smil,
6119 [  --disable-smil           Disable SMIL animation support],
6120     MOZ_SMIL=,
6121     MOZ_SMIL=1 )
6122 # Automatically disable SMIL if SVG is disabled
6123 if test -z "$MOZ_SVG"; then
6124   MOZ_SMIL=
6126 if test -n "$MOZ_SMIL"; then
6127   AC_DEFINE(MOZ_SMIL)
6130 dnl ========================================================
6131 dnl Build Freetype in the tree
6132 dnl ========================================================
6133 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6134 [  --enable-tree-freetype         Enable Tree FreeType],
6135     MOZ_TREE_FREETYPE=1,
6136     MOZ_TREE_FREETYPE= )
6137 if test -n "$MOZ_TREE_FREETYPE"; then
6138    AC_DEFINE(MOZ_TREE_FREETYPE)
6139    AC_SUBST(MOZ_TREE_FREETYPE)
6140    MOZ_ENABLE_CAIRO_FT=1       
6141    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6142    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6143    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6144    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6145    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6146    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6147    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6148    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6149    AC_SUBST(CAIRO_FT_CFLAGS)
6153 dnl ========================================================
6154 dnl Installer
6155 dnl ========================================================
6156 case "$target_os" in
6157     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6158         MOZ_INSTALLER=1
6159         ;;
6160 esac
6162 MOZ_ARG_DISABLE_BOOL(installer,
6163 [  --disable-installer     Disable building of installer],
6164     MOZ_INSTALLER=,
6165     MOZ_INSTALLER=1 )
6166 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6167     # Disable installer for Windows builds that use the new toolkit if NSIS
6168     # isn't in the path.
6169     MOZ_PATH_PROGS(MAKENSIS, makensis)
6170     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6171         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6172     fi
6173     # The Windows build for NSIS requires the iconv command line utility to
6174     # convert the charset of the locale files.
6175     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6176     if test -z "$HOST_ICONV"; then
6177         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6178     fi
6181 # Automatically disable installer if xpinstall isn't built
6182 if test -z "$MOZ_XPINSTALL"; then
6183     MOZ_INSTALLER=
6185 AC_SUBST(MOZ_INSTALLER)
6187 AC_MSG_CHECKING([for tar archiver])
6188 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6189 if test -z "$TAR"; then
6190     AC_MSG_ERROR([no tar archiver found in \$PATH])
6192 AC_MSG_RESULT([$TAR])
6193 AC_SUBST(TAR)
6195 AC_MSG_CHECKING([for wget])
6196 AC_CHECK_PROGS(WGET, wget, "")
6197 AC_MSG_RESULT([$WGET])
6198 AC_SUBST(WGET)
6200 dnl ========================================================
6201 dnl Updater
6202 dnl ========================================================
6204 MOZ_ARG_DISABLE_BOOL(updater,
6205 [  --disable-updater       Disable building of updater],
6206     MOZ_UPDATER=,
6207     MOZ_UPDATER=1 )
6208 AC_SUBST(MOZ_UPDATER)
6210 # app update channel is 'default' when not supplied.
6211 MOZ_ARG_ENABLE_STRING([update-channel],
6212 [  --enable-update-channel=CHANNEL
6213                            Select application update channel (default=default)],
6214     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6216 if test -z "$MOZ_UPDATE_CHANNEL"; then
6217     MOZ_UPDATE_CHANNEL=default
6219 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6221 # tools/update-packaging is not checked out by default.
6222 MOZ_ARG_ENABLE_BOOL(update-packaging,
6223 [  --enable-update-packaging
6224                            Enable tools/update-packaging],
6225     MOZ_UPDATE_PACKAGING=1,
6226     MOZ_UPDATE_PACKAGING= )
6227 AC_SUBST(MOZ_UPDATE_PACKAGING)
6229 dnl ========================================================
6230 dnl ActiveX
6231 dnl ========================================================
6233 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6234 [  --disable-xpconnect-idispatch
6235                           Disable building of xpconnect support for IDispatch
6236                           (win32 only)],
6237     XPC_IDISPATCH_SUPPORT=,
6238     XPC_IDISPATCH_SUPPORT=1)
6239 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6241 MOZ_ARG_DISABLE_BOOL(activex,
6242 [  --disable-activex       Disable building of ActiveX control (win32 only)],
6243     MOZ_NO_ACTIVEX_SUPPORT=1,
6244     MOZ_NO_ACTIVEX_SUPPORT= )
6245 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6247 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6248 [  --enable-activex-scripting
6249                           Enable building of ActiveX scripting support (win32)],
6250     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6251     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6252 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6254 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6255 then
6256     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6259 if test "$COMPILE_ENVIRONMENT" = "1"; then
6260 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6261 case "$target" in
6262 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6263     if test "$ac_cv_header_atlbase_h" = "no"; then
6264         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.])
6265     fi
6266     ;;
6267 esac
6271 dnl ========================================================
6272 dnl leaky
6273 dnl ========================================================
6274 MOZ_ARG_ENABLE_BOOL(leaky,
6275 [  --enable-leaky          Build leaky memory tool],
6276     MOZ_LEAKY=1,
6277     MOZ_LEAKY=)
6280 dnl ========================================================
6281 dnl xpctools
6282 dnl ========================================================
6283 MOZ_ARG_ENABLE_BOOL(xpctools,
6284 [  --enable-xpctools       Build JS profiling tool],
6285     MOZ_XPCTOOLS=1,
6286     MOZ_XPCTOOLS= )
6289 dnl ========================================================
6290 dnl build the tests by default
6291 dnl ========================================================
6292 MOZ_ARG_DISABLE_BOOL(tests,
6293 [  --disable-tests         Do not build test libraries & programs],
6294     ENABLE_TESTS=,
6295     ENABLE_TESTS=1 )
6297 dnl ========================================================
6298 dnl parental controls (for Windows Vista)
6299 dnl ========================================================
6300 MOZ_ARG_DISABLE_BOOL(parental-controls,
6301 [  --disable-parental-controls
6302                            Do not build parental controls],
6303    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6304    MOZ_DISABLE_PARENTAL_CONTROLS=)
6305 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6306     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6309 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6311 dnl ========================================================
6312 dnl =
6313 dnl = Module specific options
6314 dnl =
6315 dnl ========================================================
6316 MOZ_ARG_HEADER(Individual module options)
6318 dnl ========================================================
6319 dnl = Disable feed handling components
6320 dnl ========================================================
6321 MOZ_ARG_DISABLE_BOOL(feeds,
6322 [  --disable-feeds        Disable feed handling and processing components],
6323     MOZ_FEEDS=,
6324     MOZ_FEEDS=1 )
6325 if test -n "$MOZ_FEEDS"; then
6326     AC_DEFINE(MOZ_FEEDS)
6327 else
6328     if test "$MOZ_BUILD_APP" = "browser"; then
6329         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6330     fi
6333 dnl ========================================================
6334 dnl = Enable mozStorage
6335 dnl ========================================================
6336 dnl Implicitly enabled by default if building calendar or places
6337 MOZ_ARG_ENABLE_BOOL(storage,
6338 [  --enable-storage        Enable mozStorage module and related components],
6339     MOZ_STORAGE=1,
6340     MOZ_STORAGE= )
6341 if test -n "$MOZ_STORAGE"; then
6342     AC_DEFINE(MOZ_STORAGE)
6345 dnl ========================================================
6346 dnl Check for sqlite
6347 dnl ========================================================
6349 MOZ_NATIVE_SQLITE=
6350 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6351 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6352 MOZ_NATIVE_SQLITE=1,
6353 MOZ_NATIVE_SQLITE= )
6355 if test -z "$MOZ_NATIVE_SQLITE"
6356 then
6357     SQLITE_CFLAGS=
6358     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6359 else
6360     dnl ============================
6361     dnl === SQLite Version check ===
6362     dnl ============================
6363     dnl Check to see if the system SQLite package is new enough.
6364     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6366     dnl ==================================
6367     dnl === SQLITE_SECURE_DELETE check ===
6368     dnl ==================================
6369     dnl Check to see if the system SQLite package is compiled with
6370     dnl SQLITE_SECURE_DELETE enabled.
6371     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6372     _SAVE_CFLAGS="$CFLAGS"
6373     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6374     _SAVE_LIBS="$LIBS"
6375     LIBS="$LIBS $SQLITE_LIBS"
6376     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6377         AC_TRY_RUN([
6378             #include "sqlite3.h"
6380             int main(int argc, char **argv){
6381               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6382             }],
6383             ac_cv_sqlite_secure_delete=yes,
6384             ac_cv_sqlite_secure_delete=no,
6385             ac_cv_sqlite_secure_delete=no
6386         )
6387     ])
6388     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6389     CFLAGS="$_SAVE_CFLAGS"
6390     LIBS="$_SAVE_LIBS"
6391     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6392         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6393     fi
6395     dnl ===============================
6396     dnl === SQLITE_THREADSAFE check ===
6397     dnl ===============================
6398     dnl Check to see if the system SQLite package is compiled with
6399     dnl SQLITE_THREADSAFE enabled.
6400     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6401     _SAVE_CFLAGS="$CFLAGS"
6402     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6403     _SAVE_LIBS="$LIBS"
6404     LIBS="$LIBS $SQLITE_LIBS"
6405     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6406         AC_TRY_RUN([
6407             #include "sqlite3.h"
6409             int main(int argc, char **argv){
6410               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6411             }],
6412             ac_cv_sqlite_threadsafe=yes,
6413             ac_cv_sqlite_threadsafe=no,
6414             ac_cv_sqlite_threadsafe=no
6415         )
6416     ])
6417     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6418     CFLAGS="$_SAVE_CFLAGS"
6419     LIBS="$_SAVE_LIBS"
6420     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6421         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6422     fi
6424     dnl ================================
6425     dnl === SQLITE_ENABLE_FTS3 check ===
6426     dnl ================================
6427     dnl check to see if the system SQLite package is compiled with
6428     dnl SQLITE_THREADSAFE enabled.
6429     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6430     _SAVE_CFLAGS="$CFLAGS"
6431     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6432     _SAVE_LIBS="$LIBS"
6433     LIBS="$LIBS $SQLITE_LIBS"
6434     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6435         AC_TRY_RUN([
6436             #include "sqlite3.h"
6438             int main(int argc, char **argv){
6439               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6440             }],
6441             ac_cv_sqlite_enable_fts3=yes,
6442             ac_cv_sqlite_enable_fts3=no,
6443             ac_cv_sqlite_enable_fts3=no
6444         )
6445     ])
6446     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6447     CFLAGS="$_SAVE_CFLAGS"
6448     LIBS="$_SAVE_LIBS"
6449     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6450         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6451     fi
6454 AC_SUBST(MOZ_NATIVE_SQLITE)
6456 dnl ========================================================
6457 dnl = Enable safe browsing (anti-phishing)
6458 dnl ========================================================
6459 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6460 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6461     MOZ_SAFE_BROWSING=1,
6462     MOZ_SAFE_BROWSING= )
6463 if test -n "$MOZ_SAFE_BROWSING"; then
6464     AC_DEFINE(MOZ_SAFE_BROWSING)
6466 AC_SUBST(MOZ_SAFE_BROWSING)
6468 dnl ========================================================
6469 dnl = Enable faststart component
6470 dnl ========================================================
6471 MOZ_ARG_ENABLE_BOOL(faststart,
6472 [  --enable-faststart            Enable the faststart component],
6473     MOZ_FASTSTART=1,
6474     MOZ_FASTSTART= )
6475 if test -n "$MOZ_FASTSTART"; then
6476     AC_DEFINE(MOZ_FASTSTART)
6478 AC_SUBST(MOZ_FASTSTART)
6480 dnl ========================================================
6481 dnl = Enable url-classifier
6482 dnl ========================================================
6483 dnl Implicitly enabled by default if building with safe-browsing
6484 if test -n "$MOZ_SAFE_BROWSING"; then
6485     MOZ_URL_CLASSIFIER=1
6487 MOZ_ARG_ENABLE_BOOL(url-classifier,
6488 [  --enable-url-classifier        Enable url classifier module],
6489     MOZ_URL_CLASSIFIER=1,
6490     MOZ_URL_CLASSIFIER= )
6491 if test -n "$MOZ_URL_CLASSIFIER"; then
6492     AC_DEFINE(MOZ_URL_CLASSIFIER)
6494 AC_SUBST(MOZ_URL_CLASSIFIER)
6496 dnl ========================================================
6497 dnl = Disable zipwriter
6498 dnl ========================================================
6499 MOZ_ARG_DISABLE_BOOL(zipwriter,
6500 [  --disable-zipwriter             Disable zipwriter component],
6501     MOZ_ZIPWRITER=,
6502     MOZ_ZIPWRITER=1 )
6503 AC_SUBST(MOZ_ZIPWRITER)
6505 dnl ========================================================
6506 dnl = Disable libconic
6507 dnl ========================================================
6508 MOZ_ENABLE_LIBCONIC=1
6509 MOZ_ARG_DISABLE_BOOL(libconic,
6510 [  --disable-libconic              Disable libconic],
6511     MOZ_ENABLE_LIBCONIC=,
6512     MOZ_ENABLE_LIBCONIC=1 )
6514 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6515     PKG_CHECK_MODULES(LIBCONIC, conic,
6516                       MOZ_ENABLE_LIBCONIC=1,
6517                       MOZ_ENABLE_LIBCONIC=)
6519 if test "$MOZ_ENABLE_LIBCONIC"; then
6520     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6523 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6524 AC_SUBST(LIBCONIC_CFLAGS)
6525 AC_SUBST(LIBCONIC_LIBS)
6527 dnl ========================================================
6528 dnl = Maemo checks
6529 dnl ========================================================
6531 MAEMO_SDK_TARGET_VER=-1
6533 MOZ_ARG_WITH_STRING(maemo-version,
6534 [  --with-maemo-version=MAEMO_SDK_TARGET_VER
6535                         Maemo SDK Version],
6536   MAEMO_SDK_TARGET_VER=$withval)
6538 case "$MAEMO_SDK_TARGET_VER" in
6540     MOZ_PLATFORM_MAEMO=5
6541     ;;
6544     MOZ_PLATFORM_MAEMO=6
6545     ;;
6548     dnl We aren't compiling for Maemo, move on.
6549     ;;
6551     AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
6552     ;;
6553 esac
6555 if test $MOZ_PLATFORM_MAEMO; then
6556    AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6558    if test -z "$MOZ_ENABLE_DBUS"; then
6559        AC_MSG_ERROR([DBus is required when building for Maemo])
6560    fi
6562    MOZ_GFX_OPTIMIZE_MOBILE=1
6563    MOZ_WEBGL_GLX=
6564    MOZ_MAEMO_LIBLOCATION=
6566    if test $MOZ_PLATFORM_MAEMO = 5; then
6567       dnl if we have Xcomposite we should also have Xdamage and Xfixes
6568       AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6569                        [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6570       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6571                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6573       AC_SUBST(XCOMPOSITE_LIBS)
6575       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6576       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6577       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6578       if test -z "$_LIB_FOUND"; then
6579          AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6580       fi
6583       PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6584       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6585       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6586       if test -z "$_LIB_FOUND"; then
6587          AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6588       fi
6590       PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6591       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6592       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6593       if test -z "$_LIB_FOUND"; then
6594          AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6595       fi
6597    fi
6599    PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6600    MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6601    MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6602    if test "$_LIB_FOUND"; then
6603       MOZ_MAEMO_LIBLOCATION=1
6604       AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6605    else
6606       AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6607    fi
6608    AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6610    AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6611    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6614 dnl ========================================================
6615 dnl = faststripe theme
6616 dnl ========================================================
6617 MOZ_ARG_ENABLE_BOOL(faststripe,
6618 [  --enable-faststripe  Use faststripe theme],
6619     MOZ_THEME_FASTSTRIPE=1,
6620     MOZ_THEME_FASTSTRIPE= )
6621 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6623 dnl ========================================================
6624 dnl =
6625 dnl = Feature options that require extra sources to be pulled
6626 dnl =
6627 dnl ========================================================
6628 dnl MOZ_ARG_HEADER(Features that require extra sources)
6630 dnl ========================================================
6631 dnl =
6632 dnl = Debugging Options
6633 dnl = 
6634 dnl ========================================================
6635 MOZ_ARG_HEADER(Debugging and Optimizations)
6637 dnl ========================================================
6638 dnl = Disable building with debug info.
6639 dnl = Debugging is OFF by default
6640 dnl ========================================================
6641 if test -z "$MOZ_DEBUG_FLAGS"
6642 then
6643     case "$target" in
6644     *-irix*)
6645         if test "$GNU_CC"; then
6646             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6647             case "$GCC_VERSION" in
6648             2.95.*)
6649                 MOZ_DEBUG_FLAGS=""
6650                 ;;
6651             *)
6652                 MOZ_DEBUG_FLAGS="-g"
6653                 ;;
6654             esac
6655         else
6656             MOZ_DEBUG_FLAGS="-g"
6657         fi
6658         ;;
6659     *)
6660         MOZ_DEBUG_FLAGS="-g"
6661         ;;
6662     esac
6665 MOZ_ARG_ENABLE_STRING(debug,
6666 [  --enable-debug[=DBG]    Enable building with developer debug info
6667                            (using compiler flags DBG)],
6668 [ if test "$enableval" != "no"; then
6669     MOZ_DEBUG=1
6670     if test -n "$enableval" -a "$enableval" != "yes"; then
6671         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6672         _MOZ_DEBUG_FLAGS_SET=1
6673     fi
6674   else
6675     MOZ_DEBUG=
6676   fi ],
6677   MOZ_DEBUG=)
6679 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6680  case "${target_os}" in
6681     beos*)
6682         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6683         ;;
6684     msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6685         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6686         ;;
6687     *) 
6688         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6689         ;;
6690   esac
6691 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6693 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6695 if test -n "$MOZ_DEBUG"; then
6696     AC_MSG_CHECKING([for valid debug flags])
6697     _SAVE_CFLAGS=$CFLAGS
6698     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6699     AC_TRY_COMPILE([#include <stdio.h>], 
6700         [printf("Hello World\n");],
6701         _results=yes,
6702         _results=no)
6703     AC_MSG_RESULT([$_results])
6704     if test "$_results" = "no"; then
6705         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6706     fi
6707     CFLAGS=$_SAVE_CFLAGS
6710 dnl ========================================================
6711 dnl enable mobile optimizations
6712 dnl ========================================================
6713 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6714 [  --enable-mobile-optimize   Enable mobile optimizations],
6715     MOZ_GFX_OPTIMIZE_MOBILE=1)
6717 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6719 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6720     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6723 dnl ========================================================
6724 dnl = Enable code optimization. ON by default.
6725 dnl ========================================================
6726 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6727         MOZ_OPTIMIZE_FLAGS="-O"
6730 MOZ_ARG_ENABLE_STRING(optimize,
6731 [  --disable-optimize      Disable compiler optimization
6732   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6733 [ if test "$enableval" != "no"; then
6734     MOZ_OPTIMIZE=1
6735     if test -n "$enableval" && test "$enableval" != "yes"; then
6736         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6737         MOZ_OPTIMIZE=2
6738     fi
6739 else
6740     MOZ_OPTIMIZE=
6741 fi ], MOZ_OPTIMIZE=1)
6743 if test "$COMPILE_ENVIRONMENT"; then
6744 if test -n "$MOZ_OPTIMIZE"; then
6745     AC_MSG_CHECKING([for valid optimization flags])
6746     _SAVE_CFLAGS=$CFLAGS
6747     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6748     AC_TRY_COMPILE([#include <stdio.h>], 
6749         [printf("Hello World\n");],
6750         _results=yes,
6751         _results=no)
6752     AC_MSG_RESULT([$_results])
6753     if test "$_results" = "no"; then
6754         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6755     fi
6756     CFLAGS=$_SAVE_CFLAGS
6758 fi # COMPILE_ENVIRONMENT
6760 AC_SUBST(MOZ_OPTIMIZE)
6761 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6762 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6763 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6765 dnl ========================================================
6766 dnl = (Deprecated) generation of debugger info for specific modules
6767 dnl ========================================================
6768 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6769 [  --enable-debugger-info-modules
6770                           Enable/disable debugger info for specific modules],
6771 [ if test "$enableval" != "no"; then
6772     AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
6773     MOZ_DEBUG_SYMBOLS=1
6774   fi ])
6776 dnl ========================================================
6777 dnl = Enable generation of debug symbols
6778 dnl ========================================================
6779 MOZ_ARG_ENABLE_STRING(debug-symbols,
6780 [  --enable-debug-symbols[=DBG]    Enable debugging symbols
6781                                    (using compiler flags DBG)],
6782 [ if test "$enableval" != "no"; then
6783       MOZ_DEBUG_SYMBOLS=1
6784       if test -n "$enableval" -a "$enableval" != "yes"; then
6785           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6786               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6787           else
6788               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6789           fi
6790       fi
6791   fi ])
6793 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6794     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6795     export MOZ_DEBUG_SYMBOLS
6798 dnl ========================================================
6799 dnl Disable runtime logging checks
6800 dnl ========================================================
6801 MOZ_ARG_DISABLE_BOOL(logging,
6802 [  --disable-logging       Disable logging facilities],
6803     NS_DISABLE_LOGGING=1,
6804     NS_DISABLE_LOGGING= )
6805 if test "$NS_DISABLE_LOGGING"; then
6806     AC_DEFINE(NS_DISABLE_LOGGING)
6807 else
6808     AC_DEFINE(MOZ_LOGGING)
6811 dnl ========================================================
6812 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6813 dnl ========================================================
6814 _ENABLE_LOGREFCNT=42
6815 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6816 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6817     _ENABLE_LOGREFCNT=1,
6818     _ENABLE_LOGREFCNT= )
6819 if test "$_ENABLE_LOGREFCNT" = "1"; then
6820     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6821 elif test -z "$_ENABLE_LOGREFCNT"; then
6822     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6825 dnl ========================================================
6826 dnl = Enable trace malloc
6827 dnl ========================================================
6828 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6829 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6830 [  --enable-trace-malloc   Enable malloc tracing],
6831     NS_TRACE_MALLOC=1,
6832     NS_TRACE_MALLOC= )
6833 if test "$NS_TRACE_MALLOC"; then
6834   # Please, Mr. Linker Man, don't take away our symbol names
6835   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6836   USE_ELF_DYNSTR_GC=
6837   AC_DEFINE(NS_TRACE_MALLOC)
6839 AC_SUBST(NS_TRACE_MALLOC)
6841 dnl ========================================================
6842 dnl = Enable jemalloc
6843 dnl ========================================================
6844 MOZ_ARG_ENABLE_BOOL(jemalloc,
6845 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6846     MOZ_MEMORY=1,
6847     MOZ_MEMORY=)
6849 if test "$NS_TRACE_MALLOC"; then
6850     MOZ_MEMORY=
6853 if test "$MOZ_MEMORY"; then
6855   dnl Don't try to run compiler tests on Windows  
6856   if test "$OS_ARCH" = "WINNT"; then
6857     if test -z "$HAVE_64BIT_OS"; then
6858       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6859     else
6860       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6861     fi
6862   else
6863     AC_CHECK_SIZEOF([int *], [4])
6864     case "${ac_cv_sizeof_int_p}" in
6865     4)
6866       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6867       ;;
6868     8)
6869       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6870       ;;
6871     *)
6872       AC_MSG_ERROR([Unexpected pointer size])
6873       ;;
6874     esac
6875   fi
6877   AC_DEFINE(MOZ_MEMORY)
6878   if test "x$MOZ_DEBUG" = "x1"; then
6879     AC_DEFINE(MOZ_MEMORY_DEBUG)
6880   fi
6881   dnl The generic feature tests that determine how to compute ncpus are long and
6882   dnl complicated.  Therefore, simply define special cpp variables for the
6883   dnl platforms we have special knowledge of.
6884   case "${target_os}" in
6885   darwin*)
6886     AC_DEFINE(MOZ_MEMORY_DARWIN)
6887     ;;
6888   *freebsd*)
6889     AC_DEFINE(MOZ_MEMORY_BSD)
6890     ;;
6891   *linux*)
6892     AC_DEFINE(MOZ_MEMORY_LINUX)
6893     ;;
6894   netbsd*)
6895     AC_DEFINE(MOZ_MEMORY_BSD)
6896     ;;
6897   solaris*)
6898     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6899     ;;
6900   msvc*|mks*|cygwin*|mingw*)
6901     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6902     dnl This is sort of awful. Will revisit if we add support for more versions
6903     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6904         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6905     fi
6906     if test -z "$WIN32_CRT_SRC_DIR"; then
6907       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6908         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).])
6909       else
6910         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6911       fi
6912     fi
6913     dnl cpu check
6914     case "${target_cpu}" in
6915     i*86)
6916       _WIN32_CRT_CPU=intel
6917       ;;
6918     *)
6919       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6920       ;;
6921     esac
6923     if test ! -d "$WIN32_CRT_SRC_DIR"; then
6924       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6925     fi
6926     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6927     _objdir_win=`pwd -W`
6928     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
6929     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6930     dnl Also pass this to NSPR/NSS
6931     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6932     export DLLFLAGS
6933     ;;
6934   *wince)
6935     AC_DEFINE(MOZ_MEMORY_WINCE)
6936     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6937     if test -z "$WINCE_WINDOWS_MOBILE"; then
6938       AC_DEFINE(MOZ_MEMORY_WINCE6)
6939     fi
6940     ;;
6941   *winmo)
6942     AC_DEFINE(MOZ_MEMORY_WINCE)
6943     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6944     ;;
6945   *)
6946     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6947     ;;
6948   esac
6950   if test "$OS_ARCH" != "Darwin"; then
6951     dnl NB: this must be kept in sync with jemalloc.h
6952     AC_DEFINE(HAVE_JEMALLOC_VALLOC)
6953     AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
6954     AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
6955   fi
6957 AC_SUBST(MOZ_MEMORY)
6958 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6959 AC_SUBST(WIN32_CRT_SRC_DIR)
6960 dnl Need to set this for make because NSS doesn't have configure
6961 AC_SUBST(DLLFLAGS)
6963 dnl ========================================================
6964 dnl = Use malloc wrapper lib
6965 dnl ========================================================
6966 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6967 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6968     _WRAP_MALLOC=1,
6969     _WRAP_MALLOC= )
6971 if test -n "$_WRAP_MALLOC"; then
6972     if test "$GNU_CC"; then
6973     WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -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"
6974     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6975     fi
6978 dnl ========================================================
6979 dnl = Location of malloc wrapper lib
6980 dnl ========================================================
6981 MOZ_ARG_WITH_STRING(wrap-malloc,
6982 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6983     WRAP_MALLOC_LIB=$withval)
6985 dnl ========================================================
6986 dnl = Use TraceVis
6987 dnl ========================================================
6988 MOZ_ARG_ENABLE_BOOL(tracevis,
6989 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
6990     MOZ_TRACEVIS=1,
6991     MOZ_TRACEVIS= )
6992 if test -n "$MOZ_TRACEVIS"; then
6993     AC_DEFINE(MOZ_TRACEVIS)
6996 dnl ========================================================
6997 dnl = Use GCTimer
6998 dnl ========================================================
6999 MOZ_ARG_ENABLE_BOOL(gctimer,
7000 [  --enable-gctimer       Enable GC timer (default=no)],
7001     MOZ_GCTIMER=1,
7002     MOZ_GCTIMER= )
7003 if test -n "$MOZ_GCTIMER"; then
7004     AC_DEFINE(MOZ_GCTIMER)
7007 dnl ========================================================
7008 dnl = Use Valgrind
7009 dnl ========================================================
7010 MOZ_ARG_ENABLE_BOOL(valgrind,
7011 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
7012     MOZ_VALGRIND=1,
7013     MOZ_VALGRIND= )
7014 if test -n "$MOZ_VALGRIND"; then
7015     AC_CHECK_HEADER([valgrind/valgrind.h], [],
7016         AC_MSG_ERROR(
7017             [--enable-valgrind specified but Valgrind is not installed]))
7018     AC_DEFINE(MOZ_VALGRIND)
7021 dnl ========================================================
7022 dnl jprof
7023 dnl ========================================================
7024 MOZ_ARG_ENABLE_BOOL(jprof,
7025 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
7026     MOZ_JPROF=1,
7027     MOZ_JPROF= )
7028 if test -n "$MOZ_JPROF"; then
7029     AC_DEFINE(MOZ_JPROF)
7032 dnl ========================================================
7033 dnl shark
7034 dnl ========================================================
7035 MOZ_ARG_ENABLE_BOOL(shark,
7036 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
7037     MOZ_SHARK=1,
7038     MOZ_SHARK= )
7039 if test -n "$MOZ_SHARK"; then
7040     AC_DEFINE(MOZ_SHARK)
7043 dnl ========================================================
7044 dnl callgrind
7045 dnl ========================================================
7046 MOZ_ARG_ENABLE_BOOL(callgrind,
7047 [  --enable-callgrind      Enable callgrind profiling],
7048     MOZ_CALLGRIND=1,
7049     MOZ_CALLGRIND= )
7050 if test -n "$MOZ_CALLGRIND"; then
7051     AC_DEFINE(MOZ_CALLGRIND)
7054 dnl ========================================================
7055 dnl vtune
7056 dnl ========================================================
7057 MOZ_ARG_ENABLE_BOOL(vtune,
7058 [  --enable-vtune          Enable vtune profiling],
7059     MOZ_VTUNE=1,
7060     MOZ_VTUNE= )
7061 if test -n "$MOZ_VTUNE"; then
7062     AC_DEFINE(MOZ_VTUNE)
7065 dnl ========================================================
7066 dnl Zealous JavaScript GC
7067 dnl ========================================================
7068 MOZ_ARG_ENABLE_BOOL(gczeal,
7069 [  --enable-gczeal          Enable zealous JavaScript GCing],
7070     JS_GC_ZEAL=1,
7071     JS_GC_ZEAL= )
7072 if test -n "$JS_GC_ZEAL"; then
7073     AC_DEFINE(JS_GC_ZEAL)
7076 dnl ========================================================
7077 dnl = Enable static checking using gcc-dehydra
7078 dnl ========================================================
7080 MOZ_ARG_WITH_STRING(static-checking,
7081 [  --with-static-checking=path/to/gcc_dehydra.so
7082                             Enable static checking of code using GCC-dehydra],
7083     DEHYDRA_PATH=$withval,
7084     DEHYDRA_PATH= )
7086 if test -n "$DEHYDRA_PATH"; then
7087     if test ! -f "$DEHYDRA_PATH"; then
7088         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7089     fi
7090     AC_DEFINE(NS_STATIC_CHECKING)
7092 AC_SUBST(DEHYDRA_PATH)
7094 dnl ========================================================
7095 dnl = Enable stripping of libs & executables
7096 dnl ========================================================
7097 MOZ_ARG_ENABLE_BOOL(strip,
7098 [  --enable-strip          Enable stripping of libs & executables ],
7099     ENABLE_STRIP=1,
7100     ENABLE_STRIP= )
7102 dnl ========================================================
7103 dnl = Enable stripping of libs & executables when packaging
7104 dnl ========================================================
7105 MOZ_ARG_ENABLE_BOOL(install-strip,
7106 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
7107     PKG_SKIP_STRIP= ,
7108     PKG_SKIP_STRIP=1)
7110 dnl ========================================================
7111 dnl = --enable-elf-dynstr-gc
7112 dnl ========================================================
7113 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7114 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
7115     USE_ELF_DYNSTR_GC=1,
7116     USE_ELF_DYNSTR_GC= )
7118 dnl ========================================================
7119 dnl = 
7120 dnl = Profiling and Instrumenting
7121 dnl = 
7122 dnl ========================================================
7123 MOZ_ARG_HEADER(Profiling and Instrumenting)
7125 dnl ========================================================
7126 dnl = Enable timeline service, which provides lightweight
7127 dnl = instrumentation of mozilla for performance measurement.
7128 dnl = Timeline is off by default.
7129 dnl ========================================================
7130 MOZ_ARG_ENABLE_BOOL(timeline,
7131 [  --enable-timeline       Enable timeline services ],
7132     MOZ_TIMELINE=1,
7133     MOZ_TIMELINE= )
7134 if test -n "$MOZ_TIMELINE"; then
7135     AC_DEFINE(MOZ_TIMELINE)
7138 dnl ========================================================
7139 dnl Turn on reflow counting
7140 dnl ========================================================
7141 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7142 [  --enable-reflow-perf    Enable reflow performance tracing],
7143     MOZ_REFLOW_PERF=1,
7144     MOZ_REFLOW_PERF= )
7145 if test -n "$MOZ_REFLOW_PERF"; then
7146     AC_DEFINE(MOZ_REFLOW_PERF)
7149 dnl ========================================================
7150 dnl Enable code size metrics.
7151 dnl ========================================================
7152 MOZ_ARG_ENABLE_BOOL(codesighs,
7153 [  --enable-codesighs      Enable code size analysis tools],
7154     _ENABLE_CODESIGHS=1,
7155     _ENABLE_CODESIGHS= )
7156 if test -n "$_ENABLE_CODESIGHS"; then
7157     if test -d $srcdir/tools/codesighs; then 
7158         MOZ_MAPINFO=1
7159     else
7160         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7161     fi
7164 dnl ========================================================
7165 dnl = Support for Quantify (Windows)
7166 dnl ========================================================
7167 MOZ_ARG_ENABLE_BOOL(quantify,
7168 [  --enable-quantify      Enable Quantify support (Windows only) ],
7169     MOZ_QUANTIFY=1,
7170     MOZ_QUANTIFY= )
7172 dnl ========================================================
7173 dnl = Support for demangling undefined symbols
7174 dnl ========================================================
7175 if test -z "$SKIP_LIBRARY_CHECKS"; then
7176     AC_LANG_SAVE
7177     AC_LANG_CPLUSPLUS
7178     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7179     AC_LANG_RESTORE
7182 # Demangle only for debug or trace-malloc builds
7183 MOZ_DEMANGLE_SYMBOLS=
7184 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7185     MOZ_DEMANGLE_SYMBOLS=1
7186     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7188 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7190 dnl ========================================================
7191 dnl = Support for gcc stack unwinding (from gcc 3.3)
7192 dnl ========================================================
7193 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7194     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7197 dnl ========================================================
7198 dnl =
7199 dnl = Misc. Options
7200 dnl = 
7201 dnl ========================================================
7202 MOZ_ARG_HEADER(Misc. Options)
7204 dnl ========================================================
7205 dnl update xterm title
7206 dnl ========================================================
7207 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7208 [  --enable-xterm-updates  Update XTERM titles with current command.],
7209     MOZ_UPDATE_XTERM=1,
7210     MOZ_UPDATE_XTERM= )
7212 dnl =========================================================
7213 dnl = Chrome format
7214 dnl =========================================================
7215 MOZ_ARG_ENABLE_STRING([chrome-format],
7216 [  --enable-chrome-format=jar|flat|both|symlink
7217                           Select FORMAT of chrome files (default=jar)],
7218     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7220 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7221     MOZ_CHROME_FILE_FORMAT=jar
7224 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
7225     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7226     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7227     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
7228     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
7231 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7232    AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7234 dnl ========================================================
7235 dnl = Define default location for MOZILLA_FIVE_HOME
7236 dnl ========================================================
7237 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7238 [  --with-default-mozilla-five-home
7239                           Set the default value for MOZILLA_FIVE_HOME],
7240 [ val=`echo $withval`
7241   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7243 dnl ========================================================
7244 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7245 dnl ========================================================
7246 MOZ_ARG_WITH_STRING(user-appdir,
7247 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
7248 [ val=`echo $withval`
7249 if echo "$val" | grep "\/" >/dev/null; then
7250     AC_MSG_ERROR("Homedir must be single relative path.")
7251 else 
7252     MOZ_USER_DIR="$val"
7253 fi])
7255 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7257 dnl ========================================================
7258 dnl = Doxygen configuration
7259 dnl ========================================================
7260 dnl Use commas to specify multiple dirs to this arg
7261 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7262 MOZ_ARG_WITH_STRING(doc-input-dirs,
7263 [  --with-doc-input-dirs=DIRS
7264                           Header/idl dirs to create docs from],
7265 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7266 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7268 dnl Use commas to specify multiple dirs to this arg
7269 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7270 MOZ_ARG_WITH_STRING(doc-include-dirs,
7271 [  --with-doc-include-dirs=DIRS  
7272                           Include dirs to preprocess doc headers],
7273 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7274 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7276 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7277 MOZ_ARG_WITH_STRING(doc-output-dir,
7278 [  --with-doc-output-dir=DIR
7279                           Dir to generate docs into],
7280 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7281 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7283 if test -z "$SKIP_COMPILER_CHECKS"; then
7284 dnl ========================================================
7285 dnl =
7286 dnl = Compiler Options
7287 dnl = 
7288 dnl ========================================================
7289 MOZ_ARG_HEADER(Compiler Options)
7291 dnl ========================================================
7292 dnl Check for gcc -pipe support
7293 dnl ========================================================
7294 AC_MSG_CHECKING([for gcc -pipe support])
7295 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7296     echo '#include <stdio.h>' > dummy-hello.c
7297     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7298     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7299     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7300     if test $? = 0; then
7301         _res_as_stdin="yes"
7302     else
7303         _res_as_stdin="no"
7304     fi
7305     if test "$_res_as_stdin" = "yes"; then
7306         _SAVE_CFLAGS=$CFLAGS
7307         CFLAGS="$CFLAGS -pipe"
7308         AC_TRY_COMPILE( [ #include <stdio.h> ],
7309             [printf("Hello World\n");],
7310             [_res_gcc_pipe="yes"],
7311             [_res_gcc_pipe="no"] )
7312         CFLAGS=$_SAVE_CFLAGS
7313     fi
7314     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7315         _res="yes";
7316         CFLAGS="$CFLAGS -pipe"
7317         CXXFLAGS="$CXXFLAGS -pipe"
7318     else
7319         _res="no"
7320     fi
7321     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7322     AC_MSG_RESULT([$_res])
7323 else
7324     AC_MSG_RESULT([no])
7327 dnl pass -Wno-long-long to the compiler
7328 MOZ_ARG_ENABLE_BOOL(long-long-warning,
7329 [  --enable-long-long-warning 
7330                           Warn about use of non-ANSI long long type],
7331     _IGNORE_LONG_LONG_WARNINGS=,
7332     _IGNORE_LONG_LONG_WARNINGS=1)
7334 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
7335      _SAVE_CFLAGS="$CFLAGS"
7336      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
7337      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
7338      AC_TRY_COMPILE([], [return(0);], 
7339         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7340           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7341           result="yes" ], result="no")
7342      AC_MSG_RESULT([$result])
7343      CFLAGS="$_SAVE_CFLAGS"
7346 dnl ========================================================
7347 dnl Profile guided optimization
7348 dnl ========================================================
7349 dnl Test for profiling options
7350 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7351 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7353 dnl Provide a switch to disable PGO even when called via profiledbuild.
7354 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7355 [  --disable-profile-guided-optimization
7356                            Don't build with PGO even if called via make profiledbuild],
7357 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7358 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7360 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7362 _SAVE_CFLAGS="$CFLAGS"
7363 CFLAGS="$CFLAGS -fprofile-generate"
7365 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7366 AC_TRY_COMPILE([], [return 0;],
7367                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7368                  result="yes" ], result="no")
7369 AC_MSG_RESULT([$result])
7371 if test $result = "yes"; then
7372   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7373   PROFILE_USE_CFLAGS="-fprofile-use"
7374   PROFILE_USE_LDFLAGS="-fprofile-use"
7375 else
7376   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7377   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7378   AC_TRY_COMPILE([], [return 0;],
7379                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7380                    result="yes" ], result="no")
7381   AC_MSG_RESULT([$result])
7382   if test $result = "yes"; then
7383     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7384   fi
7385   # don't really care, this is an old GCC
7386   PROFILE_GEN_LDFLAGS=
7387   PROFILE_USE_LDFLAGS=
7390 CFLAGS="$_SAVE_CFLAGS"
7392 if test -n "$INTEL_CC"; then
7393   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7394   PROFILE_GEN_LDFLAGS=
7395   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7396   PROFILE_USE_LDFLAGS=
7399 dnl Sun Studio on Solaris
7400 if test "$SOLARIS_SUNPRO_CC"; then
7401   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7402   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7403   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7404   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7407 AC_SUBST(PROFILE_GEN_CFLAGS)
7408 AC_SUBST(PROFILE_GEN_LDFLAGS)
7409 AC_SUBST(PROFILE_USE_CFLAGS)
7410 AC_SUBST(PROFILE_USE_LDFLAGS)
7412 AC_LANG_CPLUSPLUS
7414 dnl ========================================================
7415 dnl Test for -pedantic bustage
7416 dnl ========================================================
7417 MOZ_ARG_DISABLE_BOOL(pedantic,
7418 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7419 _PEDANTIC= )
7420 if test "$_PEDANTIC"; then
7421     _SAVE_CXXFLAGS=$CXXFLAGS
7422     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7423     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7424     AC_TRY_COMPILE([$configure_static_assert_macros],
7425                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7426                    result="no", result="yes" )
7427     AC_MSG_RESULT([$result])
7428     CXXFLAGS="$_SAVE_CXXFLAGS"
7430     case "$result" in
7431     no)
7432         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7433         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7434         ;;
7435     yes)
7436         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7437         ;;
7438     esac
7441 dnl ========================================================
7442 dnl Test for correct temporary object destruction order
7443 dnl ========================================================
7444 dnl We want to make sure the compiler follows the C++ spec here as 
7445 dnl xpcom and the string classes depend on it (bug 235381).
7446 AC_MSG_CHECKING([for correct temporary object destruction order])
7447 AC_TRY_RUN([ class A {
7448              public:  A(int& x) : mValue(x) {}
7449                       ~A() { mValue--; }
7450                       operator char**() { return 0; }
7451              private:  int& mValue;
7452              };
7453              void func(char **arg) {}
7454              int m=2;
7455              void test() {
7456                   func(A(m));
7457                   if (m==1) m = 0;
7458              }
7459              int main() {
7460                  test();
7461                  return(m);
7462              }
7463              ],
7464      result="yes", result="no", result="maybe")
7465 AC_MSG_RESULT([$result])
7467 if test "$result" = "no"; then
7468     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7471 dnl ========================================================
7472 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7473 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7474 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7475 dnl ========================================================
7476 _SAVE_CXXFLAGS=$CXXFLAGS
7477 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7478 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7479     ac_nscap_nonconst_opeq_bug,
7480     [AC_TRY_COMPILE([
7481                       template <class T>
7482                       class Pointer
7483                         {
7484                         public:
7485                           T* myPtr;
7486                         };
7487                       
7488                       template <class T, class U>
7489                       int operator==(const Pointer<T>& rhs, U* lhs)
7490                         {
7491                           return rhs.myPtr == lhs;
7492                         }
7493                       
7494                       template <class T, class U>
7495                       int operator==(const Pointer<T>& rhs, const U* lhs)
7496                         {
7497                           return rhs.myPtr == lhs;
7498                         }
7499                     ],
7500                     [
7501                       Pointer<int> foo;
7502                       const int* bar;
7503                       return foo == bar;
7504                     ],
7505                     ac_nscap_nonconst_opeq_bug="no",
7506                     ac_nscap_nonconst_opeq_bug="yes")])
7507 CXXFLAGS="$_SAVE_CXXFLAGS"
7509 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7510     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7512 fi # SKIP_COMPILER_CHECKS
7514 dnl ========================================================
7515 dnl C++ rtti
7516 dnl Should be smarter and check that the compiler does indeed have rtti
7517 dnl ========================================================
7519 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7520 [  --enable-cpp-rtti       Enable C++ RTTI ],
7521 [ _MOZ_USE_RTTI=1 ],
7522 [ _MOZ_USE_RTTI= ])
7524 if test "$_MOZ_USE_RTTI"; then
7525    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7526 else
7527    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7530 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7532 dnl ========================================================
7533 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7534 dnl Should be smarter and check that the compiler does indeed have exceptions
7535 dnl ========================================================
7536 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7537 [  --enable-cpp-exceptions Enable C++ exceptions ],
7538 [ _MOZ_CPP_EXCEPTIONS=1 ],
7539 [ _MOZ_CPP_EXCEPTIONS= ])
7541 if test "$_MOZ_CPP_EXCEPTIONS"; then
7542     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7543     AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7544 else
7545     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7548 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7550 # Irix & OSF native compilers do not like exception declarations 
7551 # when exceptions are disabled
7552 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7553     AC_DEFINE(CPP_THROW_NEW, [])
7554 else
7555     AC_DEFINE(CPP_THROW_NEW, [throw()])
7557 AC_LANG_C
7559 dnl ========================================================
7560 dnl =
7561 dnl = Build depencency options
7562 dnl =
7563 dnl ========================================================
7564 MOZ_ARG_HEADER(Build dependencies)
7566 dnl ========================================================
7567 dnl = Do not auto generate dependency info
7568 dnl ========================================================
7569 MOZ_AUTO_DEPS=1
7570 MOZ_ARG_DISABLE_BOOL(auto-deps,
7571 [  --disable-auto-deps     Do not automatically generate dependency info],
7572     MOZ_AUTO_DEPS=,
7573     MOZ_AUTO_DEPS=1)
7575 if test -n "$MOZ_AUTO_DEPS"; then
7576 dnl ========================================================
7577 dnl = Use mkdepend instead of $CC -MD for dependency generation
7578 dnl ========================================================
7579 _cpp_md_flag=
7580 MOZ_ARG_DISABLE_BOOL(md,
7581 [  --disable-md            Do not use compiler-based dependencies ],
7582   [_cpp_md_flag=],
7583   [_cpp_md_flag=1],
7584   [dnl Default is to turn on -MD if using GNU-compatible compilers
7585    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7586      _cpp_md_flag=1
7587    fi
7588   dnl Default is to use -xM if using Sun Studio on Solaris
7589    if test "$SOLARIS_SUNPRO_CC"; then
7590      _cpp_md_flag=1
7591    fi])
7592 if test "$_cpp_md_flag"; then
7593   COMPILER_DEPEND=1
7594   if test "$OS_ARCH" = "OpenVMS"; then
7595     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7596   else
7597     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7598   fi
7599   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7600   if test "$SOLARIS_SUNPRO_CC"; then
7601     _DEPEND_CFLAGS=
7602   fi
7603 else
7604   COMPILER_DEPEND=
7605   dnl Don't override this for MSVC
7606   if test -z "$_WIN32_MSVC"; then
7607     _USE_CPP_INCLUDE_FLAG=
7608     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7609     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7610   fi
7612 fi # MOZ_AUTO_DEPS
7613 MDDEPDIR='.deps'
7614 AC_SUBST(MOZ_AUTO_DEPS)
7615 AC_SUBST(COMPILER_DEPEND)
7616 AC_SUBST(MDDEPDIR)
7619 dnl ========================================================
7620 dnl =
7621 dnl = Static Build Options
7622 dnl =
7623 dnl ========================================================
7624 MOZ_ARG_HEADER(Static build options)
7626 MOZ_ARG_ENABLE_BOOL(static,
7627 [  --enable-static         Enable building of internal static libs],
7628     BUILD_STATIC_LIBS=1,
7629     BUILD_STATIC_LIBS=)
7631 MOZ_ARG_ENABLE_BOOL(libxul,
7632 [  --enable-libxul         Enable building of libxul],
7633     MOZ_ENABLE_LIBXUL=1,
7634     MOZ_ENABLE_LIBXUL=)
7636 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7637         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7640 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7641         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7644 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7645     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7648 AC_SUBST(LIBXUL_LIBS)
7650 if test -n "$MOZ_ENABLE_LIBXUL"; then
7651     XPCOM_LIBS="$LIBXUL_LIBS"
7652     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7653 else
7654     if test -n "$BUILD_STATIC_LIBS"; then
7655         AC_DEFINE(MOZ_STATIC_BUILD)
7656     fi
7657     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7660 dnl ========================================================
7661 dnl =
7662 dnl = Standalone module options
7663 dnl = 
7664 dnl ========================================================
7665 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7667 dnl Check for GLib and libIDL.
7668 dnl ========================================================
7669 case "$target_os" in
7670 msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
7671     SKIP_IDL_CHECK="yes"
7672     ;;
7674     SKIP_IDL_CHECK="no"
7675     ;;
7676 esac
7678 if test -z "$COMPILE_ENVIRONMENT"; then
7679     SKIP_IDL_CHECK="yes"
7682 dnl = Allow users to disable libIDL checking for standalone modules
7683 MOZ_ARG_WITHOUT_BOOL(libIDL,
7684 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7685         SKIP_IDL_CHECK="yes")
7687 if test "$SKIP_IDL_CHECK" = "no"
7688 then
7689     _LIBIDL_FOUND=
7690     if test "$MACOS_SDK_DIR"; then 
7691       dnl xpidl, and therefore libIDL, is only needed on the build host.
7692       dnl Don't build it against the SDK, as that causes problems.
7693       _MACSAVE_CFLAGS="$CFLAGS"
7694       _MACSAVE_LIBS="$LIBS"
7695       _MACSAVE_LDFLAGS="$LDFLAGS"
7696       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7697       changequote(,)
7698       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"`
7699       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7700       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7701       changequote([,])
7702       unset NEXT_ROOT
7703     fi
7705     if test "$MOZ_ENABLE_GTK2"; then
7706         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7707     fi
7708     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7709     dnl to either libIDL1 or libIDL2.
7710     if test -z "$_LIBIDL_FOUND"; then
7711         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7712         if test -z "$_LIBIDL_FOUND"; then
7713             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7714         fi
7715     fi
7716     dnl
7717     dnl If we don't have a libIDL config program & not cross-compiling, 
7718     dnl     look for orbit-config instead.
7719     dnl
7720     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7721         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7722         if test -n "$ORBIT_CONFIG"; then
7723             AC_MSG_CHECKING([for ORBit libIDL usability])
7724                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7725             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7726             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7727             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7728             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7729             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7730             LIBIDL_CONFIG=
7731             _SAVE_CFLAGS="$CFLAGS"
7732             _SAVE_LIBS="$LIBS"
7733             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7734             LIBS="$LIBIDL_LIBS $LIBS"
7735             AC_TRY_RUN([
7736 #include <stdlib.h>
7737 #include <libIDL/IDL.h>
7738 int main() {
7739   char *s;
7740   s=strdup(IDL_get_libver_string());
7741   if(s==NULL) {
7742     exit(1);
7743   }
7744   exit(0);
7746             ], [_LIBIDL_FOUND=1
7747                 result="yes"],
7748                [LIBIDL_CFLAGS=
7749                 LIBIDL_LIBS=
7750                 result="no"],
7751                [_LIBIDL_FOUND=1
7752                 result="maybe"] )
7753             AC_MSG_RESULT($result)
7754             CFLAGS="$_SAVE_CFLAGS"
7755             LIBS="$_SAVE_LIBS"
7756         fi
7757     fi
7758     if test -z "$_LIBIDL_FOUND"; then
7759         AC_MSG_ERROR([libIDL not found.
7760         libIDL $LIBIDL_VERSION or higher is required.])
7761     fi
7762     if test "$MACOS_SDK_DIR"; then
7763       CFLAGS="$_MACSAVE_CFLAGS"
7764       LIBS="$_MACSAVE_LIBS"
7765       LDFLAGS="$_MACSAVE_LDFLAGS"
7766       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7767         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7768       fi
7769     fi
7772 if test -n "$CROSS_COMPILE"; then
7773      if test -z "$HOST_LIBIDL_CONFIG"; then
7774         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7775     fi
7776     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7777         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7778         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7779     else
7780         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7781         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7782     fi
7785 if test -z "$SKIP_PATH_CHECKS"; then
7786 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7787     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7788         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7789     else
7790         AM_PATH_GLIB(${GLIB_VERSION})
7791     fi
7795 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7796     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7799 AC_SUBST(LIBIDL_CFLAGS)
7800 AC_SUBST(LIBIDL_LIBS)
7801 AC_SUBST(STATIC_LIBIDL)
7802 AC_SUBST(GLIB_CFLAGS)
7803 AC_SUBST(GLIB_LIBS)
7804 AC_SUBST(GLIB_GMODULE_LIBS)
7805 AC_SUBST(HOST_LIBIDL_CONFIG)
7806 AC_SUBST(HOST_LIBIDL_CFLAGS)
7807 AC_SUBST(HOST_LIBIDL_LIBS)
7809 dnl ========================================================
7810 dnl Check for cairo
7811 dnl ========================================================
7812 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7814 MOZ_TREE_CAIRO=1
7815 MOZ_ARG_ENABLE_BOOL(system-cairo,
7816 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7817 MOZ_TREE_CAIRO=,
7818 MOZ_TREE_CAIRO=1 )
7820 # Check for headers defining standard int types.
7821 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7823 if test "$MOZ_TREE_CAIRO"; then
7824     AC_DEFINE(MOZ_TREE_CAIRO)
7826     # For now we assume that we will have a uint64_t available through
7827     # one of the above headers or mozstdint.h.
7828     AC_DEFINE(HAVE_UINT64_T)
7830     # Define macros for cairo-features.h
7831     if test "$MOZ_X11"; then
7832         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7833         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7834         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7835         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7836         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7837         MOZ_ENABLE_CAIRO_FT=1
7838         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7839     fi
7840     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7841         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7842     fi
7843     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7844         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7845         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7846         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7847     fi
7848     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7849         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7850         if test -z "$WINCE"; then
7851             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7852             if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7853                 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7854                 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7855                 MOZ_ENABLE_D2D_SURFACE=1
7856                 MOZ_ENABLE_DWRITE_FONT=1
7857             else
7858                 WIN32_DWRITE_FONT_FEATURE=
7859                 WIN32_D2D_SURFACE_FEATURE=
7860             fi
7861         else
7862             WIN32_FONT_FEATURE=
7863             WIN32_DWRITE_FONT_FEATURE=
7864             WIN32_D2D_SURFACE_FEATURE=
7865         fi
7867         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7868         if test -z "$HAS_DDRAW"; then
7869             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.])
7870             DDRAW_SURFACE_FEATURE=
7871         else
7872             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7873         fi
7875         if test -z "$OGLES_SDK_DIR"; then
7876             OGLES_SURFACE_FEATURE=
7877         else
7878             AC_TRY_COMPILE([
7879               #include <EGL/egl.h>
7880               #include <EGL/eglext.h>
7881               #include <GLES2/gl2.h>
7882               #include <GLES2/gl2ext.h>
7883             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7884             if test -z "$HAS_OGLES"; then
7885               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7886               OGLES_SURFACE_FEATURE=
7887             else
7888               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7889             fi
7890         fi
7892         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7893     fi
7894     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7895         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7896         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7897         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7898         MOZ_ENABLE_CAIRO_FT=1
7899         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7900         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7901     fi
7902     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7903         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7904         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7905         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7906         MOZ_ENABLE_CAIRO_FT=1
7907     fi
7908     if test "$USE_FC_FREETYPE"; then
7909         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7910     fi
7911     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7912     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7913     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7914     AC_SUBST(CAIRO_FT_CFLAGS)
7915     AC_SUBST(HAS_OGLES)
7917     if test "$MOZ_DEBUG"; then
7918       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7919     else
7920       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7921     fi
7923     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7925     AC_SUBST(PS_SURFACE_FEATURE)
7926     AC_SUBST(PDF_SURFACE_FEATURE)
7927     AC_SUBST(SVG_SURFACE_FEATURE)
7928     AC_SUBST(XLIB_SURFACE_FEATURE)
7929     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7930     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7931     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7932     AC_SUBST(XCB_SURFACE_FEATURE)
7933     AC_SUBST(WIN32_SURFACE_FEATURE)
7934     AC_SUBST(DDRAW_SURFACE_FEATURE)
7935     AC_SUBST(OGLES_SURFACE_FEATURE)    
7936     AC_SUBST(OS2_SURFACE_FEATURE)
7937     AC_SUBST(BEOS_SURFACE_FEATURE)
7938     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7939     AC_SUBST(FT_FONT_FEATURE)
7940     AC_SUBST(FC_FONT_FEATURE)
7941     AC_SUBST(WIN32_FONT_FEATURE)
7942     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7943     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7944     AC_SUBST(QUARTZ_FONT_FEATURE)
7945     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7946     AC_SUBST(QT_SURFACE_FEATURE)
7948     if test "$_WIN32_MSVC"; then
7949         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7950     else
7951         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"
7953         if test "$MOZ_X11"; then
7954             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7955         fi
7956     fi
7958     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7959     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7961 else
7962    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
7963    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7964    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7965    if test "$MOZ_X11"; then
7966         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7967         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7968         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7969    fi
7972 AC_SUBST(MOZ_TREE_CAIRO)
7973 AC_SUBST(MOZ_CAIRO_CFLAGS)
7974 AC_SUBST(MOZ_CAIRO_LIBS)
7976 dnl qcms
7977 dnl ========================================================
7979 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7980 AC_SUBST(QCMS_LIBS)
7982 dnl ========================================================
7983 dnl disable xul
7984 dnl ========================================================
7985 MOZ_ARG_DISABLE_BOOL(xul,
7986 [  --disable-xul           Disable XUL],
7987     MOZ_XUL= )
7988 if test "$MOZ_XUL"; then
7989   AC_DEFINE(MOZ_XUL)
7990 else
7991   dnl remove extensions that require XUL
7992   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7995 AC_SUBST(MOZ_XUL)
7997 dnl ========================================================
7998 dnl disable profile locking
7999 dnl   do no use this in applications that can have more than
8000 dnl   one process accessing the profile directory.
8001 dnl ========================================================
8002 MOZ_ARG_DISABLE_BOOL(profilelocking,
8003 [  --disable-profilelocking           Disable profile locking],
8004     MOZ_PROFILELOCKING=,
8005     MOZ_PROFILELOCKING=1 )
8006 if test "$MOZ_PROFILELOCKING"; then
8007   AC_DEFINE(MOZ_PROFILELOCKING)
8010 dnl ========================================================
8011 dnl disable rdf services
8012 dnl ========================================================
8013 MOZ_ARG_DISABLE_BOOL(rdf,
8014 [  --disable-rdf           Disable RDF],
8015     MOZ_RDF= )
8016 if test "$MOZ_RDF"; then
8017   AC_DEFINE(MOZ_RDF)
8020 AC_SUBST(MOZ_RDF)
8022 dnl ========================================================
8023 dnl necko configuration options
8024 dnl ========================================================
8027 dnl option to disable various necko protocols
8029 MOZ_ARG_ENABLE_STRING(necko-protocols,
8030 [  --enable-necko-protocols[={http,ftp,default,all,none}]
8031                           Enable/disable specific protocol handlers],
8032 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8033     if test "$option" = "yes" || test "$option" = "all"; then
8034         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8035     elif test "$option" = "no" || test "$option" = "none"; then
8036         NECKO_PROTOCOLS=""
8037     elif test "$option" = "default"; then
8038         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8039     elif test `echo "$option" | grep -c \^-` != 0; then
8040         option=`echo $option | sed 's/^-//'`
8041         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8042     else
8043         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8044     fi
8045 done],
8046     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8047 dnl Remove dupes
8048 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8049 AC_SUBST(NECKO_PROTOCOLS)
8050 for p in $NECKO_PROTOCOLS; do
8051     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8052 done
8055 dnl option to disable necko's disk cache
8057 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8058 [  --disable-necko-disk-cache
8059                           Disable necko disk cache],
8060     NECKO_DISK_CACHE=,
8061     NECKO_DISK_CACHE=1)
8062 AC_SUBST(NECKO_DISK_CACHE)
8063 if test "$NECKO_DISK_CACHE"; then
8064     AC_DEFINE(NECKO_DISK_CACHE)
8068 dnl option to disable necko's wifi scanner
8070 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8071 [  --disable-necko-wifi   Disable necko wifi scanner],
8072     NECKO_WIFI=,
8073     NECKO_WIFI=1
8076 if test "$OS_ARCH" = "OS2"; then
8077   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8078   NECKO_WIFI=
8080 if test "$NECKO_WIFI" -a \
8081         "$OS_ARCH" != "Linux" -a \
8082         "$OS_ARCH" != "Darwin" -a \
8083         "$OS_ARCH" != "SunOS" -a \
8084         "$OS_ARCH" != "WINNT" -a \
8085         "$OS_ARCH" != "WINCE"; then
8086   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8089 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8090 then
8091   AC_CHECK_HEADER([iwlib.h])
8092   if test "$ac_cv_header_iwlib_h" != "yes"; then
8093     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])
8094   fi
8097 if test "$NECKO_WIFI"; then
8098   AC_DEFINE(NECKO_WIFI)
8100 AC_SUBST(NECKO_WIFI)
8103 dnl option to minimize size of necko's i/o buffers
8105 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
8106 [  --enable-necko-small-buffers
8107                           Minimize size of necko's i/o buffers],
8108     NECKO_SMALL_BUFFERS=1,
8109     NECKO_SMALL_BUFFERS=)
8110 AC_SUBST(NECKO_SMALL_BUFFERS)
8111 if test "$NECKO_SMALL_BUFFERS"; then
8112     AC_DEFINE(NECKO_SMALL_BUFFERS)
8113 fi 
8116 dnl option to disable cookies
8118 MOZ_ARG_DISABLE_BOOL(cookies,
8119 [  --disable-cookies       Disable cookie support],
8120     NECKO_COOKIES=,
8121     NECKO_COOKIES=1)
8122 AC_SUBST(NECKO_COOKIES)
8123 if test "$NECKO_COOKIES"; then
8124     AC_DEFINE(NECKO_COOKIES)
8128 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8130 MOZ_ARG_DISABLE_BOOL(ctypes,
8131 [  --disable-ctypes        Disable js-ctypes],
8132     BUILD_CTYPES=,
8133     BUILD_CTYPES=1)
8134 AC_SUBST(BUILD_CTYPES)
8135 if test "$BUILD_CTYPES"; then
8136   if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8137     # Disable ctypes for arm/wince.
8138     BUILD_CTYPES=
8139   else
8140     AC_DEFINE(BUILD_CTYPES)
8141   fi
8144 dnl NECKO_ configuration options are not global
8145 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8147 dnl Only build Mork if it's required
8148 AC_SUBST(MOZ_MORK)
8149 if test "$MOZ_MORK"; then
8150   AC_DEFINE(MOZ_MORK)
8153 dnl Build the lightweight Mork reader if required
8154 AC_SUBST(MOZ_MORKREADER)
8155 if test "$MOZ_MORKREADER"; then
8156   AC_DEFINE(MOZ_MORKREADER)
8159 dnl Build Places if required
8160 if test "$MOZ_PLACES"; then
8161   AC_DEFINE(MOZ_PLACES)
8164 dnl ========================================================
8165 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8166     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8169 dnl ========================================================
8170 dnl =
8171 dnl = Maintainer debug option (no --enable equivalent)
8172 dnl =
8173 dnl ========================================================
8175 AC_SUBST(AR)
8176 AC_SUBST(AR_FLAGS)
8177 AC_SUBST(AR_LIST)
8178 AC_SUBST(AR_EXTRACT)
8179 AC_SUBST(AR_DELETE)
8180 AC_SUBST(AS)
8181 AC_SUBST(ASFLAGS)
8182 AC_SUBST(AS_DASH_C_FLAG)
8183 AC_SUBST(LD)
8184 AC_SUBST(RC)
8185 AC_SUBST(RCFLAGS)
8186 AC_SUBST(WINDRES)
8187 AC_SUBST(IMPLIB)
8188 AC_SUBST(FILTER)
8189 AC_SUBST(BIN_FLAGS)
8190 AC_SUBST(NS_USE_NATIVE)
8191 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8192 AC_SUBST(MOZ_UPDATE_XTERM)
8193 AC_SUBST(MINIMO)
8194 AC_SUBST(MOZ_PLATFORM_MAEMO)
8195 AC_SUBST(MOZ_AUTH_EXTENSION)
8196 AC_SUBST(MOZ_MATHML)
8197 AC_SUBST(MOZ_PERMISSIONS)
8198 AC_SUBST(MOZ_XTF)
8199 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8200 AC_SUBST(MOZ_PREF_EXTENSIONS)
8201 AC_SUBST(MOZ_SVG)
8202 AC_SUBST(MOZ_SMIL)
8203 AC_SUBST(MOZ_XSLT_STANDALONE)
8204 AC_SUBST(MOZ_JS_LIBS)
8205 AC_SUBST(MOZ_PSM)
8206 AC_SUBST(MOZ_DEBUG)
8207 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8208 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8209 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8210 AC_SUBST(MOZ_DEBUG_FLAGS)
8211 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8212 AC_SUBST(WARNINGS_AS_ERRORS)
8213 AC_SUBST(MOZ_EXTENSIONS)
8214 AC_SUBST(MOZ_IMG_DECODERS)
8215 AC_SUBST(MOZ_IMG_ENCODERS)
8216 AC_SUBST(MOZ_JSDEBUGGER)
8217 AC_SUBST(MOZ_PLUGINS)
8218 AC_SUBST(MOZ_LOG_REFCNT)
8219 AC_SUBST(MOZ_LEAKY)
8220 AC_SUBST(MOZ_JPROF)
8221 AC_SUBST(MOZ_SHARK)
8222 AC_SUBST(MOZ_CALLGRIND)
8223 AC_SUBST(MOZ_VTUNE)
8224 AC_SUBST(MOZ_XPCTOOLS)
8225 AC_SUBST(MOZ_JSLOADER)
8226 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8227 AC_SUBST(MOZ_QUANTIFY)
8228 AC_SUBST(LIBICONV)
8229 AC_SUBST(MOZ_PLACES)
8230 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8231 AC_SUBST(MOZ_STORAGE)
8232 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8233 AC_SUBST(MOZ_FEEDS)
8234 AC_SUBST(NS_PRINTING)
8235 AC_SUBST(MOZ_WEBGL)
8236 AC_SUBST(MOZ_HELP_VIEWER)
8238 AC_SUBST(MOZ_JAVAXPCOM)
8239 AC_SUBST(JAVA_INCLUDE_PATH)
8240 AC_SUBST(JAVA)
8241 AC_SUBST(JAVAC)
8242 AC_SUBST(JAR)
8244 AC_SUBST(MOZ_PROFILELOCKING)
8246 AC_SUBST(HAVE_XIE)
8247 AC_SUBST(MOZ_XIE_LIBS)
8248 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8250 AC_SUBST(BUILD_STATIC_LIBS)
8251 AC_SUBST(MOZ_ENABLE_LIBXUL)
8252 AC_SUBST(ENABLE_TESTS)
8253 AC_SUBST(IBMBIDI)
8254 AC_SUBST(MOZ_UNIVERSALCHARDET)
8255 AC_SUBST(ACCESSIBILITY)
8256 AC_SUBST(MOZ_XPINSTALL)
8257 AC_SUBST(MOZ_VIEW_SOURCE)
8258 AC_SUBST(MOZ_SPELLCHECK)
8259 AC_SUBST(MOZ_USER_DIR)
8260 AC_SUBST(MOZ_CRASHREPORTER)
8262 AC_SUBST(ENABLE_STRIP)
8263 AC_SUBST(PKG_SKIP_STRIP)
8264 AC_SUBST(USE_ELF_DYNSTR_GC)
8265 AC_SUBST(INCREMENTAL_LINKER)
8266 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8267 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8269 AC_SUBST(MOZ_FIX_LINK_PATHS)
8270 AC_SUBST(XPCOM_LIBS)
8271 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8272 AC_SUBST(XPCOM_GLUE_LDOPTS)
8273 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8275 AC_SUBST(USE_DEPENDENT_LIBS)
8277 AC_SUBST(MOZ_BUILD_ROOT)
8278 AC_SUBST(MOZ_OS2_TOOLS)
8279 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8281 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8282 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8283 AC_SUBST(MOZ_TIMELINE)
8284 AC_SUBST(OGLES_SDK_DIR)
8286 AC_SUBST(MOZ_APP_NAME)
8287 AC_SUBST(MOZ_APP_DISPLAYNAME)
8288 AC_SUBST(MOZ_APP_VERSION)
8289 AC_SUBST(MOZ_APP_UA_EXTRA)
8290 AC_SUBST(FIREFOX_VERSION)
8292 AC_SUBST(MOZ_PKG_SPECIAL)
8294 AC_SUBST(MOZILLA_OFFICIAL)
8296 dnl win32 options
8297 AC_SUBST(MOZ_MAPINFO)
8298 AC_SUBST(MOZ_BROWSE_INFO)
8299 AC_SUBST(MOZ_TOOLS_DIR)
8300 AC_SUBST(CYGWIN_WRAPPER)
8301 AC_SUBST(AS_PERL)
8302 AC_SUBST(WIN32_REDIST_DIR)
8303 AC_SUBST(PYTHON)
8305 AC_SUBST(WINCE)
8306 AC_SUBST(WINCE_SDK_DIR)
8307 AC_SUBST(WINCE_WINDOWS_MOBILE)
8309 dnl Echo the CFLAGS to remove extra whitespace.
8310 CFLAGS=`echo \
8311         $_WARNINGS_CFLAGS \
8312         $CFLAGS`
8314 CXXFLAGS=`echo \
8315         $_MOZ_RTTI_FLAGS \
8316         $_MOZ_EXCEPTIONS_FLAGS \
8317         $_WARNINGS_CXXFLAGS \
8318         $CXXFLAGS`
8320 COMPILE_CFLAGS=`echo \
8321     $_DEFINES_CFLAGS \
8322         $_DEPEND_CFLAGS \
8323     $COMPILE_CFLAGS`
8325 COMPILE_CXXFLAGS=`echo \
8326     $_DEFINES_CXXFLAGS \
8327         $_DEPEND_CFLAGS \
8328     $COMPILE_CXXFLAGS`
8330 AC_SUBST(SYSTEM_MAKEDEPEND)
8331 AC_SUBST(SYSTEM_LIBXUL)
8332 AC_SUBST(SYSTEM_JPEG)
8333 AC_SUBST(SYSTEM_PNG)
8334 AC_SUBST(SYSTEM_ZLIB)
8335 AC_SUBST(SYSTEM_BZ2)
8337 AC_SUBST(JPEG_CFLAGS)
8338 AC_SUBST(JPEG_LIBS)
8339 AC_SUBST(ZLIB_CFLAGS)
8340 AC_SUBST(ZLIB_LIBS)
8341 AC_SUBST(BZ2_CFLAGS)
8342 AC_SUBST(BZ2_LIBS)
8343 AC_SUBST(PNG_CFLAGS)
8344 AC_SUBST(PNG_LIBS)
8346 AC_SUBST(MOZ_JPEG_CFLAGS)
8347 AC_SUBST(MOZ_JPEG_LIBS)
8348 AC_SUBST(MOZ_ZLIB_CFLAGS)
8349 AC_SUBST(MOZ_ZLIB_LIBS)
8350 AC_SUBST(MOZ_BZ2_CFLAGS)
8351 AC_SUBST(MOZ_BZ2_LIBS)
8352 AC_SUBST(MOZ_PNG_CFLAGS)
8353 AC_SUBST(MOZ_PNG_LIBS)
8355 AC_SUBST(NSPR_CFLAGS)
8356 AC_SUBST(NSPR_LIBS)
8357 AC_SUBST(MOZ_NATIVE_NSPR)
8359 AC_SUBST(NSS_CFLAGS)
8360 AC_SUBST(NSS_LIBS)
8361 AC_SUBST(NSS_DEP_LIBS)
8362 AC_SUBST(MOZ_NATIVE_NSS)
8363 AC_SUBST(NSS_DISABLE_DBM)
8365 AC_SUBST(CFLAGS)
8366 AC_SUBST(CXXFLAGS)
8367 AC_SUBST(CPPFLAGS)
8368 AC_SUBST(COMPILE_CFLAGS)
8369 AC_SUBST(COMPILE_CXXFLAGS)
8370 AC_SUBST(LDFLAGS)
8371 AC_SUBST(LIBS)
8372 AC_SUBST(CROSS_COMPILE)
8373 AC_SUBST(WCHAR_CFLAGS)
8375 AC_SUBST(HOST_CC)
8376 AC_SUBST(HOST_CXX)
8377 AC_SUBST(HOST_CFLAGS)
8378 AC_SUBST(HOST_CXXFLAGS)
8379 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8380 AC_SUBST(HOST_AR)
8381 AC_SUBST(HOST_AR_FLAGS)
8382 AC_SUBST(HOST_LD)
8383 AC_SUBST(HOST_RANLIB)
8384 AC_SUBST(HOST_NSPR_MDCPUCFG)
8385 AC_SUBST(HOST_BIN_SUFFIX)
8386 AC_SUBST(HOST_OS_ARCH)
8388 AC_SUBST(TARGET_CPU)
8389 AC_SUBST(TARGET_VENDOR)
8390 AC_SUBST(TARGET_OS)
8391 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8392 AC_SUBST(TARGET_MD_ARCH)
8393 AC_SUBST(TARGET_XPCOM_ABI)
8394 AC_SUBST(OS_TARGET)
8395 AC_SUBST(OS_ARCH)
8396 AC_SUBST(OS_RELEASE)
8397 AC_SUBST(OS_TEST)
8399 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8400 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8402 AC_SUBST(WRAP_MALLOC_CFLAGS)
8403 AC_SUBST(WRAP_MALLOC_LIB)
8404 AC_SUBST(MKSHLIB)
8405 AC_SUBST(MKCSHLIB)
8406 AC_SUBST(MKSHLIB_FORCE_ALL)
8407 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8408 AC_SUBST(DSO_CFLAGS)
8409 AC_SUBST(DSO_PIC_CFLAGS)
8410 AC_SUBST(DSO_LDOPTS)
8411 AC_SUBST(LIB_PREFIX)
8412 AC_SUBST(DLL_PREFIX)
8413 AC_SUBST(DLL_SUFFIX)
8414 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8415 AC_SUBST(LIB_SUFFIX)
8416 AC_SUBST(OBJ_SUFFIX)
8417 AC_SUBST(BIN_SUFFIX)
8418 AC_SUBST(ASM_SUFFIX)
8419 AC_SUBST(IMPORT_LIB_SUFFIX)
8420 AC_SUBST(USE_N32)
8421 AC_SUBST(CC_VERSION)
8422 AC_SUBST(CXX_VERSION)
8423 AC_SUBST(MSMANIFEST_TOOL)
8424 AC_SUBST(NS_ENABLE_TSF)
8425 AC_SUBST(MOZ_NSS_PATCH)
8427 if test "$USING_HCC"; then
8428    CC='${topsrcdir}/build/hcc'
8429    CC="$CC '$_OLDCC'"
8430    CXX='${topsrcdir}/build/hcpp'
8431    CXX="$CXX '$_OLDCXX'"
8432    AC_SUBST(CC)
8433    AC_SUBST(CXX)
8436 dnl Check for missing components
8437 if test "$COMPILE_ENVIRONMENT"; then
8438 if test "$MOZ_X11"; then
8439     dnl ====================================================
8440     dnl = Check if X headers exist
8441     dnl ====================================================
8442     _SAVE_CFLAGS=$CFLAGS
8443     CFLAGS="$CFLAGS $XCFLAGS"
8444     AC_TRY_COMPILE([
8445         #include <stdio.h>
8446         #include <stdlib.h>
8447         #include <X11/Xlib.h>
8448         #include <X11/Intrinsic.h>
8449     ],
8450     [
8451         Display *dpy = 0;
8452         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8453             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8454             exit(1);
8455         }
8456     ], [], 
8457     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8458     CFLAGS="$_SAVE_CFLAGS"
8460     if test ! -z "$MISSING_X"; then
8461         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8462     fi
8464 fi # MOZ_X11
8466 dnl Check for headers, etc. needed by WebGL.
8467 if test -n "$MOZ_WEBGL_GLX"; then
8468     AC_CHECK_HEADER(GL/glx.h)
8469     if test "$ac_cv_header_GL_glx_h" != "yes"; then
8470         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8471     fi
8472 fi # MOZ_WEBGL_GLX
8473 fi # COMPILE_ENVIRONMENT
8475 if test "$USE_FC_FREETYPE"; then
8476     if test "$COMPILE_ENVIRONMENT"; then
8477         _SAVE_CPPFLAGS="$CPPFLAGS"
8478         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8479         AC_CHECK_HEADERS(fontconfig/fcfreetype.h, , 
8480             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8481         CPPFLAGS="$_SAVE_CPPFLAGS"
8482     else
8483         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8484     fi
8487 dnl Set various defines and substitutions
8488 dnl ========================================================
8490 if test "$OS_ARCH" = "BeOS"; then
8491   AC_DEFINE(XP_BEOS)
8492 elif test "$OS_ARCH" = "Darwin"; then
8493   AC_DEFINE(XP_UNIX)
8494   AC_DEFINE(UNIX_ASYNC_DNS)
8495 elif test "$OS_ARCH" = "OpenVMS"; then
8496   AC_DEFINE(XP_UNIX)
8497 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8498   AC_DEFINE(XP_UNIX)
8499   AC_DEFINE(UNIX_ASYNC_DNS)
8502 if test "$MOZ_DEBUG"; then
8503     AC_DEFINE(MOZ_REFLOW_PERF)
8504     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8507 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8508     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8509     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8510     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8511     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8512     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8513     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8514     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8515     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8518 dnl ========================================================
8519 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8520 dnl ========================================================
8521 case "$host_os" in
8522 mingw*)
8523     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8524     ;;
8525 cygwin*|msvc*|mks*)
8526     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8527     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8528     CC="\$(CYGWIN_WRAPPER) $CC"
8529     CXX="\$(CYGWIN_WRAPPER) $CXX"
8530     CPP="\$(CYGWIN_WRAPPER) $CPP"
8531     LD="\$(CYGWIN_WRAPPER) $LD"
8532     AS="\$(CYGWIN_WRAPPER) $AS"
8533     RC="\$(CYGWIN_WRAPPER) $RC"
8534     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8535     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8536     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8537     ;;
8538 esac
8540 AC_SUBST(CYGDRIVE_MOUNT)
8541 AC_SUBST(WIN_TOP_SRC)
8543 AC_SUBST(MOZILLA_VERSION)
8545 AC_SUBST(ac_configure_args)
8547 dnl Spit out some output
8548 dnl ========================================================
8550 dnl The following defines are used by xpcom
8551 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8552 CPP_THROW_NEW
8553 HAVE_CPP_2BYTE_WCHAR_T
8554 HAVE_CPP_ACCESS_CHANGING_USING
8555 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8556 HAVE_CPP_BOOL
8557 HAVE_CPP_CHAR16_T
8558 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8559 HAVE_CPP_EXPLICIT
8560 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8561 HAVE_CPP_NAMESPACE_STD
8562 HAVE_CPP_NEW_CASTS
8563 HAVE_CPP_PARTIAL_SPECIALIZATION
8564 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8565 HAVE_CPP_TYPENAME
8566 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8567 HAVE_STATVFS
8568 NEED_CPP_UNUSED_IMPLEMENTATIONS
8569 NEW_H
8570 HAVE_GETPAGESIZE
8571 HAVE_ICONV
8572 HAVE_ICONV_WITH_CONST_INPUT
8573 HAVE_MBRTOWC
8574 HAVE_SYS_MOUNT_H
8575 HAVE_SYS_VFS_H
8576 HAVE_WCRTOMB
8579 AC_CONFIG_HEADER(
8580 netwerk/necko-config.h
8581 xpcom/xpcom-config.h
8582 xpcom/xpcom-private.h
8585 # Save the defines header file before autoconf removes it.
8586 # (Do not add AC_DEFINE calls after this line.)
8587   _CONFIG_TMP=confdefs-tmp.h
8588   _CONFIG_DEFS_H=mozilla-config.h
8590   cat > $_CONFIG_TMP <<\EOF
8591 /* List of defines generated by configure. Included with preprocessor flag,
8592  * -include, to avoid long list of -D defines on the compile command-line.
8593  * Do not edit.
8594  */
8596 #ifndef _MOZILLA_CONFIG_H_
8597 #define _MOZILLA_CONFIG_H_
8600 _EGREP_PATTERN='^#define ('
8601 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8602     for f in $_NON_GLOBAL_ACDEFINES; do
8603         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8604     done
8606 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8608   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8610   cat >> $_CONFIG_TMP <<\EOF
8612 #endif /* _MOZILLA_CONFIG_H_ */
8616   # Only write mozilla-config.h when something changes (or it doesn't exist)
8617   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8618     rm $_CONFIG_TMP
8619   else
8620     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8621     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8623     echo ==== $_CONFIG_DEFS_H =================================
8624     cat $_CONFIG_DEFS_H
8625   fi
8627 dnl Probably shouldn't call this manually but we always want the output of DEFS
8628 rm -f confdefs.h.save
8629 mv confdefs.h confdefs.h.save
8630 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8631 AC_OUTPUT_MAKE_DEFS()
8632 MOZ_DEFINES=$DEFS
8633 AC_SUBST(MOZ_DEFINES)
8634 rm -f confdefs.h
8635 mv confdefs.h.save confdefs.h
8637 dnl Load the list of Makefiles to generate.
8638 dnl   To add new Makefiles, edit allmakefiles.sh.
8639 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8640 . ${srcdir}/allmakefiles.sh
8641 dnl 
8642 dnl Run a perl script to quickly create the makefiles.
8643 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8644 dnl   for the files it cannot handle correctly. This way, config.status
8645 dnl   will handle these files.
8646 dnl If it fails, nothing is set and config.status will run as usual.
8648 dnl This does not change the $MAKEFILES variable.
8650 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8652 if test -z "${AS_PERL}"; then
8653 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8654 else
8655 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8657 . ./conftest.sh
8658 rm conftest.sh
8660 echo $MAKEFILES > unallmakefiles
8662 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8664 AC_OUTPUT($MAKEFILES)
8666 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8667 if test "$CAIRO_FEATURES_H"; then
8668   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8669     echo "$CAIRO_FEATURES_H is unchanged"
8670     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8671   else
8672     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8673   fi
8676 dnl ========================================================
8677 dnl = Setup a nice relatively clean build environment for
8678 dnl = sub-configures.
8679 dnl ========================================================
8680 CC="$_SUBDIR_CC" 
8681 CXX="$_SUBDIR_CXX" 
8682 CFLAGS="$_SUBDIR_CFLAGS" 
8683 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8684 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8685 LDFLAGS="$_SUBDIR_LDFLAGS"
8686 HOST_CC="$_SUBDIR_HOST_CC" 
8687 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8688 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8691 unset MAKEFILES
8692 unset CONFIG_FILES
8694 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8695 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8697 if test -z "$MOZ_NATIVE_NSPR"; then
8698     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8699     if test -z "$MOZ_DEBUG"; then
8700         ac_configure_args="$ac_configure_args --disable-debug"
8701     fi
8702     if test "$MOZ_OPTIMIZE" = "1"; then
8703         ac_configure_args="$ac_configure_args --enable-optimize"
8704     fi
8705     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8706        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8707     fi
8708     if test -n "$HAVE_64BIT_OS"; then
8709         ac_configure_args="$ac_configure_args --enable-64bit"
8710     fi
8711     if test -n "$USE_ARM_KUSER"; then
8712         ac_configure_args="$ac_configure_args --with-arm-kuser"
8713     fi
8714     AC_OUTPUT_SUBDIRS(nsprpub)
8715     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8718 if test -z "$MOZ_NATIVE_NSPR"; then
8719     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8720     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8721     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8722        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8723        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8724        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8725        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8726     fi
8727     rm -f config/autoconf.mk.bak
8730 # Run the SpiderMonkey 'configure' script.
8731 dist=$MOZ_BUILD_ROOT/dist
8732 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8733 ac_configure_args="$ac_configure_args --enable-threadsafe"
8734 if test "$BUILD_CTYPES"; then
8735     # Build js-ctypes on the platforms we can.
8736     ac_configure_args="$ac_configure_args --enable-ctypes"
8738 if test -z "$MOZ_NATIVE_NSPR"; then
8739     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8740     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8742 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8743 ac_configure_args="$ac_configure_args --prefix=$dist"
8744 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8745 if test "$MOZ_MEMORY"; then
8746    ac_configure_args="$ac_configure_args --enable-jemalloc"
8747    if test -n "$MOZ_MEMORY_LDFLAGS"; then
8748      export MOZ_MEMORY_LDFLAGS
8749    fi
8751 AC_OUTPUT_SUBDIRS(js/src)
8752 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8754 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8756 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8757 dnl Needs to be at the end to respect possible changes from NSPR configure
8758 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8759   echo "config/autoconf.mk is unchanged"
8760   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8761 else
8762   rm -f config/autoconf.mk.orig 2> /dev/null