bug 523688 - avoiding spurious OOM messages when on trace. r=brendan
[mozilla-central.git] / configure.in
blob133540e4b0ca938899add1f657fc15c5f5fbaf7f
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=10217
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.6.0
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 LIBGNOME_VERSION=2.0
133 GIO_VERSION=2.0
134 STARTUP_NOTIFICATION_VERSION=0.8
135 DBUS_VERSION=0.60
136 SQLITE_VERSION=3.6.18
137 LIBNOTIFY_VERSION=0.4
139 MSMANIFEST_TOOL=
141 dnl Set various checks
142 dnl ========================================================
143 MISSING_X=
144 AC_PROG_AWK
146 dnl Initialize the Pthread test variables early so they can be
147 dnl  overridden by each platform.
148 dnl ========================================================
149 USE_PTHREADS=
150 _PTHREAD_LDFLAGS=""
152 dnl Do not allow a separate objdir build if a srcdir build exists.
153 dnl ==============================================================
154 _topsrcdir=`cd \`dirname $0\`; pwd`
155 _objdir=`pwd`
157 if test "$_topsrcdir" != "$_objdir"
158 then
159   # Check for a couple representative files in the source tree
160   _conflict_files=
161   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
162     if test -f $file; then
163       _conflict_files="$_conflict_files $file"
164     fi
165   done
166   if test "$_conflict_files"; then
167     echo "***"
168     echo "*   Your source tree contains these files:"
169     for file in $_conflict_files; do
170       echo "*         $file"
171     done
172     cat 1>&2 <<-EOF
173         *   This indicates that you previously built in the source tree.
174         *   A source tree build can confuse the separate objdir build.
175         *
176         *   To clean up the source tree:
177         *     1. cd $_topsrcdir
178         *     2. gmake distclean
179         ***
180         EOF
181     exit 1
182     break
183   fi
185 MOZ_BUILD_ROOT=`pwd`
187 dnl Default to MSVC for win32 and gcc-4.2 for darwin
188 dnl ==============================================================
189 if test -z "$CROSS_COMPILE"; then
190 case "$target" in
191 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
192     if test -z "$CC"; then CC=cl; fi
193     if test -z "$CXX"; then CXX=cl; fi
194     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
195     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
196     if test -z "$LD"; then LD=link; fi
197     if test -z "$AS"; then
198         case "${target_cpu}" in
199         i*86)
200             AS=ml;
201             ;;
202         x86_64)
203             AS=ml64;
204             ;;
205         esac
206     fi
207     if test -z "$MIDL"; then MIDL=midl; fi
208     ;;
209 *-darwin*)
210     if test -z "$CC"; then CC=gcc-4.2; fi
211     if test -z "$CXX"; then CXX=g++-4.2; fi
212     ;;
213 esac
216 COMPILE_ENVIRONMENT=1
217 MOZ_ARG_ENABLE_BOOL(compile-environment,
218 [  --disable-compile-environment
219                            Disable compiler/library checks.],
220     COMPILE_ENVIRONMENT=1,
221     COMPILE_ENVIRONMENT= )
222 AC_SUBST(COMPILE_ENVIRONMENT)
224 MOZ_ARG_WITH_STRING(l10n-base,
225 [  --with-l10n-base=DIR     path to l10n repositories],
226     L10NBASEDIR=$withval)
227 if test ! -z "$L10NBASEDIR"; then
228     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
229         AC_MSG_ERROR([--with-l10n-base must specify a path])
230     elif test -d "$L10NBASEDIR"; then
231         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
232     else
233         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
234     fi
236 AC_SUBST(L10NBASEDIR)
238 dnl Check for Perl first -- needed for win32 SDK checks
239 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
240 if test -z "$PERL" || test "$PERL" = ":"; then
241     AC_MSG_ERROR([perl not found in \$PATH])
244 dnl ========================================================
245 dnl Checks for compilers.
246 dnl ========================================================
247 dnl Set CROSS_COMPILE in the environment when running configure
248 dnl to use the cross-compile setup for now
249 dnl ========================================================
251 if test "$COMPILE_ENVIRONMENT"; then
253 dnl Do some special WinCE toolchain stuff
254 case "$target" in
255 *wince)
257     MOZ_ARG_WITH_STRING(wince-sdk,
258     [  --with-wince-sdk=WINCE_SDK_DIR
259                         The path to the Windows CE SDK],
260     WINCE_SDK_DIR=$withval)
262     MOZ_ARG_WITH_STRING(ogles-sdk,
263     [  --with-ogles-sdk=OGLES_SDK_DIR
264                         The path to the OGLES SDK],
265     OGLES_SDK_DIR=$withval)
267     dnl Default to Windows Mobile components enabled
268     WINCE_WINDOWS_MOBILE=1
270     MOZ_ARG_DISABLE_BOOL(windows-mobile-components,
271     [  --disable-windows-mobile-components
272          Disable Windows Mobile specific components from CE build],
273     WINCE_WINDOWS_MOBILE=,
274     WINCE_WINDOWS_MOBILE=1)
276     if test "$WINCE_WINDOWS_MOBILE"; then
277         AC_DEFINE(WINCE_WINDOWS_MOBILE)
278     fi
280     AC_DEFINE(WINCE)
281     
282     export WINCE=1
284     echo -----------------------------------------------------------------------------
285     echo Building Windows CE Shunt Library and Tool Chain
286     echo Using SDK in:
287     echo $WINCE_SDK_DIR
289     ac_exeext=.exe
291     _pwdw=`pwd -W`
292     _pwd=`pwd`
293     make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" TOPSRCDIR="$_topsrcdir" OBJDIR="$_pwdw" -C $srcdir/build/wince/tools
295     CC="$_pwd/dist/sdk/bin/arm-wince-gcc"
296     CXX="$_pwd/dist/sdk/bin/arm-wince-gcc"
297     CPP="$_pwd/dist/sdk/bin/arm-wince-gcc -E -nologo"
298     CXXCPP="$_pwd/dist/sdk/bin/arm-wince-gcc -TP -E -nologo"
299     LD="$_pwd/dist/sdk/bin/arm-wince-link"
300     AR="$_pwd/dist/sdk/bin/arm-wince-lib"
301     AS="$_pwd/dist/sdk/bin/arm-wince-as"
302     RC="$_pwd/dist/sdk/bin/arm-wince-res"
305     echo -----------------------------------------------------------------------------
307     ;;
308 esac
310 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
311     echo "cross compiling from $host to $target"
312     cross_compiling=yes
314     _SAVE_CC="$CC"
315     _SAVE_CFLAGS="$CFLAGS"
316     _SAVE_LDFLAGS="$LDFLAGS"
318     AC_MSG_CHECKING([for host c compiler])
319     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
320     if test -z "$HOST_CC"; then
321         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
322     fi
323     AC_MSG_RESULT([$HOST_CC])
324     AC_MSG_CHECKING([for host c++ compiler])
325     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
326     if test -z "$HOST_CXX"; then
327         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
328     fi
329     AC_MSG_RESULT([$HOST_CXX])
331     if test -z "$HOST_CFLAGS"; then
332         HOST_CFLAGS="$CFLAGS"
333     fi
334     if test -z "$HOST_CXXFLAGS"; then
335         HOST_CXXFLAGS="$CXXFLAGS"
336     fi
337     if test -z "$HOST_LDFLAGS"; then
338         HOST_LDFLAGS="$LDFLAGS"
339     fi
340     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
341     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
342     CC="$HOST_CC"
343     CFLAGS="$HOST_CFLAGS"
344     LDFLAGS="$HOST_LDFLAGS"
346     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
347     AC_TRY_COMPILE([], [return(0);], 
348         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
349         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
351     CC="$HOST_CXX"
352     CFLAGS="$HOST_CXXFLAGS"
354     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
355     AC_TRY_COMPILE([], [return(0);], 
356         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
357         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
358     
359     CC=$_SAVE_CC
360     CFLAGS=$_SAVE_CFLAGS
361     LDFLAGS=$_SAVE_LDFLAGS
363     case "$build:$target" in
364       powerpc-apple-darwin8*:i?86-apple-darwin*)
365         dnl The Darwin cross compiler doesn't necessarily point itself at a
366         dnl root that has libraries for the proper architecture, it defaults
367         dnl to the system root.  The libraries in the system root on current
368         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
369         dnl checks will fail.  Fake a working SDK in that case.
370         _SAVE_CFLAGS=$CFLAGS
371         _SAVE_CXXFLAGS=$CXXLAGS
372         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
373         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
374         ;;
375     esac
377     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
378     unset ac_cv_prog_CC
379     AC_PROG_CC
380     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
381     unset ac_cv_prog_CXX
382     AC_PROG_CXX
384     case "$build:$target" in
385       powerpc-apple-darwin8*:i?86-apple-darwin*)
386         dnl Revert the changes made above.  From this point on, the target
387         dnl compiler will never be used without applying the SDK to CFLAGS
388         dnl (see --with-macos-sdk below).
389         CFLAGS=$_SAVE_CFLAGS
390         CXXFLAGS=$_SAVE_CXXFLAGS
391         ;;
392     esac
394     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
395     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
396     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
397     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
398     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
399     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
400     AC_DEFINE(CROSS_COMPILE)
401 else
402     AC_PROG_CC
403     AC_PROG_CXX
404     AC_PROG_RANLIB
405     MOZ_PATH_PROGS(AS, $AS as, $CC)
406     AC_CHECK_PROGS(AR, ar, :)
407     AC_CHECK_PROGS(LD, ld, :)
408     AC_CHECK_PROGS(STRIP, strip, :)
409     AC_CHECK_PROGS(WINDRES, windres, :)
410     if test -z "$HOST_CC"; then
411         HOST_CC="$CC"
412     fi
413     if test -z "$HOST_CFLAGS"; then
414         HOST_CFLAGS="$CFLAGS"
415     fi
416     if test -z "$HOST_CXX"; then
417         HOST_CXX="$CXX"
418     fi
419     if test -z "$HOST_CXXFLAGS"; then
420         HOST_CXXFLAGS="$CXXFLAGS"
421     fi
422     if test -z "$HOST_LDFLAGS"; then
423         HOST_LDFLAGS="$LDFLAGS"
424     fi
425     if test -z "$HOST_RANLIB"; then
426         HOST_RANLIB="$RANLIB"
427     fi
428     if test -z "$HOST_AR"; then
429        HOST_AR="$AR"
430     fi
433 GNU_AS=
434 GNU_LD=
435 GNU_CC=
436 GNU_CXX=
437 CC_VERSION='N/A'
438 CXX_VERSION='N/A'
439 if test "$GCC" = "yes"; then
440     GNU_CC=1
441     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
443 if test "$GXX" = "yes"; then
444     GNU_CXX=1
445     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
447 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
448     GNU_AS=1
450 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
451     GNU_LD=1
453 if test "$GNU_CC"; then
454     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
455         GCC_USE_GNU_LD=1
456     fi
459 INTEL_CC=
460 INTEL_CXX=
461 if test "$GCC" = yes; then
462    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
463      INTEL_CC=1
464    fi
467 if test "$GXX" = yes; then
468    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
469      INTEL_CXX=1
470    fi
473 dnl Special win32 checks
474 dnl ========================================================
475 case "$target" in
476 *-wince)
477     WINVER=500
478     ;;
480     if test -n "$GNU_CC"; then  
481         WINVER=501
482     else    
483         WINVER=500
484     fi
485     ;;
486 esac
488 dnl Target the Windows 7 SDK by default
489 WINSDK_TARGETVER=601
491 MOZ_ARG_WITH_STRING(windows-version,
492 [  --with-windows-version=WINSDK_TARGETVER
493                           Highest Windows version to target using this SDK
494                               502: Windows Server 2003
495                               600: Windows Vista
496                               601: Windows 7],
497   WINSDK_TARGETVER=$withval)
499 case "$WINSDK_TARGETVER" in
500 502|600|601)
501     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
502     ;;
505     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
506     ;;
508 esac
510 dnl Vista SDK specific api (deprecated)
511 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
512 [  --disable-vista-sdk-requirements
513                            Do not build Vista SDK specific code],
514    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
515    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
516 if test -n "$COMPILE_ENVIRONMENT"; then
517 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
518     AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
519     MOZ_WINSDK_TARGETVER=05020000
522 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
523     MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
524     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
525     # We can't build parental controls either
526     MOZ_DISABLE_PARENTAL_CONTROLS=1
530 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
532 case "$target" in
533 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
534     if test "$GCC" != "yes"; then
535         # Check to see if we are really running in a msvc environemnt
536         _WIN32_MSVC=1
537         AC_CHECK_PROGS(MIDL, midl)
539         # Make sure compilers are valid
540         CFLAGS="$CFLAGS -TC -nologo"
541         CXXFLAGS="$CXXFLAGS -TP -nologo"
542         AC_LANG_SAVE
543         AC_LANG_C
544         AC_TRY_COMPILE([#include <stdio.h>],
545             [ printf("Hello World\n"); ],,
546             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
548         AC_LANG_CPLUSPLUS
549         AC_TRY_COMPILE([#include <new.h>],
550             [ unsigned *test = new unsigned(42); ],,
551             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
552         AC_LANG_RESTORE
553         
554         changequote(,)
555         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
556         changequote([,])
557         
558         # Determine compiler version
559         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
561         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
562         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
563         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
564         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
566         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
567         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
569         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
570             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
571         fi
572         if test "$_CC_MAJOR_VERSION" = "13"; then
573             _CC_SUITE=7
574         elif test "$_CC_MAJOR_VERSION" = "14"; then
575             _CC_SUITE=8
576             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
577             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
578             dnl so be very specific here!
579             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
580             if test $_CC_RELEASE -gt 50727; then
581                _USE_DYNAMICBASE=1
582             elif test $_CC_BUILD -ge 762; then
583                _USE_DYNAMICBASE=1
584             fi
585             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
586             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
587         elif test "$_CC_MAJOR_VERSION" = "15"; then
588             _CC_SUITE=9
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)
762     ;;
763 esac
765 dnl Test breaks icc on OS/2 && MSVC
766 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
767     AC_PROG_CC_C_O
768     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
769         USING_HCC=1
770         _OLDCC=$CC
771         _OLDCXX=$CXX
772         CC="${srcdir}/build/hcc '$CC'"
773         CXX="${srcdir}/build/hcpp '$CXX'"
774     fi
777 AC_PROG_CPP
778 AC_PROG_CXXCPP
780 if test -n "$_WIN32_MSVC"; then
781     SKIP_PATH_CHECKS=1
782     SKIP_COMPILER_CHECKS=1
783     SKIP_LIBRARY_CHECKS=1
785     # Since we're skipping compiler and library checks, hard-code
786     # some facts here.
787     case "$target" in
788     *-wince)
789         ;;
790     *)
791         AC_DEFINE(HAVE_IO_H)
792         AC_DEFINE(HAVE_SETBUF)
793         AC_DEFINE(HAVE_ISATTY)
794         ;;
795     esac
798 fi # COMPILE_ENVIRONMENT
800 AC_SUBST(MIDL_FLAGS)
801 AC_SUBST(_MSC_VER)
803 AC_SUBST(GNU_AS)
804 AC_SUBST(GNU_LD)
805 AC_SUBST(GNU_CC)
806 AC_SUBST(GNU_CXX)
807 AC_SUBST(INTEL_CC)
808 AC_SUBST(INTEL_CXX)
810 dnl ========================================================
811 dnl Checks for programs.
812 dnl ========================================================
813 AC_PROG_INSTALL
814 AC_PROG_LN_S
816 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
817 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
818 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
819 _perl_res=$?
820 AC_MSG_RESULT([$_perl_version])
822 if test "$_perl_res" != 0; then
823     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
827 AC_MSG_CHECKING([for full perl installation])
828 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
829 _perl_res=$?
830 if test "$_perl_res" != 0; then
831     AC_MSG_RESULT([no])
832     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
833 else
834     AC_MSG_RESULT([yes])    
837 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.5 python2.4 python)
838 if test -z "$PYTHON"; then
839     AC_MSG_ERROR([python was not found in \$PATH])
842 if test -z "$COMPILE_ENVIRONMENT"; then
843     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
845 AC_SUBST(NSINSTALL_BIN)
847 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
848 MOZ_PATH_PROG(WHOAMI, whoami, :)
849 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
850 MOZ_PATH_PROG(UNZIP, unzip, :)
851 MOZ_PATH_PROGS(ZIP, zip)
852 if test -z "$ZIP" || test "$ZIP" = ":"; then
853     AC_MSG_ERROR([zip not found in \$PATH])
855 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
856 MOZ_PATH_PROG(XARGS, xargs)
857 if test -z "$XARGS" || test "$XARGS" = ":"; then
858     AC_MSG_ERROR([xargs not found in \$PATH .])
861 if test "$COMPILE_ENVIRONMENT"; then
863 dnl ========================================================
864 dnl = Mac OS X toolchain support
865 dnl ========================================================
867 case "$target_os" in
868 darwin*)
869     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
870     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
871     dnl the environment and includedir purposes (when using an SDK, below),
872     dnl but remember the full version number for the libdir (SDK).
873     changequote(,)
874     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
875     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
876     changequote([,])
877     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
878         dnl Bug 280479, but this keeps popping up in bug 292530 too because
879         dnl 4.0.0/4061 is the default compiler in Tiger.
880         changequote(,)
881         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
882         changequote([,])
883         if test "$GCC_BUILD" = "4061" ; then
884             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
885 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
886 from building Mozilla. Upgrade to Xcode 2.1 or later.])
887         fi
888     fi
890     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
891     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
892     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
893     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
895     case "$PBBUILD" in
896       *xcodebuild*)
897         changequote(,)
898         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
899         changequote([,])
900         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
901           HAS_XCODE_2_1=1;
902         fi
903       ;;
904     esac
906     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
907     dnl it has moved into /usr/bin.
908     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
909     ;;
910 esac
912 AC_SUBST(GCC_VERSION)
913 AC_SUBST(XCODEBUILD_VERSION)
914 AC_SUBST(HAS_XCODE_2_1)
916 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
917 dnl that a universal binary is being produced.
918 AC_SUBST(UNIVERSAL_BINARY)
920 dnl ========================================================
921 dnl Check for MacOS deployment target version
922 dnl ========================================================
924 MOZ_ARG_ENABLE_STRING(macos-target,
925                       [  --enable-macos-target=VER (default=10.5)
926                           Set the minimum MacOS version needed at runtime],
927                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
929 case "$target" in
930 *-darwin*)
931     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
932         dnl Use the specified value
933         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
934         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
935     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
936         dnl No value specified on the command line or in the environment,
937         dnl use architecture minimum.
938         export MACOSX_DEPLOYMENT_TARGET=10.5
939     fi
940     ;;
941 esac
943 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
945 dnl ========================================================
946 dnl = Mac OS X SDK support
947 dnl ========================================================
948 MACOS_SDK_DIR=
949 NEXT_ROOT=
950 MOZ_ARG_WITH_STRING(macos-sdk,
951 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
952     MACOS_SDK_DIR=$withval)
954 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
955 dnl NEXT_ROOT will be set and exported only if it's needed.
956 AC_SUBST(MACOS_SDK_DIR)
957 AC_SUBST(NEXT_ROOT)
959 if test "$MACOS_SDK_DIR"; then
960   dnl Sync this section with the ones in NSPR and NSS.
961   dnl Changes to the cross environment here need to be accounted for in
962   dnl the libIDL checks (below) and xpidl build.
964   if test ! -d "$MACOS_SDK_DIR"; then
965     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
966 specify a valid SDK.  SDKs are installed when the optional cross-development
967 tools are selected during the Xcode/Developer Tools installation.])
968   fi
970   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
971   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
972     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
973   else
974     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
975     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
977     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
978     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
979     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
981     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
982       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
983       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
984       dnl be ignored and cause warnings when -syslibroot is specified.
985       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
986       dnl the -isysroot it receives, so this is only needed with 4.0.0.
987       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
988     fi
989   fi
991   AC_LANG_SAVE
992   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
993   AC_LANG_CPLUSPLUS
994   AC_TRY_COMPILE([#include <new>
995                  int main() { return 0; }],
996    result=yes,
997    result=no)
998   AC_LANG_RESTORE
999   AC_MSG_RESULT($result)
1001   if test "$result" = "no" ; then
1002     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1003   fi
1006 fi # COMPILE_ENVIRONMENT
1008 dnl Be sure the make we use is GNU make.
1009 dnl on win32, gmake.exe is the generally the wrong version
1010 if test -n "$MAKE"; then
1011   if test `echo $MAKE | grep -c make.py` != 1; then
1012      NOT_PYMAKE=$MAKE
1013   fi
1016 case "$host_os" in
1017 cygwin*|mingw*|mks*|msvc*)
1018     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1019     ;;
1021     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1022     ;;
1023 esac
1024 if test "$GMAKE" = ":"; then
1025    AC_MSG_ERROR([GNU make not found])
1027 AC_SUBST(GMAKE)
1029 if test "$COMPILE_ENVIRONMENT"; then
1031 AC_PATH_XTRA
1033 XCFLAGS="$X_CFLAGS"
1035 fi # COMPILE_ENVIRONMENT
1037 dnl ========================================================
1038 dnl set the defaults first
1039 dnl ========================================================
1040 AS_BIN=$AS
1041 AR_FLAGS='cr $@'
1042 AR_LIST='$(AR) t'
1043 AR_EXTRACT='$(AR) x'
1044 AR_DELETE='$(AR) d'
1045 AS='$(CC)'
1046 AS_DASH_C_FLAG='-c'
1047 DLL_PREFIX=lib
1048 LIB_PREFIX=lib
1049 DLL_SUFFIX=.so
1050 OBJ_SUFFIX=o
1051 LIB_SUFFIX=a
1052 ASM_SUFFIX=s
1053 IMPORT_LIB_SUFFIX=
1054 TARGET_MD_ARCH=unix
1055 DIRENT_INO=d_ino
1056 CYGWIN_WRAPPER=
1057 WIN_TOP_SRC=
1058 MOZ_USER_DIR=".mozilla"
1059 HOST_AR='$(AR)'
1060 HOST_AR_FLAGS='$(AR_FLAGS)'
1062 MOZ_JPEG_CFLAGS=
1063 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1064 MOZ_ZLIB_CFLAGS=
1065 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1066 MOZ_BZ2_CFLAGS=
1067 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1068 MOZ_PNG_CFLAGS=
1069 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1071 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1072 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
1073 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1074 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
1075 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1076 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1077 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1079 MOZ_FS_LAYOUT=unix
1081 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1083 USE_DEPENDENT_LIBS=1
1085 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1087 MOZ_ENABLE_POSTSCRIPT=1 
1089 if test -n "$CROSS_COMPILE"; then
1090     OS_TARGET="${target_os}"
1091     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1092     OS_RELEASE=
1093     case "${target_os}" in
1094         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1095         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1096         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1097         mingw*)       OS_ARCH=WINNT ;;
1098         wince*)       OS_ARCH=WINCE ;;
1099         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1100     esac
1101 else
1102     OS_TARGET=`uname -s`
1103     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1104     OS_RELEASE=`uname -r`
1107 # Before this used `uname -m` when not cross compiling
1108 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1109 OS_TEST="${target_cpu}"
1111 _COMPILER_PREFIX=
1113 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1115 #######################################################################
1116 # Master "Core Components" macros for getting the OS target           #
1117 #######################################################################
1120 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1121 # cross-compilation.
1125 # Define and override various archtecture-specific variables, including
1126 # HOST_OS_ARCH
1127 # OS_ARCH
1128 # OS_TEST
1129 # OS_TARGET
1130 # OS_RELEASE
1131 # OS_MINOR_RELEASE
1134 case "$HOST_OS_ARCH" in
1135 cygwin*|mingw*|mks*|msvc*)
1136     HOST_OS_ARCH=WINNT
1137     ;;
1138 linux*)
1139     HOST_OS_ARCH=Linux
1140     ;;
1141 solaris*)
1142     HOST_OS_ARCH=SunOS
1143     SOLARIS_SUNPRO_CC=
1144     SOLARIS_SUNPRO_CXX=
1145     if test -z "$GNU_CC"; then
1146         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1147             SOLARIS_SUNPRO_CC=1
1148        fi
1149     fi
1151     if test -z "$GNU_CXX"; then
1152        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1153            SOLARIS_SUNPRO_CXX=1
1154        fi
1155     fi
1156     AC_SUBST(SOLARIS_SUNPRO_CC)
1157     AC_SUBST(SOLARIS_SUNPRO_CXX)
1158     ;;
1159 BSD_386)
1160     HOST_OS_ARCH=BSD
1161     ;;
1162 dgux)
1163     HOST_OS_ARCH=DGUX
1164     ;;
1165 IRIX64)
1166     HOST_OS_ARCH=IRIX
1167     ;;
1168 UNIX_SV)
1169     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1170         HOST_OS_ARCH=NCR
1171     else
1172         HOST_OS_ARCH=UNIXWARE
1173     fi
1174     ;;
1175 ncr)
1176     HOST_OS_ARCH=NCR
1177     ;;
1178 UNIX_SYSTEM_V)
1179     HOST_OS_ARCH=NEC
1180     ;;
1181 OSF1)
1182     ;;
1183 *OpenVMS*)
1184     HOST_OS_ARCH=OpenVMS
1185     ;;
1186 OS_2)
1187     HOST_OS_ARCH=OS2
1188     ;;
1189 QNX)
1190     ;;
1191 SCO_SV)
1192     HOST_OS_ARCH=SCOOS
1193     ;;
1194 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1195     HOST_OS_ARCH=SINIX
1196     ;;
1197 UnixWare)
1198     HOST_OS_ARCH=UNIXWARE
1199     ;;
1200 esac
1202 case "$OS_ARCH" in
1203 WINNT)
1204     OS_TEST=`uname -p`
1205     ;;
1206 Windows_NT)
1208 # If uname -s returns "Windows_NT", we assume that we are using
1209 # the uname.exe in MKS toolkit.
1211 # The -r option of MKS uname only returns the major version number.
1212 # So we need to use its -v option to get the minor version number.
1213 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1215     OS_ARCH=WINNT
1216     OS_TARGET=WINNT
1217     OS_MINOR_RELEASE=`uname -v`
1218     if test "$OS_MINOR_RELEASE" = "00"; then
1219         OS_MINOR_RELEASE=0
1220     fi
1221     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1222     ;;
1223 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1225 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1226 # the uname.exe in the Cygwin tools.
1227 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1228 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1229 # the uname.exe in the GNU-Win32 tools.
1230 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1231 # the uname.exe in the MSYS tools.
1233     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1234     OS_ARCH=WINNT
1235     OS_TARGET=WINNT
1236     ;;
1237 AIX)
1238     OS_RELEASE=`uname -v`.`uname -r`
1239     OS_TEST=${target_cpu}
1240     ;;
1241 BSD_386)
1242     OS_ARCH=BSD
1243     ;;
1244 dgux)
1245     OS_ARCH=DGUX
1246     ;;
1247 IRIX64)
1248     OS_ARCH=IRIX
1249     ;;
1250 UNIX_SV)
1251     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1252         OS_ARCH=NCR
1253     else
1254         OS_ARCH=UNIXWARE
1255         OS_RELEASE=`uname -v`
1256     fi
1257     ;;
1258 ncr)
1259     OS_ARCH=NCR
1260     ;;
1261 UNIX_SYSTEM_V)
1262     OS_ARCH=NEC
1263     ;;
1264 OSF1)
1265     case `uname -v` in
1266     148)
1267         OS_RELEASE=V3.2C
1268         ;;
1269     564)
1270         OS_RELEASE=V4.0B
1271         ;;
1272     878)
1273         OS_RELEASE=V4.0D
1274         ;;
1275     esac
1276     ;;
1277 *OpenVMS*)
1278     OS_ARCH=OpenVMS
1279     OS_RELEASE=`uname -v`
1280     OS_TEST=`uname -p`
1281     ;;
1282 OS_2)
1283     OS_ARCH=OS2
1284     OS_TARGET=OS2
1285     OS_RELEASE=`uname -v`
1286     ;;
1287 QNX)
1288     if test "$OS_TARGET" != "NTO"; then
1289         changequote(,)
1290         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1291         changequote([,])
1292     fi
1293     OS_TEST=x86
1294     ;;
1295 SCO_SV)
1296     OS_ARCH=SCOOS
1297     OS_RELEASE=5.0
1298     ;;
1299 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1300     OS_ARCH=SINIX
1301     OS_TEST=`uname -p`
1302     ;;
1303 UnixWare)
1304     OS_ARCH=UNIXWARE
1305     OS_RELEASE=`uname -v`
1306     ;;
1307 WINCE)
1308     OS_ARCH=WINCE
1309     OS_TARGET=WINCE
1310     ;;
1311 Darwin)
1312     case "${target_cpu}" in
1313     powerpc*)
1314         OS_TEST=ppc
1315         ;;
1316     i*86*)
1317         OS_TEST=i386 
1318         ;;
1319     x86_64)
1320         OS_TEST=x86_64
1321         ;;
1322     *)
1323         if test -z "$CROSS_COMPILE" ; then
1324             OS_TEST=`uname -p`
1325         fi
1326         ;;
1327     esac
1328     ;;
1329 esac
1331 if test "$OS_ARCH" = "NCR"; then
1332     changequote(,)
1333     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1334     changequote([,])
1337 # Only set CPU_ARCH if we recognize the value of OS_TEST
1339 case "$OS_TEST" in
1340 *86 | i86pc)
1341     CPU_ARCH=x86
1342     ;;
1344 powerpc64 | ppc64)
1345     CPU_ARCH=ppc64
1346     ;;
1348 powerpc | ppc | rs6000)
1349     CPU_ARCH=ppc
1350     ;;
1352 Alpha | alpha | ALPHA)
1353     CPU_ARCH=Alpha
1354     ;;
1356 s390)
1357     CPU_ARCH=s390
1358     ;;
1360 s390x)
1361     CPU_ARCH=s390x
1362     ;;
1364 hppa* | parisc)
1365     CPU_ARCH=hppa
1366     ;;
1368 sun4u | sparc*)
1369     CPU_ARCH=sparc
1370     ;;
1372 x86_64 | ia64)
1373     CPU_ARCH="$OS_TEST"
1374     ;;
1376 arm)
1377     if test "$OS_TARGET" = "WINCE"; then
1378         CPU_ARCH="$OS_TEST"
1379     fi
1380     ;;
1381 esac
1383 if test -z "$OS_TARGET"; then
1384     OS_TARGET=$OS_ARCH
1386 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1388 dnl ========================================================
1389 dnl GNU specific defaults
1390 dnl ========================================================
1391 if test "$GNU_CC"; then
1392     # FIXME: Let us build with strict aliasing. bug 414641.
1393     CFLAGS="$CFLAGS -fno-strict-aliasing"
1394     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1395     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1396     DSO_LDOPTS='-shared'
1397     if test "$GCC_USE_GNU_LD"; then
1398         # Don't allow undefined symbols in libraries
1399         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1400     fi
1401     WARNINGS_AS_ERRORS='-Werror'
1402     DSO_CFLAGS=''
1403     DSO_PIC_CFLAGS='-fPIC'
1404     ASFLAGS="$ASFLAGS -fPIC"
1405     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1406     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1407     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1408     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1410     # Turn on GNU specific features
1411     # -Wall - turn on all warnings
1412     # -pedantic - make compiler warn about non-ANSI stuff, and
1413     #             be a little bit stricter
1414     # Warnings slamm took out for now (these were giving more noise than help):
1415     # -Wbad-function-cast - warns when casting a function to a new return type
1416     # -Wshadow - removed because it generates more noise than help --pete
1417     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1418     if test -z "$INTEL_CC"; then
1419        # Don't use -Wcast-align with ICC
1420        case "$CPU_ARCH" in
1421            # And don't use it on hppa, ia64, sparc, since it's noisy there
1422            hppa | ia64 | sparc)
1423            ;;
1424            *)
1425         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1426            ;;
1427        esac
1428     fi
1430     dnl Turn pedantic on but disable the warnings for long long
1431     _PEDANTIC=1
1433     if test -z "$INTEL_CC"; then
1434       _IGNORE_LONG_LONG_WARNINGS=1
1435       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1436     else
1437       _IGNORE_LONG_LONG_WARNINGS=
1438     fi
1441     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1442     _USE_CPP_INCLUDE_FLAG=1
1443 elif test "$SOLARIS_SUNPRO_CC"; then
1444     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1445     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1447     DSO_LDOPTS='-shared'
1448     if test "$GNU_LD"; then
1449         # Don't allow undefined symbols in libraries
1450         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1451     fi
1453     DSO_CFLAGS=''
1454     if test "$CPU_ARCH" = "sparc"; then
1455         # for Sun Studio on Solaris/SPARC
1456         DSO_PIC_CFLAGS='-xcode=pic32'
1457     else
1458         DSO_PIC_CFLAGS='-KPIC'
1459     fi
1460     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1461 else
1462     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1463     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1465     DSO_LDOPTS='-shared'
1466     if test "$GNU_LD"; then
1467         # Don't allow undefined symbols in libraries
1468         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1469     fi
1471     DSO_CFLAGS=''
1472     DSO_PIC_CFLAGS='-KPIC'
1473     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1476 if test "$GNU_CXX"; then
1477     # FIXME: Let us build with strict aliasing. bug 414641.
1478     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1479     # Turn on GNU specific features
1480     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1481     if test -z "$INTEL_CC"; then
1482        # Don't use -Wcast-align with ICC
1483        case "$CPU_ARCH" in
1484            # And don't use it on hppa, ia64, sparc, since it's noisy there
1485            hppa | ia64 | sparc)
1486            ;;
1487            *)
1488         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1489            ;;
1490        esac
1491     fi
1493     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1494     _USE_CPP_INCLUDE_FLAG=1
1496     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1497                    ac_has_wno_invalid_offsetof,
1498         [
1499             AC_LANG_SAVE
1500             AC_LANG_CPLUSPLUS
1501             _SAVE_CXXFLAGS="$CXXFLAGS"
1502             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1503             AC_TRY_COMPILE([],
1504                            [return(0);],
1505                            ac_has_wno_invalid_offsetof="yes",
1506                            ac_has_wno_invalid_offsetof="no")
1507             CXXFLAGS="$_SAVE_CXXFLAGS"
1508             AC_LANG_RESTORE
1509         ])
1510     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1511         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1512     fi
1513 else
1514     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1517 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1518 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1519 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1520 dnl normal behavior.
1521 dnl ========================================================
1522 MKSHLIB_FORCE_ALL=
1523 MKSHLIB_UNFORCE_ALL=
1525 if test "$COMPILE_ENVIRONMENT"; then
1526 if test "$GNU_CC"; then
1527   AC_MSG_CHECKING(whether ld has archive extraction flags)
1528   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1529    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1530     ac_cv_mkshlib_force_and_unforce="no"
1531     exec 3<&0 <<LOOP_INPUT
1532         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1533         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1534         force="-Wl,-all";              unforce="-Wl,-none"
1535 LOOP_INPUT
1536     while read line
1537     do
1538       eval $line
1539       LDFLAGS=$force
1540       LIBS=$unforce
1541       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1542     done
1543     exec 0<&3 3<&-
1544     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1545    ])
1546   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1547     AC_MSG_RESULT(no)
1548   else
1549     AC_MSG_RESULT(yes)
1550     eval $ac_cv_mkshlib_force_and_unforce
1551     MKSHLIB_FORCE_ALL=$force
1552     MKSHLIB_UNFORCE_ALL=$unforce
1553   fi
1554 fi # GNU_CC
1555 fi # COMPILE_ENVIRONMENT
1557 dnl =================================================================
1558 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1559 dnl which is bad when cross compiling.
1560 dnl =================================================================
1561 if test "$COMPILE_ENVIRONMENT"; then
1562 configure_static_assert_macros='
1563 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1564 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1565 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1568 dnl test that the macros actually work:
1569 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1570 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1571  [AC_LANG_SAVE
1572   AC_LANG_C
1573   ac_cv_static_assertion_macros_work="yes"
1574   AC_TRY_COMPILE([$configure_static_assert_macros],
1575                  [CONFIGURE_STATIC_ASSERT(1)],
1576                  ,
1577                  ac_cv_static_assertion_macros_work="no")
1578   AC_TRY_COMPILE([$configure_static_assert_macros],
1579                  [CONFIGURE_STATIC_ASSERT(0)],
1580                  ac_cv_static_assertion_macros_work="no",
1581                  )
1582   AC_LANG_CPLUSPLUS
1583   AC_TRY_COMPILE([$configure_static_assert_macros],
1584                  [CONFIGURE_STATIC_ASSERT(1)],
1585                  ,
1586                  ac_cv_static_assertion_macros_work="no")
1587   AC_TRY_COMPILE([$configure_static_assert_macros],
1588                  [CONFIGURE_STATIC_ASSERT(0)],
1589                  ac_cv_static_assertion_macros_work="no",
1590                  )
1591   AC_LANG_RESTORE
1592  ])
1593 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1594 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1595     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1597 fi # COMPILE_ENVIRONMENT
1599 dnl ========================================================
1600 dnl Checking for 64-bit OS
1601 dnl ========================================================
1602 if test "$COMPILE_ENVIRONMENT"; then
1603 AC_LANG_SAVE
1604 AC_LANG_C
1605 AC_MSG_CHECKING(for 64-bit OS)
1606 AC_TRY_COMPILE([$configure_static_assert_macros],
1607                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1608                result="yes", result="no")
1609 AC_MSG_RESULT("$result")
1610 if test "$result" = "yes"; then
1611     AC_DEFINE(HAVE_64BIT_OS)
1612     HAVE_64BIT_OS=1
1614 AC_SUBST(HAVE_64BIT_OS)
1615 AC_LANG_RESTORE
1616 fi # COMPILE_ENVIRONMENT
1618 dnl ========================================================
1619 dnl Enable high-memory support on OS/2 by default.
1620 dnl ========================================================
1621 MOZ_OS2_HIGH_MEMORY=1
1622 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1623 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1624     MOZ_OS2_HIGH_MEMORY=,
1625     MOZ_OS2_HIGH_MEMORY=1 )
1626 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1628 dnl ========================================================
1629 dnl System overrides of the defaults for host
1630 dnl ========================================================
1631 case "$host" in
1632 *-beos*)
1633     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1634     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1635     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1636     ;;
1638 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1639     # we need Python 2.5 on Windows
1640     PYTHON_VERSION=2.5
1641     if test -n "$_WIN32_MSVC"; then
1642         HOST_AR=lib
1643         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1644         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1645         HOST_RANLIB='echo ranlib'
1646     else
1647         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1648     fi
1649     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1650     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1651     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1652     HOST_BIN_SUFFIX=.exe
1653     case "$host" in
1654     *mingw*)
1655     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1656         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1657         ;;
1658     *)
1659         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1660         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1661             _pwd=`pwd`
1662             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1663         fi
1664         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1665             AS_PERL=1
1666             PERL="${CYGWIN_WRAPPER} $PERL"
1667         fi
1669         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1670             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1671         fi
1672         ;;
1673     esac
1675     case "${host_cpu}" in
1676     x86_64)
1677         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1678         ;;
1679     esac
1680     ;;
1682 *-darwin*)
1683     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1684     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1685     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1686     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1687     ;;
1689 *-linux*|*-kfreebsd*-gnu)
1690     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1691     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1692     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1693     ;;
1695 *os2*)
1696     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1697     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1698     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1699     HOST_BIN_SUFFIX=.exe
1700     MOZ_FIX_LINK_PATHS=
1701     ;;
1703 *-osf*)
1704     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1705     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1706     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1707     ;;
1710     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1711     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1712     ;;
1713 esac
1715 dnl We require version 2.4 or newer of Python to build,
1716 dnl and 2.5 or newer on Windows.
1717 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1718 changequote(,)
1719 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1720 _python_res=$?
1721 changequote([,])
1722 if test "$_python_res" != 0; then
1723     AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1725 AC_MSG_RESULT([yes])
1727 dnl Get mozilla version from central milestone file
1728 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1730 dnl Get version of various core apps from the version files.
1731 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1733 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1734 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1736 dnl ========================================================
1737 dnl System overrides of the defaults for target
1738 dnl ========================================================
1740 case "$target" in
1741 *-aix*)
1742     AC_DEFINE(AIX)
1743     if test ! "$GNU_CC"; then
1744         if test ! "$HAVE_64BIT_OS"; then
1745             # Compiling with Visual Age C++ object model compat is the
1746             # default. To compile with object model ibm, add 
1747             # AIX_OBJMODEL=ibm to .mozconfig.
1748             if test "$AIX_OBJMODEL" = "ibm"; then
1749                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1750             else
1751                 AIX_OBJMODEL=compat
1752             fi
1753         else
1754             AIX_OBJMODEL=compat
1755         fi
1756         AC_SUBST(AIX_OBJMODEL)
1757         DSO_LDOPTS='-qmkshrobj=1'
1758         DSO_CFLAGS='-qflag=w:w'
1759         DSO_PIC_CFLAGS=
1760         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1761         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1762         MOZ_FIX_LINK_PATHS=
1763         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1764         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1765         if test "$COMPILE_ENVIRONMENT"; then
1766             AC_LANG_SAVE
1767             AC_LANG_CPLUSPLUS
1768             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1769             AC_TRY_COMPILE([],
1770                 [#if (__IBMCPP__ < 600)
1771                  #error "Bad compiler"
1772                  #endif],
1773                 _BAD_COMPILER=,_BAD_COMPILER=1)
1774             if test -n "$_BAD_COMPILER"; then
1775                 AC_MSG_RESULT([no])    
1776                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1777             else
1778                 AC_MSG_RESULT([yes])    
1779             fi
1780             AC_LANG_RESTORE
1781             TARGET_COMPILER_ABI="ibmc"
1782             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1783             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1784         fi
1785     fi
1786     case "${target_os}" in
1787     aix4.1*)
1788         DLL_SUFFIX='_shr.a'
1789         ;;
1790     esac
1791     if test "$COMPILE_ENVIRONMENT"; then
1792         AC_CHECK_HEADERS(sys/inttypes.h)
1793     fi
1794     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1795     ;;
1797 *-beos*)
1798     no_x=yes
1799     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1800     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1801     DSO_LDOPTS='-nostart'
1802     TK_LIBS='-lbe -lroot'
1803     LIBS="$LIBS -lbe"
1804     if test "$COMPILE_ENVIRONMENT"; then
1805         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1806         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1807     fi
1808     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1809     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1810     _MOZ_USE_RTTI=1
1811     USE_DEPENDENT_LIBS=
1812     MOZ_USER_DIR="Mozilla"
1813     ;;
1815 *-bsdi*)
1816     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1817     _PEDANTIC=
1818     _IGNORE_LONG_LONG_WARNINGS=
1819     case $OS_RELEASE in
1820         4.*|5.*)
1821             STRIP="$STRIP -d"
1822             ;;
1823         *)
1824             DSO_CFLAGS=''
1825             DSO_LDOPTS='-r'
1826             _WARNINGS_CFLAGS="-Wall"
1827             _WARNINGS_CXXFLAGS="-Wall"
1828             # The test above doesn't work properly, at least on 3.1.
1829             MKSHLIB_FORCE_ALL=''
1830             MKSHLIB_UNFORCE_ALL=''
1831         ;;
1832     esac
1833     ;;
1835 *-darwin*) 
1836     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1837     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1838     MOZ_OPTIMIZE_FLAGS="-O3"
1839     _PEDANTIC=
1840     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1841     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1842     DLL_SUFFIX=".dylib"
1843     DSO_LDOPTS=''
1844     STRIP="$STRIP -x -S"
1845     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1846     MOZ_ENABLE_POSTSCRIPT=
1847     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1848     # The ExceptionHandling framework is needed for Objective-C exception
1849     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1850     # builds.
1851     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1853     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1854     dnl ===================================================================
1855     if test "x$enable_dtrace" = "xyes"; then
1856         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1857     else
1858         dnl check for the presence of the -dead_strip linker flag
1859         AC_MSG_CHECKING([for -dead_strip option to ld])
1860         _SAVE_LDFLAGS=$LDFLAGS
1861         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1862         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1863         if test -n "$_HAVE_DEAD_STRIP" ; then
1864             AC_MSG_RESULT([yes])
1865             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1866         else
1867             AC_MSG_RESULT([no])
1868         fi
1869         
1870         LDFLAGS=$_SAVE_LDFLAGS
1871     fi
1872     ;;
1874 *-freebsd*)
1875     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1876         DLL_SUFFIX=".so.1.0"
1877         DSO_LDOPTS="-shared"
1878     fi
1879     if test ! "$GNU_CC"; then
1880         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1881     fi
1882 # Can't have force w/o an unforce.
1883 #    # Hack for FreeBSD 2.2
1884 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1885 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1886 #       MKSHLIB_UNFORCE_ALL=''
1887 #    fi
1888     ;; 
1890 *-hpux*)
1891     DLL_SUFFIX=".sl"
1892     if test ! "$GNU_CC"; then
1893         DSO_LDOPTS='-b -Wl,+s'
1894         DSO_CFLAGS=""
1895         DSO_PIC_CFLAGS="+Z"
1896         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1897         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1898         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1899     else
1900         DSO_LDOPTS='-b -E +s'
1901         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1902         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1903     fi
1904     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1905     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1906     ;;
1908 *-irix5*)
1909     AC_DEFINE(IRIX)
1910     DSO_LDOPTS='-elf -shared'
1912     if test "$GNU_CC"; then
1913        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1914        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1915        MKSHLIB_FORCE_ALL='-Wl,-all'
1916        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1917        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1918     else
1919        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1920        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1921        MKSHLIB_FORCE_ALL='-all'
1922        MKSHLIB_UNFORCE_ALL='-none'
1923     fi
1924     ;;
1926 *-irix6*)
1927     AC_DEFINE(IRIX)
1928     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1929     dnl compile and link using -n32
1930     USE_N32=1
1931     TARGET_COMPILER_ABI=n32
1932     DSO_LDOPTS='-elf -shared'
1933     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1934     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1935     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1936     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1937     if test "$GNU_CC"; then
1938        MKSHLIB_FORCE_ALL='-Wl,-all'
1939        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1940        _WARNINGS_CFLAGS="-Wall"
1941        _WARNINGS_CXXFLAGS="-Wall"
1942        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1943     else
1944        MKSHLIB_FORCE_ALL='-all'
1945        MKSHLIB_UNFORCE_ALL='-none'
1946            AR_LIST="$AR t"
1947            AR_EXTRACT="$AR x"
1948            AR_DELETE="$AR d"
1949            AR='$(CXX) -ar'
1950            AR_FLAGS='-o $@'
1951        CFLAGS="$CFLAGS -woff 3262 -G 4"
1952        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1953        if test -n "$USE_N32"; then
1954            ASFLAGS="$ASFLAGS -n32"
1955            CFLAGS="$CFLAGS -n32"
1956            CXXFLAGS="$CXXFLAGS -n32"
1957            LDFLAGS="$LDFLAGS -n32"
1958        fi
1959        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1960        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1961        MOZ_FIX_LINK_PATHS=
1962     fi
1963     if test -z "$GNU_CXX"; then
1964       MIPSPRO_CXX=1
1965     fi
1966     ;;
1968 *-*linux*)
1969     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1970     # Similarly for GNU_CXX and INTEL_CXX.
1971     if test "$INTEL_CC" || test "$INTEL_CXX"; then
1972         # -Os has been broken on Intel's C/C++ compilers for quite a
1973         # while; Intel recommends against using it.
1974         MOZ_OPTIMIZE_FLAGS="-O2"
1975         MOZ_DEBUG_FLAGS="-g -fno-inline"
1976     elif test "$GNU_CC" || test "$GNU_CXX"; then
1977         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1978         case $GCC_VERSION in
1979         4.1.*|4.2.*)
1980             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1981             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1982         esac
1983         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1984         MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1985                                           # and that combo is not yet good at
1986                                           # debugging inlined functions (even
1987                                           # when using DWARF2 as the debugging
1988                                           # format)
1989     fi
1991     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1993     MOZ_MEMORY=1
1995     case "${target_cpu}" in
1996     alpha*)
1997         CFLAGS="$CFLAGS -mieee"
1998         CXXFLAGS="$CXXFLAGS -mieee"
1999     ;;
2000     i*86)
2001         USE_ELF_DYNSTR_GC=1
2002     ;;
2003     mips*)
2004         MOZ_DEBUG_FLAGS="-g" # We want inlining
2005     ;;
2006     esac
2007     ;;
2009 *-wince*)
2010     TARGET_COMPILER_ABI=msvc
2011     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
2012     AR_LIST="$AR -list"
2013     AR_EXTRACT="$AR -extract"
2014     AR_DELETE="$AR d"
2015     AR_FLAGS='-OUT:"$@"'
2017     if test "$AS_BIN"; then
2018         AS="$AS_BIN"
2019     fi
2020     DSO_CFLAGS=
2021     DSO_PIC_CFLAGS=
2022     DLL_SUFFIX=.dll
2023     BIN_SUFFIX='.exe'
2024     if test -z "$RC"; then 
2025         RC=rc.exe  
2026     fi
2027     # certain versions of cygwin's makedepend barf on the 
2028     # #include <string> vs -I./dist/include/string issue so don't use it
2029     SYSTEM_MAKEDEPEND=
2031     HOST_CC=cl
2032     HOST_CXX=cl
2033     HOST_LD=link
2034     HOST_AR='lib -OUT:$@'
2035     HOST_RANLIB='echo ranlib'
2036     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2037         
2038         
2039     WARNINGS_AS_ERRORS='-WX'
2040     MOZ_OPTIMIZE_FLAGS='-Ox'
2041     AR_FLAGS='-NOLOGO -OUT:"$@"'
2042     ASM_SUFFIX=asm
2043     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2044     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2045     DLL_PREFIX=
2046     DOXYGEN=:
2047     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2048     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2049     GARBAGE=
2050     IMPORT_LIB_SUFFIX=lib
2051     LIBS="$LIBS"
2052     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2053     LIB_PREFIX=
2054     LIB_SUFFIX=lib 
2055     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2056     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2057     MKSHLIB_FORCE_ALL=
2058     MKSHLIB_UNFORCE_ALL=
2059     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2060     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2061     MOZ_DEBUG_FLAGS='-Zi'
2062     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2063     MOZ_FIX_LINK_PATHS=
2064     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2065     OBJ_SUFFIX=obj
2066     RANLIB='echo not_ranlib'
2067     STRIP='echo not_strip'
2068     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2069     UNZIP=unzip
2070     XARGS=xargs
2071     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2072     ZIP=zip
2073     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2074     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2075     STATIC_LIBIDL=1
2076     MOZ_TREE_FREETYPE=1
2078     AC_DEFINE(HAVE_SNPRINTF)
2079     AC_DEFINE(_WINDOWS)
2080     AC_DEFINE(WIN32)
2081     AC_DEFINE(XP_WIN)
2082     AC_DEFINE(XP_WIN32)
2083     AC_DEFINE(HW_THREADS)
2084     AC_DEFINE(STDC_HEADERS)
2085     AC_DEFINE(NEW_H, <new>)
2086     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2087     AC_DEFINE(HAVE_LOCALTIME_R)
2089     TARGET_MD_ARCH=win32
2090     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2091     BIN_SUFFIX='.exe'
2092     MOZ_ENABLE_POSTSCRIPT=
2093     MOZ_USER_DIR="Mozilla"
2095     MOZ_GFX_OPTIMIZE_MOBILE=1
2097     # Sanity check for WINCE_WINDOWS_MOBILE
2098     # XXX disabled until we can fix the mobile tinderbox
2099     ##if test "$WINCE_WINDOWS_MOBILE"; then
2100     ##   AC_CHECK_HEADER(tpcshell.h, [],
2101     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2102     ##fi
2106 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2107     DSO_CFLAGS=
2108     DSO_PIC_CFLAGS=
2109     DLL_SUFFIX=.dll
2110     RC=rc.exe
2111     # certain versions of cygwin's makedepend barf on the 
2112     # #include <string> vs -I./dist/include/string issue so don't use it
2113     SYSTEM_MAKEDEPEND=
2114     if test -n "$GNU_CC"; then
2115         CC="$CC -mno-cygwin"
2116         CXX="$CXX -mno-cygwin"
2117         CPP="$CPP -mno-cygwin"
2118         CFLAGS="$CFLAGS -mms-bitfields"
2119         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2120         DSO_LDOPTS='-shared'
2121         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2122         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2123         RC='$(WINDRES)'
2124         # Use temp file for windres (bug 213281)
2125         RCFLAGS='-O coff --use-temp-file'
2126         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2127         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
2128         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2129         MOZ_FIX_LINK_PATHS=
2130         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
2131         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2132         DLL_PREFIX=
2133         IMPORT_LIB_SUFFIX=dll.a
2134     else
2135         TARGET_COMPILER_ABI=msvc
2136         HOST_CC='$(CC)'
2137         HOST_CXX='$(CXX)'
2138         HOST_LD='$(LD)'
2139         if test "$AS_BIN"; then
2140             AS="$(basename "$AS_BIN")"
2141         fi
2142         AR='lib -NOLOGO -OUT:"$@"'
2143         AR_FLAGS=
2144         RANLIB='echo not_ranlib'
2145         STRIP='echo not_strip'
2146         XARGS=xargs
2147         ZIP=zip
2148         UNZIP=unzip
2149         DOXYGEN=:
2150         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2151         ASM_SUFFIX=asm
2152         OBJ_SUFFIX=obj
2153         LIB_SUFFIX=lib
2154         DLL_PREFIX=
2155         LIB_PREFIX=
2156         IMPORT_LIB_SUFFIX=lib
2157         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2158         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2159         MKSHLIB_FORCE_ALL=
2160         MKSHLIB_UNFORCE_ALL=
2161         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2162         _USE_CPP_INCLUDE_FLAG=1
2163         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2164         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2165         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2166         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2167         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2168         MOZ_DEBUG_FLAGS='-Zi'
2169         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2170         WARNINGS_AS_ERRORS='-WX'
2171         MOZ_OPTIMIZE_FLAGS='-O1'
2172         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2173         MOZ_FIX_LINK_PATHS=
2174         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2175         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2176         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2177         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2178         if test $_MSC_VER -ge 1400; then
2179             LDFLAGS="$LDFLAGS -NXCOMPAT"
2180             dnl For profile-guided optimization
2181             PROFILE_GEN_CFLAGS="-GL"
2182             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2183             dnl XXX: PGO builds can fail with warnings treated as errors,
2184             dnl specifically "no profile data available" appears to be
2185             dnl treated as an error sometimes. This might be a consequence
2186             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2187             dnl with the linker doing most of the work in the whole-program
2188             dnl optimization/PGO case. I think it's probably a compiler bug,
2189             dnl but we work around it here.
2190             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2191             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2192             dnl Probably also a compiler bug, but what can you do?
2193             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2194             if test -n "$_USE_DYNAMICBASE"; then
2195                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2196             fi
2197         fi
2198     fi
2199     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2200     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2201     AC_DEFINE(HAVE_SNPRINTF)
2202     AC_DEFINE(_WINDOWS)
2203     AC_DEFINE(WIN32)
2204     AC_DEFINE(XP_WIN)
2205     AC_DEFINE(XP_WIN32)
2206     AC_DEFINE(HW_THREADS)
2207     AC_DEFINE(STDC_HEADERS)
2208     AC_DEFINE(NEW_H, <new>)
2209     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2210     TARGET_MD_ARCH=win32
2211     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2212     BIN_SUFFIX='.exe'
2213     MOZ_ENABLE_POSTSCRIPT=
2214     MOZ_USER_DIR="Mozilla"
2216     dnl Hardcode to win95 for now - cls
2217     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2219     dnl set NO_X11 defines here as the general check is skipped on win32
2220     no_x=yes
2221     AC_DEFINE(NO_X11)
2223     dnl MinGW/MSYS doesn't provide or need cygpath
2224     case "$host" in
2225     *-mingw*)
2226         CYGPATH_W=echo
2227         CYGPATH_S=cat
2228         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2229         ;;
2230     *-cygwin*|*-msvc*|*-mks*)
2231         CYGPATH_W="cygpath -a -w"
2232         CYGPATH_S="sed -e s|\\\\|/|g"
2233         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2234         ;;
2235     esac
2236     case "$host" in
2237     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2239     if test -z "$MOZ_TOOLS"; then
2240         AC_MSG_ERROR([MOZ_TOOLS is not set])
2241     fi
2243     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2244     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2245         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2246     fi
2247     MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2248     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2249         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2250     fi
2251     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2253     if test -n "$GLIB_PREFIX"; then
2254         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2255         if test "$?" = "0"; then
2256             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2257                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2258             fi
2259             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2260         else
2261             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2262         fi
2263     else
2264         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2265     fi
2266     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2267         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2268     fi
2269     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2270     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2271         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2272     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2273         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2274     else
2275         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2276     fi
2278     if test -n "$LIBIDL_PREFIX"; then
2279         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2280         if test "$?" = "0"; then
2281             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2282                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2283             fi
2284             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2285         else
2286             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2287         fi
2288     else
2289         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2290     fi        
2291     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2292         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2293     fi
2294     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2295     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2296         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2297         STATIC_LIBIDL=1
2298     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2299         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2300     else
2301         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2302     fi
2303     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2304     ;;
2306     *) # else cross-compiling
2307         if test -n "$GLIB_PREFIX"; then
2308             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2309             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2310                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2311             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2312                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2313             else
2314                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2315             fi
2316         fi
2317         if test -n "$LIBIDL_PREFIX"; then
2318             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2319             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2320                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2321                 STATIC_LIBIDL=1
2322             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2323                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2324             else
2325                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2326             fi
2327         fi
2328         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2329         ;;
2330     esac 
2333     case "$host_os" in
2334     cygwin*|msvc*|mks*)
2335         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])
2336         ;;
2338     *)
2339         AC_CHECK_HEADERS(oleacc.idl)
2341         AC_LANG_SAVE
2342         AC_LANG_CPLUSPLUS
2343         AC_CHECK_HEADERS(atlbase.h)
2344         AC_LANG_RESTORE
2345         ;;
2346     esac
2348     case "$target" in
2349     i*86-*)
2350         if test "$HAVE_64BIT_OS"; then
2351             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2352         fi
2354         if test $_MSC_VER -ge 1400; then
2355             LDFLAGS="$LDFLAGS -SAFESEH"
2356         fi
2357         AC_CHECK_HEADERS(mmintrin.h)
2358         AC_DEFINE(_X86_)
2359         ;;
2360     alpha-*)
2361         AC_DEFINE(_ALPHA_)
2362         ;;
2363     mips-*)
2364         AC_DEFINE(_MIPS_)
2365         ;;
2366     x86_64-*)
2367         AC_DEFINE(_AMD64_)
2368         ;;
2369     *)
2370         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2371         ;;
2372     esac
2374     if test "$HAVE_64BIT_OS"; then
2375         AC_DEFINE(_WIN64)
2376     fi
2377     ;;
2379 *-netbsd*)
2380     DSO_CFLAGS=''
2381     CFLAGS="$CFLAGS -Dunix"
2382     CXXFLAGS="$CXXFLAGS -Dunix"
2383     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2384         DLL_SUFFIX=".so"
2385         DSO_PIC_CFLAGS='-fPIC -DPIC'
2386         DSO_LDOPTS='-shared'
2387         BIN_FLAGS='-Wl,--export-dynamic'
2388     else
2389         DSO_PIC_CFLAGS='-fPIC -DPIC'
2390         DLL_SUFFIX=".so.1.0"
2391         DSO_LDOPTS='-shared'
2392     fi
2393     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2394     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2395     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2396     if test "$LIBRUNPATH"; then
2397         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2398     fi
2399     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2400     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2401     ;;
2403 *-nto*) 
2404         AC_DEFINE(NTO)  
2405         AC_DEFINE(_QNX_SOURCE)
2406         AC_DEFINE(_i386)
2407         OS_TARGET=NTO
2408         WARNINGS_AS_ERRORS=''
2409         MOZ_OPTIMIZE_FLAGS="-O"
2410         MOZ_DEBUG_FLAGS="-gstabs"
2411         USE_PTHREADS=1
2412         _PEDANTIC=
2413         LIBS="$LIBS -lsocket -lstdc++"
2414         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2415         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2416         if test "$with_x" != "yes"
2417         then
2418                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2419             TK_CFLAGS='-I/usr/include/photon'
2420                 TK_LIBS='-lph'
2421         fi
2422         case "${target_cpu}" in
2423         ppc*)
2424         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2425         ;;
2426         esac
2427         case "${host_cpu}" in
2428         i*86)
2429         USE_ELF_DYNSTR_GC=1
2430         ;;
2431         esac
2432         ;;
2434 *-openbsd*)
2435     DLL_SUFFIX=".so.1.0"
2436     DSO_CFLAGS=''
2437     DSO_PIC_CFLAGS='-fPIC'
2438     DSO_LDOPTS='-shared -fPIC'
2439     if test "$LIBRUNPATH"; then
2440         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2441     fi
2442     ;;
2444 *-openvms*) 
2445     AC_DEFINE(NO_PW_GECOS)
2446     AC_DEFINE(NO_UDSOCK)
2447     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2448     USE_PTHREADS=1
2449     MKSHLIB_FORCE_ALL='-all'
2450     MKSHLIB_UNFORCE_ALL='-none'
2451     AS='as'
2452     AS_DASH_C_FLAG='-Wc/names=as_is'
2453     AR_FLAGS='c $@'
2454     DSO_LDOPTS='-shared -auto_symvec'
2455     DSO_PIC_CFLAGS=
2456     MOZ_DEBUG_LDFLAGS='-g'
2457     COMPAQ_CXX=1
2458     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2459     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2460     ;;
2463 *-os2*)
2464     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2465     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2466     AC_DEFINE(OS2)
2467     AC_DEFINE(XP_OS2)
2468     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2469     AC_DEFINE(TCPV40HDRS)
2470     DLL_PREFIX=
2471     LIB_PREFIX=
2472     LIB_SUFFIX=lib
2473     BIN_SUFFIX=".exe"
2474     DLL_SUFFIX=".dll"
2475     IMPORT_LIB_SUFFIX=lib
2476     DSO_PIC_CFLAGS=
2477     AR=emxomfar
2478     AR_FLAGS='r $@'
2479     CFLAGS="$CFLAGS -Zomf"
2480     CXXFLAGS="$CXXFLAGS -Zomf"
2481     DSO_LDOPTS='-Zdll'
2482     BIN_FLAGS='-Zlinker /ST:0x100000'
2483     IMPLIB='emximp -o'
2484     FILTER='emxexp -o'
2485     LDFLAGS='-Zmap'
2486     WARNINGS_AS_ERRORS='-Werror'
2487     MOZ_DEBUG_FLAGS="-g -fno-inline"
2488     MOZ_OPTIMIZE_FLAGS="-O2"
2489     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2490     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2491     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2492     TARGET_MD_ARCH=os2
2493     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2494     MOZ_ENABLE_POSTSCRIPT=
2495     RC=rc.exe
2496     RCFLAGS='-n'
2497     MOZ_USER_DIR="Mozilla"
2499     if test "$MOZTOOLS"; then
2500         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2501     else
2502         AC_MSG_ERROR([MOZTOOLS is not set])
2503     fi
2504     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2505         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2506         LDFLAGS="$LDFLAGS -Zhigh-mem"
2507         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2508         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2509     fi
2511     # GCC for OS/2 currently predefines these, but we don't want them
2512     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2513     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2515     AC_CACHE_CHECK(for __declspec(dllexport),
2516         ac_os2_declspec,
2517         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2518                         [return 0;],
2519                         ac_os2_declspec="yes",
2520                         ac_os2_declspec="no")])
2521     if test "$ac_os2_declspec" = "yes"; then
2522         FILTER='true'
2523         MOZ_OS2_USE_DECLSPEC='1'
2524     fi
2525     ;;
2527 alpha*-*-osf*)
2528     if test "$GNU_CC"; then
2529       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2530       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2532     else
2533         MOZ_DEBUG_FLAGS='-g'
2534         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2535         CFLAGS="$CFLAGS -ieee"
2536         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2537         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2538         DSO_CFLAGS=
2539         DSO_PIC_CFLAGS=
2540         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2541         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2542         MKSHLIB_FORCE_ALL='-all'
2543         MKSHLIB_UNFORCE_ALL='-none'
2544         dnl Might fix the libxpcom.so breakage on this platform as well....
2545         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2546         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2547     fi
2548     if test -z "$GNU_CXX"; then
2549       COMPAQ_CXX=1
2550     fi
2551     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2552     ;;
2554 *-qnx*) 
2555     DIRENT_INO=d_stat.st_ino
2556     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2557     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2558     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2559     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2560     AC_DEFINE(STDC_HEADERS)
2561     if test "$no_x" = "yes"; then
2562             _PLATFORM_DEFAULT_TOOLKIT='photon'
2563             TK_CFLAGS='-I/usr/nto/include/photon'
2564             TK_LIBS='-lphoton -lphrender'
2565     fi
2566     ;;
2568 *-sco*) 
2569     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2570     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2571     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2572     if test ! "$GNU_CC"; then
2573        DSO_LDOPTS='-G'
2574     fi
2575     ;;
2577 dnl the qsort routine under solaris is faulty
2578 *-solaris*) 
2579     AC_DEFINE(SOLARIS)
2580     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2581     SYSTEM_MAKEDEPEND=
2582     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2583     # libraries one level up (e.g. libnspr4.so)
2584     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2585     MOZ_MEMORY=1
2586     if test "$SOLARIS_SUNPRO_CC"; then
2587        LIBS="-lCrun -lCstd $LIBS"
2588        NS_USE_NATIVE=1
2589        MOZ_FIX_LINK_PATHS=
2590        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2591        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2592        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2593        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2594        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2595            _SAVE_LDFLAGS=$LDFLAGS
2596            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2597            AC_TRY_LINK([#include <stdio.h>],
2598                        [printf("Hello World\n");],
2599                        ,
2600                        [LDFLAGS=$_SAVE_LDFLAGS])
2601        fi
2602        WARNINGS_AS_ERRORS='-Werror'
2603        MOZ_OPTIMIZE_FLAGS="-xO4"
2604        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2605        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2606        MKSHLIB_FORCE_ALL='-z allextract'
2607        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2608        DSO_LDOPTS='-G -z muldefs'
2609        AR_LIST="$AR t"
2610        AR_EXTRACT="$AR x"
2611        AR_DELETE="$AR d"
2612        AR='$(CXX) -xar'
2613        AR_FLAGS='-o $@'
2614        AS='/usr/ccs/bin/as'
2615        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2616        AS_DASH_C_FLAG=''
2617        TARGET_COMPILER_ABI="sunc"
2618        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2619        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2620        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2621        AC_LANG_SAVE
2622        AC_LANG_CPLUSPLUS
2623        AC_TRY_COMPILE([],
2624            [#if (__SUNPRO_CC < 0x590)
2625            #error "Denied"
2626            #endif],
2627            _BAD_COMPILER=,_BAD_COMPILER=1)
2628         if test -n "$_BAD_COMPILER"; then
2629             _res="no"
2630             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2631         else
2632             _res="yes"
2633         fi
2634         AC_MSG_RESULT([$_res])
2635         AC_LANG_RESTORE
2636     else
2637        ASFLAGS="$ASFLAGS -fPIC"
2638        DSO_LDOPTS='-G'
2639        _WARNINGS_CFLAGS=''
2640        _WARNINGS_CXXFLAGS=''
2641        if test "$OS_RELEASE" = "5.3"; then
2642           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2643        fi
2644     fi
2645     if test "$OS_RELEASE" = "5.5.1"; then
2646        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2647     fi
2648     ;;
2650 *-sunos*) 
2651     DSO_LDOPTS='-Bdynamic'
2652     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2653     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2654     AC_DEFINE(SUNOS4)
2655     AC_DEFINE(SPRINTF_RETURNS_STRING)
2656     case "$(target_os)" in
2657     sunos4.1*)
2658         DLL_SUFFIX='.so.1.0'
2659         ;;
2660     esac
2661     ;;
2663 *-sysv4.2uw7*) 
2664         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2665     ;;
2667 *-os2*)
2668     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2669     ;;
2671 esac
2673 dnl Only one oddball right now (QNX), but this gives us flexibility
2674 dnl if any other platforms need to override this in the future.
2675 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2677 dnl ========================================================
2678 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2679 dnl by now will not have any way to link most binaries (tests
2680 dnl as well as viewer, apprunner, etc.), because some symbols
2681 dnl will be left out of the "composite" .so's by ld as unneeded.
2682 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2683 dnl they can link in the static libs that provide the missing
2684 dnl symbols.
2685 dnl ========================================================
2686 NO_LD_ARCHIVE_FLAGS=
2687 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2688     NO_LD_ARCHIVE_FLAGS=1
2690 case "$target" in
2691 *-os2*)
2692     NO_LD_ARCHIVE_FLAGS=
2693     ;;
2694 *-aix4.3*|*-aix5*)
2695     NO_LD_ARCHIVE_FLAGS=
2696     ;;
2697 *-openvms*)
2698     NO_LD_ARCHIVE_FLAGS=
2699     ;;
2700 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2701     if test -z "$GNU_CC"; then
2702         NO_LD_ARCHIVE_FLAGS=
2703     fi
2704     ;;
2705 esac
2706 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2708 dnl ========================================================
2709 dnl = Flags to strip unused symbols from .so components
2710 dnl ========================================================
2711 case "$target" in
2712     *-linux*|*-kfreebsd*-gnu)
2713         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2714         ;;
2715     *-solaris*)
2716         if test -z "$GNU_CC"; then
2717          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2718         else
2719          if test -z "$GCC_USE_GNU_LD"; then
2720           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2721          else
2722           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2723          fi
2724         fi
2725         ;;
2726     *-nto*) 
2727         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2728         ;;
2729     *-darwin*)
2730         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2731         ;;
2732     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2733         if test -n "$GNU_CC"; then
2734            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2735         fi
2736         ;;
2737 esac
2739 if test -z "$COMPILE_ENVIRONMENT"; then
2740     SKIP_COMPILER_CHECKS=1
2741     SKIP_LIBRARY_CHECKS=1
2744 if test -z "$SKIP_COMPILER_CHECKS"; then
2745 dnl Checks for typedefs, structures, and compiler characteristics.
2746 dnl ========================================================
2747 AC_LANG_C
2748 AC_HEADER_STDC
2749 AC_C_CONST
2750 AC_TYPE_MODE_T
2751 AC_TYPE_OFF_T
2752 AC_TYPE_PID_T
2753 AC_TYPE_SIZE_T
2754 AC_STRUCT_ST_BLKSIZE
2755 AC_MSG_CHECKING(for siginfo_t)
2756 AC_CACHE_VAL(ac_cv_siginfo_t,
2757  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2758                   #include <signal.h>],
2759                  [siginfo_t* info;],
2760                  [ac_cv_siginfo_t=true],
2761                  [ac_cv_siginfo_t=false])])
2762 if test "$ac_cv_siginfo_t" = true ; then
2763   AC_DEFINE(HAVE_SIGINFO_T)
2764   AC_MSG_RESULT(yes)
2765 else
2766   AC_MSG_RESULT(no)
2769 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2770 dnl ========================================================
2771 AC_MSG_CHECKING(for int16_t)
2772 AC_CACHE_VAL(ac_cv_int16_t,
2773  [AC_TRY_COMPILE([#include <stdio.h>
2774                   #include <sys/types.h>],
2775                  [int16_t foo = 0;],
2776                  [ac_cv_int16_t=true],
2777                  [ac_cv_int16_t=false])])
2778 if test "$ac_cv_int16_t" = true ; then
2779   AC_DEFINE(HAVE_INT16_T)
2780   AC_MSG_RESULT(yes)
2781 else
2782   AC_MSG_RESULT(no)
2784 AC_MSG_CHECKING(for int32_t)
2785 AC_CACHE_VAL(ac_cv_int32_t,
2786  [AC_TRY_COMPILE([#include <stdio.h>
2787                   #include <sys/types.h>],
2788                  [int32_t foo = 0;],
2789                  [ac_cv_int32_t=true],
2790                  [ac_cv_int32_t=false])])
2791 if test "$ac_cv_int32_t" = true ; then
2792   AC_DEFINE(HAVE_INT32_T)
2793   AC_MSG_RESULT(yes)
2794 else
2795   AC_MSG_RESULT(no)
2797 AC_MSG_CHECKING(for int64_t)
2798 AC_CACHE_VAL(ac_cv_int64_t,
2799  [AC_TRY_COMPILE([#include <stdio.h>
2800                   #include <sys/types.h>],
2801                  [int64_t foo = 0;],
2802                  [ac_cv_int64_t=true],
2803                  [ac_cv_int64_t=false])])
2804 if test "$ac_cv_int64_t" = true ; then
2805   AC_DEFINE(HAVE_INT64_T)
2806   AC_MSG_RESULT(yes)
2807 else
2808   AC_MSG_RESULT(no)
2810 AC_MSG_CHECKING(for int64)
2811 AC_CACHE_VAL(ac_cv_int64,
2812  [AC_TRY_COMPILE([#include <stdio.h>
2813                   #include <sys/types.h>],
2814                  [int64 foo = 0;],
2815                  [ac_cv_int64=true],
2816                  [ac_cv_int64=false])])
2817 if test "$ac_cv_int64" = true ; then
2818   AC_DEFINE(HAVE_INT64)
2819   AC_MSG_RESULT(yes)
2820 else
2821   AC_MSG_RESULT(no)
2823 AC_MSG_CHECKING(for uint)
2824 AC_CACHE_VAL(ac_cv_uint,
2825  [AC_TRY_COMPILE([#include <stdio.h>
2826                   #include <sys/types.h>],
2827                  [uint foo = 0;],
2828                  [ac_cv_uint=true],
2829                  [ac_cv_uint=false])])
2830 if test "$ac_cv_uint" = true ; then
2831   AC_DEFINE(HAVE_UINT)
2832   AC_MSG_RESULT(yes)
2833 else
2834   AC_MSG_RESULT(no)
2836 AC_MSG_CHECKING(for uint_t)
2837 AC_CACHE_VAL(ac_cv_uint_t,
2838  [AC_TRY_COMPILE([#include <stdio.h>
2839                   #include <sys/types.h>],
2840                  [uint_t foo = 0;],
2841                  [ac_cv_uint_t=true],
2842                  [ac_cv_uint_t=false])])
2843 if test "$ac_cv_uint_t" = true ; then
2844   AC_DEFINE(HAVE_UINT_T)
2845   AC_MSG_RESULT(yes)
2846 else
2847   AC_MSG_RESULT(no)
2849 AC_MSG_CHECKING(for uint16_t)
2850 AC_CACHE_VAL(ac_cv_uint16_t,
2851  [AC_TRY_COMPILE([#include <stdio.h>
2852                   #include <sys/types.h>],
2853                  [uint16_t foo = 0;],
2854                  [ac_cv_uint16_t=true],
2855                  [ac_cv_uint16_t=false])])
2856 if test "$ac_cv_uint16_t" = true ; then
2857   AC_DEFINE(HAVE_UINT16_T)
2858   AC_MSG_RESULT(yes)
2859 else
2860   AC_MSG_RESULT(no)
2863 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2864 dnl are defined when compiling C++ but not C.  Since the result of this
2865 dnl test is used only in C++, do it in C++.
2866 AC_LANG_CPLUSPLUS
2868 AC_MSG_CHECKING(for uname.domainname)
2869 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2870     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2871         [ struct utsname *res; char *domain; 
2872             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2873         [ac_cv_have_uname_domainname_field=true],
2874         [ac_cv_have_uname_domainname_field=false])])
2876 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2877     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2878     AC_MSG_RESULT(yes)
2879 else
2880     AC_MSG_RESULT(no)
2883 AC_MSG_CHECKING(for uname.__domainname)
2884 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2885     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2886         [ struct utsname *res; char *domain; 
2887             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2888         [ac_cv_have_uname_us_domainname_field=true],
2889         [ac_cv_have_uname_us_domainname_field=false])])
2891 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2892     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2893     AC_MSG_RESULT(yes)
2894 else
2895     AC_MSG_RESULT(no)
2898 AC_LANG_CPLUSPLUS
2900 dnl Check for usable char16_t (2 bytes, unsigned)
2901 dnl (we might not need the unsignedness check anymore)
2902 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2903     ac_cv_have_usable_char16_t,
2904     [AC_TRY_COMPILE([$configure_static_assert_macros],
2905                     [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2906                      CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2907                      CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2908                      CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2909                      CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2910                     ac_cv_have_usable_char16_t="yes",
2911                     ac_cv_have_usable_char16_t="no")])
2912 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2913     AC_DEFINE(HAVE_CPP_CHAR16_T)
2914     HAVE_CPP_CHAR16_T=1
2917 dnl Check for usable wchar_t (2 bytes, unsigned)
2918 dnl (we really don't need the unsignedness check anymore)
2919 dnl ========================================================
2921 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2922     ac_cv_have_usable_wchar_v2,
2923     [AC_TRY_COMPILE([#include <stddef.h>
2924                      $configure_static_assert_macros],
2925                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2926                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2927                     ac_cv_have_usable_wchar_v2="yes",
2928                     ac_cv_have_usable_wchar_v2="no")])
2929 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2930     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2931     HAVE_CPP_2BYTE_WCHAR_T=1
2932 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2933 dnl This is really gcc-only
2934 dnl Do this test using CXX only since some versions of gcc
2935 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2936 dnl only have short-wchar support for c++.
2937 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2939     _SAVE_CXXFLAGS=$CXXFLAGS
2940     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2942     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2943         ac_cv_have_usable_wchar_option_v2,
2944         [AC_TRY_LINK([#include <stddef.h>
2945                       $configure_static_assert_macros],
2946                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2947                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2948                      ac_cv_have_usable_wchar_option_v2="yes",
2949                      ac_cv_have_usable_wchar_option_v2="no")])
2951     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2952         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2953         HAVE_CPP_2BYTE_WCHAR_T=1
2954         WCHAR_CFLAGS="-fshort-wchar"
2955     else    
2956         CXXFLAGS=$_SAVE_CXXFLAGS
2957     fi
2960 AC_LANG_C
2962 dnl Check for .hidden assembler directive and visibility attribute.
2963 dnl Borrowed from glibc configure.in
2964 dnl ===============================================================
2965 if test "$GNU_CC"; then
2966   AC_CACHE_CHECK(for visibility(hidden) attribute,
2967                  ac_cv_visibility_hidden,
2968                  [cat > conftest.c <<EOF
2969                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2971                   ac_cv_visibility_hidden=no
2972                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2973                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2974                       ac_cv_visibility_hidden=yes
2975                     fi
2976                   fi
2977                   rm -f conftest.[cs]
2978                  ])
2979   if test "$ac_cv_visibility_hidden" = "yes"; then
2980     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2982     AC_CACHE_CHECK(for visibility(default) attribute,
2983                    ac_cv_visibility_default,
2984                    [cat > conftest.c <<EOF
2985                     int foo __attribute__ ((visibility ("default"))) = 1;
2987                     ac_cv_visibility_default=no
2988                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2989                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2990                         ac_cv_visibility_default=yes
2991                       fi
2992                     fi
2993                     rm -f conftest.[cs]
2994                    ])
2995     if test "$ac_cv_visibility_default" = "yes"; then
2996       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2998       AC_CACHE_CHECK(for visibility pragma support,
2999                      ac_cv_visibility_pragma,
3000                      [cat > conftest.c <<EOF
3001 #pragma GCC visibility push(hidden)
3002                       int foo_hidden = 1;
3003 #pragma GCC visibility push(default)
3004                       int foo_default = 1;
3006                       ac_cv_visibility_pragma=no
3007                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3008                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3009                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3010                             ac_cv_visibility_pragma=yes
3011                           fi
3012                         fi
3013                       fi
3014                       rm -f conftest.[cs]
3015                     ])
3016       if test "$ac_cv_visibility_pragma" = "yes"; then
3017         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3018                        ac_cv_have_visibility_class_bug,
3019                        [cat > conftest.c <<EOF
3020 #pragma GCC visibility push(hidden)
3021 struct __attribute__ ((visibility ("default"))) TestStruct {
3022   static void Init();
3024 __attribute__ ((visibility ("default"))) void TestFunc() {
3025   TestStruct::Init();
3028                        ac_cv_have_visibility_class_bug=no
3029                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3030                          ac_cv_have_visibility_class_bug=yes
3031                        else
3032                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3033                            ac_cv_have_visibility_class_bug=yes
3034                          fi
3035                        fi
3036                        rm -rf conftest.{c,S}
3037                        ])
3039         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3040                        ac_cv_have_visibility_builtin_bug,
3041                        [cat > conftest.c <<EOF
3042 #pragma GCC visibility push(hidden)
3043 #pragma GCC visibility push(default)
3044 #include <string.h>
3045 #pragma GCC visibility pop
3047 __attribute__ ((visibility ("default"))) void Func() {
3048   char c[[100]];
3049   memset(c, 0, sizeof(c));
3052                        ac_cv_have_visibility_builtin_bug=no
3053                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3054                          ac_cv_have_visibility_builtin_bug=yes
3055                        else
3056                          if test `grep -c "@PLT" conftest.S` = 0; then
3057                            ac_cv_visibility_builtin_bug=yes
3058                          fi
3059                        fi
3060                        rm -f conftest.{c,S}
3061                        ])
3062         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3063                 "$ac_cv_have_visibility_class_bug" = "no"; then
3064           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3065           WRAP_SYSTEM_INCLUDES=1
3066         else
3067           VISIBILITY_FLAGS='-fvisibility=hidden'
3068         fi # have visibility pragma bug
3069       fi   # have visibility pragma
3070     fi     # have visibility(default) attribute
3071   fi       # have visibility(hidden) attribute
3072 fi         # GNU_CC
3074 # visibility hidden flag for Sun Studio on Solaris
3075 if test "$SOLARIS_SUNPRO_CC"; then
3076 VISIBILITY_FLAGS='-xldscope=hidden'
3077 fi         # Sun Studio on Solaris
3079 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3080 AC_SUBST(VISIBILITY_FLAGS)
3082 dnl Checks for header files.
3083 dnl ========================================================
3084 AC_HEADER_DIRENT
3085 case "$target_os" in
3086 freebsd*)
3087 # for stuff like -lXshm
3088     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3089     ;;
3090 esac
3091 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3092 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3093 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3094 AC_CHECK_HEADERS(malloc.h)
3095 AC_CHECK_HEADERS(X11/XKBlib.h)
3096 AC_CHECK_HEADERS(io.h)
3098 dnl These are all the places some variant of statfs can be hiding.
3099 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3101 dnl Quota support
3102 AC_CHECK_HEADERS(sys/quota.h)
3104 dnl Try for MMX support
3105 dnl NB - later gcc versions require -mmmx for this header to be successfully
3106 dnl included (or another option which implies it, such as -march=pentium-mmx)
3107 AC_CHECK_HEADERS(mmintrin.h)
3109 dnl Check whether the compiler supports the new-style C++ standard
3110 dnl library headers (i.e. <new>) or needs the old "new.h"
3111 AC_LANG_CPLUSPLUS
3112 NEW_H=new.h
3113 AC_CHECK_HEADER(new, [NEW_H=new])
3114 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3115 AC_LANG_C
3117 AC_ARG_ENABLE(dtrace,
3118               [  --enable-dtrace         build with dtrace support if available (default=no)],
3119               [enable_dtrace="yes"],)
3120 if test "x$enable_dtrace" = "xyes"; then
3121   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3122   if test -n "$HAVE_DTRACE"; then
3123       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3124   else
3125       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3126   fi
3128 AC_SUBST(HAVE_DTRACE)
3130 case $target in
3131 *-aix4.3*|*-aix5*)
3132         ;;
3134         AC_CHECK_HEADERS(sys/cdefs.h)
3135         ;;
3136 esac
3138 dnl Checks for libraries.
3139 dnl ========================================================
3140 case $target in
3141 *-hpux11.*)
3142         ;;
3144         AC_CHECK_LIB(c_r, gethostbyname_r)
3145         ;;
3146 esac
3148 dnl We don't want to link with libdl even if it's present on OS X, since
3149 dnl it's not used and not part of the default installation.
3150 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3151 dnl We don't want to link against libm or libpthread on Darwin since
3152 dnl they both are just symlinks to libSystem and explicitly linking
3153 dnl against libSystem causes issues when debugging (see bug 299601).
3154 case $target in
3155 *-darwin*)
3156     ;;
3157 *-beos*)
3158     ;;
3159 *-os2*)
3160     ;;
3162     AC_CHECK_LIB(m, atan)
3163     AC_CHECK_LIB(dl, dlopen,
3164     AC_CHECK_HEADER(dlfcn.h, 
3165         LIBS="-ldl $LIBS"
3166         AC_DEFINE(HAVE_LIBDL)))
3167     ;;
3168 esac
3170 _SAVE_CFLAGS="$CFLAGS"
3171 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3172 AC_CHECK_FUNCS(dladdr)
3173 CFLAGS="$_SAVE_CFLAGS"
3175 if test ! "$GNU_CXX"; then
3177     case $target in
3178     *-aix*)
3179         AC_CHECK_LIB(C_r, demangle)
3180         ;;
3181      *)
3182         AC_CHECK_LIB(C, demangle)
3183         ;;
3184      esac
3187 dnl OS/2 has socket in libc.
3188 case $target in
3189 *-os2*)
3190     ;;
3192     AC_CHECK_LIB(socket, socket)
3193 esac
3195 dnl ========================================================
3196 dnl Check whether we can compile code for Core Text
3197 dnl (Mac OS X 10.5 or later)
3198 dnl ========================================================
3199 case "$target" in
3200 *-darwin*)
3201   AC_MSG_CHECKING([for Core Text])
3202   AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3203                  [CTLineRef lineRef;],
3204                   ac_cv_have_core_text="yes",
3205                   ac_cv_have_core_text="no")
3206   AC_MSG_RESULT([$ac_cv_have_core_text])
3208   MOZ_CORETEXT=1
3210   MOZ_ARG_DISABLE_BOOL(coretext,
3211 [  --disable-coretext      Use ATSUI instead of Core Text for text rendering],
3212     MOZ_CORETEXT=,
3213     MOZ_CORETEXT=1)
3215   if test -n "$MOZ_CORETEXT"; then
3216     if test "$ac_cv_have_core_text" = "no"; then
3217       AC_MSG_ERROR([--enable-coretext requires MacOS SDK 10.5 or newer])
3218      fi
3219      AC_DEFINE(MOZ_CORETEXT)
3220   fi
3221   ;;
3222 esac
3224 AC_SUBST(MOZ_CORETEXT)
3226 XLDFLAGS="$X_LIBS"
3227 XLIBS="$X_EXTRA_LIBS"
3229 dnl ========================================================
3230 dnl Checks for X libraries.
3231 dnl Ordering is important.
3232 dnl Xt is dependent upon SM as of X11R6
3233 dnl ========================================================
3234 if test "$no_x" = "yes"; then
3235     AC_DEFINE(NO_X11)
3236 else
3237     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3238         XLIBS="-lX11 $XLIBS"
3239         _SAVE_LDFLAGS="$LDFLAGS"
3240         LDFLAGS="$XLDFLAGS $LDFLAGS"
3241         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3242                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3243         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3244                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3245      
3246         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3247         unset ac_cv_lib_Xt_XtFree
3248             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3249             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3250         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3251                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3252         ])
3254     # AIX needs the motif library linked before libXt to prevent
3255     # crashes in plugins linked against Motif - Bug #98892
3256     case "${target_os}" in
3257     aix*)
3258         XT_LIBS="-lXm $XT_LIBS"
3259         ;;
3260     esac
3262     dnl ========================================================
3263     dnl = Check for XShm
3264     dnl ========================================================
3265     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3266         $XLIBS $XEXT_LIBS)
3267     AC_CHECK_HEADER(X11/extensions/XShm.h)
3268     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3269         test -n "$_HAVE_XSHM_XEXT"; then
3270         AC_DEFINE(HAVE_XSHM)
3271     fi
3273     dnl ========================================================
3274     dnl = Check for XIE
3275     dnl ========================================================
3276     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3277         $XLIBS $XEXT_LIBS)
3278     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3280     if test "$MOZ_XIE_LIBS"; then
3281         dnl ====================================================
3282         dnl = If XIE is present and is desired, turn it on
3283         dnl ====================================================
3284         case $target in
3285             *-hpux*)
3286                 ;;
3287             *)
3288                 HAVE_XIE=1
3289                 ;;
3290         esac
3291     fi
3293         LDFLAGS="$_SAVE_LDFLAGS"
3295     dnl ========================================================
3296     dnl = Check for freetype2 and its functionality
3297     dnl ========================================================
3298     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3300     if test "$_HAVE_FREETYPE2"; then
3301         _SAVE_LIBS="$LIBS"
3302         _SAVE_CFLAGS="$CFLAGS"
3303         LIBS="$LIBS $FT2_LIBS"
3304         CFLAGS="$CFLAGS $FT2_CFLAGS"
3306         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3307             ac_cv_member_FT_Bitmap_Size_y_ppem,
3308             [AC_TRY_COMPILE([#include <ft2build.h>
3309                              #include FT_FREETYPE_H],
3310                             [FT_Bitmap_Size s;
3311                              if (sizeof s.y_ppem) return 0;
3312                              return 1],
3313                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3314                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3315         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3316             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3317         else
3318             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3319         fi
3320         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3321                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3322                            [FT_Bitmap_Size structure includes y_ppem field])
3324         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3326         LIBS="$_SAVE_LIBS"
3327         CFLAGS="$_SAVE_CFLAGS"
3328     fi
3330 fi # $no_x
3332 AC_SUBST(XCFLAGS)
3333 AC_SUBST(XLDFLAGS)
3334 AC_SUBST(XLIBS)
3335 AC_SUBST(XEXT_LIBS)
3336 AC_SUBST(XT_LIBS)
3338 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3339 AC_TRY_COMPILE([],
3340                [asm("uqadd8 r1, r1, r2");],
3341                result="yes", result="no")
3342 AC_MSG_RESULT("$result")
3343 if test "$result" = "yes"; then
3344     AC_DEFINE(HAVE_ARM_SIMD)
3345     HAVE_ARM_SIMD=1
3347 AC_SUBST(HAVE_ARM_SIMD)
3349 AC_MSG_CHECKING(for ARM NEON support in compiler)
3350 _SAVE_CFLAGS="$CFLAGS"
3351 if test "$GNU_CC"; then
3352   # gcc needs -mfpu=neon to recognize NEON instructions
3353   CFLAGS="$CFLAGS -mfpu=neon"
3355 AC_TRY_COMPILE([],
3356                [asm("vadd.i8 d0, d0, d0");],
3357                result="yes", result="no")
3358 AC_MSG_RESULT("$result")
3359 if test "$result" = "yes"; then
3360     AC_DEFINE(HAVE_ARM_NEON)
3361     HAVE_ARM_NEON=1
3363 CFLAGS="$_SAVE_CFLAGS"
3364 AC_SUBST(HAVE_ARM_NEON)
3366 dnl ========================================================
3367 dnl = pthread support
3368 dnl = Start by checking whether the system support pthreads
3369 dnl ========================================================
3370 case "$target_os" in
3371 darwin*)
3372     USE_PTHREADS=1
3373     ;;
3375     MOZ_CHECK_PTHREADS(pthreads,
3376         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3377         MOZ_CHECK_PTHREADS(pthread,
3378             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3379             MOZ_CHECK_PTHREADS(c_r,
3380                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3381                 MOZ_CHECK_PTHREADS(c,
3382                     USE_PTHREADS=1
3383                 )
3384             )
3385         )
3386     )
3387     ;;
3388 esac
3390 dnl ========================================================
3391 dnl Check the command line for --with-pthreads 
3392 dnl ========================================================
3393 MOZ_ARG_WITH_BOOL(pthreads,
3394 [  --with-pthreads         Force use of system pthread library with NSPR ],
3395 [ if test "$USE_PTHREADS"x = x; then
3396     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3397 fi],
3398     USE_PTHREADS=
3399     _PTHREAD_LDFLAGS=
3402 dnl ========================================================
3403 dnl Do the platform specific pthread hackery
3404 dnl ========================================================
3405 if test "$USE_PTHREADS"x != x
3406 then
3407         dnl
3408         dnl See if -pthread is supported.
3409         dnl
3410         rm -f conftest*
3411         ac_cv_have_dash_pthread=no
3412         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3413         echo 'int main() { return 0; }' | cat > conftest.c
3414         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3415         if test $? -eq 0; then
3416                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3417                         ac_cv_have_dash_pthread=yes
3418                 case "$target_os" in
3419                 freebsd*)
3420 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3421                 ;;
3422                 *)
3423                             CFLAGS="$CFLAGS -pthread"
3424                             CXXFLAGS="$CXXFLAGS -pthread"
3425                 ;;
3426                 esac
3427                 fi
3428         fi
3429         rm -f conftest*
3430     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3432         dnl
3433         dnl See if -pthreads is supported.
3434         dnl
3435     ac_cv_have_dash_pthreads=no
3436     if test "$ac_cv_have_dash_pthread" = "no"; then
3437             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3438         echo 'int main() { return 0; }' | cat > conftest.c
3439             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3440         if test $? -eq 0; then
3441                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3442                             ac_cv_have_dash_pthreads=yes
3443                             CFLAGS="$CFLAGS -pthreads"
3444                             CXXFLAGS="$CXXFLAGS -pthreads"
3445                     fi
3446             fi
3447             rm -f conftest*
3448         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3449     fi
3451         case "$target" in
3452             *-*-freebsd*)
3453                         AC_DEFINE(_REENTRANT)
3454                         AC_DEFINE(_THREAD_SAFE)
3455                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3456                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3457                                 _PTHREAD_LDFLAGS="-pthread"
3458                         else
3459                                 _PTHREAD_LDFLAGS="-lc_r"
3460                         fi
3461                         ;;
3463             *-*-openbsd*|*-*-bsdi*)
3464                         AC_DEFINE(_REENTRANT)
3465                         AC_DEFINE(_THREAD_SAFE)
3466                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3467                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3468                 _PTHREAD_LDFLAGS="-pthread"
3469                         fi
3470                         ;;
3472             *-*-linux*|*-*-kfreebsd*-gnu)
3473                         AC_DEFINE(_REENTRANT) 
3474                         ;;
3476             *-*-nto*) 
3477                         AC_DEFINE(_REENTRANT) 
3478                         ;;
3480             *-aix4.3*|*-aix5*)
3481                         AC_DEFINE(_REENTRANT) 
3482                         ;;
3484             *-hpux11.*)
3485                         AC_DEFINE(_REENTRANT) 
3486                         ;;
3488             alpha*-*-osf*)
3489                         AC_DEFINE(_REENTRANT)
3490                         ;;
3492             *-*-solaris*) 
3493                         AC_DEFINE(_REENTRANT)
3494                         if test "$SOLARIS_SUNPRO_CC"; then
3495                                 CFLAGS="$CFLAGS -mt" 
3496                                 CXXFLAGS="$CXXFLAGS -mt" 
3497                         fi
3498                         ;;
3499         esac
3500     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3503 dnl ========================================================
3504 dnl See if mmap sees writes
3505 dnl For cross compiling, just define it as no, which is a safe default
3506 dnl ========================================================
3507 AC_MSG_CHECKING(whether mmap() sees write()s)
3509 changequote(,)
3510 mmap_test_prog='
3511     #include <stdlib.h>
3512     #include <unistd.h>
3513     #include <sys/mman.h>
3514     #include <sys/types.h>
3515     #include <sys/stat.h>
3516     #include <fcntl.h>
3518     char fname[] = "conftest.file";
3519     char zbuff[1024]; /* Fractional page is probably worst case */
3521     int main() {
3522         char *map;
3523         int fd;
3524         int i;
3525         unlink(fname);
3526         fd = open(fname, O_RDWR | O_CREAT, 0660);
3527         if(fd<0) return 1;
3528         unlink(fname);
3529         write(fd, zbuff, sizeof(zbuff));
3530         lseek(fd, 0, SEEK_SET);
3531         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3532         if(map==(char*)-1) return 2;
3533         for(i=0; fname[i]; i++) {
3534             int rc = write(fd, &fname[i], 1);
3535             if(map[i]!=fname[i]) return 4;
3536         }
3537         return 0;
3538     }
3540 changequote([,])
3542 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3544 AC_MSG_RESULT("$result")
3546 if test "$result" = "no"; then
3547     AC_DEFINE(MMAP_MISSES_WRITES)
3551 dnl Checks for library functions.
3552 dnl ========================================================
3553 AC_PROG_GCC_TRADITIONAL
3554 AC_FUNC_MEMCMP
3555 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3556 AC_CHECK_FUNCS(flockfile getpagesize)
3557 AC_CHECK_FUNCS(localtime_r strtok_r)
3559 dnl check for wcrtomb/mbrtowc
3560 dnl =======================================================================
3561 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3562 AC_LANG_SAVE
3563 AC_LANG_CPLUSPLUS
3564 AC_CACHE_CHECK(for wcrtomb,
3565     ac_cv_have_wcrtomb,
3566     [AC_TRY_LINK([#include <wchar.h>],
3567                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3568                  ac_cv_have_wcrtomb="yes",
3569                  ac_cv_have_wcrtomb="no")])
3570 if test "$ac_cv_have_wcrtomb" = "yes"; then
3571     AC_DEFINE(HAVE_WCRTOMB)
3573 AC_CACHE_CHECK(for mbrtowc,
3574     ac_cv_have_mbrtowc,
3575     [AC_TRY_LINK([#include <wchar.h>],
3576                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3577                  ac_cv_have_mbrtowc="yes",
3578                  ac_cv_have_mbrtowc="no")])
3579 if test "$ac_cv_have_mbrtowc" = "yes"; then
3580     AC_DEFINE(HAVE_MBRTOWC)
3582 AC_LANG_RESTORE
3585 AC_CACHE_CHECK(
3586     [for res_ninit()],
3587     ac_cv_func_res_ninit,
3588     [AC_TRY_LINK([
3589         #ifdef linux
3590         #define _BSD_SOURCE 1
3591         #endif
3592         #include <resolv.h>
3593         ],
3594         [int foo = res_ninit(&_res);],
3595         [ac_cv_func_res_ninit=yes],
3596         [ac_cv_func_res_ninit=no])
3597     ])
3599 if test "$ac_cv_func_res_ninit" = "yes"; then
3600     AC_DEFINE(HAVE_RES_NINIT)
3601 dnl must add the link line we do something as foolish as this... dougt
3602 dnl else
3603 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3604 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3607 AC_LANG_CPLUSPLUS
3608 AC_CACHE_CHECK(
3609     [for gnu_get_libc_version()],
3610     ac_cv_func_gnu_get_libc_version,
3611     [AC_TRY_LINK([
3612         #ifdef HAVE_GNU_LIBC_VERSION_H
3613         #include <gnu/libc-version.h>
3614         #endif
3615         ],
3616         [const char *glibc_version = gnu_get_libc_version();],
3617         [ac_cv_func_gnu_get_libc_version=yes],
3618         [ac_cv_func_gnu_get_libc_version=no] 
3619         )]
3620     )
3622 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3623     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3626 case $target_os in
3627     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3628         ;;
3629     *)
3630     
3631 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3632     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3633         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3634 _SAVE_LIBS=$LIBS
3635 LIBS="$LIBS $_ICONV_LIBS"
3636 AC_CACHE_CHECK(
3637     [for iconv()],
3638     ac_cv_func_iconv,
3639     [AC_TRY_LINK([
3640         #include <stdlib.h>
3641         #include <iconv.h>
3642         ],
3643         [
3644             iconv_t h = iconv_open("", "");
3645             iconv(h, NULL, NULL, NULL, NULL);
3646             iconv_close(h);
3647         ],
3648         [ac_cv_func_iconv=yes],
3649         [ac_cv_func_iconv=no] 
3650         )]
3651     )
3652 if test "$ac_cv_func_iconv" = "yes"; then
3653     AC_DEFINE(HAVE_ICONV)
3654     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3655     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3656     LIBICONV="$_ICONV_LIBS"
3657     AC_CACHE_CHECK(
3658         [for iconv() with const input],
3659         ac_cv_func_const_iconv,
3660         [AC_TRY_COMPILE([
3661             #include <stdlib.h>
3662             #include <iconv.h>
3663             ],
3664             [
3665                 const char *input = "testing";
3666                 iconv_t h = iconv_open("", "");
3667                 iconv(h, &input, NULL, NULL, NULL);
3668                 iconv_close(h);
3669             ],
3670             [ac_cv_func_const_iconv=yes],
3671             [ac_cv_func_const_iconv=no] 
3672             )]
3673         )
3674     if test "$ac_cv_func_const_iconv" = "yes"; then
3675         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3676     fi
3678 LIBS=$_SAVE_LIBS
3680     ;;
3681 esac
3683 AM_LANGINFO_CODESET
3685 AC_LANG_C
3687 dnl **********************
3688 dnl *** va_copy checks ***
3689 dnl **********************
3690 dnl we currently check for all three va_copy possibilities, so we get
3691 dnl all results in config.log for bug reports.
3692 AC_MSG_CHECKING(for an implementation of va_copy())
3693 AC_CACHE_VAL(ac_cv_va_copy,[
3694     AC_TRY_RUN([
3695         #include <stdarg.h>
3696         void f (int i, ...) {
3697             va_list args1, args2;
3698             va_start (args1, i);
3699             va_copy (args2, args1);
3700             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3701                 exit (1);
3702             va_end (args1); va_end (args2);
3703         }
3704         int main() { f (0, 42); return 0; }],
3705         ac_cv_va_copy=yes,
3706         ac_cv_va_copy=no,
3707         ac_cv_va_copy=no
3708     )
3710 AC_MSG_RESULT($ac_cv_va_copy)
3711 AC_MSG_CHECKING(for an implementation of __va_copy())
3712 AC_CACHE_VAL(ac_cv___va_copy,[
3713     AC_TRY_RUN([
3714         #include <stdarg.h>
3715         void f (int i, ...) {
3716             va_list args1, args2;
3717             va_start (args1, i);
3718             __va_copy (args2, args1);
3719             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3720                 exit (1);
3721             va_end (args1); va_end (args2);
3722         }
3723         int main() { f (0, 42); return 0; }],
3724         ac_cv___va_copy=yes,
3725         ac_cv___va_copy=no,
3726         ac_cv___va_copy=no
3727     )
3729 AC_MSG_RESULT($ac_cv___va_copy)
3730 AC_MSG_CHECKING(whether va_lists can be copied by value)
3731 AC_CACHE_VAL(ac_cv_va_val_copy,[
3732     AC_TRY_RUN([
3733         #include <stdarg.h>
3734         void f (int i, ...) {
3735             va_list args1, args2;
3736             va_start (args1, i);
3737             args2 = args1;
3738             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3739                 exit (1);
3740             va_end (args1); va_end (args2);
3741         }
3742         int main() { f (0, 42); return 0; }],
3743         ac_cv_va_val_copy=yes,
3744         ac_cv_va_val_copy=no,
3745         ac_cv_va_val_copy=yes
3746     )
3748 if test "x$ac_cv_va_copy" = "xyes"; then
3749     AC_DEFINE(VA_COPY, va_copy)
3750     AC_DEFINE(HAVE_VA_COPY)
3751 elif test "x$ac_cv___va_copy" = "xyes"; then
3752     AC_DEFINE(VA_COPY, __va_copy)
3753     AC_DEFINE(HAVE_VA_COPY)
3756 if test "x$ac_cv_va_val_copy" = "xno"; then
3757    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3759 AC_MSG_RESULT($ac_cv_va_val_copy)
3761 dnl Check for dll-challenged libc's.
3762 dnl This check is apparently only needed for Linux.
3763 case "$target" in
3764         *-linux*)
3765             dnl ===================================================================
3766             _curdir=`pwd`
3767             export _curdir
3768             rm -rf conftest* _conftest
3769             mkdir _conftest
3770             cat >> conftest.C <<\EOF
3771 #include <stdio.h>
3772 #include <link.h>
3773 #include <dlfcn.h>
3774 #ifdef _dl_loaded
3775 void __dump_link_map(void) {
3776   struct link_map *map = _dl_loaded;
3777   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3779 int main() {
3780   dlopen("./conftest1.so",RTLD_LAZY);
3781   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3782   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3783   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3784   __dump_link_map();
3786 #else
3787 /* _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).*/
3788 int main() { printf("./conftest1.so\n"); }
3789 #endif
3792             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3794             cat >> conftest1.C <<\EOF
3795 #include <stdio.h>
3796 void foo(void) {printf("foo in dll called\n");}
3798             ${CXX-g++} -fPIC -c -g conftest1.C
3799             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3800             ${CXX-g++} -g conftest.C -o conftest -ldl
3801             cp -f conftest1.so conftest _conftest
3802             cd _conftest
3803             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3804             then
3805                 echo
3806                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3807                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3808                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3809                 echo "*** will be excessive memory usage at runtime."
3810                 echo
3811             fi
3812             cd ${_curdir}
3813             rm -rf conftest* _conftest
3814             dnl ===================================================================
3815             ;;
3816 esac
3818 dnl ===================================================================
3819 dnl ========================================================
3820 dnl By default, turn rtti and exceptions off on g++/egcs
3821 dnl ========================================================
3822 if test "$GNU_CXX"; then
3824   AC_MSG_CHECKING(for C++ exceptions flag)
3826   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3827   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3828   [echo "int main() { return 0; }" | cat > conftest.C
3830   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3832   if egrep "warning.*renamed" conftest.out >/dev/null; then
3833     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3834   else
3835     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3836   fi
3838   rm -f conftest*])
3840   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3841   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3842   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3845 dnl ========================================================
3846 dnl Put your C++ language/feature checks below
3847 dnl ========================================================
3848 AC_LANG_CPLUSPLUS
3850 HAVE_GCC3_ABI=
3851 if test "$GNU_CC"; then
3852   AC_CACHE_CHECK(for gcc 3.0 ABI,
3853       ac_cv_gcc_three_abi,
3854       [AC_TRY_COMPILE([],
3855                       [
3856 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3857   return 0;
3858 #else
3859 #error Not gcc3.
3860 #endif
3861                       ],
3862                       ac_cv_gcc_three_abi="yes",
3863                       ac_cv_gcc_three_abi="no")])
3864   if test "$ac_cv_gcc_three_abi" = "yes"; then
3865       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3866       HAVE_GCC3_ABI=1
3867   else
3868       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3869   fi
3871 AC_SUBST(HAVE_GCC3_ABI)
3874 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3875                ac_cv_cpp_explicit,
3876                [AC_TRY_COMPILE(class X {
3877                                public: explicit X(int i) : i_(i) {}
3878                                private: int i_;
3879                                };,
3880                                X x(3);,
3881                                ac_cv_cpp_explicit=yes,
3882                                ac_cv_cpp_explicit=no)])
3883 if test "$ac_cv_cpp_explicit" = yes ; then
3884    AC_DEFINE(HAVE_CPP_EXPLICIT)
3887 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3888                ac_cv_cpp_typename,
3889                [AC_TRY_COMPILE(class param {
3890                                public:
3891                                    typedef unsigned long num_type;
3892                                };
3894                                template <class T> class tplt {
3895                                public:
3896                                    typedef typename T::num_type t_num_type;
3897                                    t_num_type foo(typename T::num_type num) {
3898                                        return num;
3899                                    }
3900                                };,
3901                                tplt<param> A;
3902                                A.foo(0);,
3903                                ac_cv_cpp_typename=yes,
3904                                ac_cv_cpp_typename=no)])
3905 if test "$ac_cv_cpp_typename" = yes ; then
3906    AC_DEFINE(HAVE_CPP_TYPENAME)
3909 dnl Check for support of modern template specialization syntax
3910 dnl Test code and requirement from scc@netscape.com.
3911 dnl Autoconf cut-and-paste job by waterson@netscape.com
3912 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3913                ac_cv_cpp_modern_specialize_template_syntax,
3914                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3915                                class Y {};
3916                                template <> struct X<Y> { double a; };,
3917                                X<int> int_x;
3918                                X<Y> y_x;,
3919                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3920                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3921 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3922   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3926 dnl Some compilers support only full specialization, and some don't.
3927 AC_CACHE_CHECK(whether partial template specialization works,
3928                ac_cv_cpp_partial_specialization,
3929                [AC_TRY_COMPILE(template <class T> class Foo {};
3930                                template <class T> class Foo<T*> {};,
3931                                return 0;,
3932                                ac_cv_cpp_partial_specialization=yes,
3933                                ac_cv_cpp_partial_specialization=no)])
3934 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3935   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3938 dnl Some compilers have limited support for operators with templates;
3939 dnl specifically, it is necessary to define derived operators when a base
3940 dnl class's operator declaration should suffice.
3941 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3942                ac_cv_need_derived_template_operators,
3943                [AC_TRY_COMPILE([template <class T> class Base { };
3944                                 template <class T>
3945                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3946                                 template <class T> class Derived : public Base<T> { };],
3947                                [Derived<char> a, b;
3948                                 Base<char> c = a + b;
3949                                 return 0;],
3950                                ac_cv_need_derived_template_operators=no,
3951                                ac_cv_need_derived_template_operators=yes)])
3952 if test "$ac_cv_need_derived_template_operators" = yes ; then
3953   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3957 dnl Some compilers have trouble detecting that a template class
3958 dnl that derives from another template is actually an instance
3959 dnl of the base class. This test checks for that.
3960 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3961                ac_cv_need_cpp_template_cast_to_base,
3962                [AC_TRY_COMPILE([template <class T> class Base { };
3963                                 template <class T> class Derived : public Base<T> { };
3964                                 template <class T> int foo(const Base<T>&) { return 0; }],
3965                                [Derived<char> bar; return foo(bar);],
3966                                ac_cv_need_cpp_template_cast_to_base=no,
3967                                ac_cv_need_cpp_template_cast_to_base=yes)])
3968 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3969   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3972 dnl Some compilers have trouble resolving the ambiguity between two
3973 dnl functions whose arguments differ only by cv-qualifications.
3974 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3975                ac_cv_can_resolve_const_ambiguity,
3976                [AC_TRY_COMPILE([
3977                                 template <class T> class ptrClass {
3978                                   public: T* ptr;
3979                                 };
3981                                 template <class T> T* a(ptrClass<T> *arg) {
3982                                   return arg->ptr;
3983                                 }
3985                                 template <class T>
3986                                 const T* a(const ptrClass<T> *arg) {
3987                                   return arg->ptr;
3988                                 }
3989                                ],
3990                                [ ptrClass<int> i;
3991                                  a(&i); ],
3992                                ac_cv_can_resolve_const_ambiguity=yes,
3993                                ac_cv_can_resolve_const_ambiguity=no)])
3994 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3995   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3999 dnl We don't do exceptions on unix.  The only reason this used to be here
4000 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
4001 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
4002 dnl So im commenting this out until someone writes some artificial 
4003 dnl intelligence to detect not only if the compiler has exceptions, but if 
4004 dnl they are enabled as well.
4005 dnl 
4006 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4007 dnl                ac_cv_cpp_exceptions,
4008 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
4009 dnl                                static void F() { throw X(); },
4010 dnl                                try { F(); } catch(X & e) { },
4011 dnl                                ac_cv_cpp_exceptions=yes,
4012 dnl                                ac_cv_cpp_exceptions=no)])
4013 dnl if test $ac_cv_cpp_exceptions = yes ; then
4014 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4015 dnl fi
4017 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4018 dnl supports it well enough to allow us to use it to change access, but not
4019 dnl to resolve ambiguity. The next two tests determine how well the |using|
4020 dnl keyword is supported.
4022 dnl Check to see if we can change access with |using|.  Test both a
4023 dnl legal and an illegal example.
4024 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4025                ac_cv_cpp_access_changing_using2,
4026                [AC_TRY_COMPILE(
4027                    class A { protected: int foo() { return 0; } };
4028                    class B : public A { public: using A::foo; };,
4029                    B b; return b.foo();,
4030                    [AC_TRY_COMPILE(
4031                        class A { public: int foo() { return 1; } };
4032                        class B : public A { private: using A::foo; };,
4033                        B b; return b.foo();,
4034                        ac_cv_cpp_access_changing_using2=no,
4035                        ac_cv_cpp_access_changing_using2=yes)],
4036                    ac_cv_cpp_access_changing_using2=no)])
4037 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4038    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4041 dnl Check to see if we can resolve ambiguity with |using|.
4042 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4043                ac_cv_cpp_ambiguity_resolving_using,
4044                [AC_TRY_COMPILE(class X { 
4045                                  public: int go(const X&) {return 3;}
4046                                          int jo(const X&) {return 3;}
4047                                };
4048                                class Y : public X {
4049                                  public:  int go(int) {return 2;}
4050                                           int jo(int) {return 2;}
4051                                           using X::jo;
4052                                  private: using X::go;
4053                                };,
4054                                X x; Y y; y.jo(x);,
4055                                ac_cv_cpp_ambiguity_resolving_using=yes,
4056                                ac_cv_cpp_ambiguity_resolving_using=no)])
4057 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4058    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4061 dnl Check to see if the |std| namespace is supported. If so, we'll want
4062 dnl to qualify any standard library calls with "std::" to ensure that
4063 dnl those functions can be resolved.
4064 AC_CACHE_CHECK(for \"std::\" namespace,
4065                ac_cv_cpp_namespace_std,
4066                [AC_TRY_COMPILE([#include <algorithm>],
4067                                [return std::min(0, 1);],
4068                                ac_cv_cpp_namespace_std=yes,
4069                                ac_cv_cpp_namespace_std=no)])
4070 if test "$ac_cv_cpp_namespace_std" = yes ; then
4071    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4074 dnl Older compilers are overly ambitious with respect to using the standard
4075 dnl template library's |operator!=()| when |operator==()| is defined. In
4076 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4077 dnl ambiguity at compile-time. This test checks for that case.
4078 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4079                ac_cv_cpp_unambiguous_std_notequal,
4080                [AC_TRY_COMPILE([#include <algorithm>
4081                                 struct T1 {};
4082                                 int operator==(const T1&, const T1&) { return 0; }
4083                                 int operator!=(const T1&, const T1&) { return 0; }],
4084                                [T1 a,b; return a != b;],
4085                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4086                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4087 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4088   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4092 AC_CACHE_CHECK(for C++ reinterpret_cast,
4093                ac_cv_cpp_reinterpret_cast,
4094                [AC_TRY_COMPILE(struct X { int i; };
4095                                struct Y { int i; };,
4096                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4097                                ac_cv_cpp_reinterpret_cast=yes,
4098                                ac_cv_cpp_reinterpret_cast=no)])
4099 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4100    AC_DEFINE(HAVE_CPP_NEW_CASTS)
4103 dnl See if a dynamic_cast to void* gives the most derived object.
4104 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4105                ac_cv_cpp_dynamic_cast_void_ptr,
4106                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4107                             class Y { int j; public: virtual ~Y() { } };
4108                             class Z : public X, public Y { int k; };
4110                             int main() {
4111                                  Z mdo;
4112                                  X *subx = (X*)&mdo;
4113                                  Y *suby = (Y*)&mdo;
4114                                  return !((((void*)&mdo != (void*)subx) &&
4115                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4116                                           (((void*)&mdo != (void*)suby) &&
4117                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
4118                             }],
4119                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
4120                            ac_cv_cpp_dynamic_cast_void_ptr=no,
4121                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
4122 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4123    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4127 dnl note that this one is reversed - if the test fails, then
4128 dnl we require implementations of unused virtual methods. Which
4129 dnl really blows because it means we'll have useless vtable
4130 dnl bloat.
4131 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4132                ac_cv_cpp_unused_required,
4133                [AC_TRY_LINK(class X {private: virtual void never_called();};,
4134                                X x;,
4135                                ac_cv_cpp_unused_required=no,
4136                                ac_cv_cpp_unused_required=yes)])
4137 if test "$ac_cv_cpp_unused_required" = yes ; then
4138    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4142 dnl Some compilers have trouble comparing a constant reference to a templatized
4143 dnl class to zero, and require an explicit operator==() to be defined that takes
4144 dnl an int. This test separates the strong from the weak.
4146 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4147                ac_cv_trouble_comparing_to_zero,
4148                [AC_TRY_COMPILE([#include <algorithm>
4149                                 template <class T> class Foo {};
4150                                 class T2;
4151                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4152                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4153                                [Foo<int> f; return (0 != f);],
4154                                ac_cv_trouble_comparing_to_zero=no,
4155                                ac_cv_trouble_comparing_to_zero=yes)])
4156 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4157   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4162 dnl End of C++ language/feature checks
4163 AC_LANG_C
4165 dnl ========================================================
4166 dnl =  Internationalization checks
4167 dnl ========================================================
4169 dnl Internationalization and Locale support is different
4170 dnl on various UNIX platforms.  Checks for specific i18n
4171 dnl features go here.
4173 dnl check for LC_MESSAGES
4174 AC_CACHE_CHECK(for LC_MESSAGES,
4175                 ac_cv_i18n_lc_messages,
4176                 [AC_TRY_COMPILE([#include <locale.h>],
4177                                 [int category = LC_MESSAGES;],
4178                                 ac_cv_i18n_lc_messages=yes,
4179                                 ac_cv_i18n_lc_messages=no)])
4180 if test "$ac_cv_i18n_lc_messages" = yes; then
4181    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4182 fi      
4184 fi # SKIP_COMPILER_CHECKS
4186 TARGET_XPCOM_ABI=
4187 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4188     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4191 dnl Mozilla specific options
4192 dnl ========================================================
4193 dnl The macros used for command line options
4194 dnl are defined in build/autoconf/altoptions.m4.
4197 dnl ========================================================
4198 dnl =
4199 dnl = Check for external package dependencies
4200 dnl =
4201 dnl ========================================================
4202 MOZ_ARG_HEADER(External Packages)
4204 MOZ_ENABLE_LIBXUL=
4206 MOZ_ARG_WITH_STRING(libxul-sdk,
4207 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4208   LIBXUL_SDK_DIR=$withval)
4210 if test "$LIBXUL_SDK_DIR" = "yes"; then
4211     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4212 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4213     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4215     if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4216         AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4217     fi
4219     MOZ_ENABLE_LIBXUL=1
4221 AC_SUBST(LIBXUL_SDK)
4223 if test -n "$LIBXUL_SDK"; then
4224     LIBXUL_DIST="$LIBXUL_SDK"
4225 else
4226     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4228 AC_SUBST(LIBXUL_DIST)
4230 SYSTEM_LIBXUL=
4232 MOZ_ARG_WITH_BOOL(system-libxul,
4233 [  --with-system-libxul   Use system installed libxul SDK],
4234     SYSTEM_LIBXUL=1)
4236 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4237     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4240 dnl ========================================================
4241 dnl = If NSPR was not detected in the system, 
4242 dnl = use the one in the source tree (mozilla/nsprpub)
4243 dnl ========================================================
4244 MOZ_ARG_WITH_BOOL(system-nspr,
4245 [  --with-system-nspr      Use system installed NSPR],
4246     _USE_SYSTEM_NSPR=1 )
4248 if test -n "$_USE_SYSTEM_NSPR"; then
4249     AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4252 if test -n "$MOZ_NATIVE_NSPR"; then
4253     _SAVE_CFLAGS=$CFLAGS
4254     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4255     AC_TRY_COMPILE([#include "prlog.h"],
4256                 [#ifndef PR_STATIC_ASSERT
4257                  #error PR_STATIC_ASSERT not defined
4258                  #endif],
4259                 [MOZ_NATIVE_NSPR=1],
4260                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4261     CFLAGS=$_SAVE_CFLAGS
4262 else
4263     if test "$OS_ARCH" = "WINCE"; then
4264         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4265         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4266     elif test "$OS_ARCH" = "WINNT"; then
4267         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4268         if test -n "$GNU_CC"; then
4269             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4270         else
4271             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4272         fi
4273     else
4274         NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4275         NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4276     fi
4279 dnl ========================================================
4280 dnl = If NSS was not detected in the system, 
4281 dnl = use the one in the source tree (mozilla/security/nss)
4282 dnl ========================================================
4284 MOZ_ARG_WITH_BOOL(system-nss,
4285 [  --with-system-nss      Use system installed NSS],
4286     _USE_SYSTEM_NSS=1 )
4288 if test -n "$_USE_SYSTEM_NSS"; then
4289     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4292 if test -n "$MOZ_NATIVE_NSS"; then
4293    NSS_LIBS="$NSS_LIBS -lcrmf"
4294 else
4295    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4296    NSS_DEP_LIBS="\
4297         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4298         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4299         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4300         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4301         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4303    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4304        NSS_LIBS="\
4305         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4306         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4307         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4308         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4309         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4310    else
4311        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4312    fi
4315 if test -z "$SKIP_LIBRARY_CHECKS"; then
4316 dnl system JPEG support
4317 dnl ========================================================
4318 MOZ_ARG_WITH_STRING(system-jpeg,
4319 [  --with-system-jpeg[=PFX]
4320                           Use system libjpeg [installed at prefix PFX]],
4321     JPEG_DIR=$withval)
4323 _SAVE_CFLAGS=$CFLAGS
4324 _SAVE_LDFLAGS=$LDFLAGS
4325 _SAVE_LIBS=$LIBS
4326 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4327     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4328     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4330 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4331     SYSTEM_JPEG=
4332 else
4333     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4336 if test "$SYSTEM_JPEG" = 1; then
4337     LIBS="$JPEG_LIBS $LIBS"
4338     AC_TRY_COMPILE([ #include <stdio.h>
4339                      #include <sys/types.h>
4340                      #include <jpeglib.h> ],
4341                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4342                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4343                      #endif ],
4344                    SYSTEM_JPEG=1,
4345                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4346 fi 
4347 CFLAGS=$_SAVE_CFLAGS
4348 LDFLAGS=$_SAVE_LDFLAGS
4349 LIBS=$_SAVE_LIBS
4351 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4352     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4353     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4356 dnl system ZLIB support
4357 dnl ========================================================
4358 MOZ_ARG_WITH_STRING(system-zlib,
4359 [  --with-system-zlib[=PFX]
4360                           Use system libz [installed at prefix PFX]],
4361     ZLIB_DIR=$withval)
4363 _SAVE_CFLAGS=$CFLAGS
4364 _SAVE_LDFLAGS=$LDFLAGS
4365 _SAVE_LIBS=$LIBS
4366 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4367     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4368     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4370 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4371     SYSTEM_ZLIB=
4372 else
4373     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4374         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4376 if test "$SYSTEM_ZLIB" = 1; then
4377     LIBS="$ZLIB_LIBS $LIBS"
4378     AC_TRY_COMPILE([ #include <stdio.h>
4379                      #include <string.h>
4380                      #include <zlib.h> ],
4381                    [ #if ZLIB_VERNUM < $MOZZLIB 
4382                      #error "Insufficient zlib version ($MOZZLIB required)."
4383                      #endif ],
4384                    SYSTEM_ZLIB=1,
4385                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4387 CFLAGS=$_SAVE_CFLAGS
4388 LDFLAGS=$_SAVE_LDFLAGS
4389 LIBS=$_SAVE_LIBS
4391 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4392     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4393     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4396 dnl system BZIP2 Support
4397 dnl ========================================================
4398 MOZ_ARG_WITH_STRING(system-bz2,
4399 [  --with-system-bz2[=PFX]
4400                           Use system libbz2 [installed at prefix PFX]],
4401     BZ2_DIR=$withval)
4403 _SAVE_CFLAGS=$CFLAGS
4404 _SAVE_LDFLAGS=$LDFLAGS
4405 _SAVE_LIBS=$LIBS
4406 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4407     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4408     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4410 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4411     SYSTEM_BZ2=
4412 else
4413     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4414         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4416 CFLAGS=$_SAVE_CFLAGS
4417 LDFLAGS=$_SAVE_LDFLAGS
4418 LIBS=$_SAVE_LIBS
4420 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4421     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4422     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4425 dnl system PNG Support
4426 dnl ========================================================
4427 MOZ_ARG_WITH_STRING(system-png, 
4428 [  --with-system-png[=PFX]
4429                           Use system libpng [installed at prefix PFX]],
4430     PNG_DIR=$withval)
4432 _SAVE_CFLAGS=$CFLAGS
4433 _SAVE_LDFLAGS=$LDFLAGS
4434 _SAVE_LIBS=$LIBS
4435 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4436 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4437 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4438     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4439     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4441 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4442     SYSTEM_PNG=
4443 else
4444     _SAVE_PNG_LIBS=$PNG_LIBS
4445     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4446                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4447                  $PNG_LIBS)
4448     AC_CHECK_LIB(png, png_get_acTL, ,
4449                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4450                  $_SAVE_PNG_LIBS)
4452 if test "$SYSTEM_PNG" = 1; then
4453     LIBS="$PNG_LIBS $LIBS"
4454     AC_TRY_COMPILE([ #include <stdio.h>
4455                      #include <sys/types.h>
4456                      #include <png.h> ],
4457                    [ #if PNG_LIBPNG_VER < $MOZPNG
4458                      #error "Insufficient libpng version ($MOZPNG required)."
4459                      #endif
4460                      #ifndef PNG_UINT_31_MAX
4461                      #error "Insufficient libpng version."
4462                      #endif ],
4463                    SYSTEM_PNG=1,
4464                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4466 CFLAGS=$_SAVE_CFLAGS
4467 LDFLAGS=$_SAVE_LDFLAGS
4468 LIBS=$_SAVE_LIBS
4470 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4471     PNG_CFLAGS="-I${PNG_DIR}/include"
4472     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4475 fi # SKIP_LIBRARY_CHECKS
4477 dnl system HunSpell Support
4478 dnl ========================================================
4479 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4480 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4481     SYSTEM_HUNSPELL=1 )
4483 if test -n "$SYSTEM_HUNSPELL"; then
4484     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4487 AC_SUBST(SYSTEM_HUNSPELL)
4489 dnl ========================================================
4490 dnl Java SDK support
4491 dnl ========================================================
4492 JAVA_INCLUDE_PATH=
4493 MOZ_ARG_WITH_STRING(java-include-path,
4494 [  --with-java-include-path=dir   Location of Java SDK headers],
4495     JAVA_INCLUDE_PATH=$withval)
4497 JAVA_BIN_PATH=
4498 MOZ_ARG_WITH_STRING(java-bin-path,
4499 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4500     JAVA_BIN_PATH=$withval)
4502 dnl ========================================================
4503 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4504 dnl their usage and use them in spidermonkey.
4505 dnl ========================================================
4506 MOZ_ARG_WITH_BOOL(arm-kuser,
4507 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4508     USE_ARM_KUSER=1,
4509     USE_ARM_KUSER=)
4510 if test -n "$USE_ARM_KUSER"; then
4511    AC_DEFINE(USE_ARM_KUSER)
4514 dnl ========================================================
4515 dnl =
4516 dnl = Application
4517 dnl =
4518 dnl ========================================================
4520 MOZ_ARG_HEADER(Application)
4522 BUILD_STATIC_LIBS=
4523 ENABLE_TESTS=1
4524 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4525 MOZ_BRANDING_DIRECTORY=
4526 MOZ_OFFICIAL_BRANDING=
4527 MOZ_DBGRINFO_MODULES=
4528 MOZ_FEEDS=1
4529 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4530 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4531 MOZ_JAVAXPCOM=
4532 MOZ_JSDEBUGGER=1
4533 MOZ_JSLOADER=1
4534 MOZ_MATHML=1
4535 MOZ_MORK=1
4536 MOZ_MORKREADER=
4537 MOZ_AUTH_EXTENSION=1
4538 MOZ_NO_ACTIVEX_SUPPORT=1
4539 MOZ_NO_INSPECTOR_APIS=
4540 MOZ_NO_FAST_LOAD=
4541 MOZ_OGG=1
4542 MOZ_SYDNEYAUDIO=
4543 MOZ_WAVE=1
4544 MOZ_MEDIA=
4545 MOZ_PERMISSIONS=1
4546 MOZ_PLACES=
4547 MOZ_PLAINTEXT_EDITOR_ONLY=
4548 MOZ_PLUGINS=1
4549 MOZ_PREF_EXTENSIONS=1
4550 MOZ_PROFILELOCKING=1
4551 MOZ_PSM=1
4552 MOZ_RDF=1
4553 MOZ_REFLOW_PERF=
4554 MOZ_SAFE_BROWSING=
4555 MOZ_FASTSTART=
4556 MOZ_HELP_VIEWER=
4557 MOZ_SPELLCHECK=1
4558 MOZ_SPLASHSCREEN=
4559 MOZ_STATIC_MAIL_BUILD=
4560 MOZ_STORAGE=1
4561 MOZ_SVG=1
4562 MOZ_TIMELINE=
4563 MOZ_UI_LOCALE=en-US
4564 MOZ_UNIVERSALCHARDET=1
4565 MOZ_URL_CLASSIFIER=
4566 MOZ_USE_NATIVE_UCONV=
4567 MOZ_VIEW_SOURCE=1
4568 MOZ_XPFE_COMPONENTS=1
4569 MOZ_XPINSTALL=1
4570 MOZ_XSLT_STANDALONE=
4571 MOZ_XTF=1
4572 MOZ_XUL=1
4573 MOZ_ZIPWRITER=1
4574 NS_PRINTING=1
4575 NECKO_WIFI=1
4576 NECKO_COOKIES=1
4577 NECKO_DISK_CACHE=1
4578 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4579 NECKO_SMALL_BUFFERS=
4580 XPC_IDISPATCH_SUPPORT=
4583 case "$target_os" in
4584 darwin*)
4585     ACCESSIBILITY=
4586     ;;
4588     ACCESSIBILITY=1
4589     ;;
4590 esac
4592 case "$target_os" in
4593     msvc*|mks*|cygwin*|mingw*)
4594         NS_ENABLE_TSF=1
4595         if test -z "$GNU_CC"; then 
4596             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4597                 NS_ENABLE_TSF=
4598             fi
4599             XPC_IDISPATCH_SUPPORT=1
4600             MOZ_NO_ACTIVEX_SUPPORT=
4601         fi
4602         if test -n "$NS_ENABLE_TSF"; then
4603             AC_DEFINE(NS_ENABLE_TSF)
4604         fi
4605         ;;
4606 esac
4608 MOZ_ARG_ENABLE_STRING(application,
4609 [  --enable-application=APP
4610                           Options include:
4611                             browser (Firefox)
4612                             xulrunner
4613                             content/xslt (Standalone Transformiix XSLT)
4614                             netwerk (Standalone Necko)
4615                             tools/update-packaging (AUS-related packaging tools)
4616                             standalone (use this for standalone
4617                               xpcom/xpconnect or to manually drive a build)],
4618 [ MOZ_BUILD_APP=$enableval ] )
4620 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4621 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4622   XULRUNNER_STUB_NAME=$withval)
4624 if test -z "$XULRUNNER_STUB_NAME"; then
4625   case "$target_os" in
4626   darwin*)
4627     XULRUNNER_STUB_NAME=xulrunner
4628     ;;
4629   *)
4630     XULRUNNER_STUB_NAME=xulrunner-stub
4631   esac
4633 AC_SUBST(XULRUNNER_STUB_NAME)
4635 if test -z "$MOZ_BUILD_APP"; then
4636   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4637 else
4638   # We have a valid application only if it has a build.mk file in its top
4639   # directory.
4640   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4641     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4642   fi
4645 # Allow the application to influence configure with a confvars.sh script.
4647 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4648 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4649   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4650   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4651 else
4652   AC_MSG_RESULT([no])
4655 # Now is a good time to test for logic errors, define mismatches, etc.
4656 case "$MOZ_BUILD_APP" in
4657 xulrunner)
4658   if test "$LIBXUL_SDK"; then
4659     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4660   fi
4661   ;;
4662 esac
4664 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4665 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4666 # MOZ_BUILD_APP.
4667 case "$MOZ_BUILD_APP" in
4668 browser)
4669   AC_DEFINE(MOZ_PHOENIX)
4670   ;;
4672 xulrunner)
4673   AC_DEFINE(MOZ_XULRUNNER)
4674   ;;
4676 content/xslt)
4677   AC_DEFINE(TX_EXE)
4678   ;;
4680 standalone) 
4681   MOZ_APP_NAME=mozilla
4682   MOZ_APP_DISPLAYNAME=Mozilla
4683   MOZ_APP_VERSION=$MOZILLA_VERSION
4684   ;;
4686 esac
4688 AC_SUBST(MOZ_BUILD_APP)
4689 AC_SUBST(MOZ_PHOENIX)
4690 AC_SUBST(MOZ_XULRUNNER)
4692 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4694 dnl ========================================================
4695 dnl = 
4696 dnl = Toolkit Options
4697 dnl = 
4698 dnl ========================================================
4699 MOZ_ARG_HEADER(Toolkit Options)
4701     dnl ========================================================
4702     dnl = Select the default toolkit
4703     dnl ========================================================
4704         MOZ_ARG_ENABLE_STRING(default-toolkit,
4705         [  --enable-default-toolkit=TK
4706                           Select default toolkit
4707                           Platform specific defaults:
4708                             BeOS - cairo-beos
4709                             Mac OS X - cairo-cocoa
4710                             Neutrino/QNX - photon
4711                             OS/2 - cairo-os2
4712                             Win32/WinCE - cairo-windows
4713                             Gtk2 with DirectFB - cairo-gtk2-dfb
4714                             * - cairo-gtk2
4715                             * - cairo-qt],
4716     [ _DEFAULT_TOOLKIT=$enableval ],
4717     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4719     if test "$_DEFAULT_TOOLKIT" = "photon" \
4720         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4721         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4722         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4723         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4724         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4725         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4726         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4727         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4728     then
4729         dnl nglayout only supports building with one toolkit,
4730         dnl so ignore everything after the first comma (",").
4731         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4732     else
4733         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4734     fi
4736 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4738 dnl ========================================================
4739 dnl = Enable the toolkit as needed                         =
4740 dnl ========================================================
4742 case "$MOZ_WIDGET_TOOLKIT" in
4743 photon)
4744         MOZ_ENABLE_PHOTON=1
4745         AC_DEFINE(MOZ_WIDGET_PHOTON)
4746     ;;
4748 cairo-windows)
4749     MOZ_WIDGET_TOOLKIT=windows
4750     ;;
4752 cairo-gtk2|cairo-gtk2-x11)
4753     MOZ_WIDGET_TOOLKIT=gtk2
4754     MOZ_ENABLE_GTK2=1
4755     MOZ_ENABLE_XREMOTE=1
4757     AC_DEFINE(MOZ_X11)
4758     MOZ_X11=1
4760     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4761     TK_LIBS='$(MOZ_GTK2_LIBS)'
4762     AC_DEFINE(MOZ_WIDGET_GTK2)
4763     ;;
4765 cairo-gtk2-dfb)
4766     MOZ_WIDGET_TOOLKIT=gtk2
4767     MOZ_ENABLE_GTK2=1
4769     AC_DEFINE(MOZ_DFB)
4770     MOZ_DFB=1
4772     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4773     TK_LIBS='$(MOZ_GTK2_LIBS)'
4774     AC_DEFINE(MOZ_WIDGET_GTK2)
4775     if test "$no_x" != "yes"; then
4776         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4777         no_x=yes
4778     fi
4779     ;;
4781 cairo-qt)
4782     MOZ_WIDGET_TOOLKIT=qt
4783     MOZ_ENABLE_QT=1
4784     MOZ_ENABLE_XREMOTE=1
4785     USE_ELF_DYNSTR_GC=
4786     NS_PRINTING=
4788     AC_DEFINE(MOZ_X11)
4789     MOZ_X11=1
4791     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4792     TK_LIBS='$(MOZ_QT_LIBS)'
4793     AC_DEFINE(MOZ_WIDGET_QT)
4794     ;;
4796 cairo-beos)
4797     MOZ_WIDGET_TOOLKIT=beos
4798     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4799     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4800     ;;
4802 cairo-os2)
4803     MOZ_WIDGET_TOOLKIT=os2
4804     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4805     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4806     ;;
4808 cairo-cocoa)
4809     MOZ_WIDGET_TOOLKIT=cocoa
4810     AC_DEFINE(MOZ_WIDGET_COCOA)
4811     MOZ_USER_DIR="Mozilla"
4812     AC_DEFINE(XP_MACOSX)
4813     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4814     TK_CFLAGS="-DNO_X11"
4815     LDFLAGS="$LDFLAGS -framework Cocoa"
4816     CFLAGS="$CFLAGS $TK_CFLAGS"
4817     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4818     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
4819     MOZ_FS_LAYOUT=bundle
4820     ;;
4821 esac
4823 if test "$MOZ_ENABLE_XREMOTE"; then
4824     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4827 if test "$COMPILE_ENVIRONMENT"; then
4828   if test "$MOZ_ENABLE_GTK2"; then
4829     if test "$MOZ_X11"; then
4830       GDK_PACKAGES=gdk-x11-2.0
4831     elif test "$MOZ_DFB"; then
4832       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4833       GDK_PACKAGES=directfb
4834     fi
4836     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4837   fi
4839 fi # COMPILE_ENVIRONMENT
4841 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4842 AC_SUBST(MOZ_FS_LAYOUT)
4844 dnl ========================================================
4845 dnl = startup-notification support module
4846 dnl ========================================================
4848 if test "$MOZ_ENABLE_GTK2"
4849 then
4850     MOZ_ENABLE_STARTUP_NOTIFICATION=
4852     MOZ_ARG_ENABLE_BOOL(startup-notification,
4853     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4854         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4855         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4856     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4857     then
4858         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4859                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4860         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4861             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4862             then
4863                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4864             fi
4865             MOZ_ENABLE_STARTUP_NOTIFICATION=
4866         ])
4867     fi
4869     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4870         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4871     fi
4873     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4875 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4876 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4877 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4879 dnl ========================================================
4880 dnl = QT support
4881 dnl ========================================================
4882 if test "$MOZ_ENABLE_QT"
4883 then
4884     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4885     AC_SUBST(MOZ_QT_CFLAGS)
4886     AC_SUBST(MOZ_QT_LIBS)
4888     MOZ_ARG_WITH_STRING(qtdir,
4889     [  --with-qtdir=\$dir       Specify Qt directory ],
4890     [ QTDIR=$withval])
4892     if test -z "$QTDIR"; then
4893       QTDIR="/usr"
4894     fi
4895     QTINCDIR="/include/qt"
4896     if test ! -d "$QTDIR$QTINCDIR"; then
4897        QTINCDIR="/include/X11/qt"
4898     fi
4899     if test ! -d "$QTDIR$QTINCDIR"; then
4900        QTINCDIR="/include"
4901     fi
4903     if test -x "$QTDIR/bin/moc-qt4"; then
4904       HOST_MOC="$QTDIR/bin/moc-qt4"
4905     else
4906       if test -x "$QTDIR/bin/moc"; then
4907         HOST_MOC="$QTDIR/bin/moc"
4908       else
4909         AC_CHECK_PROGS(HOST_MOC, moc, "")
4910       fi
4911     fi
4912     if test -z "$HOST_MOC"; then
4913       AC_MSG_ERROR([no acceptable moc preprocessor found])
4914     fi
4915     MOC=$HOST_MOC
4918 AC_SUBST(GTK_CONFIG)
4919 AC_SUBST(TK_CFLAGS)
4920 AC_SUBST(TK_LIBS)
4922 AC_SUBST(MOZ_ENABLE_GTK2)
4923 AC_SUBST(MOZ_ENABLE_PHOTON)
4924 AC_SUBST(MOZ_ENABLE_QT)
4925 AC_SUBST(MOZ_ENABLE_XREMOTE)
4926 AC_SUBST(MOZ_GTK2_CFLAGS)
4927 AC_SUBST(MOZ_GTK2_LIBS)
4928 AC_SUBST(MOZ_QT_CFLAGS)
4929 AC_SUBST(MOZ_QT_LIBS)
4931 AC_SUBST(MOC)
4933 AC_SUBST(MOZ_DFB)
4934 AC_SUBST(MOZ_X11)
4936 dnl ========================================================
4937 dnl =
4938 dnl = Components & Features
4939 dnl = 
4940 dnl ========================================================
4941 MOZ_ARG_HEADER(Components and Features)
4943 dnl ========================================================
4944 dnl = Localization
4945 dnl ========================================================
4946 MOZ_ARG_ENABLE_STRING(ui-locale,
4947 [  --enable-ui-locale=ab-CD
4948                           Select the user interface locale (default: en-US)],
4949     MOZ_UI_LOCALE=$enableval )
4950 AC_SUBST(MOZ_UI_LOCALE)
4952 dnl ========================================================
4953 dnl = Trademarked Branding 
4954 dnl ========================================================
4955 MOZ_ARG_ENABLE_BOOL(official-branding,
4956 [  --enable-official-branding Enable Official mozilla.org Branding
4957                           Do not distribute builds with
4958                           --enable-official-branding unless you have
4959                           permission to use trademarks per
4960                           http://www.mozilla.org/foundation/trademarks/ .],
4962   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4963     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4964   else
4965     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4966     MOZ_OFFICIAL_BRANDING=1
4967   fi
4968 ], MOZ_OFFICIAL_BRANDING=)
4970 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4971 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4972   AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4975 MOZ_ARG_WITH_STRING(branding,
4976 [  --with-branding=dir    Use branding from the specified directory.],
4977     MOZ_BRANDING_DIRECTORY=$withval)
4979 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4980 if test -z "$REAL_BRANDING_DIRECTORY"; then
4981   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4984 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4985   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4988 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4990 dnl ========================================================
4991 dnl = Distribution ID
4992 dnl ========================================================
4993 MOZ_ARG_WITH_STRING(distribution-id,
4994 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4995 [ val=`echo $withval`
4996     MOZ_DISTRIBUTION_ID="$val"])
4998 if test -z "$MOZ_DISTRIBUTION_ID"; then
4999    MOZ_DISTRIBUTION_ID="org.mozilla"
5002 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5003 AC_SUBST(MOZ_DISTRIBUTION_ID)
5006 dnl ========================================================
5007 dnl complex text support off by default
5008 dnl ========================================================
5009 MOZ_PANGO=1
5010 MOZ_ARG_DISABLE_BOOL(pango,
5011 [  --disable-pango Disable usage of Pango ],
5012     MOZ_PANGO=,
5013     MOZ_PANGO=1)
5016 dnl ========================================================
5017 dnl = Pango
5018 dnl ========================================================
5019 if test "$MOZ_ENABLE_GTK2"
5020 then
5021     AC_SUBST(MOZ_PANGO)
5023     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5025     if test "$MOZ_PANGO"
5026     then
5027         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5028         AC_SUBST(MOZ_PANGO_CFLAGS)
5029         AC_SUBST(MOZ_PANGO_LIBS)
5030         AC_DEFINE(MOZ_PANGO)
5031     else
5032         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5033         AC_SUBST(MOZ_PANGO_CFLAGS)
5034         AC_SUBST(MOZ_PANGO_LIBS)
5036         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5037         AC_SUBST(FT2_CFLAGS)
5038         AC_SUBST(FT2_LIBS)
5039     fi
5042 dnl ========================================================
5043 dnl = GnomeVFS support module
5044 dnl ========================================================
5046 if test "$MOZ_X11"
5047 then
5048     dnl build the gnomevfs extension by default only when the
5049     dnl GTK2 toolkit is in use.
5050     if test "$MOZ_ENABLE_GTK2"
5051     then
5052         MOZ_ENABLE_GNOMEVFS=1
5053         MOZ_ENABLE_GCONF=1
5054     fi
5056     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5057     [  --disable-gnomevfs      Disable GnomeVFS support ],
5058         MOZ_ENABLE_GNOMEVFS=,
5059         MOZ_ENABLE_GNOMEVFS=force)
5061     if test "$MOZ_ENABLE_GNOMEVFS"
5062     then
5063         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5064             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5065             MOZ_ENABLE_GNOMEVFS=1
5066             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5067         ],[
5068             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5069             then
5070                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5071             fi
5072             MOZ_ENABLE_GNOMEVFS=
5073         ])
5074     fi
5076     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5077     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5078     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5080     if test "$MOZ_ENABLE_GCONF"
5081     then
5082         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5083             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5084             MOZ_ENABLE_GCONF=1
5085         ],[
5086             MOZ_ENABLE_GCONF=
5087         ])
5088     fi
5090     if test "$MOZ_ENABLE_GCONF"; then
5091         AC_DEFINE(MOZ_ENABLE_GCONF)
5092     fi
5094     AC_SUBST(MOZ_ENABLE_GCONF)
5095     AC_SUBST(MOZ_GCONF_CFLAGS)
5096     AC_SUBST(MOZ_GCONF_LIBS)
5098     dnl ========================================================
5099     dnl = GIO support module
5100     dnl ========================================================
5101     MOZ_ARG_ENABLE_BOOL(gio,
5102     [  --enable-gio            Enable GIO support (default: disabled)],
5103         MOZ_ENABLE_GIO=force,
5104         MOZ_ENABLE_GIO=)
5106     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5107     then
5108         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5109             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5110             MOZ_ENABLE_GIO=1
5111             AC_DEFINE(MOZ_ENABLE_GIO)
5112         ],[
5113             if test "$MOZ_ENABLE_GIO" = "force"
5114             then
5115                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5116             fi
5117             MOZ_ENABLE_GIO=
5118         ])
5119     fi
5121     AC_SUBST(MOZ_ENABLE_GIO)
5122     AC_SUBST(MOZ_GIO_CFLAGS)
5123     AC_SUBST(MOZ_GIO_LIBS)
5126 dnl ========================================================
5127 dnl = libgnomeui support module
5128 dnl ========================================================
5130 if test "$MOZ_ENABLE_GTK2"
5131 then
5132     MOZ_ENABLE_GNOMEUI=1
5134     MOZ_ARG_DISABLE_BOOL(gnomeui,
5135     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5136         MOZ_ENABLE_GNOMEUI=,
5137         MOZ_ENABLE_GNOMEUI=force)
5139     if test "$MOZ_ENABLE_GNOMEUI"
5140     then
5141         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5142         [
5143             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5144             MOZ_ENABLE_GNOMEUI=1
5145         ],[
5146             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5147             then
5148                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5149             fi
5150             MOZ_ENABLE_GNOMEUI=
5151         ])
5152     fi
5154     if test "$MOZ_ENABLE_GNOMEUI"; then
5155         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5156     fi
5158     # The GNOME component is built if gtk2, gconf and gnome-vfs
5159     # are all available.
5161     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" && \
5162             (test "$MOZ_ENABLE_GNOMEVFS" || test "$MOZ_ENABLE_GIO"); then
5163       MOZ_ENABLE_GNOME_COMPONENT=1
5164     else
5165       MOZ_ENABLE_GNOME_COMPONENT=
5166     fi
5168     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5170 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5171 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5172 AC_SUBST(MOZ_GNOMEUI_LIBS)
5174 dnl ========================================================
5175 dnl = dbus support
5176 dnl ========================================================
5178 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5179 then
5180     MOZ_ENABLE_DBUS=1
5182     MOZ_ARG_DISABLE_BOOL(dbus,
5183     [  --disable-dbus       Disable dbus support ],
5184         MOZ_ENABLE_DBUS=,
5185         MOZ_ENABLE_DBUS=1)
5187     if test "$MOZ_ENABLE_DBUS"
5188     then
5189         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5190         AC_DEFINE(MOZ_ENABLE_DBUS)
5191     fi
5193 AC_SUBST(MOZ_ENABLE_DBUS)
5194 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5195 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5197 dnl ========================================================
5198 dnl = libnotify support
5199 dnl ========================================================
5201 if test "$MOZ_ENABLE_GTK2"
5202 then
5203     MOZ_ENABLE_LIBNOTIFY=1
5205     MOZ_ARG_DISABLE_BOOL(libnotify,
5206     [  --disable-libnotify       Disable libnotify support ],
5207     MOZ_ENABLE_LIBNOTIFY=,
5208     MOZ_ENABLE_LIBNOTIFY=1)
5210     if test "$MOZ_ENABLE_LIBNOTIFY"
5211     then
5212         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5213     fi
5216 if test -z "$SKIP_LIBRARY_CHECKS"
5217 then
5218     if test "$MOZ_ENABLE_GTK2"
5219     then
5220         if test "$MOZ_ENABLE_LIBNOTIFY"
5221         then
5222             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5223         fi
5224     fi
5226 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5227 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5228 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5230 dnl ========================================================
5231 dnl = Build Personal Security Manager
5232 dnl ========================================================
5233 MOZ_ARG_DISABLE_BOOL(crypto,
5234 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5235     MOZ_PSM=,
5236     MOZ_PSM=1 )
5238 dnl ========================================================
5239 dnl = JS Debugger XPCOM component (js/jsd)
5240 dnl ========================================================
5241 MOZ_ARG_DISABLE_BOOL(jsd,
5242 [  --disable-jsd           Disable JavaScript debug library],
5243     MOZ_JSDEBUGGER=,
5244     MOZ_JSDEBUGGER=1)
5247 dnl ========================================================
5248 dnl = Disable plugin support
5249 dnl ========================================================
5250 MOZ_ARG_DISABLE_BOOL(plugins,
5251 [  --disable-plugins       Disable plugins support],
5252     MOZ_PLUGINS=,
5253     MOZ_PLUGINS=1)
5255 dnl ========================================================
5256 dnl = Disable building dbm
5257 dnl ========================================================
5258 MOZ_ARG_DISABLE_BOOL(dbm,
5259 [  --disable-dbm       Disable building dbm],
5260     NSS_DISABLE_DBM=1,
5261     NSS_DISABLE_DBM=)
5263 dnl bi-directional support always on
5264 IBMBIDI=1
5265 AC_DEFINE(IBMBIDI)
5267 dnl ========================================================
5268 dnl view source support on by default
5269 dnl ========================================================
5270 if test "$MOZ_VIEW_SOURCE"; then
5271     AC_DEFINE(MOZ_VIEW_SOURCE)
5274 dnl ========================================================
5275 dnl accessibility support on by default on all platforms 
5276 dnl except OS X.
5277 dnl ========================================================
5278 MOZ_ARG_DISABLE_BOOL(accessibility,
5279 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5280     ACCESSIBILITY=,
5281     ACCESSIBILITY=1 )
5282 if test "$ACCESSIBILITY"; then
5283     AC_DEFINE(ACCESSIBILITY)
5286 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5287 case "$target" in
5288 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5289     if test "$ac_cv_header_atlbase_h" = "no"; then
5290         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.])
5291     fi
5292     if test "$ac_cv_header_oleacc_idl" = "no"; then
5293         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.])
5294     fi
5295     ;;
5296 esac
5299 dnl ========================================================
5300 dnl xpfe/components on by default
5301 dnl ========================================================
5302 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5303 [  --disable-xpfe-components
5304                           Disable xpfe components],
5305     MOZ_XPFE_COMPONENTS=,
5306     MOZ_XPFE_COMPONENTS=1 )
5308 dnl ========================================================
5309 dnl xpinstall support on by default
5310 dnl ========================================================
5311 MOZ_ARG_DISABLE_BOOL(xpinstall,
5312 [  --disable-xpinstall     Disable xpinstall support],
5313     MOZ_XPINSTALL=,
5314     MOZ_XPINSTALL=1 )
5315 if test "$MOZ_XPINSTALL"; then
5316     AC_DEFINE(MOZ_XPINSTALL)
5319 dnl ========================================================
5320 dnl xpcom js loader support on by default
5321 dnl ========================================================
5322 if test "$MOZ_JSLOADER"; then
5323     AC_DEFINE(MOZ_JSLOADER)
5326 dnl ========================================================
5327 dnl Disable printing
5328 dnl ========================================================
5329 MOZ_ARG_DISABLE_BOOL(printing,
5330 [  --disable-printing  Disable printing support],
5331     NS_PRINTING=,
5332     NS_PRINTING=1 )
5334 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5335     AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5336     NS_PRINTING=
5339 if test "$NS_PRINTING"; then
5340     AC_DEFINE(NS_PRINTING)
5341     AC_DEFINE(NS_PRINT_PREVIEW)
5344 dnl ========================================================
5345 dnl use native unicode converters
5346 dnl ========================================================
5347 MOZ_ARG_ENABLE_BOOL(native-uconv,
5348 [  --enable-native-uconv   Enable iconv support],
5349     MOZ_USE_NATIVE_UCONV=1,
5350     MOZ_USE_NATIVE_UCONV= )
5351 if test "$MOZ_USE_NATIVE_UCONV"; then
5352     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5354 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5355     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5359 dnl ========================================================
5360 dnl Libeditor can be build as plaintext-only,
5361 dnl or as a full html and text editing component.
5362 dnl We build both by default.
5363 dnl ========================================================
5364 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5365 [  --enable-plaintext-editor-only
5366                           Allow only plaintext editing],
5367     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5368     MOZ_PLAINTEXT_EDITOR_ONLY= )
5369 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5370 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5372 dnl ========================================================
5373 dnl = Disable Fast Load
5374 dnl ========================================================
5375 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5376 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5377     MOZ_NO_FAST_LOAD=1,
5378     MOZ_NO_FAST_LOAD=)
5380 AC_SUBST(MOZ_NO_FAST_LOAD)
5382 if test -n "$MOZ_NO_FAST_LOAD"; then
5383     AC_DEFINE(MOZ_NO_FAST_LOAD)
5386 dnl ========================================================
5387 dnl = Disable Ogg Codecs
5388 dnl ========================================================
5389 MOZ_ARG_DISABLE_BOOL(ogg,
5390 [  --disable-ogg           Disable Ogg Codec support],
5391     MOZ_OGG=,
5392     MOZ_OGG=1)
5394 AC_SUBST(MOZ_OGG)
5396 if test -n "$MOZ_OGG"; then
5397     AC_DEFINE(MOZ_OGG)
5398     MOZ_SYDNEYAUDIO=1
5399     MOZ_MEDIA=1
5401     dnl Checks for __attribute__(aligned()) directive
5402     AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5403         [ac_cv_c_attribute_aligned],
5404         [ac_cv_c_attribute_aligned=0
5405          CFLAGS_save="${CFLAGS}"
5406          CFLAGS="${CFLAGS} -Werror"
5407          for ac_cv_c_attr_align_try in 64 32 16 8; do
5408            echo "trying $ac_cv_c_attr_align_try"
5409            AC_TRY_COMPILE([],
5410                           [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5411                           [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5412            if test "$ac_cv_c_attribute_aligned" != 0; then
5413              break;
5414            fi
5415          done
5416            CFLAGS="${CFLAGS_save}"])
5417     if test "${ac_cv_c_attribute_aligned}" != "0"; then
5418       AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5419                          [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5420     fi
5423 dnl ========================================================
5424 dnl = Disable Wave decoder support
5425 dnl ========================================================
5426 MOZ_ARG_DISABLE_BOOL(wave,
5427 [  --disable-wave          Disable Wave decoder support],
5428     MOZ_WAVE=,
5429     MOZ_WAVE=1)
5431 AC_SUBST(MOZ_WAVE)
5433 if test -n "$MOZ_WAVE"; then
5434     AC_DEFINE(MOZ_WAVE)
5435     MOZ_SYDNEYAUDIO=1
5436     MOZ_MEDIA=1
5439 dnl ========================================================
5440 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5441 dnl ========================================================
5443 AC_SUBST(MOZ_SYDNEYAUDIO)
5445 if test -n "$MOZ_SYDNEYAUDIO"; then
5446     AC_DEFINE(MOZ_SYDNEYAUDIO)
5449 AC_SUBST(MOZ_MEDIA)
5451 if test -n "$MOZ_MEDIA"; then
5452     AC_DEFINE(MOZ_MEDIA)
5455 dnl ========================================================
5456 dnl = Check alsa availability on Linux if using sydneyaudio
5457 dnl ========================================================
5459 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5460 if test -n "$MOZ_SYDNEYAUDIO"; then
5461    case "$target_os" in
5462 linux*)
5463       PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5464          [echo "$MOZ_ALSA_PKG_ERRORS"
5465           AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux.  Disable with --disable-ogg --disable-wave.])])
5466       ;;
5467    esac
5469 AC_SUBST(MOZ_ALSA_LIBS)
5471 dnl ========================================================
5472 dnl Splashscreen
5473 dnl ========================================================
5474 AC_ARG_ENABLE(splashscreen,
5475               [  --enable-splashscreen   display splashscreen while loading (default=no)],
5476               [enable_splash="yes"],[enable_splash=""])
5477 if test "x$enable_splash" = "xyes"; then
5478   MOZ_SPLASHSCREEN=1
5479   AC_DEFINE(MOZ_SPLASHSCREEN)
5481 AC_SUBST(MOZ_SPLASHSCREEN)
5483 dnl ========================================================
5484 dnl Permissions System
5485 dnl ========================================================
5486 MOZ_ARG_DISABLE_BOOL(permissions,
5487 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5488     MOZ_PERMISSIONS=,
5489     MOZ_PERMISSIONS=1
5492 dnl ========================================================
5493 dnl NegotiateAuth
5494 dnl ========================================================
5495 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5496 [  --disable-negotiateauth Disable GSS-API negotiation ],
5497     MOZ_AUTH_EXTENSION=,
5498     MOZ_AUTH_EXTENSION=1 )
5500 dnl ========================================================
5501 dnl XTF
5502 dnl ========================================================
5503 MOZ_ARG_DISABLE_BOOL(xtf,
5504 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5505     MOZ_XTF=,
5506     MOZ_XTF=1 )
5507 if test "$MOZ_XTF"; then
5508   AC_DEFINE(MOZ_XTF)
5511 dnl ========================================================
5512 dnl Pref extensions (autoconfig and system-pref)
5513 dnl ========================================================
5514 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5515 [  --disable-pref-extensions
5516                           Disable pref extensions such as autoconfig and
5517                           system-pref],
5518   MOZ_PREF_EXTENSIONS=,
5519   MOZ_PREF_EXTENSIONS=1 )
5521 dnl ========================================================
5522 dnl = Universalchardet
5523 dnl ========================================================
5524 MOZ_ARG_DISABLE_BOOL(universalchardet,
5525 [  --disable-universalchardet
5526                           Disable universal encoding detection],
5527   MOZ_UNIVERSALCHARDET=,
5528   MOZ_UNIVERSALCHARDET=1 )
5530 dnl ========================================================
5531 dnl JavaXPCOM
5532 dnl ========================================================
5533 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5534 [  --enable-javaxpcom
5535                           Enable Java-XPCOM bridge],
5536     MOZ_JAVAXPCOM=1,
5537     MOZ_JAVAXPCOM= )
5539 if test -n "${MOZ_JAVAXPCOM}"; then
5540   case "$host_os" in
5541     cygwin*|msvc*|mks*)
5542       if test -n "$JAVA_HOME"; then
5543         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5544       fi
5545       ;;
5546     *mingw*)
5547       if test -n "$JAVA_HOME"; then
5548         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5549       fi
5550       ;;
5551   esac
5553   if test -n "${JAVA_INCLUDE_PATH}"; then
5554     dnl Make sure jni.h exists in the given include path.
5555     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5556       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5557     fi
5558   else
5559     case "$target_os" in
5560       darwin*)
5561         dnl Default to java system location
5562         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5563         ;;
5564       *)
5565         dnl Try $JAVA_HOME
5566         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5567         ;;
5568     esac
5569     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5570       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.])
5571     fi
5572   fi
5574   if test -n "${JAVA_BIN_PATH}"; then
5575     dnl Look for javac and jar in the specified path.
5576     JAVA_PATH="$JAVA_BIN_PATH"
5577   else
5578     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5579     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5580   fi
5582   MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5583   MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5584   MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5585   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5586     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.])
5587   fi
5590 dnl ========================================================
5591 dnl = Breakpad crash reporting (on by default on supported platforms)
5592 dnl ========================================================
5594 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5595     || test "$OS_ARCH" = "Darwin" \
5596     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5597     || test "$OS_ARCH" = "SunOS") \
5598    && test -z "$HAVE_64BIT_OS"; then
5599    MOZ_CRASHREPORTER=1
5602 MOZ_ARG_DISABLE_BOOL(crashreporter,
5603 [  --disable-crashreporter          Disable breakpad crash reporting],
5604     MOZ_CRASHREPORTER=,
5605     MOZ_CRASHREPORTER=1)
5607 if test -n "$MOZ_CRASHREPORTER"; then
5608    AC_DEFINE(MOZ_CRASHREPORTER)
5610   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5611     test -z "$SKIP_LIBRARY_CHECKS"; then
5612     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5613     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5614     AC_SUBST(MOZ_GTHREAD_LIBS)
5616     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.])])
5617   fi
5620 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5621 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5622 [ val=`echo $withval | sed 's/[^0-9]//g'`
5623     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5625 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5626    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5628 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5630 dnl ========================================================
5631 dnl = Enable compilation of specific extension modules
5632 dnl ========================================================
5634 MOZ_ARG_ENABLE_STRING(extensions,
5635 [  --enable-extensions     Enable extensions],
5636 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5637     if test "$option" = "yes" || test "$option" = "all"; then
5638         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5639     elif test "$option" = "no" || test "$option" = "none"; then
5640         MOZ_EXTENSIONS=""
5641     elif test "$option" = "default"; then
5642         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5643     elif test `echo "$option" | grep -c \^-` != 0; then
5644         option=`echo $option | sed 's/^-//'`
5645         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5646     else
5647         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5648     fi
5649 done],
5650     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5652 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5653     # Suppress warning on non-X11 platforms
5654     if test -n "$MOZ_X11"; then
5655         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5656     fi
5657     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5660 dnl Do not build gnomevfs with libxul based apps
5661 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5662     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5665 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5666     # Suppress warning on non-X11 platforms
5667     if test -n "$MOZ_X11"; then
5668         AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5669     fi
5670     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5673 dnl Do not build gio with libxul based apps
5674 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5675     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5678 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5679     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5680     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5683 dnl This might be temporary: build tridentprofile only on Windows
5684 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5685     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5686     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5689 dnl cookie must be built before tridentprofile. put it at list's end.
5690 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5691   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5692   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5695 dnl xforms requires xtf and schema-validation
5696 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5697     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5698     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5700 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5701     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5702     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5705 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5706     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5707     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5710 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5711     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5712     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5715 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5716     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5717     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5720 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5721     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5722     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5725 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5726     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5727     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5730 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5731     AC_MSG_WARN([spellcheck is no longer an extension.])
5732     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5735 dnl Remove dupes
5736 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5738 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5739 dnl when trying to build a non-existent extension.
5740 for extension in $MOZ_EXTENSIONS; do
5741     if test ! -d "${srcdir}/extensions/${extension}"; then
5742         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5743     fi
5744 done
5747 dnl ========================================================
5748 dnl Image decoders
5749 dnl ========================================================
5750 case "$MOZ_WIDGET_TOOLKIT" in
5751 beos|windows|os2|mac|cocoa)
5752     ;;
5754     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5755        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5756     fi
5757     ;;
5758 esac
5760 MOZ_ARG_ENABLE_STRING(image-decoders,
5761 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5762                           Enable specific image decoders],
5763 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5764     if test "$option" = "yes" || test "$option" = "all"; then
5765         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5766     elif test "$option" = "no" || test "$option" = "none"; then
5767         MOZ_IMG_DECODERS=""
5768     elif test "$option" = "default"; then
5769         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5770     elif test `echo "$option" | grep -c \^-` != 0; then
5771         option=`echo $option | sed 's/^-//'`
5772         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5773     else
5774         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5775     fi
5776 done],
5777     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5779 dnl Dupes are removed in the encoder section because it will also add decoders
5781 dnl ========================================================
5782 dnl Image encoders
5783 dnl ========================================================
5784 MOZ_ARG_ENABLE_STRING(image-encoders,
5785 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5786                           Enable specific image encoders],
5787 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5788     if test "$option" = "yes" || test "$option" = "all"; then
5789         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5790     elif test "$option" = "no" || test "$option" = "none"; then
5791         MOZ_IMG_ENCODERS=""
5792         addencoder=""
5793     elif test "$option" = "default"; then
5794         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5795     elif test `echo "$option" | grep -c \^-` != 0; then
5796         option=`echo $option | sed 's/^-//'`
5797         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5798     else
5799         addencoder="$option"
5800     fi
5801     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5802 done],
5803     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5805 dnl Remove dupes
5806 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5807 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5809 dnl ========================================================
5810 dnl MathML on by default
5811 dnl ========================================================
5812 MOZ_ARG_DISABLE_BOOL(mathml,
5813 [  --disable-mathml        Disable MathML support],
5814     MOZ_MATHML=,
5815     MOZ_MATHML=1 )
5816 if test "$MOZ_MATHML"; then
5817   AC_DEFINE(MOZ_MATHML)
5820 dnl ========================================================
5821 dnl SVG
5822 dnl ========================================================
5823 MOZ_ARG_DISABLE_BOOL(svg,
5824 [  --disable-svg            Disable SVG support],
5825     MOZ_SVG=,
5826     MOZ_SVG=1 )
5827 if test -n "$MOZ_SVG"; then
5828   AC_DEFINE(MOZ_SVG)
5831 dnl ========================================================
5832 dnl SMIL
5833 dnl ========================================================
5834 MOZ_SMIL=1
5835 MOZ_ARG_DISABLE_BOOL(smil,
5836 [  --disable-smil           Disable SMIL animation support],
5837     MOZ_SMIL=,
5838     MOZ_SMIL=1 )
5839 # Automatically disable SMIL if SVG is disabled
5840 if test -z "$MOZ_SVG"; then
5841   MOZ_SMIL=
5843 if test -n "$MOZ_SMIL"; then
5844   AC_DEFINE(MOZ_SMIL)
5847 dnl ========================================================
5848 dnl Build Freetype in the tree
5849 dnl ========================================================
5850 MOZ_ARG_ENABLE_BOOL(tree-freetype,
5851 [  --enable-tree-freetype         Enable Tree FreeType],
5852     MOZ_TREE_FREETYPE=1,
5853     MOZ_TREE_FREETYPE= )
5854 if test -n "$MOZ_TREE_FREETYPE"; then
5855    AC_DEFINE(MOZ_TREE_FREETYPE)
5856    AC_SUBST(MOZ_TREE_FREETYPE)
5857    MOZ_ENABLE_CAIRO_FT=1       
5858    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5859    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5860    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5861    FT2_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5862    CAIRO_FT_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5863    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
5864    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
5865    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
5866    AC_SUBST(CAIRO_FT_CFLAGS)
5870 dnl ========================================================
5871 dnl Installer
5872 dnl ========================================================
5873 case "$target_os" in
5874     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5875         MOZ_INSTALLER=1
5876         ;;
5877 esac
5879 MOZ_ARG_DISABLE_BOOL(installer,
5880 [  --disable-installer     Disable building of installer],
5881     MOZ_INSTALLER=,
5882     MOZ_INSTALLER=1 )
5883 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
5884     # Disable installer for Windows builds that use the new toolkit if NSIS
5885     # isn't in the path.
5886     MOZ_PATH_PROGS(MAKENSIS, makensis)
5887     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5888         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5889     fi
5890     # The Windows build for NSIS requires the iconv command line utility to
5891     # convert the charset of the locale files.
5892     MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5893     if test -z "$HOST_ICONV"; then
5894         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5895     fi
5898 # Automatically disable installer if xpinstall isn't built
5899 if test -z "$MOZ_XPINSTALL"; then
5900     MOZ_INSTALLER=
5902 AC_SUBST(MOZ_INSTALLER)
5904 AC_MSG_CHECKING([for tar archiver])
5905 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5906 if test -z "$TAR"; then
5907     AC_MSG_ERROR([no tar archiver found in \$PATH])
5909 AC_MSG_RESULT([$TAR])
5910 AC_SUBST(TAR)
5912 AC_MSG_CHECKING([for wget])
5913 AC_CHECK_PROGS(WGET, wget, "")
5914 AC_MSG_RESULT([$WGET])
5915 AC_SUBST(WGET)
5917 dnl ========================================================
5918 dnl Updater
5919 dnl ========================================================
5921 MOZ_ARG_DISABLE_BOOL(updater,
5922 [  --disable-updater       Disable building of updater],
5923     MOZ_UPDATER=,
5924     MOZ_UPDATER=1 )
5925 AC_SUBST(MOZ_UPDATER)
5927 # app update channel is 'default' when not supplied.
5928 MOZ_ARG_ENABLE_STRING([update-channel],
5929 [  --enable-update-channel=CHANNEL
5930                            Select application update channel (default=default)],
5931     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5933 if test -z "$MOZ_UPDATE_CHANNEL"; then
5934     MOZ_UPDATE_CHANNEL=default
5936 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5938 # tools/update-packaging is not checked out by default.
5939 MOZ_ARG_ENABLE_BOOL(update-packaging,
5940 [  --enable-update-packaging
5941                            Enable tools/update-packaging],
5942     MOZ_UPDATE_PACKAGING=1,
5943     MOZ_UPDATE_PACKAGING= )
5944 AC_SUBST(MOZ_UPDATE_PACKAGING)
5946 dnl ========================================================
5947 dnl ActiveX
5948 dnl ========================================================
5950 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5951 [  --disable-xpconnect-idispatch
5952                           Disable building of xpconnect support for IDispatch
5953                           (win32 only)],
5954     XPC_IDISPATCH_SUPPORT=,
5955     XPC_IDISPATCH_SUPPORT=1)
5956 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5958 MOZ_ARG_DISABLE_BOOL(activex,
5959 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5960     MOZ_NO_ACTIVEX_SUPPORT=1,
5961     MOZ_NO_ACTIVEX_SUPPORT= )
5962 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5964 MOZ_ARG_ENABLE_BOOL(activex-scripting,
5965 [  --enable-activex-scripting
5966                           Enable building of ActiveX scripting support (win32)],
5967     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
5968     MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
5969 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5971 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5972 then
5973     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5976 if test "$COMPILE_ENVIRONMENT" = "1"; then
5977 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5978 case "$target" in
5979 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5980     if test "$ac_cv_header_atlbase_h" = "no"; then
5981         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.])
5982     fi
5983     ;;
5984 esac
5988 dnl ========================================================
5989 dnl leaky
5990 dnl ========================================================
5991 MOZ_ARG_ENABLE_BOOL(leaky,
5992 [  --enable-leaky          Build leaky memory tool],
5993     MOZ_LEAKY=1,
5994     MOZ_LEAKY=)
5997 dnl ========================================================
5998 dnl xpctools
5999 dnl ========================================================
6000 MOZ_ARG_ENABLE_BOOL(xpctools,
6001 [  --enable-xpctools       Build JS profiling tool],
6002     MOZ_XPCTOOLS=1,
6003     MOZ_XPCTOOLS= )
6006 dnl ========================================================
6007 dnl build the tests by default
6008 dnl ========================================================
6009 MOZ_ARG_DISABLE_BOOL(tests,
6010 [  --disable-tests         Do not build test libraries & programs],
6011     ENABLE_TESTS=,
6012     ENABLE_TESTS=1 )
6014 dnl ========================================================
6015 dnl parental controls (for Windows Vista)
6016 dnl ========================================================
6017 MOZ_ARG_DISABLE_BOOL(parental-controls,
6018 [  --disable-parental-controls
6019                            Do not build parental controls],
6020    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6021    MOZ_DISABLE_PARENTAL_CONTROLS=)
6022 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6023     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6026 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6028 dnl ========================================================
6029 dnl =
6030 dnl = Module specific options
6031 dnl =
6032 dnl ========================================================
6033 MOZ_ARG_HEADER(Individual module options)
6035 dnl ========================================================
6036 dnl = Enable places (new history/bookmarks)
6037 dnl ========================================================
6038 MOZ_ARG_ENABLE_BOOL(places,
6039 [  --enable-places        Enable 'places' bookmark/history implementation],
6040     MOZ_PLACES=1,
6041     MOZ_PLACES= )
6042 if test -n "$MOZ_PLACES"; then
6043     AC_DEFINE(MOZ_PLACES)
6044     if test -z "$MOZ_MAIL_NEWS"; then
6045       MOZ_MORK=
6046     fi
6047     MOZ_MORKREADER=1
6048 else
6049   if test "$MOZ_BUILD_APP" = "browser"; then
6050     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6051   fi
6054 dnl ========================================================
6055 dnl = Disable feed handling components
6056 dnl ========================================================
6057 MOZ_ARG_DISABLE_BOOL(feeds,
6058 [  --disable-feeds        Disable feed handling and processing components],
6059     MOZ_FEEDS=,
6060     MOZ_FEEDS=1 )
6061 if test -n "$MOZ_FEEDS"; then
6062     AC_DEFINE(MOZ_FEEDS)
6063 else
6064     if test "$MOZ_BUILD_APP" = "browser"; then
6065         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6066     fi
6069 dnl ========================================================
6070 dnl = Enable mozStorage
6071 dnl ========================================================
6072 dnl Implicitly enabled by default if building calendar or places
6073 MOZ_ARG_ENABLE_BOOL(storage,
6074 [  --enable-storage        Enable mozStorage module and related components],
6075     MOZ_STORAGE=1,
6076     MOZ_STORAGE= )
6077 if test -n "$MOZ_STORAGE"; then
6078     AC_DEFINE(MOZ_STORAGE)
6081 dnl ========================================================
6082 dnl Check for sqlite
6083 dnl ========================================================
6085 MOZ_NATIVE_SQLITE=
6086 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6087 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6088 MOZ_NATIVE_SQLITE=1,
6089 MOZ_NATIVE_SQLITE= )
6091 if test -z "$MOZ_NATIVE_SQLITE"
6092 then
6093     SQLITE_CFLAGS=
6094     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6095 else
6096     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6099 AC_SUBST(MOZ_NATIVE_SQLITE)
6101 dnl ========================================================
6102 dnl = Enable help viewer (off by default)
6103 dnl ========================================================
6104 MOZ_ARG_ENABLE_BOOL(help-viewer,
6105 [  --enable-help-viewer        Enable help viewer],
6106     MOZ_HELP_VIEWER=1,
6107     MOZ_HELP_VIEWER= )
6108 if test -n "$MOZ_HELP_VIEWER"; then
6109      AC_DEFINE(MOZ_HELP_VIEWER)
6111 AC_SUBST(MOZ_HELP_VIEWER)
6112 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6113     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6116 dnl ========================================================
6117 dnl = Enable safe browsing (anti-phishing)
6118 dnl ========================================================
6119 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6120 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6121     MOZ_SAFE_BROWSING=1,
6122     MOZ_SAFE_BROWSING= )
6123 if test -n "$MOZ_SAFE_BROWSING"; then
6124     AC_DEFINE(MOZ_SAFE_BROWSING)
6126 AC_SUBST(MOZ_SAFE_BROWSING)
6128 dnl ========================================================
6129 dnl = Enable faststart component
6130 dnl ========================================================
6131 MOZ_ARG_ENABLE_BOOL(faststart,
6132 [  --enable-faststart            Enable the faststart component],
6133     MOZ_FASTSTART=1,
6134     MOZ_FASTSTART= )
6135 if test -n "$MOZ_FASTSTART"; then
6136     AC_DEFINE(MOZ_FASTSTART)
6138 AC_SUBST(MOZ_FASTSTART)
6140 dnl ========================================================
6141 dnl = Enable url-classifier
6142 dnl ========================================================
6143 dnl Implicitly enabled by default if building with safe-browsing
6144 if test -n "$MOZ_SAFE_BROWSING"; then
6145     MOZ_URL_CLASSIFIER=1
6147 MOZ_ARG_ENABLE_BOOL(url-classifier,
6148 [  --enable-url-classifier        Enable url classifier module],
6149     MOZ_URL_CLASSIFIER=1,
6150     MOZ_URL_CLASSIFIER= )
6151 if test -n "$MOZ_URL_CLASSIFIER"; then
6152     AC_DEFINE(MOZ_URL_CLASSIFIER)
6154 AC_SUBST(MOZ_URL_CLASSIFIER)
6156 dnl ========================================================
6157 dnl = Disable zipwriter
6158 dnl ========================================================
6159 MOZ_ARG_DISABLE_BOOL(zipwriter,
6160 [  --disable-zipwriter             Disable zipwriter component],
6161     MOZ_ZIPWRITER=,
6162     MOZ_ZIPWRITER=1 )
6163 AC_SUBST(MOZ_ZIPWRITER)
6165 dnl ========================================================
6166 dnl = Hildon and OSSO checks
6167 dnl ========================================================
6168 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6169                   MOZ_PLATFORM_HILDON=1,
6170                   MOZ_PLATFORM_HILDON=)
6171 if test $MOZ_PLATFORM_HILDON; then
6172    AC_DEFINE(MOZ_PLATFORM_HILDON)
6173    X11_COMPOSITED_PLUGINS="yes"
6175 AC_SUBST(LIBHILDONMIME_CFLAGS)
6176 AC_SUBST(LIBHILDONMIME_LIBS)
6178 if test "$X11_COMPOSITED_PLUGINS" = "yes"; then
6179     dnl if we have Xcomposite we should also have Xdamage and Xfixes
6180     AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6181                      [AC_MSG_ERROR([Couldn't find X11/extentsions/Xdamage.h which is required for composited plugins.])])
6182     AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6183                  [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6185 AC_SUBST(XCOMPOSITE_LIBS)
6187 PKG_CHECK_MODULES(LIBOSSO,libosso,
6188                   NS_OSSO=1,
6189                   NS_OSSO=)
6191 if test $NS_OSSO; then
6192     if test -z "$MOZ_ENABLE_DBUS"; then
6193         AC_MSG_ERROR([DBus is required when building for OSSO])
6194     fi
6195     AC_DEFINE(NS_OSSO)
6196     MOZ_GFX_OPTIMIZE_MOBILE=1
6198 AC_SUBST(LIBOSSO_CFLAGS)
6199 AC_SUBST(LIBOSSO_LIBS)
6201 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2,
6202                   NS_HILDONFM=1,
6203                   NS_HILDONFM)
6204 AC_SUBST(LIBHILDONFM_CFLAGS)
6205 AC_SUBST(LIBHILDONFM_LIBS)
6207 dnl ========================================================
6208 dnl = faststripe theme
6209 dnl ========================================================
6210 MOZ_ARG_ENABLE_BOOL(faststripe,
6211 [  --enable-faststripe  Use faststripe theme],
6212     MOZ_THEME_FASTSTRIPE=1,
6213     MOZ_THEME_FASTSTRIPE= )
6214 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6216 dnl ========================================================
6217 dnl =
6218 dnl = Feature options that require extra sources to be pulled
6219 dnl =
6220 dnl ========================================================
6221 dnl MOZ_ARG_HEADER(Features that require extra sources)
6223 dnl ========================================================
6224 dnl =
6225 dnl = Debugging Options
6226 dnl = 
6227 dnl ========================================================
6228 MOZ_ARG_HEADER(Debugging and Optimizations)
6230 dnl ========================================================
6231 dnl = Disable building with debug info.
6232 dnl = Debugging is OFF by default
6233 dnl ========================================================
6234 if test -z "$MOZ_DEBUG_FLAGS"
6235 then
6236     case "$target" in
6237     *-irix*)
6238         if test "$GNU_CC"; then
6239             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6240             case "$GCC_VERSION" in
6241             2.95.*)
6242                 MOZ_DEBUG_FLAGS=""
6243                 ;;
6244             *)
6245                 MOZ_DEBUG_FLAGS="-g"
6246                 ;;
6247             esac
6248         else
6249             MOZ_DEBUG_FLAGS="-g"
6250         fi
6251         ;;
6252     *)
6253         MOZ_DEBUG_FLAGS="-g"
6254         ;;
6255     esac
6258 MOZ_ARG_ENABLE_STRING(debug,
6259 [  --enable-debug[=DBG]    Enable building with developer debug info
6260                           (Using compiler flags DBG)],
6261 [ if test "$enableval" != "no"; then
6262     MOZ_DEBUG=1
6263     if test -n "$enableval" && test "$enableval" != "yes"; then
6264         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6265     fi
6266   else
6267     MOZ_DEBUG=
6268   fi ],
6269   MOZ_DEBUG=)
6271 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6272  case "${target_os}" in
6273     beos*)
6274         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6275         ;;
6276     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6277         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6278         ;;
6279     *) 
6280         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6281         ;;
6282   esac
6283 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6285 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6287 if test -n "$MOZ_DEBUG"; then
6288     AC_MSG_CHECKING([for valid debug flags])
6289     _SAVE_CFLAGS=$CFLAGS
6290     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6291     AC_TRY_COMPILE([#include <stdio.h>], 
6292         [printf("Hello World\n");],
6293         _results=yes,
6294         _results=no)
6295     AC_MSG_RESULT([$_results])
6296     if test "$_results" = "no"; then
6297         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6298     fi
6299     CFLAGS=$_SAVE_CFLAGS
6302 dnl ========================================================
6303 dnl enable mobile optimizations
6304 dnl ========================================================
6305 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6306 [  --enable-mobile-optimize   Enable mobile optimizations],
6307     MOZ_GFX_OPTIMIZE_MOBILE=1)
6309 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6311 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6312     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6315 dnl ========================================================
6316 dnl = Enable code optimization. ON by default.
6317 dnl ========================================================
6318 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6319         MOZ_OPTIMIZE_FLAGS="-O"
6322 MOZ_ARG_ENABLE_STRING(optimize,
6323 [  --disable-optimize      Disable compiler optimization
6324   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6325 [ if test "$enableval" != "no"; then
6326     MOZ_OPTIMIZE=1
6327     if test -n "$enableval" && test "$enableval" != "yes"; then
6328         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6329         MOZ_OPTIMIZE=2
6330     fi
6331 else
6332     MOZ_OPTIMIZE=
6333 fi ], MOZ_OPTIMIZE=1)
6335 if test "$COMPILE_ENVIRONMENT"; then
6336 if test -n "$MOZ_OPTIMIZE"; then
6337     AC_MSG_CHECKING([for valid optimization flags])
6338     _SAVE_CFLAGS=$CFLAGS
6339     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6340     AC_TRY_COMPILE([#include <stdio.h>], 
6341         [printf("Hello World\n");],
6342         _results=yes,
6343         _results=no)
6344     AC_MSG_RESULT([$_results])
6345     if test "$_results" = "no"; then
6346         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6347     fi
6348     CFLAGS=$_SAVE_CFLAGS
6350 fi # COMPILE_ENVIRONMENT
6352 AC_SUBST(MOZ_OPTIMIZE)
6353 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6354 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6355 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6357 dnl ========================================================
6358 dnl = Enable/disable debug for specific modules only
6359 dnl =   module names beginning with ^ will be disabled 
6360 dnl ========================================================
6361 MOZ_ARG_ENABLE_STRING(debug-modules,
6362 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6363 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6365 dnl ========================================================
6366 dnl = Enable/disable generation of debugger info for specific modules only
6367 dnl =    the special module name ALL_MODULES can be used to denote all modules
6368 dnl =    module names beginning with ^ will be disabled
6369 dnl ========================================================
6370 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6371 [  --enable-debugger-info-modules
6372                           Enable/disable debugger info for specific modules],
6373 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6374       dnl note that the list of module names is reversed as it is copied
6375       dnl this is important, as it will allow config.mk to interpret stuff like
6376       dnl "^ALL_MODULES xpcom" properly
6377       if test "$i" = "no"; then
6378         i="^ALL_MODULES"
6379       fi
6380       if test "$i" = "yes"; then
6381         i="ALL_MODULES"
6382       fi
6383       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6384     done ])
6386 dnl ========================================================
6387 dnl Disable runtime logging checks
6388 dnl ========================================================
6389 MOZ_ARG_DISABLE_BOOL(logging,
6390 [  --disable-logging       Disable logging facilities],
6391     NS_DISABLE_LOGGING=1,
6392     NS_DISABLE_LOGGING= )
6393 if test "$NS_DISABLE_LOGGING"; then
6394     AC_DEFINE(NS_DISABLE_LOGGING)
6395 else
6396     AC_DEFINE(MOZ_LOGGING)
6399 dnl ========================================================
6400 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6401 dnl ========================================================
6402 _ENABLE_LOGREFCNT=42
6403 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6404 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6405     _ENABLE_LOGREFCNT=1,
6406     _ENABLE_LOGREFCNT= )
6407 if test "$_ENABLE_LOGREFCNT" = "1"; then
6408     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6409 elif test -z "$_ENABLE_LOGREFCNT"; then
6410     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6413 dnl ========================================================
6414 dnl = Enable trace malloc
6415 dnl ========================================================
6416 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6417 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6418 [  --enable-trace-malloc   Enable malloc tracing],
6419     NS_TRACE_MALLOC=1,
6420     NS_TRACE_MALLOC= )
6421 if test "$NS_TRACE_MALLOC"; then
6422   # Please, Mr. Linker Man, don't take away our symbol names
6423   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6424   USE_ELF_DYNSTR_GC=
6425   AC_DEFINE(NS_TRACE_MALLOC)
6427 AC_SUBST(NS_TRACE_MALLOC)
6429 dnl ========================================================
6430 dnl = Enable jemalloc
6431 dnl ========================================================
6432 MOZ_ARG_ENABLE_BOOL(jemalloc,
6433 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6434     MOZ_MEMORY=1,
6435     MOZ_MEMORY=)
6437 if test "$NS_TRACE_MALLOC"; then
6438     MOZ_MEMORY=
6441 if test "$MOZ_MEMORY"; then
6443   dnl Don't try to run compiler tests on Windows  
6444   if test "$OS_ARCH" = "WINNT"; then
6445     if test -z "$HAVE_64BIT_OS"; then
6446       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6447     else
6448       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6449     fi
6450   else
6451     AC_CHECK_SIZEOF([int *], [4])
6452     case "${ac_cv_sizeof_int_p}" in
6453     4)
6454       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6455       ;;
6456     8)
6457       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6458       ;;
6459     *)
6460       AC_MSG_ERROR([Unexpected pointer size])
6461       ;;
6462     esac
6463   fi
6465   AC_DEFINE(MOZ_MEMORY)
6466   if test "x$MOZ_DEBUG" = "x1"; then
6467     AC_DEFINE(MOZ_MEMORY_DEBUG)
6468   fi
6469   dnl The generic feature tests that determine how to compute ncpus are long and
6470   dnl complicated.  Therefore, simply define special cpp variables for the
6471   dnl platforms we have special knowledge of.
6472   case "${target_os}" in
6473   darwin*)
6474     AC_DEFINE(MOZ_MEMORY_DARWIN)
6475     ;;
6476   *freebsd*)
6477     AC_DEFINE(MOZ_MEMORY_BSD)
6478     ;;
6479   *linux*)
6480     AC_DEFINE(MOZ_MEMORY_LINUX)
6481     ;;
6482   netbsd*)
6483     AC_DEFINE(MOZ_MEMORY_BSD)
6484     ;;
6485   solaris*)
6486     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6487     ;;
6488   msvc*|mks*|cygwin*|mingw*)
6489     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6490     dnl This is sort of awful. Will revisit if we add support for more versions
6491     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6492         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6493     fi
6494     if test -z "$WIN32_CRT_SRC_DIR"; then
6495       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6496         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).])
6497       else
6498         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6499       fi
6500     fi
6501     dnl cpu check
6502     case "${target_cpu}" in
6503     i*86)
6504       _WIN32_CRT_CPU=intel
6505       ;;
6506     *)
6507       AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6508       ;;
6509     esac
6511     if test ! -d "$WIN32_CRT_SRC_DIR"; then
6512       AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6513     fi
6514     WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6515     _objdir_win=`pwd -W`
6516     WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
6517     MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6518     dnl Also pass this to NSPR/NSS
6519     DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6520     export DLLFLAGS
6521     ;;
6522   *wince)
6523     AC_DEFINE(MOZ_MEMORY_WINCE)
6524     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6525     if test -z "$WINCE_WINDOWS_MOBILE"; then
6526       AC_DEFINE(MOZ_MEMORY_WINCE6)
6527     fi
6528     ;;
6529   *)
6530     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6531     ;;
6532   esac
6534 AC_SUBST(MOZ_MEMORY)
6535 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6536 AC_SUBST(WIN32_CRT_SRC_DIR)
6537 dnl Need to set this for make because NSS doesn't have configure
6538 AC_SUBST(DLLFLAGS)
6540 dnl ========================================================
6541 dnl = Use malloc wrapper lib
6542 dnl ========================================================
6543 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6544 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6545     _WRAP_MALLOC=1,
6546     _WRAP_MALLOC= )
6548 if test -n "$_WRAP_MALLOC"; then
6549     if test "$GNU_CC"; then
6550     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"
6551     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6552     fi
6555 dnl ========================================================
6556 dnl = Location of malloc wrapper lib
6557 dnl ========================================================
6558 MOZ_ARG_WITH_STRING(wrap-malloc,
6559 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6560     WRAP_MALLOC_LIB=$withval)
6562 dnl ========================================================
6563 dnl = Use TraceVis
6564 dnl ========================================================
6565 MOZ_ARG_ENABLE_BOOL(tracevis,
6566 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
6567     MOZ_TRACEVIS=1,
6568     MOZ_TRACEVIS= )
6569 if test -n "$MOZ_TRACEVIS"; then
6570     AC_DEFINE(MOZ_TRACEVIS)
6573 dnl ========================================================
6574 dnl = Use Valgrind
6575 dnl ========================================================
6576 MOZ_ARG_ENABLE_BOOL(valgrind,
6577 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
6578     MOZ_VALGRIND=1,
6579     MOZ_VALGRIND= )
6580 if test -n "$MOZ_VALGRIND"; then
6581     AC_CHECK_HEADER([valgrind/valgrind.h], [],
6582         AC_MSG_ERROR(
6583             [--enable-valgrind specified but Valgrind is not installed]))
6584     AC_DEFINE(MOZ_VALGRIND)
6587 dnl ========================================================
6588 dnl jprof
6589 dnl ========================================================
6590 MOZ_ARG_ENABLE_BOOL(jprof,
6591 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6592     MOZ_JPROF=1,
6593     MOZ_JPROF= )
6594 if test -n "$MOZ_JPROF"; then
6595     AC_DEFINE(MOZ_JPROF)
6598 dnl ========================================================
6599 dnl shark
6600 dnl ========================================================
6601 MOZ_ARG_ENABLE_BOOL(shark,
6602 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6603     MOZ_SHARK=1,
6604     MOZ_SHARK= )
6605 if test -n "$MOZ_SHARK"; then
6606     AC_DEFINE(MOZ_SHARK)
6609 dnl ========================================================
6610 dnl callgrind
6611 dnl ========================================================
6612 MOZ_ARG_ENABLE_BOOL(callgrind,
6613 [  --enable-callgrind      Enable callgrind profiling],
6614     MOZ_CALLGRIND=1,
6615     MOZ_CALLGRIND= )
6616 if test -n "$MOZ_CALLGRIND"; then
6617     AC_DEFINE(MOZ_CALLGRIND)
6620 dnl ========================================================
6621 dnl vtune
6622 dnl ========================================================
6623 MOZ_ARG_ENABLE_BOOL(vtune,
6624 [  --enable-vtune          Enable vtune profiling],
6625     MOZ_VTUNE=1,
6626     MOZ_VTUNE= )
6627 if test -n "$MOZ_VTUNE"; then
6628     AC_DEFINE(MOZ_VTUNE)
6631 dnl ========================================================
6632 dnl Zealous JavaScript GC
6633 dnl ========================================================
6634 MOZ_ARG_ENABLE_BOOL(gczeal,
6635 [  --enable-gczeal          Enable zealous JavaScript GCing],
6636     JS_GC_ZEAL=1,
6637     JS_GC_ZEAL= )
6638 if test -n "$JS_GC_ZEAL"; then
6639     AC_DEFINE(JS_GC_ZEAL)
6642 dnl ========================================================
6643 dnl = Enable static checking using gcc-dehydra
6644 dnl ========================================================
6646 MOZ_ARG_WITH_STRING(static-checking,
6647 [  --with-static-checking=path/to/gcc_dehydra.so
6648                             Enable static checking of code using GCC-dehydra],
6649     DEHYDRA_PATH=$withval,
6650     DEHYDRA_PATH= )
6652 if test -n "$DEHYDRA_PATH"; then
6653     if test ! -f "$DEHYDRA_PATH"; then
6654         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6655     fi
6656     AC_DEFINE(NS_STATIC_CHECKING)
6658 AC_SUBST(DEHYDRA_PATH)
6660 dnl ========================================================
6661 dnl = Enable stripping of libs & executables
6662 dnl ========================================================
6663 MOZ_ARG_ENABLE_BOOL(strip,
6664 [  --enable-strip          Enable stripping of libs & executables ],
6665     ENABLE_STRIP=1,
6666     ENABLE_STRIP= )
6668 dnl ========================================================
6669 dnl = Enable stripping of libs & executables when packaging
6670 dnl ========================================================
6671 MOZ_ARG_ENABLE_BOOL(install-strip,
6672 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6673     PKG_SKIP_STRIP= ,
6674     PKG_SKIP_STRIP=1)
6676 dnl ========================================================
6677 dnl = --enable-elf-dynstr-gc
6678 dnl ========================================================
6679 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6680 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6681     USE_ELF_DYNSTR_GC=1,
6682     USE_ELF_DYNSTR_GC= )
6684 dnl ========================================================
6685 dnl = 
6686 dnl = Profiling and Instrumenting
6687 dnl = 
6688 dnl ========================================================
6689 MOZ_ARG_HEADER(Profiling and Instrumenting)
6691 dnl ========================================================
6692 dnl = Enable timeline service, which provides lightweight
6693 dnl = instrumentation of mozilla for performance measurement.
6694 dnl = Timeline is off by default.
6695 dnl ========================================================
6696 MOZ_ARG_ENABLE_BOOL(timeline,
6697 [  --enable-timeline       Enable timeline services ],
6698     MOZ_TIMELINE=1,
6699     MOZ_TIMELINE= )
6700 if test -n "$MOZ_TIMELINE"; then
6701     AC_DEFINE(MOZ_TIMELINE)
6704 dnl ========================================================
6705 dnl Turn on reflow counting
6706 dnl ========================================================
6707 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6708 [  --enable-reflow-perf    Enable reflow performance tracing],
6709     MOZ_REFLOW_PERF=1,
6710     MOZ_REFLOW_PERF= )
6711 if test -n "$MOZ_REFLOW_PERF"; then
6712     AC_DEFINE(MOZ_REFLOW_PERF)
6715 dnl ========================================================
6716 dnl Enable code size metrics.
6717 dnl ========================================================
6718 MOZ_ARG_ENABLE_BOOL(codesighs,
6719 [  --enable-codesighs      Enable code size analysis tools],
6720     _ENABLE_CODESIGHS=1,
6721     _ENABLE_CODESIGHS= )
6722 if test -n "$_ENABLE_CODESIGHS"; then
6723     if test -d $srcdir/tools/codesighs; then 
6724         MOZ_MAPINFO=1
6725     else
6726         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6727     fi
6730 MOZ_ARG_ENABLE_BOOL(insure,
6731 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6732     _ENABLE_INSURE=1,
6733     _ENABLE_INSURE= )
6734 if test -n "$_ENABLE_INSURE"; then
6735     MOZ_INSURE="insure"
6736     MOZ_INSURIFYING=1
6737     MOZ_INSURE_DIRS="."
6738     MOZ_INSURE_EXCLUDE_DIRS="config"
6741 MOZ_ARG_WITH_STRING(insure-dirs,
6742 [  --with-insure-dirs=DIRS
6743                           Dirs to instrument with insure ],
6744     MOZ_INSURE_DIRS=$withval )
6746 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6747 [  --with-insure-exclude-dirs=DIRS
6748                           Dirs to not instrument with insure ],
6749     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6751 dnl ========================================================
6752 dnl = Support for Quantify (Windows)
6753 dnl ========================================================
6754 MOZ_ARG_ENABLE_BOOL(quantify,
6755 [  --enable-quantify      Enable Quantify support (Windows only) ],
6756     MOZ_QUANTIFY=1,
6757     MOZ_QUANTIFY= )
6759 dnl ========================================================
6760 dnl = Support for demangling undefined symbols
6761 dnl ========================================================
6762 if test -z "$SKIP_LIBRARY_CHECKS"; then
6763     AC_LANG_SAVE
6764     AC_LANG_CPLUSPLUS
6765     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6766     AC_LANG_RESTORE
6769 # Demangle only for debug or trace-malloc builds
6770 MOZ_DEMANGLE_SYMBOLS=
6771 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6772     MOZ_DEMANGLE_SYMBOLS=1
6773     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6775 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6777 dnl ========================================================
6778 dnl = Support for gcc stack unwinding (from gcc 3.3)
6779 dnl ========================================================
6780 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6781     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6784 dnl ========================================================
6785 dnl =
6786 dnl = Misc. Options
6787 dnl = 
6788 dnl ========================================================
6789 MOZ_ARG_HEADER(Misc. Options)
6791 dnl ========================================================
6792 dnl update xterm title
6793 dnl ========================================================
6794 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6795 [  --enable-xterm-updates  Update XTERM titles with current command.],
6796     MOZ_UPDATE_XTERM=1,
6797     MOZ_UPDATE_XTERM= )
6799 dnl =========================================================
6800 dnl = Chrome format
6801 dnl =========================================================
6802 MOZ_ARG_ENABLE_STRING([chrome-format],
6803 [  --enable-chrome-format=jar|flat|both|symlink
6804                           Select FORMAT of chrome files (default=jar)],
6805     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6807 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6808     MOZ_CHROME_FILE_FORMAT=jar
6811 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6812     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6813     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6814     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6815     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6818 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
6819    AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
6821 dnl ========================================================
6822 dnl = Define default location for MOZILLA_FIVE_HOME
6823 dnl ========================================================
6824 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6825 [  --with-default-mozilla-five-home
6826                           Set the default value for MOZILLA_FIVE_HOME],
6827 [ val=`echo $withval`
6828   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6830 dnl ========================================================
6831 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6832 dnl ========================================================
6833 MOZ_ARG_WITH_STRING(user-appdir,
6834 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6835 [ val=`echo $withval`
6836 if echo "$val" | grep "\/" >/dev/null; then
6837     AC_MSG_ERROR("Homedir must be single relative path.")
6838 else 
6839     MOZ_USER_DIR="$val"
6840 fi])
6842 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6844 dnl ========================================================
6845 dnl = Doxygen configuration
6846 dnl ========================================================
6847 dnl Use commas to specify multiple dirs to this arg
6848 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6849 MOZ_ARG_WITH_STRING(doc-input-dirs,
6850 [  --with-doc-input-dirs=DIRS
6851                           Header/idl dirs to create docs from],
6852 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6853 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6855 dnl Use commas to specify multiple dirs to this arg
6856 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6857 MOZ_ARG_WITH_STRING(doc-include-dirs,
6858 [  --with-doc-include-dirs=DIRS  
6859                           Include dirs to preprocess doc headers],
6860 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6861 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6863 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6864 MOZ_ARG_WITH_STRING(doc-output-dir,
6865 [  --with-doc-output-dir=DIR
6866                           Dir to generate docs into],
6867 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6868 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6870 if test -z "$SKIP_COMPILER_CHECKS"; then
6871 dnl ========================================================
6872 dnl =
6873 dnl = Compiler Options
6874 dnl = 
6875 dnl ========================================================
6876 MOZ_ARG_HEADER(Compiler Options)
6878 dnl ========================================================
6879 dnl Check for gcc -pipe support
6880 dnl ========================================================
6881 AC_MSG_CHECKING([for gcc -pipe support])
6882 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6883     echo '#include <stdio.h>' > dummy-hello.c
6884     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6885     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6886     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
6887     if test $? = 0; then
6888         _res_as_stdin="yes"
6889     else
6890         _res_as_stdin="no"
6891     fi
6892     if test "$_res_as_stdin" = "yes"; then
6893         _SAVE_CFLAGS=$CFLAGS
6894         CFLAGS="$CFLAGS -pipe"
6895         AC_TRY_COMPILE( [ #include <stdio.h> ],
6896             [printf("Hello World\n");],
6897             [_res_gcc_pipe="yes"],
6898             [_res_gcc_pipe="no"] )
6899         CFLAGS=$_SAVE_CFLAGS
6900     fi
6901     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6902         _res="yes";
6903         CFLAGS="$CFLAGS -pipe"
6904         CXXFLAGS="$CXXFLAGS -pipe"
6905     else
6906         _res="no"
6907     fi
6908     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6909     AC_MSG_RESULT([$_res])
6910 else
6911     AC_MSG_RESULT([no])
6914 dnl pass -Wno-long-long to the compiler
6915 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6916 [  --enable-long-long-warning 
6917                           Warn about use of non-ANSI long long type],
6918     _IGNORE_LONG_LONG_WARNINGS=,
6919     _IGNORE_LONG_LONG_WARNINGS=1)
6921 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6922      _SAVE_CFLAGS="$CFLAGS"
6923      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6924      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6925      AC_TRY_COMPILE([], [return(0);], 
6926         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6927           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6928           result="yes" ], result="no")
6929      AC_MSG_RESULT([$result])
6930      CFLAGS="$_SAVE_CFLAGS"
6933 dnl ========================================================
6934 dnl Profile guided optimization
6935 dnl ========================================================
6936 dnl Test for profiling options
6937 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6938 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6940 dnl Provide a switch to disable PGO even when called via profiledbuild.
6941 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6942 [  --disable-profile-guided-optimization
6943                            Don't build with PGO even if called via make profiledbuild],
6944 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6945 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6947 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6949 _SAVE_CFLAGS="$CFLAGS"
6950 CFLAGS="$CFLAGS -fprofile-generate"
6952 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6953 AC_TRY_COMPILE([], [return 0;],
6954                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6955                  result="yes" ], result="no")
6956 AC_MSG_RESULT([$result])
6958 if test $result = "yes"; then
6959   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6960   PROFILE_USE_CFLAGS="-fprofile-use"
6961   PROFILE_USE_LDFLAGS="-fprofile-use"
6962 else
6963   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6964   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6965   AC_TRY_COMPILE([], [return 0;],
6966                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6967                    result="yes" ], result="no")
6968   AC_MSG_RESULT([$result])
6969   if test $result = "yes"; then
6970     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6971   fi
6972   # don't really care, this is an old GCC
6973   PROFILE_GEN_LDFLAGS=
6974   PROFILE_USE_LDFLAGS=
6977 CFLAGS="$_SAVE_CFLAGS"
6979 if test -n "$INTEL_CC"; then
6980   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6981   PROFILE_GEN_LDFLAGS=
6982   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6983   PROFILE_USE_LDFLAGS=
6986 dnl Sun Studio on Solaris
6987 if test "$SOLARIS_SUNPRO_CC"; then
6988   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6989   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6990   if test "$CPU_ARCH" != "sparc"; then
6991     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6992     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6993   else
6994     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6995     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6996   fi
6999 AC_SUBST(PROFILE_GEN_CFLAGS)
7000 AC_SUBST(PROFILE_GEN_LDFLAGS)
7001 AC_SUBST(PROFILE_USE_CFLAGS)
7002 AC_SUBST(PROFILE_USE_LDFLAGS)
7004 AC_LANG_CPLUSPLUS
7006 dnl ========================================================
7007 dnl Test for -pedantic bustage
7008 dnl ========================================================
7009 MOZ_ARG_DISABLE_BOOL(pedantic,
7010 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7011 _PEDANTIC= )
7012 if test "$_PEDANTIC"; then
7013     _SAVE_CXXFLAGS=$CXXFLAGS
7014     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7015     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7016     AC_TRY_COMPILE([$configure_static_assert_macros],
7017                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7018                    result="no", result="yes" )
7019     AC_MSG_RESULT([$result])
7020     CXXFLAGS="$_SAVE_CXXFLAGS"
7022     case "$result" in
7023     no)
7024         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7025         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7026         ;;
7027     yes)
7028         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7029         ;;
7030     esac
7033 dnl ========================================================
7034 dnl Test for correct temporary object destruction order
7035 dnl ========================================================
7036 dnl We want to make sure the compiler follows the C++ spec here as 
7037 dnl xpcom and the string classes depend on it (bug 235381).
7038 AC_MSG_CHECKING([for correct temporary object destruction order])
7039 AC_TRY_RUN([ class A {
7040              public:  A(int& x) : mValue(x) {}
7041                       ~A() { mValue--; }
7042                       operator char**() { return 0; }
7043              private:  int& mValue;
7044              };
7045              void func(char **arg) {}
7046              int m=2;
7047              void test() {
7048                   func(A(m));
7049                   if (m==1) m = 0;
7050              }
7051              int main() {
7052                  test();
7053                  return(m);
7054              }
7055              ],
7056      result="yes", result="no", result="maybe")
7057 AC_MSG_RESULT([$result])
7059 if test "$result" = "no"; then
7060     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7063 dnl ========================================================
7064 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7065 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7066 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7067 dnl ========================================================
7068 _SAVE_CXXFLAGS=$CXXFLAGS
7069 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7070 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7071     ac_nscap_nonconst_opeq_bug,
7072     [AC_TRY_COMPILE([
7073                       template <class T>
7074                       class Pointer
7075                         {
7076                         public:
7077                           T* myPtr;
7078                         };
7079                       
7080                       template <class T, class U>
7081                       int operator==(const Pointer<T>& rhs, U* lhs)
7082                         {
7083                           return rhs.myPtr == lhs;
7084                         }
7085                       
7086                       template <class T, class U>
7087                       int operator==(const Pointer<T>& rhs, const U* lhs)
7088                         {
7089                           return rhs.myPtr == lhs;
7090                         }
7091                     ],
7092                     [
7093                       Pointer<int> foo;
7094                       const int* bar;
7095                       return foo == bar;
7096                     ],
7097                     ac_nscap_nonconst_opeq_bug="no",
7098                     ac_nscap_nonconst_opeq_bug="yes")])
7099 CXXFLAGS="$_SAVE_CXXFLAGS"
7101 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7102     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7104 fi # SKIP_COMPILER_CHECKS
7106 dnl ========================================================
7107 dnl C++ rtti
7108 dnl Should be smarter and check that the compiler does indeed have rtti
7109 dnl ========================================================
7110 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7111 [  --enable-cpp-rtti       Enable C++ RTTI ],
7112 [ _MOZ_USE_RTTI=1 ],
7113 [ _MOZ_USE_RTTI= ])
7115 if test "$_MOZ_USE_RTTI"; then
7116    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7117 else
7118    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7121 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7123 dnl ========================================================
7124 dnl C++ exceptions (g++/egcs only - for now)
7125 dnl Should be smarter and check that the compiler does indeed have exceptions
7126 dnl ========================================================
7127 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7128 [  --enable-cpp-exceptions Enable C++ exceptions ],
7129 [ _MOZ_CPP_EXCEPTIONS=1 ],
7130 [ _MOZ_CPP_EXCEPTIONS= ])
7132 if test "$_MOZ_CPP_EXCEPTIONS"; then
7133     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7134 else
7135     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7138 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7140 # Irix & OSF native compilers do not like exception declarations 
7141 # when exceptions are disabled
7142 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7143     AC_DEFINE(CPP_THROW_NEW, [])
7144 else
7145     AC_DEFINE(CPP_THROW_NEW, [throw()])
7147 AC_LANG_C
7149 dnl ========================================================
7150 dnl =
7151 dnl = Build depencency options
7152 dnl =
7153 dnl ========================================================
7154 MOZ_ARG_HEADER(Build dependencies)
7156 dnl ========================================================
7157 dnl = Do not auto generate dependency info
7158 dnl ========================================================
7159 MOZ_AUTO_DEPS=1
7160 MOZ_ARG_DISABLE_BOOL(auto-deps,
7161 [  --disable-auto-deps     Do not automatically generate dependency info],
7162     MOZ_AUTO_DEPS=,
7163     MOZ_AUTO_DEPS=1)
7165 if test -n "$MOZ_AUTO_DEPS"; then
7166 dnl ========================================================
7167 dnl = Use mkdepend instead of $CC -MD for dependency generation
7168 dnl ========================================================
7169 _cpp_md_flag=
7170 MOZ_ARG_DISABLE_BOOL(md,
7171 [  --disable-md            Do not use compiler-based dependencies ],
7172   [_cpp_md_flag=],
7173   [_cpp_md_flag=1],
7174   [dnl Default is to turn on -MD if using GNU-compatible compilers
7175    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7176      _cpp_md_flag=1
7177    fi
7178   dnl Default is to use -xM if using Sun Studio on Solaris
7179    if test "$SOLARIS_SUNPRO_CC"; then
7180      _cpp_md_flag=1
7181    fi])
7182 if test "$_cpp_md_flag"; then
7183   COMPILER_DEPEND=1
7184   if test "$OS_ARCH" = "OpenVMS"; then
7185     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7186   else
7187     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7188   fi
7189   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7190   if test "$SOLARIS_SUNPRO_CC"; then
7191     _DEPEND_CFLAGS=
7192   fi
7193 else
7194   COMPILER_DEPEND=
7195   dnl Don't override this for MSVC
7196   if test -z "$_WIN32_MSVC"; then
7197     _USE_CPP_INCLUDE_FLAG=
7198     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7199     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7200   fi
7202 fi # MOZ_AUTO_DEPS
7203 MDDEPDIR='.deps'
7204 AC_SUBST(MOZ_AUTO_DEPS)
7205 AC_SUBST(COMPILER_DEPEND)
7206 AC_SUBST(MDDEPDIR)
7209 dnl ========================================================
7210 dnl =
7211 dnl = Static Build Options
7212 dnl =
7213 dnl ========================================================
7214 MOZ_ARG_HEADER(Static build options)
7216 MOZ_ARG_ENABLE_BOOL(static,
7217 [  --enable-static         Enable building of internal static libs],
7218     BUILD_STATIC_LIBS=1,
7219     BUILD_STATIC_LIBS=)
7221 dnl Disable libxul in debug builds, but not for xulrunner.
7222 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7223    MOZ_ENABLE_LIBXUL=
7226 MOZ_ARG_ENABLE_BOOL(libxul,
7227 [  --enable-libxul         Enable building of libxul],
7228     MOZ_ENABLE_LIBXUL=1,
7229     MOZ_ENABLE_LIBXUL=)
7231 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7232         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7235 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7236         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7239 AC_SUBST(LIBXUL_LIBS)
7241 if test -n "$MOZ_ENABLE_LIBXUL"; then
7242     XPCOM_LIBS="$LIBXUL_LIBS"
7243     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7244 else
7245     if test -n "$BUILD_STATIC_LIBS"; then
7246         AC_DEFINE(MOZ_STATIC_BUILD)
7247     fi
7248     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7251 dnl ========================================================
7252 dnl =
7253 dnl = Standalone module options
7254 dnl = 
7255 dnl ========================================================
7256 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7258 dnl Check for GLib and libIDL.
7259 dnl ========================================================
7260 case "$target_os" in
7261 msvc*|mks*|cygwin*|mingw*|wince*)
7262     SKIP_IDL_CHECK="yes"
7263     ;;
7265     SKIP_IDL_CHECK="no"
7266     ;;
7267 esac
7269 if test -z "$COMPILE_ENVIRONMENT"; then
7270     SKIP_IDL_CHECK="yes"
7273 dnl = Allow users to disable libIDL checking for standalone modules
7274 MOZ_ARG_WITHOUT_BOOL(libIDL,
7275 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7276         SKIP_IDL_CHECK="yes")
7278 if test "$SKIP_IDL_CHECK" = "no"
7279 then
7280     _LIBIDL_FOUND=
7281     if test "$MACOS_SDK_DIR"; then 
7282       dnl xpidl, and therefore libIDL, is only needed on the build host.
7283       dnl Don't build it against the SDK, as that causes problems.
7284       _MACSAVE_CFLAGS="$CFLAGS"
7285       _MACSAVE_LIBS="$LIBS"
7286       _MACSAVE_LDFLAGS="$LDFLAGS"
7287       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7288       changequote(,)
7289       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"`
7290       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7291       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7292       changequote([,])
7293       unset NEXT_ROOT
7294     fi
7296     if test "$MOZ_ENABLE_GTK2"; then
7297         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7298     fi
7299     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7300     dnl to either libIDL1 or libIDL2.
7301     if test -z "$_LIBIDL_FOUND"; then
7302         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7303         if test -z "$_LIBIDL_FOUND"; then
7304             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7305         fi
7306     fi
7307     dnl
7308     dnl If we don't have a libIDL config program & not cross-compiling, 
7309     dnl     look for orbit-config instead.
7310     dnl
7311     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7312         MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7313         if test -n "$ORBIT_CONFIG"; then
7314             AC_MSG_CHECKING([for ORBit libIDL usability])
7315                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7316             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7317             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7318             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7319             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7320             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7321             LIBIDL_CONFIG=
7322             _SAVE_CFLAGS="$CFLAGS"
7323             _SAVE_LIBS="$LIBS"
7324             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7325             LIBS="$LIBIDL_LIBS $LIBS"
7326             AC_TRY_RUN([
7327 #include <stdlib.h>
7328 #include <libIDL/IDL.h>
7329 int main() {
7330   char *s;
7331   s=strdup(IDL_get_libver_string());
7332   if(s==NULL) {
7333     exit(1);
7334   }
7335   exit(0);
7337             ], [_LIBIDL_FOUND=1
7338                 result="yes"],
7339                [LIBIDL_CFLAGS=
7340                 LIBIDL_LIBS=
7341                 result="no"],
7342                [_LIBIDL_FOUND=1
7343                 result="maybe"] )
7344             AC_MSG_RESULT($result)
7345             CFLAGS="$_SAVE_CFLAGS"
7346             LIBS="$_SAVE_LIBS"
7347         fi
7348     fi
7349     if test -z "$_LIBIDL_FOUND"; then
7350         AC_MSG_ERROR([libIDL not found.
7351         libIDL $LIBIDL_VERSION or higher is required.])
7352     fi
7353     if test "$MACOS_SDK_DIR"; then
7354       CFLAGS="$_MACSAVE_CFLAGS"
7355       LIBS="$_MACSAVE_LIBS"
7356       LDFLAGS="$_MACSAVE_LDFLAGS"
7357       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7358         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7359       fi
7360     fi
7363 if test -n "$CROSS_COMPILE"; then
7364      if test -z "$HOST_LIBIDL_CONFIG"; then
7365         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7366     fi
7367     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7368         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7369         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7370     else
7371         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7372         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7373     fi
7376 if test -z "$SKIP_PATH_CHECKS"; then
7377 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7378     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7379         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7380     else
7381         AM_PATH_GLIB(${GLIB_VERSION})
7382     fi
7386 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7387     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7390 AC_SUBST(LIBIDL_CFLAGS)
7391 AC_SUBST(LIBIDL_LIBS)
7392 AC_SUBST(STATIC_LIBIDL)
7393 AC_SUBST(GLIB_CFLAGS)
7394 AC_SUBST(GLIB_LIBS)
7395 AC_SUBST(GLIB_GMODULE_LIBS)
7396 AC_SUBST(HOST_LIBIDL_CONFIG)
7397 AC_SUBST(HOST_LIBIDL_CFLAGS)
7398 AC_SUBST(HOST_LIBIDL_LIBS)
7400 dnl ========================================================
7401 dnl Check for cairo
7402 dnl ========================================================
7403 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7405 MOZ_TREE_CAIRO=1
7406 MOZ_ARG_ENABLE_BOOL(system-cairo,
7407 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7408 MOZ_TREE_CAIRO=,
7409 MOZ_TREE_CAIRO=1 )
7411 # Check for headers defining standard int types.
7412 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7414 if test "$MOZ_TREE_CAIRO"; then
7415     AC_DEFINE(MOZ_TREE_CAIRO)
7417     # For now we assume that we will have a uint64_t available through
7418     # one of the above headers or mozstdint.h.
7419     AC_DEFINE(HAVE_UINT64_T)
7421     # Define macros for cairo-features.h
7422     if test "$MOZ_X11"; then
7423         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7424         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7425         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7426         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7427         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7428         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7429         MOZ_ENABLE_CAIRO_FT=1
7430         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7431     fi
7432     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7433         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7434     fi
7435     if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7436         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7437         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7438         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7439     fi
7440     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7441         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7442         if test -z "$WINCE"; then
7443             WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7444         else
7445             WIN32_FONT_FEATURE=
7446         fi
7448         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7449         if test -z "$HAS_DDRAW"; then
7450             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.])
7451             DDRAW_SURFACE_FEATURE=
7452         else
7453             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7454         fi
7456         if test -z "$OGLES_SDK_DIR"; then
7457             OGLES_SURFACE_FEATURE=
7458         else
7459             AC_TRY_COMPILE([
7460               #include <EGL/egl.h>
7461               #include <EGL/eglext.h>
7462               #include <GLES2/gl2.h>
7463               #include <GLES2/gl2ext.h>
7464             ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7465             if test -z "$HAS_OGLES"; then
7466               AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7467               OGLES_SURFACE_FEATURE=
7468             else
7469               OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7470             fi
7471         fi
7473         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7474     fi
7475     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7476         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7477         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7478         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7479         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7480         MOZ_ENABLE_CAIRO_FT=1
7481         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7482         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7483     fi
7484     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7485         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7486         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7487         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7488         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7489         MOZ_ENABLE_CAIRO_FT=1
7490     fi
7491     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7492     AC_SUBST(CAIRO_FT_CFLAGS)
7493     AC_SUBST(HAS_OGLES)
7495     if test "$MOZ_DEBUG"; then
7496       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7497     else
7498       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7499     fi
7501     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7503     AC_SUBST(PS_SURFACE_FEATURE)
7504     AC_SUBST(PDF_SURFACE_FEATURE)
7505     AC_SUBST(SVG_SURFACE_FEATURE)
7506     AC_SUBST(XLIB_SURFACE_FEATURE)
7507     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7508     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7509     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7510     AC_SUBST(XCB_SURFACE_FEATURE)
7511     AC_SUBST(WIN32_SURFACE_FEATURE)
7512     AC_SUBST(DDRAW_SURFACE_FEATURE)
7513     AC_SUBST(OGLES_SURFACE_FEATURE)    
7514     AC_SUBST(OS2_SURFACE_FEATURE)
7515     AC_SUBST(BEOS_SURFACE_FEATURE)
7516     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7517     AC_SUBST(FT_FONT_FEATURE)
7518     AC_SUBST(FC_FONT_FEATURE)
7519     AC_SUBST(WIN32_FONT_FEATURE)
7520     AC_SUBST(QUARTZ_FONT_FEATURE)
7521     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7522     AC_SUBST(QT_SURFACE_FEATURE)
7524     if test "$_WIN32_MSVC"; then
7525         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7526     else
7527         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"
7529         if test "$MOZ_X11"; then
7530             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7531         fi
7532     fi
7534     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7535     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7537 else
7538    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7539    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7540    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7541    if test "$MOZ_X11"; then
7542         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7543         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7544         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7545    fi
7548 AC_SUBST(MOZ_TREE_CAIRO)
7549 AC_SUBST(MOZ_CAIRO_CFLAGS)
7550 AC_SUBST(MOZ_CAIRO_LIBS)
7552 dnl qcms
7553 dnl ========================================================
7555 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7556 AC_SUBST(QCMS_LIBS)
7558 dnl ========================================================
7559 dnl disable xul
7560 dnl ========================================================
7561 MOZ_ARG_DISABLE_BOOL(xul,
7562 [  --disable-xul           Disable XUL],
7563     MOZ_XUL= )
7564 if test "$MOZ_XUL"; then
7565   AC_DEFINE(MOZ_XUL)
7566 else
7567   dnl remove extensions that require XUL
7568   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7571 AC_SUBST(MOZ_XUL)
7573 dnl ========================================================
7574 dnl disable profile locking
7575 dnl   do no use this in applications that can have more than
7576 dnl   one process accessing the profile directory.
7577 dnl ========================================================
7578 MOZ_ARG_DISABLE_BOOL(profilelocking,
7579 [  --disable-profilelocking           Disable profile locking],
7580     MOZ_PROFILELOCKING=,
7581     MOZ_PROFILELOCKING=1 )
7582 if test "$MOZ_PROFILELOCKING"; then
7583   AC_DEFINE(MOZ_PROFILELOCKING)
7586 dnl ========================================================
7587 dnl disable rdf services
7588 dnl ========================================================
7589 MOZ_ARG_DISABLE_BOOL(rdf,
7590 [  --disable-rdf           Disable RDF],
7591     MOZ_RDF= )
7592 if test "$MOZ_RDF"; then
7593   AC_DEFINE(MOZ_RDF)
7596 AC_SUBST(MOZ_RDF)
7598 dnl ========================================================
7599 dnl necko configuration options
7600 dnl ========================================================
7603 dnl option to disable various necko protocols
7605 MOZ_ARG_ENABLE_STRING(necko-protocols,
7606 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7607                           Enable/disable specific protocol handlers],
7608 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7609     if test "$option" = "yes" || test "$option" = "all"; then
7610         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7611     elif test "$option" = "no" || test "$option" = "none"; then
7612         NECKO_PROTOCOLS=""
7613     elif test "$option" = "default"; then
7614         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7615     elif test `echo "$option" | grep -c \^-` != 0; then
7616         option=`echo $option | sed 's/^-//'`
7617         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7618     else
7619         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7620     fi
7621 done],
7622     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7623 dnl Remove dupes
7624 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7625 AC_SUBST(NECKO_PROTOCOLS)
7626 for p in $NECKO_PROTOCOLS; do
7627     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7628 done
7631 dnl option to disable necko's disk cache
7633 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7634 [  --disable-necko-disk-cache
7635                           Disable necko disk cache],
7636     NECKO_DISK_CACHE=,
7637     NECKO_DISK_CACHE=1)
7638 AC_SUBST(NECKO_DISK_CACHE)
7639 if test "$NECKO_DISK_CACHE"; then
7640     AC_DEFINE(NECKO_DISK_CACHE)
7644 dnl option to disable necko's wifi scanner
7646 MOZ_ARG_DISABLE_BOOL(necko-wifi,
7647 [  --disable-necko-wifi   Disable necko wifi scanner],
7648     NECKO_WIFI=,
7649     NECKO_WIFI=1
7652 if test "$OS_ARCH" = "OS2"; then
7653   dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
7654   NECKO_WIFI=
7656 if test "$NECKO_WIFI" -a \
7657         "$OS_ARCH" != "Linux" -a \
7658         "$OS_ARCH" != "Darwin" -a \
7659         "$OS_ARCH" != "WINNT" -a \
7660         "$OS_ARCH" != "WINCE"; then
7661   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
7664 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
7665 then
7666   AC_CHECK_HEADER([iwlib.h])
7667   if test "$ac_cv_header_iwlib_h" != "yes"; then
7668     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])
7669   fi
7672 if test "$NECKO_WIFI"; then
7673   AC_DEFINE(NECKO_WIFI)
7675 AC_SUBST(NECKO_WIFI)
7678 dnl option to minimize size of necko's i/o buffers
7680 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7681 [  --enable-necko-small-buffers
7682                           Minimize size of necko's i/o buffers],
7683     NECKO_SMALL_BUFFERS=1,
7684     NECKO_SMALL_BUFFERS=)
7685 AC_SUBST(NECKO_SMALL_BUFFERS)
7686 if test "$NECKO_SMALL_BUFFERS"; then
7687     AC_DEFINE(NECKO_SMALL_BUFFERS)
7688 fi 
7691 dnl option to disable cookies
7693 MOZ_ARG_DISABLE_BOOL(cookies,
7694 [  --disable-cookies       Disable cookie support],
7695     NECKO_COOKIES=,
7696     NECKO_COOKIES=1)
7697 AC_SUBST(NECKO_COOKIES)
7698 if test "$NECKO_COOKIES"; then
7699     AC_DEFINE(NECKO_COOKIES)
7703 dnl Build jsctypes on the platforms we can.
7705 AC_SUBST(BUILD_CTYPES)
7706 case "$OS_TEST" in
7707 arm*)
7708   ;;
7710   BUILD_CTYPES=1
7711   AC_DEFINE(BUILD_CTYPES)
7712   ;;
7713 esac
7715 dnl NECKO_ configuration options are not global
7716 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7718 dnl Only build Mork if it's required
7719 AC_SUBST(MOZ_MORK)
7720 if test "$MOZ_MORK"; then
7721   AC_DEFINE(MOZ_MORK)
7724 dnl Build the lightweight Mork reader if required
7725 AC_SUBST(MOZ_MORKREADER)
7726 if test "$MOZ_MORKREADER"; then
7727   AC_DEFINE(MOZ_MORKREADER)
7730 dnl ========================================================
7731 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7732     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7735 dnl ========================================================
7736 dnl =
7737 dnl = Maintainer debug option (no --enable equivalent)
7738 dnl =
7739 dnl ========================================================
7741 AC_SUBST(AR)
7742 AC_SUBST(AR_FLAGS)
7743 AC_SUBST(AR_LIST)
7744 AC_SUBST(AR_EXTRACT)
7745 AC_SUBST(AR_DELETE)
7746 AC_SUBST(AS)
7747 AC_SUBST(ASFLAGS)
7748 AC_SUBST(AS_DASH_C_FLAG)
7749 AC_SUBST(LD)
7750 AC_SUBST(RC)
7751 AC_SUBST(RCFLAGS)
7752 AC_SUBST(WINDRES)
7753 AC_SUBST(IMPLIB)
7754 AC_SUBST(FILTER)
7755 AC_SUBST(BIN_FLAGS)
7756 AC_SUBST(NS_USE_NATIVE)
7757 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7758 AC_SUBST(MOZ_UPDATE_XTERM)
7759 AC_SUBST(MINIMO)
7760 AC_SUBST(MOZ_PLATFORM_HILDON)
7761 AC_SUBST(NS_OSSO)
7762 AC_SUBST(NS_MAEMO_LOCATION)
7763 AC_SUBST(MOZ_AUTH_EXTENSION)
7764 AC_SUBST(MOZ_MATHML)
7765 AC_SUBST(MOZ_PERMISSIONS)
7766 AC_SUBST(MOZ_XTF)
7767 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7768 AC_SUBST(MOZ_PREF_EXTENSIONS)
7769 AC_SUBST(MOZ_SVG)
7770 AC_SUBST(MOZ_SMIL)
7771 AC_SUBST(MOZ_XSLT_STANDALONE)
7772 AC_SUBST(MOZ_JS_LIBS)
7773 AC_SUBST(MOZ_PSM)
7774 AC_SUBST(MOZ_DEBUG)
7775 AC_SUBST(MOZ_DEBUG_MODULES)
7776 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7777 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7778 AC_SUBST(MOZ_DEBUG_FLAGS)
7779 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7780 AC_SUBST(WARNINGS_AS_ERRORS)
7781 AC_SUBST(MOZ_DBGRINFO_MODULES)
7782 AC_SUBST(MOZ_EXTENSIONS)
7783 AC_SUBST(MOZ_IMG_DECODERS)
7784 AC_SUBST(MOZ_IMG_ENCODERS)
7785 AC_SUBST(MOZ_JSDEBUGGER)
7786 AC_SUBST(MOZ_PLUGINS)
7787 AC_SUBST(MOZ_LOG_REFCNT)
7788 AC_SUBST(MOZ_LEAKY)
7789 AC_SUBST(MOZ_JPROF)
7790 AC_SUBST(MOZ_SHARK)
7791 AC_SUBST(MOZ_CALLGRIND)
7792 AC_SUBST(MOZ_VTUNE)
7793 AC_SUBST(MOZ_XPCTOOLS)
7794 AC_SUBST(MOZ_JSLOADER)
7795 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7796 AC_SUBST(MOZ_INSURE)
7797 AC_SUBST(MOZ_INSURE_DIRS)
7798 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7799 AC_SUBST(MOZ_QUANTIFY)
7800 AC_SUBST(MOZ_INSURIFYING)
7801 AC_SUBST(LIBICONV)
7802 AC_SUBST(MOZ_PLACES)
7803 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7804 AC_SUBST(MOZ_STORAGE)
7805 AC_SUBST(MOZ_FEEDS)
7806 AC_SUBST(NS_PRINTING)
7808 AC_SUBST(MOZ_JAVAXPCOM)
7809 AC_SUBST(JAVA_INCLUDE_PATH)
7810 AC_SUBST(JAVA)
7811 AC_SUBST(JAVAC)
7812 AC_SUBST(JAR)
7814 AC_SUBST(MOZ_PROFILELOCKING)
7816 AC_SUBST(HAVE_XIE)
7817 AC_SUBST(MOZ_XIE_LIBS)
7818 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7820 AC_SUBST(BUILD_STATIC_LIBS)
7821 AC_SUBST(MOZ_ENABLE_LIBXUL)
7822 AC_SUBST(ENABLE_TESTS)
7823 AC_SUBST(IBMBIDI)
7824 AC_SUBST(MOZ_UNIVERSALCHARDET)
7825 AC_SUBST(ACCESSIBILITY)
7826 AC_SUBST(MOZ_XPINSTALL)
7827 AC_SUBST(MOZ_VIEW_SOURCE)
7828 AC_SUBST(MOZ_SPELLCHECK)
7829 AC_SUBST(MOZ_XPFE_COMPONENTS)
7830 AC_SUBST(MOZ_USER_DIR)
7831 AC_SUBST(MOZ_CRASHREPORTER)
7833 AC_SUBST(ENABLE_STRIP)
7834 AC_SUBST(PKG_SKIP_STRIP)
7835 AC_SUBST(USE_ELF_DYNSTR_GC)
7836 AC_SUBST(INCREMENTAL_LINKER)
7837 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7838 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7840 AC_SUBST(MOZ_FIX_LINK_PATHS)
7841 AC_SUBST(XPCOM_LIBS)
7842 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7843 AC_SUBST(XPCOM_GLUE_LDOPTS)
7844 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7846 AC_SUBST(USE_DEPENDENT_LIBS)
7848 AC_SUBST(MOZ_BUILD_ROOT)
7849 AC_SUBST(MOZ_OS2_TOOLS)
7850 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7852 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7853 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7854 AC_SUBST(MOZ_TIMELINE)
7855 AC_SUBST(OGLES_SDK_DIR)
7857 AC_SUBST(MOZ_APP_NAME)
7858 AC_SUBST(MOZ_APP_DISPLAYNAME)
7859 AC_SUBST(MOZ_APP_VERSION)
7860 AC_SUBST(FIREFOX_VERSION)
7862 AC_SUBST(MOZ_PKG_SPECIAL)
7864 AC_SUBST(MOZILLA_OFFICIAL)
7866 dnl win32 options
7867 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7868 AC_SUBST(MOZ_MAPINFO)
7869 AC_SUBST(MOZ_BROWSE_INFO)
7870 AC_SUBST(MOZ_TOOLS_DIR)
7871 AC_SUBST(CYGWIN_WRAPPER)
7872 AC_SUBST(AS_PERL)
7873 AC_SUBST(WIN32_REDIST_DIR)
7874 AC_SUBST(PYTHON)
7876 AC_SUBST(WINCE)
7877 AC_SUBST(WINCE_SDK_DIR)
7878 AC_SUBST(WINCE_WINDOWS_MOBILE)
7880 dnl Echo the CFLAGS to remove extra whitespace.
7881 CFLAGS=`echo \
7882         $_WARNINGS_CFLAGS \
7883         $CFLAGS`
7885 CXXFLAGS=`echo \
7886         $_MOZ_RTTI_FLAGS \
7887         $_MOZ_EXCEPTIONS_FLAGS \
7888         $_WARNINGS_CXXFLAGS \
7889         $CXXFLAGS`
7891 COMPILE_CFLAGS=`echo \
7892     $_DEFINES_CFLAGS \
7893         $_DEPEND_CFLAGS \
7894     $COMPILE_CFLAGS`
7896 COMPILE_CXXFLAGS=`echo \
7897     $_DEFINES_CXXFLAGS \
7898         $_DEPEND_CFLAGS \
7899     $COMPILE_CXXFLAGS`
7901 AC_SUBST(SYSTEM_MAKEDEPEND)
7902 AC_SUBST(SYSTEM_LIBXUL)
7903 AC_SUBST(SYSTEM_JPEG)
7904 AC_SUBST(SYSTEM_PNG)
7905 AC_SUBST(SYSTEM_ZLIB)
7906 AC_SUBST(SYSTEM_BZ2)
7908 AC_SUBST(JPEG_CFLAGS)
7909 AC_SUBST(JPEG_LIBS)
7910 AC_SUBST(ZLIB_CFLAGS)
7911 AC_SUBST(ZLIB_LIBS)
7912 AC_SUBST(BZ2_CFLAGS)
7913 AC_SUBST(BZ2_LIBS)
7914 AC_SUBST(PNG_CFLAGS)
7915 AC_SUBST(PNG_LIBS)
7917 AC_SUBST(MOZ_JPEG_CFLAGS)
7918 AC_SUBST(MOZ_JPEG_LIBS)
7919 AC_SUBST(MOZ_ZLIB_CFLAGS)
7920 AC_SUBST(MOZ_ZLIB_LIBS)
7921 AC_SUBST(MOZ_BZ2_CFLAGS)
7922 AC_SUBST(MOZ_BZ2_LIBS)
7923 AC_SUBST(MOZ_PNG_CFLAGS)
7924 AC_SUBST(MOZ_PNG_LIBS)
7926 AC_SUBST(NSPR_CFLAGS)
7927 AC_SUBST(NSPR_LIBS)
7928 AC_SUBST(MOZ_NATIVE_NSPR)
7930 AC_SUBST(NSS_CFLAGS)
7931 AC_SUBST(NSS_LIBS)
7932 AC_SUBST(NSS_DEP_LIBS)
7933 AC_SUBST(MOZ_NATIVE_NSS)
7934 AC_SUBST(NSS_DISABLE_DBM)
7936 AC_SUBST(CFLAGS)
7937 AC_SUBST(CXXFLAGS)
7938 AC_SUBST(CPPFLAGS)
7939 AC_SUBST(COMPILE_CFLAGS)
7940 AC_SUBST(COMPILE_CXXFLAGS)
7941 AC_SUBST(LDFLAGS)
7942 AC_SUBST(LIBS)
7943 AC_SUBST(CROSS_COMPILE)
7944 AC_SUBST(WCHAR_CFLAGS)
7946 AC_SUBST(HOST_CC)
7947 AC_SUBST(HOST_CXX)
7948 AC_SUBST(HOST_CFLAGS)
7949 AC_SUBST(HOST_CXXFLAGS)
7950 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7951 AC_SUBST(HOST_AR)
7952 AC_SUBST(HOST_AR_FLAGS)
7953 AC_SUBST(HOST_LD)
7954 AC_SUBST(HOST_RANLIB)
7955 AC_SUBST(HOST_NSPR_MDCPUCFG)
7956 AC_SUBST(HOST_BIN_SUFFIX)
7957 AC_SUBST(HOST_OS_ARCH)
7959 AC_SUBST(TARGET_CPU)
7960 AC_SUBST(TARGET_VENDOR)
7961 AC_SUBST(TARGET_OS)
7962 AC_SUBST(TARGET_NSPR_MDCPUCFG)
7963 AC_SUBST(TARGET_MD_ARCH)
7964 AC_SUBST(TARGET_XPCOM_ABI)
7965 AC_SUBST(OS_TARGET)
7966 AC_SUBST(OS_ARCH)
7967 AC_SUBST(OS_RELEASE)
7968 AC_SUBST(OS_TEST)
7970 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
7971 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
7973 AC_SUBST(WRAP_MALLOC_CFLAGS)
7974 AC_SUBST(WRAP_MALLOC_LIB)
7975 AC_SUBST(MKSHLIB)
7976 AC_SUBST(MKCSHLIB)
7977 AC_SUBST(MKSHLIB_FORCE_ALL)
7978 AC_SUBST(MKSHLIB_UNFORCE_ALL)
7979 AC_SUBST(DSO_CFLAGS)
7980 AC_SUBST(DSO_PIC_CFLAGS)
7981 AC_SUBST(DSO_LDOPTS)
7982 AC_SUBST(LIB_PREFIX)
7983 AC_SUBST(DLL_PREFIX)
7984 AC_SUBST(DLL_SUFFIX)
7985 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
7986 AC_SUBST(LIB_SUFFIX)
7987 AC_SUBST(OBJ_SUFFIX)
7988 AC_SUBST(BIN_SUFFIX)
7989 AC_SUBST(ASM_SUFFIX)
7990 AC_SUBST(IMPORT_LIB_SUFFIX)
7991 AC_SUBST(USE_N32)
7992 AC_SUBST(CC_VERSION)
7993 AC_SUBST(CXX_VERSION)
7994 AC_SUBST(MSMANIFEST_TOOL)
7995 AC_SUBST(NS_ENABLE_TSF)
7996 AC_SUBST(MOZ_NSS_PATCH)
7998 if test "$USING_HCC"; then
7999    CC='${topsrcdir}/build/hcc'
8000    CC="$CC '$_OLDCC'"
8001    CXX='${topsrcdir}/build/hcpp'
8002    CXX="$CXX '$_OLDCXX'"
8003    AC_SUBST(CC)
8004    AC_SUBST(CXX)
8007 dnl Check for missing components
8008 if test "$COMPILE_ENVIRONMENT"; then
8009 if test "$MOZ_X11"; then
8010     dnl ====================================================
8011     dnl = Check if X headers exist
8012     dnl ====================================================
8013     _SAVE_CFLAGS=$CFLAGS
8014     CFLAGS="$CFLAGS $XCFLAGS"
8015     AC_TRY_COMPILE([
8016         #include <stdio.h>
8017         #include <stdlib.h>
8018         #include <X11/Xlib.h>
8019         #include <X11/Intrinsic.h>
8020     ],
8021     [
8022         Display *dpy = 0;
8023         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8024             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8025             exit(1);
8026         }
8027     ], [], 
8028     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8029     CFLAGS="$_SAVE_CFLAGS"
8031     if test ! -z "$MISSING_X"; then
8032         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8033     fi
8035 fi # MOZ_X11
8036 fi # COMPILE_ENVIRONMENT
8038 dnl Set various defines and substitutions
8039 dnl ========================================================
8041 if test "$OS_ARCH" = "BeOS"; then
8042   AC_DEFINE(XP_BEOS)
8043   MOZ_MOVEMAIL=1
8044 elif test "$OS_ARCH" = "Darwin"; then
8045   AC_DEFINE(XP_UNIX)
8046   AC_DEFINE(UNIX_ASYNC_DNS)
8047   MOZ_MOVEMAIL=1
8048 elif test "$OS_ARCH" = "OpenVMS"; then
8049   AC_DEFINE(XP_UNIX)
8050 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8051   AC_DEFINE(XP_UNIX)
8052   AC_DEFINE(UNIX_ASYNC_DNS)
8053   MOZ_MOVEMAIL=1
8055 AC_SUBST(MOZ_MOVEMAIL)
8057 if test "$MOZ_DEBUG"; then
8058     AC_DEFINE(MOZ_REFLOW_PERF)
8059     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8062 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8063     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8064     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8065     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8066     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8067     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8068     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8069     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8070     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8073 dnl ========================================================
8074 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8075 dnl ========================================================
8076 case "$host_os" in
8077 mingw*)
8078     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8079     ;;
8080 cygwin*|msvc*|mks*)
8081     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8082     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8083     CC="\$(CYGWIN_WRAPPER) $CC"
8084     CXX="\$(CYGWIN_WRAPPER) $CXX"
8085     CPP="\$(CYGWIN_WRAPPER) $CPP"
8086     LD="\$(CYGWIN_WRAPPER) $LD"
8087     AS="\$(CYGWIN_WRAPPER) $AS"
8088     RC="\$(CYGWIN_WRAPPER) $RC"
8089     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8090     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8091     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8092     ;;
8093 esac
8095 AC_SUBST(CYGDRIVE_MOUNT)
8096 AC_SUBST(WIN_TOP_SRC)
8098 AC_SUBST(MOZILLA_VERSION)
8100 AC_SUBST(ac_configure_args)
8102 dnl Spit out some output
8103 dnl ========================================================
8105 dnl The following defines are used by xpcom
8106 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8107 CPP_THROW_NEW
8108 HAVE_CPP_2BYTE_WCHAR_T
8109 HAVE_CPP_ACCESS_CHANGING_USING
8110 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8111 HAVE_CPP_BOOL
8112 HAVE_CPP_CHAR16_T
8113 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8114 HAVE_CPP_EXPLICIT
8115 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8116 HAVE_CPP_NAMESPACE_STD
8117 HAVE_CPP_NEW_CASTS
8118 HAVE_CPP_PARTIAL_SPECIALIZATION
8119 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8120 HAVE_CPP_TYPENAME
8121 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8122 HAVE_STATVFS
8123 NEED_CPP_UNUSED_IMPLEMENTATIONS
8124 NEW_H
8125 HAVE_GETPAGESIZE
8126 HAVE_ICONV
8127 HAVE_ICONV_WITH_CONST_INPUT
8128 HAVE_MBRTOWC
8129 HAVE_SYS_MOUNT_H
8130 HAVE_SYS_VFS_H
8131 HAVE_WCRTOMB
8134 AC_CONFIG_HEADER(
8135 netwerk/necko-config.h
8136 xpcom/xpcom-config.h
8137 xpcom/xpcom-private.h
8140 # Save the defines header file before autoconf removes it.
8141 # (Do not add AC_DEFINE calls after this line.)
8142   _CONFIG_TMP=confdefs-tmp.h
8143   _CONFIG_DEFS_H=mozilla-config.h
8145   cat > $_CONFIG_TMP <<\EOF
8146 /* List of defines generated by configure. Included with preprocessor flag,
8147  * -include, to avoid long list of -D defines on the compile command-line.
8148  * Do not edit.
8149  */
8151 #ifndef _MOZILLA_CONFIG_H_
8152 #define _MOZILLA_CONFIG_H_
8155 _EGREP_PATTERN='^#define ('
8156 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8157     for f in $_NON_GLOBAL_ACDEFINES; do
8158         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8159     done
8161 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8163   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8165   cat >> $_CONFIG_TMP <<\EOF
8167 #endif /* _MOZILLA_CONFIG_H_ */
8171   # Only write mozilla-config.h when something changes (or it doesn't exist)
8172   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8173     rm $_CONFIG_TMP
8174   else
8175     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8176     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8178     echo ==== $_CONFIG_DEFS_H =================================
8179     cat $_CONFIG_DEFS_H
8180   fi
8182 dnl Probably shouldn't call this manually but we always want the output of DEFS
8183 rm -f confdefs.h.save
8184 mv confdefs.h confdefs.h.save
8185 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8186 AC_OUTPUT_MAKE_DEFS()
8187 MOZ_DEFINES=$DEFS
8188 AC_SUBST(MOZ_DEFINES)
8189 rm -f confdefs.h
8190 mv confdefs.h.save confdefs.h
8192 dnl Load the list of Makefiles to generate.
8193 dnl   To add new Makefiles, edit allmakefiles.sh.
8194 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8195 . ${srcdir}/allmakefiles.sh
8196 dnl 
8197 dnl Run a perl script to quickly create the makefiles.
8198 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8199 dnl   for the files it cannot handle correctly. This way, config.status
8200 dnl   will handle these files.
8201 dnl If it fails, nothing is set and config.status will run as usual.
8203 dnl This does not change the $MAKEFILES variable.
8205 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8207 if test -z "${AS_PERL}"; then
8208 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8209 else
8210 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8212 . ./conftest.sh
8213 rm conftest.sh
8215 echo $MAKEFILES > unallmakefiles
8217 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8219 AC_OUTPUT($MAKEFILES)
8221 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8222 if test "$CAIRO_FEATURES_H"; then
8223   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8224     echo "$CAIRO_FEATURES_H is unchanged"
8225     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8226   else
8227     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8228   fi
8231 dnl ========================================================
8232 dnl = Setup a nice relatively clean build environment for
8233 dnl = sub-configures.
8234 dnl ========================================================
8235 CC="$_SUBDIR_CC" 
8236 CXX="$_SUBDIR_CXX" 
8237 CFLAGS="$_SUBDIR_CFLAGS" 
8238 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8239 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8240 LDFLAGS="$_SUBDIR_LDFLAGS"
8241 HOST_CC="$_SUBDIR_HOST_CC" 
8242 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8243 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8246 unset MAKEFILES
8247 unset CONFIG_FILES
8249 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8250 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8252 if test -z "$MOZ_NATIVE_NSPR"; then
8253     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8254     if test -z "$MOZ_DEBUG"; then
8255         ac_configure_args="$ac_configure_args --disable-debug"
8256     fi
8257     if test "$MOZ_OPTIMIZE" = "1"; then
8258         ac_configure_args="$ac_configure_args --enable-optimize"
8259     fi
8260     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8261        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8262     fi
8263     if test -n "$HAVE_64BIT_OS"; then
8264         ac_configure_args="$ac_configure_args --enable-64bit"
8265     fi
8266     if test -n "$USE_ARM_KUSER"; then
8267         ac_configure_args="$ac_configure_args --with-arm-kuser"
8268     fi
8269     AC_OUTPUT_SUBDIRS(nsprpub)
8270     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8273 if test -z "$MOZ_NATIVE_NSPR"; then
8274     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8275     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8276     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8277        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8278        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8279        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8280        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8281     fi
8282     rm -f config/autoconf.mk.bak
8285 # Run the SpiderMonkey 'configure' script.
8286 dist=$MOZ_BUILD_ROOT/dist
8287 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8288 ac_configure_args="$ac_configure_args --enable-threadsafe"
8289 if test -z "$MOZ_NATIVE_NSPR"; then
8290     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8291     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8293 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8294 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8295 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8296 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8297 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8298 if test "$MOZ_MEMORY"; then
8299    ac_configure_args="$ac_configure_args --enable-jemalloc"
8300    if test -n "$MOZ_MEMORY_LDFLAGS"; then
8301      export MOZ_MEMORY_LDFLAGS
8302    fi
8304 AC_OUTPUT_SUBDIRS(js/src)
8305 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8307 # Build jsctypes on the platforms we can.
8308 if test "$BUILD_CTYPES"; then
8309   # Run the libffi 'configure' script on platforms that it supports.
8310   if test -z "$_MSC_VER"; then
8311     ac_configure_args="--disable-shared --enable-static --disable-raw-api"
8312     if test "$MOZ_DEBUG"; then
8313       ac_configure_args="$ac_configure_args --enable-debug"
8314     fi
8315     if test -n "$DSO_PIC_CFLAGS"; then
8316       ac_configure_args="$ac_configure_args --with-pic"
8317     fi
8318     if test -n "$CROSS_COMPILE"; then
8319       ac_configure_args="$ac_configure_args --build=$build --host=$target"
8320     fi
8321     AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8322     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8323   fi
8326 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8328 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8329 dnl Needs to be at the end to respect possible changes from NSPR configure
8330 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8331   echo "config/autoconf.mk is unchanged"
8332   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8333 else
8334   rm -f config/autoconf.mk.orig 2> /dev/null