Fixing test
[mozilla-central.git] / configure.in
blob62a6178d9f17716ba690326926240ff44ba2fed6
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
46 dnl Alternatively, the contents of this file may be used under the terms of
47 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
48 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
49 dnl in which case the provisions of the GPL or the LGPL are applicable instead
50 dnl of those above. If you wish to allow use of your version of this file only
51 dnl under the terms of either the GPL or the LGPL, and not to allow others to
52 dnl use your version of this file under the terms of the MPL, indicate your
53 dnl decision by deleting the provisions above and replace them with the notice
54 dnl and other provisions required by the GPL or the LGPL. If you do not delete
55 dnl the provisions above, a recipient may use your version of this file under
56 dnl the terms of any one of the MPL, the GPL or the LGPL.
57 dnl
58 dnl ***** END LICENSE BLOCK *****
60 dnl Process this file with autoconf to produce a configure script.
61 dnl ========================================================
63 AC_PREREQ(2.13)
64 AC_INIT(config/config.mk)
65 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
66 AC_CANONICAL_SYSTEM
67 TARGET_CPU="${target_cpu}"
68 TARGET_VENDOR="${target_vendor}"
69 TARGET_OS="${target_os}"
72 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
73 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
77 dnl =
78 dnl = Don't change the following two lines.  Doing so breaks:
79 dnl =
80 dnl = CFLAGS="-foo" ./configure
81 dnl =
82 dnl ========================================================
83 CFLAGS="${CFLAGS=}"
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
86 LDFLAGS="${LDFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
96 _SUBDIR_CC="$CC"
97 _SUBDIR_CXX="$CXX"
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
110 MOZJPEG=62
111 MOZPNG=10217
112 MOZZLIB=0x1230
113 NSPR_VERSION=4
114 NSS_VERSION=3
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
118 GLIB_VERSION=1.2.0
119 LIBIDL_VERSION=0.6.3
120 PERL_VERSION=5.006
121 CAIRO_VERSION=1.6.0
122 PANGO_VERSION=1.14.0
123 GTK2_VERSION=2.10.0
124 MAKE_VERSION=3.78
125 WINDRES_VERSION=2.14.90
126 W32API_VERSION=3.8
127 GNOMEVFS_VERSION=2.0
128 GNOMEUI_VERSION=2.2.0
129 GCONF_VERSION=1.2.1
130 LIBGNOME_VERSION=2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
132 DBUS_VERSION=0.60
133 LCMS_VERSION=1.17
134 SQLITE_VERSION=3.6.10
135 LIBNOTIFY_VERSION=0.4
137 MSMANIFEST_TOOL=
139 dnl Set various checks
140 dnl ========================================================
141 MISSING_X=
142 AC_PROG_AWK
144 dnl Initialize the Pthread test variables early so they can be
145 dnl  overridden by each platform.
146 dnl ========================================================
147 USE_PTHREADS=
148 _PTHREAD_LDFLAGS=""
150 dnl Do not allow a separate objdir build if a srcdir build exists.
151 dnl ==============================================================
152 _topsrcdir=`cd \`dirname $0\`; pwd`
153 _objdir=`pwd`
155 if test "$_topsrcdir" != "$_objdir"
156 then
157   # Check for a couple representative files in the source tree
158   _conflict_files=
159   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
160     if test -f $file; then
161       _conflict_files="$_conflict_files $file"
162     fi
163   done
164   if test "$_conflict_files"; then
165     echo "***"
166     echo "*   Your source tree contains these files:"
167     for file in $_conflict_files; do
168       echo "*         $file"
169     done
170     cat 1>&2 <<-EOF
171         *   This indicates that you previously built in the source tree.
172         *   A source tree build can confuse the separate objdir build.
173         *
174         *   To clean up the source tree:
175         *     1. cd $_topsrcdir
176         *     2. gmake distclean
177         ***
178         EOF
179     exit 1
180     break
181   fi
183 MOZ_BUILD_ROOT=`pwd`
185 dnl Default to MSVC for win32
186 dnl ==============================================================
187 if test -z "$CROSS_COMPILE"; then
188 case "$target" in
189 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
190     MAKE_VERSION=3.79
191     if test -z "$CC"; then CC=cl; fi
192     if test -z "$CXX"; then CXX=cl; fi
193     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
194     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
195     if test -z "$LD"; then LD=link; fi
196     if test -z "$AS"; then AS=ml; fi
197     if test -z "$MIDL"; then MIDL=midl; fi
198     ;;
199 esac
202 COMPILE_ENVIRONMENT=1
203 MOZ_ARG_ENABLE_BOOL(compile-environment,
204 [  --disable-compile-environment
205                            Disable compiler/library checks.],
206     COMPILE_ENVIRONMENT=1,
207     COMPILE_ENVIRONMENT= )
209 MOZ_ARG_WITH_STRING(l10n-base,
210 [  --with-l10n-base=DIR     path to l10n repositories],
211     L10NBASEDIR=$withval)
212 if test ! -z "$L10NBASEDIR"; then
213     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
214         AC_MSG_ERROR([--with-l10n-base must specify a path])
215     elif test -d "$L10NBASEDIR"; then
216         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
217     else
218         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
219     fi
221 AC_SUBST(L10NBASEDIR)
223 dnl ========================================================
224 dnl Checks for compilers.
225 dnl ========================================================
226 dnl Set CROSS_COMPILE in the environment when running configure
227 dnl to use the cross-compile setup for now
228 dnl ========================================================
230 if test "$COMPILE_ENVIRONMENT"; then
232 dnl Do some special WinCE toolchain stuff
233 case "$target" in
234 *wince)
236     MOZ_ARG_WITH_STRING(wince-sdk,
237     [  --with-wince-sdk=WINCE_SDK_DIR
238                         The path to the Windows CE SDK],
239     WINCE_SDK_DIR=$withval)
241     dnl Default to Windows Mobile components enabled
242     WINCE_WINDOWS_MOBILE=1
244     MOZ_ARG_DISABLE_BOOL(windows-mobile-components,
245     [  --disable-windows-mobile-components
246          Disable Windows Mobile specific components from CE build],
247     WINCE_WINDOWS_MOBILE=,
248     WINCE_WINDOWS_MOBILE=1)
250     if test "$WINCE_WINDOWS_MOBILE"; then
251         AC_DEFINE(WINCE_WINDOWS_MOBILE)
252     fi
254     AC_SUBST(WINCE_WINDOWS_MOBILE)
256     export WINCE=1
258     echo -----------------------------------------------------------------------------
259     echo Building Windows CE Shunt Library and Tool Chain
260     echo Using SDK in:
261     echo $WINCE_SDK_DIR
263     ac_exeext=.exe
265     _pwdw=`pwd -W`
266     _pwd=`pwd`
267     make WINCE_SDK_DIR="$WINCE_SDK_DIR" TOPSRCDIR="$srcdir" OBJDIR="$_pwdw" -C $srcdir/build/wince/tools
269     CC="$_pwd/dist/sdk/bin/arm-wince-gcc"
270     CXX="$_pwd/dist/sdk/bin/arm-wince-gcc"
271     CPP="$_pwd/dist/sdk/bin/arm-wince-gcc -E -nologo"
272     CXXCPP="$_pwd/dist/sdk/bin/arm-wince-gcc -TP -E -nologo"
273     LD="$_pwd/dist/sdk/bin/arm-wince-link"
274     AR="$_pwd/dist/sdk/bin/arm-wince-lib"
275     AS="$_pwd/dist/sdk/bin/arm-wince-as"
276     RC="$_pwd/dist/sdk/bin/arm-wince-res"
279     echo -----------------------------------------------------------------------------
281     ;;
282 esac
284 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
285     echo "cross compiling from $host to $target"
286     cross_compiling=yes
288     _SAVE_CC="$CC"
289     _SAVE_CFLAGS="$CFLAGS"
290     _SAVE_LDFLAGS="$LDFLAGS"
292     AC_MSG_CHECKING([for host c compiler])
293     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
294     if test -z "$HOST_CC"; then
295         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
296     fi
297     AC_MSG_RESULT([$HOST_CC])
298     AC_MSG_CHECKING([for host c++ compiler])
299     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
300     if test -z "$HOST_CXX"; then
301         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
302     fi
303     AC_MSG_RESULT([$HOST_CXX])
305     if test -z "$HOST_CFLAGS"; then
306         HOST_CFLAGS="$CFLAGS"
307     fi
308     if test -z "$HOST_CXXFLAGS"; then
309         HOST_CXXFLAGS="$CXXFLAGS"
310     fi
311     if test -z "$HOST_LDFLAGS"; then
312         HOST_LDFLAGS="$LDFLAGS"
313     fi
314     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
315     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
316     CC="$HOST_CC"
317     CFLAGS="$HOST_CFLAGS"
318     LDFLAGS="$HOST_LDFLAGS"
320     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
321     AC_TRY_COMPILE([], [return(0);], 
322         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
323         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
325     CC="$HOST_CXX"
326     CFLAGS="$HOST_CXXFLAGS"
328     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
329     AC_TRY_COMPILE([], [return(0);], 
330         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
331         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
332     
333     CC=$_SAVE_CC
334     CFLAGS=$_SAVE_CFLAGS
335     LDFLAGS=$_SAVE_LDFLAGS
337     case "$build:$target" in
338       powerpc-apple-darwin8*:i?86-apple-darwin*)
339         dnl The Darwin cross compiler doesn't necessarily point itself at a
340         dnl root that has libraries for the proper architecture, it defaults
341         dnl to the system root.  The libraries in the system root on current
342         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
343         dnl checks will fail.  Fake a working SDK in that case.
344         _SAVE_CFLAGS=$CFLAGS
345         _SAVE_CXXFLAGS=$CXXLAGS
346         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
347         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
348         ;;
349     esac
351     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
352     unset ac_cv_prog_CC
353     AC_PROG_CC
354     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
355     unset ac_cv_prog_CXX
356     AC_PROG_CXX
358     case "$build:$target" in
359       powerpc-apple-darwin8*:i?86-apple-darwin*)
360         dnl Revert the changes made above.  From this point on, the target
361         dnl compiler will never be used without applying the SDK to CFLAGS
362         dnl (see --with-macos-sdk below).
363         CFLAGS=$_SAVE_CFLAGS
364         CXXFLAGS=$_SAVE_CXXFLAGS
365         ;;
366     esac
368     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
369     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
370     AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
371     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
372     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
373     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
374     AC_DEFINE(CROSS_COMPILE)
375 else
376     AC_PROG_CC
377     AC_PROG_CXX
378     AC_PROG_RANLIB
379     AC_PATH_PROGS(AS, $AS as, $CC)
380     AC_CHECK_PROGS(AR, ar, :)
381     AC_CHECK_PROGS(LD, ld, :)
382     AC_CHECK_PROGS(STRIP, strip, :)
383     AC_CHECK_PROGS(WINDRES, windres, :)
384     if test -z "$HOST_CC"; then
385         HOST_CC="$CC"
386     fi
387     if test -z "$HOST_CFLAGS"; then
388         HOST_CFLAGS="$CFLAGS"
389     fi
390     if test -z "$HOST_CXX"; then
391         HOST_CXX="$CXX"
392     fi
393     if test -z "$HOST_CXXFLAGS"; then
394         HOST_CXXFLAGS="$CXXFLAGS"
395     fi
396     if test -z "$HOST_LDFLAGS"; then
397         HOST_LDFLAGS="$LDFLAGS"
398     fi
399     if test -z "$HOST_RANLIB"; then
400         HOST_RANLIB="$RANLIB"
401     fi
402     if test -z "$HOST_AR"; then
403        HOST_AR="$AR"
404     fi
407 GNU_AS=
408 GNU_LD=
409 GNU_CC=
410 GNU_CXX=
411 CC_VERSION='N/A'
412 CXX_VERSION='N/A'
413 if test "$GCC" = "yes"; then
414     GNU_CC=1
415     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
417 if test "$GXX" = "yes"; then
418     GNU_CXX=1
419     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
421 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
422     GNU_AS=1
424 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
425     GNU_LD=1
427 if test "$GNU_CC"; then
428     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
429         GCC_USE_GNU_LD=1
430     fi
433 INTEL_CC=
434 INTEL_CXX=
435 if test "$GCC" = yes; then
436    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
437      INTEL_CC=1
438    fi
441 if test "$GXX" = yes; then
442    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
443      INTEL_CXX=1
444    fi
447 dnl Special win32 checks
448 dnl ========================================================
449 case "$target" in
450 *-wince)
451     WINVER=500
452     ;;
454     if test -n "$GNU_CC"; then  
455         WINVER=501
456     else    
457         WINVER=500
458     fi
459     ;;
460 esac
462 MOZ_ARG_WITH_STRING(windows-version,
463 [  --with-windows-version=WINVER
464                           Minimum Windows version (WINVER) to support
465                               400: Windows 95
466                               500: Windows 2000
467                               501: Windows XP],
468   WINVER=$withval)
470 case "$WINVER" in
471 400|500|501)
472     ;;
475     AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
476     ;;
478 esac
480 case "$target" in
481 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
482     if test "$GCC" != "yes"; then
483         # Check to see if we are really running in a msvc environemnt
484         _WIN32_MSVC=1
485         AC_CHECK_PROGS(MIDL, midl)
487         # Make sure compilers are valid
488         CFLAGS="$CFLAGS -TC -nologo"
489         CXXFLAGS="$CXXFLAGS -TP -nologo"
490         AC_LANG_SAVE
491         AC_LANG_C
492         AC_TRY_COMPILE([#include <stdio.h>],
493             [ printf("Hello World\n"); ],,
494             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
496         AC_LANG_CPLUSPLUS
497         AC_TRY_COMPILE([#include <new.h>],
498             [ unsigned *test = new unsigned(42); ],,
499             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
500         AC_LANG_RESTORE
501         
502         changequote(,)
503         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
504         changequote([,])
505         
506         # Determine compiler version
507         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
508         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
509         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
510         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
511         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
512         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
514         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
515         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
517         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
518             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
519         fi
520         if test "$_CC_MAJOR_VERSION" = "12"; then
521             _CC_SUITE=6
522         elif test "$_CC_MAJOR_VERSION" = "13"; then
523             _CC_SUITE=7
524         elif test "$_CC_MAJOR_VERSION" = "14"; then
525             _CC_SUITE=8
526             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
527             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
528             dnl so be very specific here!
529             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
530             if test $_CC_RELEASE -gt 50727; then
531                _USE_DYNAMICBASE=1
532             elif test $_CC_BUILD -ge 762; then
533                _USE_DYNAMICBASE=1
534             fi
535             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
536             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
537         elif test "$_CC_MAJOR_VERSION" = "15"; then
538             _CC_SUITE=9
539             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
540             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
541             _USE_DYNAMICBASE=1
542             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
543             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
544         else
545             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
546         fi
548         _MOZ_RTTI_FLAGS_ON='-GR'
549         _MOZ_RTTI_FLAGS_OFF='-GR-'
550         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
551         _MOZ_EXCEPTIONS_FLAGS_OFF=''
553         if test -n "$WIN32_REDIST_DIR"; then
554             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
555         fi
556         
557         # bug #249782
558         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
559         if test "$_CC_SUITE" -ge "8"; then
560                 changequote(,)
561                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
562                 changequote([,])
564                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
565                 if test -n "$MSMT_TOOL"; then
566                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
567                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
568                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
569                         fi
570                         MSMANIFEST_TOOL=1
571                         unset MSMT_TOOL
572                 else
573                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
574                 fi
575         fi
577         # Check linker version
578         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
579         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
580         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
581             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
582         fi
583         INCREMENTAL_LINKER=1
585         # Check midl version
586         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
587         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
588         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
589         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
590         # Add flags if necessary
591         AC_MSG_CHECKING([for midl flags])
592         case "$target" in
593         i*86-*)
594             if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
595                 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
596                 # MIDL version 7.00.0500 or later has no problem.
597                 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
598                 AC_MSG_RESULT([need -env win32])
599             else
600                 AC_MSG_RESULT([none needed])
601             fi
602             ;;
603         *)
604             AC_MSG_RESULT([none needed])
605             ;;
606         esac
608         unset _MSVC_VER_FILTER
610     else
611         # Check w32api version
612         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
613         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
614         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
615         AC_TRY_COMPILE([#include <w32api.h>],
616             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
617                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
618                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
619                 #error "test failed."
620             #endif
621             , [ res=yes ], [ res=no ])
622         AC_MSG_RESULT([$res])
623         if test "$res" != "yes"; then
624             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
625         fi
626         # Check windres version
627         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
628         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
629         AC_MSG_RESULT([$_WINDRES_VERSION])
630         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
631         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
632         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
633         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
634         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
635         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
636         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
637                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
638                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
639                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
640                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
641                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
642         then
643             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
644         fi
645     fi # !GNU_CC
647     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
648     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
649     # Require OS features provided by IE 5.0
650     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
651     ;;
652 esac
654 dnl Test breaks icc on OS/2 && MSVC
655 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
656     AC_PROG_CC_C_O
657     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
658         USING_HCC=1
659         _OLDCC=$CC
660         _OLDCXX=$CXX
661         CC="${srcdir}/build/hcc '$CC'"
662         CXX="${srcdir}/build/hcpp '$CXX'"
663     fi
666 AC_PROG_CPP
667 AC_PROG_CXXCPP
669 if test -n "$_WIN32_MSVC"; then
670     SKIP_PATH_CHECKS=1
671     SKIP_COMPILER_CHECKS=1
672     SKIP_LIBRARY_CHECKS=1
674     # Since we're skipping compiler and library checks, hard-code
675     # some facts here.
676     case "$target" in
677     *-wince)
678         ;;
679     *)
680         AC_DEFINE(HAVE_IO_H)
681         AC_DEFINE(HAVE_SETBUF)
682         AC_DEFINE(HAVE_ISATTY)
683         ;;
684     esac
687 fi # COMPILE_ENVIRONMENT
689 AC_SUBST(MIDL_FLAGS)
690 AC_SUBST(_MSC_VER)
692 AC_SUBST(GNU_AS)
693 AC_SUBST(GNU_LD)
694 AC_SUBST(GNU_CC)
695 AC_SUBST(GNU_CXX)
696 AC_SUBST(INTEL_CC)
697 AC_SUBST(INTEL_CXX)
699 dnl ========================================================
700 dnl Checks for programs.
701 dnl ========================================================
702 AC_PROG_INSTALL
703 AC_PROG_LN_S
704 AC_PATH_PROGS(PERL, $PERL perl5 perl )
705 if test -z "$PERL" || test "$PERL" = ":"; then
706     AC_MSG_ERROR([perl not found in \$PATH])
709 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
710 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
711 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
712 _perl_res=$?
713 AC_MSG_RESULT([$_perl_version])
715 if test "$_perl_res" != 0; then
716     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
720 AC_MSG_CHECKING([for full perl installation])
721 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
722 _perl_res=$?
723 if test "$_perl_res" != 0; then
724     AC_MSG_RESULT([no])
725     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
726 else
727     AC_MSG_RESULT([yes])    
730 AC_PATH_PROGS(PYTHON, $PYTHON python)
731 if test -z "$PYTHON"; then
732     AC_MSG_ERROR([python was not found in \$PATH])
735 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
736 if test -z "$COMPILE_ENVIRONMENT"; then
737 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
738     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
741 AC_SUBST(NSINSTALL_BIN)
743 AC_PATH_PROG(DOXYGEN, doxygen, :)
744 AC_PATH_PROG(WHOAMI, whoami, :)
745 AC_PATH_PROG(AUTOCONF, autoconf, :)
746 AC_PATH_PROG(UNZIP, unzip, :)
747 AC_PATH_PROGS(ZIP, zip)
748 if test -z "$ZIP" || test "$ZIP" = ":"; then
749     AC_MSG_ERROR([zip not found in \$PATH])
751 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
752 AC_PATH_PROG(XARGS, xargs)
753 if test -z "$XARGS" || test "$XARGS" = ":"; then
754     AC_MSG_ERROR([xargs not found in \$PATH .])
757 if test "$COMPILE_ENVIRONMENT"; then
759 dnl ========================================================
760 dnl = Mac OS X toolchain support
761 dnl ========================================================
763 case "$target_os" in
764 darwin*)
765     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
766     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
767     dnl the environment and includedir purposes (when using an SDK, below),
768     dnl but remember the full version number for the libdir (SDK).
769     changequote(,)
770     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
771     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
772     changequote([,])
773     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
774         dnl Bug 280479, but this keeps popping up in bug 292530 too because
775         dnl 4.0.0/4061 is the default compiler in Tiger.
776         changequote(,)
777         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
778         changequote([,])
779         if test "$GCC_BUILD" = "4061" ; then
780             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
781 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
782 from building Mozilla. Upgrade to Xcode 2.1 or later.])
783         fi
784     fi
786     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
787     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
788     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
789     AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
791     case "$PBBUILD" in
792       *xcodebuild*)
793         changequote(,)
794         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
795         changequote([,])
796         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
797           HAS_XCODE_2_1=1;
798         fi
799       ;;
800     esac
802     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
803     dnl it has moved into /usr/bin.
804     AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
805     ;;
806 esac
808 AC_SUBST(GCC_VERSION)
809 AC_SUBST(XCODEBUILD_VERSION)
810 AC_SUBST(HAS_XCODE_2_1)
812 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
813 dnl that a universal binary is being produced.
814 AC_SUBST(UNIVERSAL_BINARY)
816 dnl ========================================================
817 dnl Check for MacOS deployment target version
818 dnl ========================================================
820 MOZ_ARG_ENABLE_STRING(macos-target,
821                       [  --enable-macos-target=VER (default=10.4)
822                           Set the minimum MacOS version needed at runtime],
823                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
825 case "$target" in
826 *-darwin*)
827     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
828         dnl Use the specified value
829         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
830         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
831     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
832         dnl No value specified on the command line or in the environment,
833         dnl use the lesser of the application's minimum or the architecture's
834         dnl minimum.
835         export MACOSX_DEPLOYMENT_TARGET=10.4
836     fi
837     ;;
838 esac
840 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
842 dnl ========================================================
843 dnl = Mac OS X SDK support
844 dnl ========================================================
845 MACOS_SDK_DIR=
846 NEXT_ROOT=
847 MOZ_ARG_WITH_STRING(macos-sdk,
848 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
849     MACOS_SDK_DIR=$withval)
851 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
852 dnl NEXT_ROOT will be set and exported only if it's needed.
853 AC_SUBST(MACOS_SDK_DIR)
854 AC_SUBST(NEXT_ROOT)
856 if test "$MACOS_SDK_DIR"; then
857   dnl Sync this section with the ones in NSPR and NSS.
858   dnl Changes to the cross environment here need to be accounted for in
859   dnl the libIDL checks (below) and xpidl build.
861   if test ! -d "$MACOS_SDK_DIR"; then
862     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
863 specify a valid SDK.  SDKs are installed when the optional cross-development
864 tools are selected during the Xcode/Developer Tools installation.])
865   fi
867   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
868   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
869     SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include -F${MACOS_SDK_DIR}/System/Library/Frameworks"
870     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
871       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
872     fi
873     SDK_CXX_INCLUDE="-I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward"
875     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
876     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
878     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
879     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
880     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
882     dnl ld support for -syslibroot is compiler-agnostic, but only available
883     dnl on Tiger.  Although it's possible to switch on the build host's
884     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
885     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
886     dnl set because both the compiler and linker use it.
887     LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib $LIBS"
888     export NEXT_ROOT=$MACOS_SDK_DIR
890     if test -n "$CROSS_COMPILE" ; then
891       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
892       dnl the build host.  HOST_CXX is presently unused.
893       HOST_CC="NEXT_ROOT= $HOST_CC"
894       HOST_CXX="NEXT_ROOT= $HOST_CXX"
895     fi
896   else
897     dnl gcc >= 4.0 uses different paths than above, but knows how to find
898     dnl them itself.
899     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
900     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
902     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
903     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
904     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
906     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
907       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
908       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
909       dnl be ignored and cause warnings when -syslibroot is specified.
910       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
911       dnl the -isysroot it receives, so this is only needed with 4.0.0.
912       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
913     fi
914   fi
916   AC_LANG_SAVE
917   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
918   AC_LANG_CPLUSPLUS
919   AC_TRY_COMPILE([#include <new>
920                  int main() { return 0; }],
921    result=yes,
922    result=no)
923   AC_LANG_RESTORE
924   AC_MSG_RESULT($result)
926   if test "$result" = "no" ; then
927     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
928   fi
931 fi # COMPILE_ENVIRONMENT
933 dnl Be sure the make we use is GNU make.
934 dnl on win32, gmake.exe is the generally the wrong version
935 case "$host_os" in
936 cygwin*|mingw*|mks*|msvc*)
937     AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
938     ;;
940     AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
941     ;;
942 esac
943 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
944 if test ! "$_make_try"
945 then
946         echo
947         echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
948         echo
949         exit 1
951 dnl Now exit if version if < MAKE_VERSION
952 rm -f dummy.mk
953 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
954 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
955 rm -f dummy.mk
956 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
957 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
958 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
959 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
960 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
961    test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
962         "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
963    AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
965 AC_SUBST(MAKE)
967 if test "$COMPILE_ENVIRONMENT"; then
969 AC_PATH_XTRA
971 dnl Check in X11 include directory too.
972 if test "$no_x" != "yes"; then
973     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
976 XCFLAGS="$X_CFLAGS"
978 fi # COMPILE_ENVIRONMENT
980 dnl ========================================================
981 dnl set the defaults first
982 dnl ========================================================
983 AS_BIN=$AS
984 AR_FLAGS='cr $@'
985 AR_LIST='$(AR) t'
986 AR_EXTRACT='$(AR) x'
987 AR_DELETE='$(AR) d'
988 AS='$(CC)'
989 AS_DASH_C_FLAG='-c'
990 DLL_PREFIX=lib
991 LIB_PREFIX=lib
992 DLL_SUFFIX=.so
993 OBJ_SUFFIX=o
994 LIB_SUFFIX=a
995 ASM_SUFFIX=s
996 IMPORT_LIB_SUFFIX=
997 TARGET_MD_ARCH=unix
998 DIRENT_INO=d_ino
999 CYGWIN_WRAPPER=
1000 WIN_TOP_SRC=
1001 MOZ_USER_DIR=".mozilla"
1002 HOST_AR='$(AR)'
1003 HOST_AR_FLAGS='$(AR_FLAGS)'
1005 MOZ_JPEG_CFLAGS=
1006 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1007 MOZ_ZLIB_CFLAGS=
1008 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1009 MOZ_BZ2_CFLAGS=
1010 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1011 MOZ_PNG_CFLAGS=
1012 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1014 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1015 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
1016 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1017 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
1018 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1019 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1020 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1022 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1023 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
1025 USE_DEPENDENT_LIBS=1
1027 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1028 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
1030 MOZ_ENABLE_POSTSCRIPT=1 
1032 if test -n "$CROSS_COMPILE"; then
1033     OS_TARGET="${target_os}"
1034     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1035     OS_RELEASE=
1036     case "${target_os}" in
1037         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1038         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1039         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1040         mingw*)       OS_ARCH=WINNT ;;
1041         wince*)       OS_ARCH=WINCE ;;
1042         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1043     esac
1044 else
1045     OS_TARGET=`uname -s`
1046     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1047     OS_RELEASE=`uname -r`
1050 # Before this used `uname -m` when not cross compiling
1051 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1052 OS_TEST="${target_cpu}"
1054 _COMPILER_PREFIX=
1056 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1058 #######################################################################
1059 # Master "Core Components" macros for getting the OS target           #
1060 #######################################################################
1063 # Note: OS_TARGET should be specified on the command line for gmake.
1064 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
1065 # The difference between the Win95 target and the WinNT target is that
1066 # the WinNT target uses Windows NT specific features not available
1067 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1068 # at lesser performance (the Win95 target uses threads; the WinNT target
1069 # uses fibers).
1071 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1072 # cross-compilation.
1076 # The following hack allows one to build on a WIN95 machine (as if
1077 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1078 # It also accomodates for MKS's uname.exe.  If you never intend
1079 # to do development on a WIN95 machine, you don't need this hack.
1081 case "$OS_ARCH" in
1082 WIN95)
1083     OS_ARCH=WINNT
1084     OS_TARGET=WIN95
1085     ;;
1086 Windows_95)
1087     OS_ARCH=Windows_NT
1088     OS_TARGET=WIN95
1089     ;;
1090 Windows_98)
1091     OS_ARCH=Windows_NT
1092     OS_TARGET=WIN95
1093     ;;
1094 CYGWIN_9*|CYGWIN_ME*)
1095     OS_ARCH='CYGWIN_NT-4.0'
1096     OS_TARGET=WIN95
1097     ;;
1098 esac
1101 # Define and override various archtecture-specific variables, including
1102 # HOST_OS_ARCH
1103 # OS_ARCH
1104 # OS_TEST
1105 # OS_TARGET
1106 # OS_RELEASE
1107 # OS_MINOR_RELEASE
1110 case "$HOST_OS_ARCH" in
1111 cygwin*|mingw*|mks*|msvc*)
1112     HOST_OS_ARCH=WINNT
1113     ;;
1114 linux*)
1115     HOST_OS_ARCH=Linux
1116     ;;
1117 solaris*)
1118     HOST_OS_ARCH=SunOS
1119     SOLARIS_SUNPRO_CC=
1120     SOLARIS_SUNPRO_CXX=
1121     if test -z "$GNU_CC"; then
1122         if test "`$_SUBDIR_CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1123             SOLARIS_SUNPRO_CC=1
1124        fi
1125     fi
1127     if test -z "$GNU_CXX"; then
1128        if test "`$_SUBDIR_CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1129            SOLARIS_SUNPRO_CXX=1
1130        fi
1131     fi
1132     AC_SUBST(SOLARIS_SUNPRO_CC)
1133     AC_SUBST(SOLARIS_SUNPRO_CXX)
1134     ;;
1135 BSD_386)
1136     HOST_OS_ARCH=BSD
1137     ;;
1138 dgux)
1139     HOST_OS_ARCH=DGUX
1140     ;;
1141 IRIX64)
1142     HOST_OS_ARCH=IRIX
1143     ;;
1144 UNIX_SV)
1145     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1146         HOST_OS_ARCH=NCR
1147     else
1148         HOST_OS_ARCH=UNIXWARE
1149     fi
1150     ;;
1151 ncr)
1152     HOST_OS_ARCH=NCR
1153     ;;
1154 UNIX_SYSTEM_V)
1155     HOST_OS_ARCH=NEC
1156     ;;
1157 OSF1)
1158     ;;
1159 *OpenVMS*)
1160     HOST_OS_ARCH=OpenVMS
1161     ;;
1162 OS_2)
1163     HOST_OS_ARCH=OS2
1164     ;;
1165 QNX)
1166     ;;
1167 SCO_SV)
1168     HOST_OS_ARCH=SCOOS
1169     ;;
1170 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1171     HOST_OS_ARCH=SINIX
1172     ;;
1173 UnixWare)
1174     HOST_OS_ARCH=UNIXWARE
1175     ;;
1176 esac
1178 case "$OS_ARCH" in
1179 WINNT)
1180     OS_TEST=`uname -p`
1181     ;;
1182 Windows_NT)
1184 # If uname -s returns "Windows_NT", we assume that we are using
1185 # the uname.exe in MKS toolkit.
1187 # The -r option of MKS uname only returns the major version number.
1188 # So we need to use its -v option to get the minor version number.
1189 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1191     OS_ARCH=WINNT
1192     OS_TARGET=WINNT
1193     OS_MINOR_RELEASE=`uname -v`
1194     if test "$OS_MINOR_RELEASE" = "00"; then
1195         OS_MINOR_RELEASE=0
1196     fi
1197     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1198     ;;
1199 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1201 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1202 # the uname.exe in the Cygwin tools.
1203 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1204 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1205 # the uname.exe in the GNU-Win32 tools.
1206 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1207 # the uname.exe in the MSYS tools.
1209     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1210     OS_ARCH=WINNT
1211     OS_TARGET=WINNT
1212     ;;
1213 AIX)
1214     OS_RELEASE=`uname -v`.`uname -r`
1215     OS_TEST=${target_cpu}
1216     ;;
1217 BSD_386)
1218     OS_ARCH=BSD
1219     ;;
1220 dgux)
1221     OS_ARCH=DGUX
1222     ;;
1223 IRIX64)
1224     OS_ARCH=IRIX
1225     ;;
1226 UNIX_SV)
1227     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1228         OS_ARCH=NCR
1229     else
1230         OS_ARCH=UNIXWARE
1231         OS_RELEASE=`uname -v`
1232     fi
1233     ;;
1234 ncr)
1235     OS_ARCH=NCR
1236     ;;
1237 UNIX_SYSTEM_V)
1238     OS_ARCH=NEC
1239     ;;
1240 OSF1)
1241     case `uname -v` in
1242     148)
1243         OS_RELEASE=V3.2C
1244         ;;
1245     564)
1246         OS_RELEASE=V4.0B
1247         ;;
1248     878)
1249         OS_RELEASE=V4.0D
1250         ;;
1251     esac
1252     ;;
1253 *OpenVMS*)
1254     OS_ARCH=OpenVMS
1255     OS_RELEASE=`uname -v`
1256     OS_TEST=`uname -p`
1257     ;;
1258 OS_2)
1259     OS_ARCH=OS2
1260     OS_TARGET=OS2
1261     OS_RELEASE=`uname -v`
1262     ;;
1263 QNX)
1264     if test "$OS_TARGET" != "NTO"; then
1265         changequote(,)
1266         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1267         changequote([,])
1268     fi
1269     OS_TEST=x86
1270     ;;
1271 SCO_SV)
1272     OS_ARCH=SCOOS
1273     OS_RELEASE=5.0
1274     ;;
1275 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1276     OS_ARCH=SINIX
1277     OS_TEST=`uname -p`
1278     ;;
1279 UnixWare)
1280     OS_ARCH=UNIXWARE
1281     OS_RELEASE=`uname -v`
1282     ;;
1283 WINCE)
1284     OS_ARCH=WINCE
1285     OS_TARGET=WINCE
1286     ;;
1287 Darwin)
1288     case "${target_cpu}" in
1289     powerpc*)
1290         OS_TEST=ppc
1291         ;;
1292     i*86*)
1293         OS_TEST=i386 
1294         ;;
1295     x86_64)
1296         OS_TEST=x86_64
1297         ;;
1298     *)
1299         if test -z "$CROSS_COMPILE" ; then
1300             OS_TEST=`uname -p`
1301         fi
1302         ;;
1303     esac
1304     ;;
1305 esac
1307 if test "$OS_ARCH" = "NCR"; then
1308     changequote(,)
1309     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1310     changequote([,])
1313 # Only set CPU_ARCH if we recognize the value of OS_TEST
1315 case "$OS_TEST" in
1316 *86 | i86pc)
1317     CPU_ARCH=x86
1318     ;;
1320 powerpc* | ppc | rs6000)
1321     CPU_ARCH=ppc
1322     ;;
1324 Alpha | alpha | ALPHA)
1325     CPU_ARCH=Alpha
1326     ;;
1328 hppa* | parisc)
1329     CPU_ARCH=hppa
1330     ;;
1332 sun4u | sparc*)
1333     CPU_ARCH=sparc
1334     ;;
1336 x86_64 | ia64)
1337     CPU_ARCH="$OS_TEST"
1338     ;;
1339 esac
1341 if test -z "$OS_TARGET"; then
1342     OS_TARGET=$OS_ARCH
1344 if test "$OS_TARGET" = "WIN95"; then
1345     OS_RELEASE="4.0"
1347 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1349 dnl ========================================================
1350 dnl GNU specific defaults
1351 dnl ========================================================
1352 if test "$GNU_CC"; then
1353     # FIXME: Let us build with strict aliasing. bug 414641.
1354     CFLAGS="$CFLAGS -fno-strict-aliasing"
1355     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1356     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1357     DSO_LDOPTS='-shared'
1358     if test "$GCC_USE_GNU_LD"; then
1359         # Don't allow undefined symbols in libraries
1360         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1361     fi
1362     WARNINGS_AS_ERRORS='-Werror'
1363     DSO_CFLAGS=''
1364     DSO_PIC_CFLAGS='-fPIC'
1365     ASFLAGS="$ASFLAGS -fPIC"
1366     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1367     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1368     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1369     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1371     # Turn on GNU specific features
1372     # -Wall - turn on all warnings
1373     # -pedantic - make compiler warn about non-ANSI stuff, and
1374     #             be a little bit stricter
1375     # Warnings slamm took out for now (these were giving more noise than help):
1376     # -Wbad-function-cast - warns when casting a function to a new return type
1377     # -Wshadow - removed because it generates more noise than help --pete
1378     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1379     if test -z "$INTEL_CC"; then
1380        # Don't use -Wcast-align with ICC
1381        case "$CPU_ARCH" in
1382            # And don't use it on hppa, ia64, sparc, since it's noisy there
1383            hppa | ia64 | sparc)
1384            ;;
1385            *)
1386         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1387            ;;
1388        esac
1389     fi
1391     dnl Turn pedantic on but disable the warnings for long long
1392     _PEDANTIC=1
1394     if test -z "$INTEL_CC"; then
1395       _IGNORE_LONG_LONG_WARNINGS=1
1396       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1397     else
1398       _IGNORE_LONG_LONG_WARNINGS=
1399     fi
1402     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1403     _USE_CPP_INCLUDE_FLAG=1
1404 elif test "$SOLARIS_SUNPRO_CC"; then
1405     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1406     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1408     DSO_LDOPTS='-shared'
1409     if test "$GNU_LD"; then
1410         # Don't allow undefined symbols in libraries
1411         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1412     fi
1414     DSO_CFLAGS=''
1415     if test "$CPU_ARCH" = "sparc"; then
1416         # for Sun Studio on Solaris/SPARC
1417         DSO_PIC_CFLAGS='-xcode=pic32'
1418     else
1419         DSO_PIC_CFLAGS='-KPIC'
1420     fi
1421     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1422 else
1423     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1424     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1426     DSO_LDOPTS='-shared'
1427     if test "$GNU_LD"; then
1428         # Don't allow undefined symbols in libraries
1429         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1430     fi
1432     DSO_CFLAGS=''
1433     DSO_PIC_CFLAGS='-KPIC'
1434     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1437 if test "$GNU_CXX"; then
1438     # FIXME: Let us build with strict aliasing. bug 414641.
1439     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1440     # Turn on GNU specific features
1441     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1442     if test -z "$INTEL_CC"; then
1443        # Don't use -Wcast-align with ICC
1444        case "$CPU_ARCH" in
1445            # And don't use it on hppa, ia64, sparc, since it's noisy there
1446            hppa | ia64 | sparc)
1447            ;;
1448            *)
1449         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1450            ;;
1451        esac
1452     fi
1454     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1455     _USE_CPP_INCLUDE_FLAG=1
1457     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1458                    ac_has_wno_invalid_offsetof,
1459         [
1460             AC_LANG_SAVE
1461             AC_LANG_CPLUSPLUS
1462             _SAVE_CXXFLAGS="$CXXFLAGS"
1463             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1464             AC_TRY_COMPILE([],
1465                            [return(0);],
1466                            ac_has_wno_invalid_offsetof="yes",
1467                            ac_has_wno_invalid_offsetof="no")
1468             CXXFLAGS="$_SAVE_CXXFLAGS"
1469             AC_LANG_RESTORE
1470         ])
1471     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1472         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1473     fi
1474 else
1475     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1478 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1479 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1480 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1481 dnl normal behavior.
1482 dnl ========================================================
1483 MKSHLIB_FORCE_ALL=
1484 MKSHLIB_UNFORCE_ALL=
1486 if test "$COMPILE_ENVIRONMENT"; then
1487 if test "$GNU_CC"; then
1488   AC_MSG_CHECKING(whether ld has archive extraction flags)
1489   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1490    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1491     ac_cv_mkshlib_force_and_unforce="no"
1492     exec 3<&0 <<LOOP_INPUT
1493         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1494         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1495         force="-Wl,-all";              unforce="-Wl,-none"
1496 LOOP_INPUT
1497     while read line
1498     do
1499       eval $line
1500       LDFLAGS=$force
1501       LIBS=$unforce
1502       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1503     done
1504     exec 0<&3 3<&-
1505     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1506    ])
1507   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1508     AC_MSG_RESULT(no)
1509   else
1510     AC_MSG_RESULT(yes)
1511     eval $ac_cv_mkshlib_force_and_unforce
1512     MKSHLIB_FORCE_ALL=$force
1513     MKSHLIB_UNFORCE_ALL=$unforce
1514   fi
1515 fi # GNU_CC
1516 fi # COMPILE_ENVIRONMENT
1518 dnl =================================================================
1519 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1520 dnl which is bad when cross compiling.
1521 dnl =================================================================
1522 if test "$COMPILE_ENVIRONMENT"; then
1523 configure_static_assert_macros='
1524 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1525 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1526 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1529 dnl test that the macros actually work:
1530 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1531 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1532  [AC_LANG_SAVE
1533   AC_LANG_C
1534   ac_cv_static_assertion_macros_work="yes"
1535   AC_TRY_COMPILE([$configure_static_assert_macros],
1536                  [CONFIGURE_STATIC_ASSERT(1)],
1537                  ,
1538                  ac_cv_static_assertion_macros_work="no")
1539   AC_TRY_COMPILE([$configure_static_assert_macros],
1540                  [CONFIGURE_STATIC_ASSERT(0)],
1541                  ac_cv_static_assertion_macros_work="no",
1542                  )
1543   AC_LANG_CPLUSPLUS
1544   AC_TRY_COMPILE([$configure_static_assert_macros],
1545                  [CONFIGURE_STATIC_ASSERT(1)],
1546                  ,
1547                  ac_cv_static_assertion_macros_work="no")
1548   AC_TRY_COMPILE([$configure_static_assert_macros],
1549                  [CONFIGURE_STATIC_ASSERT(0)],
1550                  ac_cv_static_assertion_macros_work="no",
1551                  )
1552   AC_LANG_RESTORE
1553  ])
1554 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1555 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1556     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1558 fi # COMPILE_ENVIRONMENT
1560 dnl ========================================================
1561 dnl Checking for 64-bit OS
1562 dnl ========================================================
1563 if test "$COMPILE_ENVIRONMENT"; then
1564 AC_LANG_SAVE
1565 AC_LANG_C
1566 AC_MSG_CHECKING(for 64-bit OS)
1567 AC_TRY_COMPILE([$configure_static_assert_macros],
1568                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1569                result="yes", result="no")
1570 AC_MSG_RESULT("$result")
1571 if test "$result" = "yes"; then
1572     AC_DEFINE(HAVE_64BIT_OS)
1573     HAVE_64BIT_OS=1
1575 AC_SUBST(HAVE_64BIT_OS)
1576 AC_LANG_RESTORE
1577 fi # COMPILE_ENVIRONMENT
1579 dnl ========================================================
1580 dnl Enable high-memory support on OS/2 by default.
1581 dnl ========================================================
1582 MOZ_OS2_HIGH_MEMORY=1
1583 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1584 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1585     MOZ_OS2_HIGH_MEMORY=,
1586     MOZ_OS2_HIGH_MEMORY=1 )
1587 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1589 dnl ========================================================
1590 dnl System overrides of the defaults for host
1591 dnl ========================================================
1592 case "$host" in
1593 *-beos*)
1594     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1595     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1596     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1597     ;;
1599 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1600     if test -n "$_WIN32_MSVC"; then
1601         HOST_AR=lib
1602         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1603         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1604         HOST_RANLIB='echo ranlib'
1605     else
1606         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1607     fi
1608     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1609     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1610     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1611     HOST_BIN_SUFFIX=.exe
1612     case "$host" in
1613     *mingw*)
1614     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1615         ;;
1616     *)
1617         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1618         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1619             _pwd=`pwd`
1620             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1621         fi
1622         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1623             AS_PERL=1
1624             PERL="${CYGWIN_WRAPPER} $PERL"
1625         fi
1627         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1628             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1629         fi
1630         ;;
1631     esac
1632     ;;
1634 *-darwin*)
1635     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1636     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1637     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1638     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1639     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1640     ;;
1642 *-linux*|*-kfreebsd*-gnu)
1643     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1644     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1645     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1646     ;;
1648 *os2*)
1649     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1650     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1651     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1652     HOST_BIN_SUFFIX=.exe
1653     MOZ_FIX_LINK_PATHS=
1654     ;;
1656 *-osf*)
1657     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1658     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1659     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1660     ;;
1663     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1664     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1665     ;;
1666 esac
1668 dnl Get mozilla version from central milestone file
1669 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1671 dnl Get version of various core apps from the version files.
1672 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1674 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1675 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1677 dnl ========================================================
1678 dnl System overrides of the defaults for target
1679 dnl ========================================================
1681 case "$target" in
1682 *-aix*)
1683     AC_DEFINE(AIX)
1684     if test ! "$GNU_CC"; then
1685         if test ! "$HAVE_64BIT_OS"; then
1686             # Compiling with Visual Age C++ object model compat is the
1687             # default. To compile with object model ibm, add 
1688             # AIX_OBJMODEL=ibm to .mozconfig.
1689             if test "$AIX_OBJMODEL" = "ibm"; then
1690                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1691             else
1692                 AIX_OBJMODEL=compat
1693             fi
1694         else
1695             AIX_OBJMODEL=compat
1696         fi
1697         AC_SUBST(AIX_OBJMODEL)
1698         DSO_LDOPTS='-qmkshrobj=1'
1699         DSO_CFLAGS='-qflag=w:w'
1700         DSO_PIC_CFLAGS=
1701         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1702         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1703         MOZ_FIX_LINK_PATHS=
1704         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1705         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1706         if test "$COMPILE_ENVIRONMENT"; then
1707             AC_LANG_SAVE
1708             AC_LANG_CPLUSPLUS
1709             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1710             AC_TRY_COMPILE([],
1711                 [#if (__IBMCPP__ < 600)
1712                  #error "Bad compiler"
1713                  #endif],
1714                 _BAD_COMPILER=,_BAD_COMPILER=1)
1715             if test -n "$_BAD_COMPILER"; then
1716                 AC_MSG_RESULT([no])    
1717                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1718             else
1719                 AC_MSG_RESULT([yes])    
1720             fi
1721             AC_LANG_RESTORE
1722             TARGET_COMPILER_ABI="ibmc"
1723             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1724             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1725         fi
1726     fi
1727     case "${target_os}" in
1728     aix4.1*)
1729         DLL_SUFFIX='_shr.a'
1730         ;;
1731     esac
1732     if test "$COMPILE_ENVIRONMENT"; then
1733         AC_CHECK_HEADERS(sys/inttypes.h)
1734     fi
1735     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1736     ;;
1738 *-beos*)
1739     no_x=yes
1740     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1741     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1742     DSO_LDOPTS='-nostart'
1743     TK_LIBS='-lbe -lroot'
1744     LIBS="$LIBS -lbe"
1745     if test "$COMPILE_ENVIRONMENT"; then
1746         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1747         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1748     fi
1749     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1750     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1751     _MOZ_USE_RTTI=1
1752     USE_DEPENDENT_LIBS=
1753     MOZ_USER_DIR="Mozilla"
1754     ;;
1756 *-bsdi*)
1757     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1758     _PEDANTIC=
1759     _IGNORE_LONG_LONG_WARNINGS=
1760     case $OS_RELEASE in
1761         4.*|5.*)
1762             STRIP="$STRIP -d"
1763             ;;
1764         *)
1765             DSO_CFLAGS=''
1766             DSO_LDOPTS='-r'
1767             _WARNINGS_CFLAGS="-Wall"
1768             _WARNINGS_CXXFLAGS="-Wall"
1769             # The test above doesn't work properly, at least on 3.1.
1770             MKSHLIB_FORCE_ALL=''
1771             MKSHLIB_UNFORCE_ALL=''
1772         ;;
1773     esac
1774     ;;
1776 *-darwin*) 
1777     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1778     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1779     MOZ_OPTIMIZE_FLAGS="-O2"
1780     _PEDANTIC=
1781     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1782     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1783     DLL_SUFFIX=".dylib"
1784     DSO_LDOPTS=''
1785     STRIP="$STRIP -x -S"
1786     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1787     MOZ_ENABLE_POSTSCRIPT=
1788     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1789     LDFLAGS="$LDFLAGS -framework Cocoa"
1790     # The ExceptionHandling framework is needed for Objective-C exception
1791     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1792     # builds.
1793     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1794     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1795     MACOSX=1
1797     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1798     dnl ===================================================================
1799     if test "x$enable_dtrace" = "xyes"; then
1800         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1801     else
1802         dnl check for the presence of the -dead_strip linker flag
1803         AC_MSG_CHECKING([for -dead_strip option to ld])
1804         _SAVE_LDFLAGS=$LDFLAGS
1805         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1806         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1807         if test -n "$_HAVE_DEAD_STRIP" ; then
1808             AC_MSG_RESULT([yes])
1809             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1810         else
1811             AC_MSG_RESULT([no])
1812         fi
1813         
1814         LDFLAGS=$_SAVE_LDFLAGS
1815     fi
1816     ;;
1818 *-freebsd*)
1819     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1820         DLL_SUFFIX=".so.1.0"
1821         DSO_LDOPTS="-shared"
1822     fi
1823     if test ! "$GNU_CC"; then
1824         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1825     fi
1826 # Can't have force w/o an unforce.
1827 #    # Hack for FreeBSD 2.2
1828 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1829 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1830 #       MKSHLIB_UNFORCE_ALL=''
1831 #    fi
1832     ;; 
1834 *-hpux*)
1835     DLL_SUFFIX=".sl"
1836     if test ! "$GNU_CC"; then
1837         DSO_LDOPTS='-b -Wl,+s'
1838         DSO_CFLAGS=""
1839         DSO_PIC_CFLAGS="+Z"
1840         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1841         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1842         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1843     else
1844         DSO_LDOPTS='-b -E +s'
1845         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1846         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1847     fi
1848     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1849     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1850     ;;
1852 *-irix5*)
1853     AC_DEFINE(IRIX)
1854     DSO_LDOPTS='-elf -shared'
1856     if test "$GNU_CC"; then
1857        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1858        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1859        MKSHLIB_FORCE_ALL='-Wl,-all'
1860        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1861        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1862     else
1863        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1864        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1865        MKSHLIB_FORCE_ALL='-all'
1866        MKSHLIB_UNFORCE_ALL='-none'
1867     fi
1868     ;;
1870 *-irix6*)
1871     AC_DEFINE(IRIX)
1872     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1873     dnl compile and link using -n32
1874     USE_N32=1
1875     TARGET_COMPILER_ABI=n32
1876     DSO_LDOPTS='-elf -shared'
1877     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1878     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1879     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1880     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1881     if test "$GNU_CC"; then
1882        MKSHLIB_FORCE_ALL='-Wl,-all'
1883        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1884        _WARNINGS_CFLAGS="-Wall"
1885        _WARNINGS_CXXFLAGS="-Wall"
1886        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1887     else
1888        MKSHLIB_FORCE_ALL='-all'
1889        MKSHLIB_UNFORCE_ALL='-none'
1890            AR_LIST="$AR t"
1891            AR_EXTRACT="$AR x"
1892            AR_DELETE="$AR d"
1893            AR='$(CXX) -ar'
1894            AR_FLAGS='-o $@'
1895        CFLAGS="$CFLAGS -woff 3262 -G 4"
1896        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1897        if test -n "$USE_N32"; then
1898            ASFLAGS="$ASFLAGS -n32"
1899            CFLAGS="$CFLAGS -n32"
1900            CXXFLAGS="$CXXFLAGS -n32"
1901            LDFLAGS="$LDFLAGS -n32"
1902        fi
1903        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1904        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1905        MOZ_FIX_LINK_PATHS=
1906     fi
1907     if test -z "$GNU_CXX"; then
1908       MIPSPRO_CXX=1
1909     fi
1910     ;;
1912 *-*linux*)
1913     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1914     # Similarly for GNU_CXX and INTEL_CXX.
1915     if test "$INTEL_CC" || test "$INTEL_CXX"; then
1916         # -Os has been broken on Intel's C/C++ compilers for quite a
1917         # while; Intel recommends against using it.
1918         MOZ_OPTIMIZE_FLAGS="-O2"
1919         MOZ_DEBUG_FLAGS="-g -fno-inline"
1920     elif test "$GNU_CC" || test "$GNU_CXX"; then
1921         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1922         case $GCC_VERSION in
1923         4.1.*|4.2.*)
1924             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1925             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1926         esac
1927         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1928         MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1929                                           # and that combo is not yet good at
1930                                           # debugging inlined functions (even
1931                                           # when using DWARF2 as the debugging
1932                                           # format)
1933     fi
1935     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1937     MOZ_MEMORY=1
1939     case "${target_cpu}" in
1940     alpha*)
1941         CFLAGS="$CFLAGS -mieee"
1942         CXXFLAGS="$CXXFLAGS -mieee"
1943     ;;
1944     i*86)
1945         USE_ELF_DYNSTR_GC=1
1946         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1947     ;;
1948     mips*)
1949         MOZ_DEBUG_FLAGS="-g" # We want inlining
1950     ;;
1951     esac
1952     ;;
1954 *-wince*)
1956     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1957     AR_LIST="$AR -list"
1958     AR_EXTRACT="$AR -extract"
1959     AR_DELETE="$AR d"
1960     AR_FLAGS='-OUT:"$@"'
1962     if test "$AS_BIN"; then
1963         AS="$AS_BIN"
1964     fi
1965     DSO_CFLAGS=
1966     DSO_PIC_CFLAGS=
1967     DLL_SUFFIX=.dll
1968     BIN_SUFFIX='.exe'
1969     if test -z "$RC"; then 
1970         RC=rc.exe  
1971     fi
1972     # certain versions of cygwin's makedepend barf on the 
1973     # #include <string> vs -I./dist/include/string issue so don't use it
1974     SYSTEM_MAKEDEPEND=
1976     HOST_CC=cl
1977     HOST_CXX=cl
1978     HOST_LD=link
1979     HOST_AR='lib -OUT:$@'
1980     HOST_RANLIB='echo ranlib'
1981     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1982         
1983         
1984     WARNINGS_AS_ERRORS='-WX'
1985     MOZ_OPTIMIZE_FLAGS='-Ox'
1986     AR_FLAGS='-NOLOGO -OUT:"$@"'
1987     ASM_SUFFIX=asm
1988     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1989     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1990     DLL_PREFIX=
1991     DOXYGEN=:
1992     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1993     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1994     GARBAGE=
1995     IMPORT_LIB_SUFFIX=lib
1996     LIBS="$LIBS"
1997     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1998     LIB_PREFIX=
1999     LIB_SUFFIX=lib 
2000     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2001     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2002     MKSHLIB_FORCE_ALL=
2003     MKSHLIB_UNFORCE_ALL=
2004     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2005     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2006     MOZ_DEBUG_FLAGS='-Zi'
2007     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2008     MOZ_FIX_LINK_PATHS=
2009     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2010     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2011     OBJ_SUFFIX=obj
2012     RANLIB='echo not_ranlib'
2013     STRIP='echo not_strip'
2014     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2015     UNZIP=unzip
2016     XARGS=xargs
2017     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2018     ZIP=zip
2019     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2020     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2021     STATIC_LIBIDL=1
2022     MOZ_TREE_FREETYPE=1
2024     AC_DEFINE(HAVE_SNPRINTF)
2025     AC_DEFINE(_WINDOWS)
2026     AC_DEFINE(_WIN32)
2027     AC_DEFINE(WIN32)
2028     AC_DEFINE(XP_WIN)
2029     AC_DEFINE(XP_WIN32)
2030     AC_DEFINE(HW_THREADS)
2031     AC_DEFINE(STDC_HEADERS)
2032     AC_DEFINE(NEW_H, <new>)
2033     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2035     TARGET_MD_ARCH=win32
2036     _PLATFORM_DEFAULT_TOOLKIT='windows'
2037     BIN_SUFFIX='.exe'
2038     USE_SHORT_LIBNAME=1
2039     MOZ_ENABLE_POSTSCRIPT=
2040     MOZ_USER_DIR="Mozilla"
2042     MOZ_GFX_OPTIMIZE_MOBILE=1
2044     # Sanity check for WINCE_WINDOWS_MOBILE
2045     # XXX disabled until we can fix the mobile tinderbox
2046     ##if test "$WINCE_WINDOWS_MOBILE"; then
2047     ##   AC_CHECK_HEADER(tpcshell.h, [],
2048     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2049     ##fi
2053 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2054     DSO_CFLAGS=
2055     DSO_PIC_CFLAGS=
2056     DLL_SUFFIX=.dll
2057     RC=rc.exe
2058     # certain versions of cygwin's makedepend barf on the 
2059     # #include <string> vs -I./dist/include/string issue so don't use it
2060     SYSTEM_MAKEDEPEND=
2061     if test -n "$GNU_CC"; then
2062         CC="$CC -mno-cygwin"
2063         CXX="$CXX -mno-cygwin"
2064         CPP="$CPP -mno-cygwin"
2065         CFLAGS="$CFLAGS -mms-bitfields"
2066         CXXFLAGS="$CXXFLAGS -mms-bitfields"
2067         DSO_LDOPTS='-shared'
2068         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2069         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2070         RC='$(WINDRES)'
2071         # Use temp file for windres (bug 213281)
2072         RCFLAGS='-O coff --use-temp-file'
2073         # mingw doesn't require kernel32, user32, and advapi32 explicitly
2074         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
2075         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
2076         MOZ_FIX_LINK_PATHS=
2077         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
2078         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2079         DLL_PREFIX=
2080         IMPORT_LIB_SUFFIX=dll.a
2081     else
2082         TARGET_COMPILER_ABI=msvc
2083         HOST_CC='$(CC)'
2084         HOST_CXX='$(CXX)'
2085         HOST_LD='$(LD)'
2086         AR='lib -NOLOGO -OUT:"$@"'
2087         AR_FLAGS=
2088         RANLIB='echo not_ranlib'
2089         STRIP='echo not_strip'
2090         XARGS=xargs
2091         ZIP=zip
2092         UNZIP=unzip
2093         DOXYGEN=:
2094         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2095         OBJ_SUFFIX=obj
2096         LIB_SUFFIX=lib
2097         DLL_PREFIX=
2098         LIB_PREFIX=
2099         IMPORT_LIB_SUFFIX=lib
2100         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2101         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2102         MKSHLIB_FORCE_ALL=
2103         MKSHLIB_UNFORCE_ALL=
2104         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2105         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2106         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2107         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2108         MOZ_DEBUG_FLAGS='-Zi'
2109         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2110         WARNINGS_AS_ERRORS='-WX'
2111         MOZ_OPTIMIZE_FLAGS='-O1'
2112         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2113         MOZ_FIX_LINK_PATHS=
2114         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2115         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2116         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2117         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2118         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2119         if test $_MSC_VER -ge 1400; then
2120             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2121             dnl For profile-guided optimization
2122             PROFILE_GEN_CFLAGS="-GL"
2123             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2124             dnl XXX: PGO builds can fail with warnings treated as errors,
2125             dnl specifically "no profile data available" appears to be
2126             dnl treated as an error sometimes. This might be a consequence
2127             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2128             dnl with the linker doing most of the work in the whole-program
2129             dnl optimization/PGO case. I think it's probably a compiler bug,
2130             dnl but we work around it here.
2131             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2132             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2133             dnl Probably also a compiler bug, but what can you do?
2134             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2135             if test -n "$_USE_DYNAMICBASE"; then
2136                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2137             fi
2138         fi
2139     fi
2140     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2141     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2142     AC_DEFINE(HAVE_SNPRINTF)
2143     AC_DEFINE(_WINDOWS)
2144     AC_DEFINE(_WIN32)
2145     AC_DEFINE(WIN32)
2146     AC_DEFINE(XP_WIN)
2147     AC_DEFINE(XP_WIN32)
2148     AC_DEFINE(HW_THREADS)
2149     AC_DEFINE(STDC_HEADERS)
2150     AC_DEFINE(NEW_H, <new>)
2151     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2152     TARGET_MD_ARCH=win32
2153     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2154     BIN_SUFFIX='.exe'
2155     USE_SHORT_LIBNAME=1
2156     MOZ_ENABLE_POSTSCRIPT=
2157     MOZ_USER_DIR="Mozilla"
2159     dnl Hardcode to win95 for now - cls
2160     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2162     dnl set NO_X11 defines here as the general check is skipped on win32
2163     no_x=yes
2164     AC_DEFINE(NO_X11)
2166     dnl MinGW/MSYS doesn't provide or need cygpath
2167     case "$host" in
2168     *-mingw*)
2169         CYGPATH_W=echo
2170         CYGPATH_S=cat
2171         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2172         ;;
2173     *-cygwin*|*-msvc*|*-mks*)
2174         CYGPATH_W="cygpath -a -w"
2175         CYGPATH_S="sed -e s|\\\\|/|g"
2176         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2177         ;;
2178     esac
2179     case "$host" in
2180     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2182     if test -z "$MOZ_TOOLS"; then
2183         AC_MSG_ERROR([MOZ_TOOLS is not set])
2184     fi
2186     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2187     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2188         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2189     fi
2190     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2191         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2192     fi
2193     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2195     if test -n "$GLIB_PREFIX"; then
2196         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2197         if test "$?" = "0"; then
2198             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2199                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2200             fi
2201             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2202         else
2203             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2204         fi
2205     else
2206         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2207     fi
2208     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2209         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2210     fi
2211     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2212     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2213         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2214     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2215         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2216     else
2217         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2218     fi
2220     if test -n "$LIBIDL_PREFIX"; then
2221         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2222         if test "$?" = "0"; then
2223             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2224                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2225             fi
2226             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2227         else
2228             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2229         fi
2230     else
2231         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2232     fi        
2233     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2234         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2235     fi
2236     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2237     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2238         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2239         STATIC_LIBIDL=1
2240     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2241         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2242     else
2243         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2244     fi
2245     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2246     ;;
2248     *) # else cross-compiling
2249         if test -n "$GLIB_PREFIX"; then
2250             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2251             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2252                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2253             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2254                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2255             else
2256                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2257             fi
2258         fi
2259         if test -n "$LIBIDL_PREFIX"; then
2260             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2261             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2262                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2263                 STATIC_LIBIDL=1
2264             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2265                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2266             else
2267                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2268             fi
2269         fi
2270         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2271         ;;
2272     esac 
2275     case "$host_os" in
2276     cygwin*|msvc*|mks*)
2277         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])
2278         ;;
2280     *)
2281         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2283         AC_LANG_SAVE
2284         AC_LANG_CPLUSPLUS
2285         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2286         AC_LANG_RESTORE
2287         ;;
2288     esac
2290     case "$target" in
2291     i*86-*)
2292         AC_DEFINE(_X86_)
2293         ;;
2294     alpha-*)
2295         AC_DEFINE(_ALPHA_)
2296         ;;
2297     mips-*)
2298         AC_DEFINE(_MIPS_)
2299         ;;
2300     *)
2301         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2302         ;;
2303     esac
2304     ;;
2306 *-netbsd*)
2307     DSO_CFLAGS=''
2308     CFLAGS="$CFLAGS -Dunix"
2309     CXXFLAGS="$CXXFLAGS -Dunix"
2310     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2311         DLL_SUFFIX=".so"
2312         DSO_PIC_CFLAGS='-fPIC -DPIC'
2313         DSO_LDOPTS='-shared'
2314         BIN_FLAGS='-Wl,--export-dynamic'
2315     else
2316         DSO_PIC_CFLAGS='-fPIC -DPIC'
2317         DLL_SUFFIX=".so.1.0"
2318         DSO_LDOPTS='-shared'
2319     fi
2320     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2321     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2322     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2323     if test "$LIBRUNPATH"; then
2324         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2325     fi
2326     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2327     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2328     ;;
2330 *-nto*) 
2331         AC_DEFINE(NTO)  
2332         AC_DEFINE(_QNX_SOURCE)
2333         AC_DEFINE(_i386)
2334         OS_TARGET=NTO
2335         WARNINGS_AS_ERRORS=''
2336         MOZ_OPTIMIZE_FLAGS="-O"
2337         MOZ_DEBUG_FLAGS="-gstabs"
2338         USE_PTHREADS=1
2339         _PEDANTIC=
2340         LIBS="$LIBS -lsocket -lstdc++"
2341         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2342         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2343         if test "$with_x" != "yes"
2344         then
2345                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2346             TK_CFLAGS='-I/usr/include/photon'
2347                 TK_LIBS='-lph'
2348         fi
2349         case "${target_cpu}" in
2350         ppc*)
2351         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2352         ;;
2353         esac
2354         case "${host_cpu}" in
2355         i*86)
2356         USE_ELF_DYNSTR_GC=1
2357         ;;
2358         esac
2359         ;;
2361 *-openbsd*)
2362     DLL_SUFFIX=".so.1.0"
2363     DSO_CFLAGS=''
2364     DSO_PIC_CFLAGS='-fPIC'
2365     DSO_LDOPTS='-shared -fPIC'
2366     if test "$LIBRUNPATH"; then
2367         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2368     fi
2369     ;;
2371 *-openvms*) 
2372     AC_DEFINE(NO_PW_GECOS)
2373     AC_DEFINE(NO_UDSOCK)
2374     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2375     USE_PTHREADS=1
2376     MKSHLIB_FORCE_ALL='-all'
2377     MKSHLIB_UNFORCE_ALL='-none'
2378     AS='as'
2379     AS_DASH_C_FLAG='-Wc/names=as_is'
2380     AR_FLAGS='c $@'
2381     DSO_LDOPTS='-shared -auto_symvec'
2382     DSO_PIC_CFLAGS=
2383     MOZ_DEBUG_LDFLAGS='-g'
2384     COMPAQ_CXX=1
2385     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2386     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2387     ;;
2390 *-os2*)
2391     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2392     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2393     AC_DEFINE(OS2)
2394     AC_DEFINE(XP_OS2)
2395     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2396     AC_DEFINE(TCPV40HDRS)
2397     USE_SHORT_LIBNAME=1
2398     DLL_PREFIX=
2399     LIB_PREFIX=
2400     LIB_SUFFIX=lib
2401     BIN_SUFFIX=".exe"
2402     DLL_SUFFIX=".dll"
2403     IMPORT_LIB_SUFFIX=lib
2404     DSO_PIC_CFLAGS=
2405     AR=emxomfar
2406     AR_FLAGS='r $@'
2407     CFLAGS="$CFLAGS -Zomf"
2408     CXXFLAGS="$CXXFLAGS -Zomf"
2409     DSO_LDOPTS='-Zdll'
2410     BIN_FLAGS='-Zlinker /ST:0x100000'
2411     IMPLIB='emximp -o'
2412     FILTER='emxexp -o'
2413     LDFLAGS='-Zmap'
2414     WARNINGS_AS_ERRORS='-Werror'
2415     MOZ_DEBUG_FLAGS="-g -fno-inline"
2416     MOZ_OPTIMIZE_FLAGS="-O2"
2417     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2418     MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2419     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2420     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2421     TARGET_MD_ARCH=os2
2422     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2423     MOZ_ENABLE_POSTSCRIPT=
2424     RC=rc.exe
2425     RCFLAGS='-n'
2426     MOZ_USER_DIR="Mozilla"
2428     if test "$MOZTOOLS"; then
2429         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2430     else
2431         AC_MSG_ERROR([MOZTOOLS is not set])
2432     fi
2433     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2434         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2435         LDFLAGS="$LDFLAGS -Zhigh-mem"
2436         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2437         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2438     fi
2440     # GCC for OS/2 currently predefines these, but we don't want them
2441     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2442     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2444     AC_CACHE_CHECK(for __declspec(dllexport),
2445         ac_os2_declspec,
2446         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2447                         [return 0;],
2448                         ac_os2_declspec="yes",
2449                         ac_os2_declspec="no")])
2450     if test "$ac_os2_declspec" = "yes"; then
2451         FILTER='true'
2452         MOZ_OS2_USE_DECLSPEC='1'
2453     fi
2454     ;;
2456 alpha*-*-osf*)
2457     if test "$GNU_CC"; then
2458       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2459       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2461     else
2462         MOZ_DEBUG_FLAGS='-g'
2463         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2464         CFLAGS="$CFLAGS -ieee"
2465         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2466         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2467         DSO_CFLAGS=
2468         DSO_PIC_CFLAGS=
2469         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2470         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2471         MKSHLIB_FORCE_ALL='-all'
2472         MKSHLIB_UNFORCE_ALL='-none'
2473         dnl Might fix the libxpcom.so breakage on this platform as well....
2474         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2475         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2476     fi
2477     if test -z "$GNU_CXX"; then
2478       COMPAQ_CXX=1
2479     fi
2480     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2481     ;;
2483 *-qnx*) 
2484     DIRENT_INO=d_stat.st_ino
2485     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2486     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2487     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2488     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2489     AC_DEFINE(STDC_HEADERS)
2490     if test "$no_x" = "yes"; then
2491             _PLATFORM_DEFAULT_TOOLKIT='photon'
2492             TK_CFLAGS='-I/usr/nto/include/photon'
2493             TK_LIBS='-lphoton -lphrender'
2494     fi
2495     ;;
2497 *-sco*) 
2498     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2499     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2500     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2501     if test ! "$GNU_CC"; then
2502        DSO_LDOPTS='-G'
2503     fi
2504     ;;
2506 dnl the qsort routine under solaris is faulty
2507 *-solaris*) 
2508     AC_DEFINE(SOLARIS)
2509     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2510     SYSTEM_MAKEDEPEND=
2511     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2512     # libraries one level up (e.g. libnspr4.so)
2513     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2514     MOZ_MEMORY=1
2515     if test "$SOLARIS_SUNPRO_CC"; then
2516        LIBS="-lCrun -lCstd $LIBS"
2517        NS_USE_NATIVE=1
2518        MOZ_FIX_LINK_PATHS=
2519        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2520        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2521        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2522        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2523        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2524            _SAVE_LDFLAGS=$LDFLAGS
2525            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2526            AC_TRY_LINK([#include <stdio.h>],
2527                        [printf("Hello World\n");],
2528                        ,
2529                        [LDFLAGS=$_SAVE_LDFLAGS])
2530        fi
2531        WARNINGS_AS_ERRORS='-Werror'
2532        MOZ_OPTIMIZE_FLAGS="-xO4"
2533        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2534        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2535        MKSHLIB_FORCE_ALL='-z allextract'
2536        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2537        DSO_LDOPTS='-G -z muldefs'
2538        AR_LIST="$AR t"
2539        AR_EXTRACT="$AR x"
2540        AR_DELETE="$AR d"
2541        AR='$(CXX) -xar'
2542        AR_FLAGS='-o $@'
2543        AS='/usr/ccs/bin/as'
2544        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2545        AS_DASH_C_FLAG=''
2546        TARGET_COMPILER_ABI="sunc"
2547        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2548        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2549        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2550        AC_LANG_SAVE
2551        AC_LANG_CPLUSPLUS
2552        AC_TRY_COMPILE([],
2553            [#if (__SUNPRO_CC < 0x590)
2554            #error "Denied"
2555            #endif],
2556            _BAD_COMPILER=,_BAD_COMPILER=1)
2557         if test -n "$_BAD_COMPILER"; then
2558             _res="no"
2559             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2560         else
2561             _res="yes"
2562         fi
2563         AC_MSG_RESULT([$_res])
2564         AC_LANG_RESTORE
2565     else
2566        ASFLAGS="$ASFLAGS -fPIC"
2567        DSO_LDOPTS='-G'
2568        _WARNINGS_CFLAGS=''
2569        _WARNINGS_CXXFLAGS=''
2570        if test "$OS_RELEASE" = "5.3"; then
2571           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2572        fi
2573     fi
2574     if test "$OS_RELEASE" = "5.5.1"; then
2575        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2576     fi
2577     ;;
2579 *-sunos*) 
2580     DSO_LDOPTS='-Bdynamic'
2581     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2582     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2583     AC_DEFINE(SUNOS4)
2584     AC_DEFINE(SPRINTF_RETURNS_STRING)
2585     case "$(target_os)" in
2586     sunos4.1*)
2587         DLL_SUFFIX='.so.1.0'
2588         ;;
2589     esac
2590     ;;
2592 *-sysv4.2uw7*) 
2593         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2594     ;;
2596 *-os2*)
2597     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2598     ;;
2600 esac
2602 dnl Only one oddball right now (QNX), but this gives us flexibility
2603 dnl if any other platforms need to override this in the future.
2604 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2606 dnl ========================================================
2607 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2608 dnl by now will not have any way to link most binaries (tests
2609 dnl as well as viewer, apprunner, etc.), because some symbols
2610 dnl will be left out of the "composite" .so's by ld as unneeded.
2611 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2612 dnl they can link in the static libs that provide the missing
2613 dnl symbols.
2614 dnl ========================================================
2615 NO_LD_ARCHIVE_FLAGS=
2616 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2617     NO_LD_ARCHIVE_FLAGS=1
2619 case "$target" in
2620 *-os2*)
2621     NO_LD_ARCHIVE_FLAGS=
2622     ;;
2623 *-aix4.3*|*-aix5*)
2624     NO_LD_ARCHIVE_FLAGS=
2625     ;;
2626 *-openvms*)
2627     NO_LD_ARCHIVE_FLAGS=
2628     ;;
2629 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2630     if test -z "$GNU_CC"; then
2631         NO_LD_ARCHIVE_FLAGS=
2632     fi
2633     ;;
2634 esac
2635 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2638 dnl Indicate that platform requires special thread safe 
2639 dnl locking when starting up the OJI JVM 
2640 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2641 dnl ========================================================
2642 case "$target" in
2643     *-hpux*)      
2644         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2645         ;;
2646 esac
2648 dnl ========================================================
2649 dnl = Flags to strip unused symbols from .so components
2650 dnl ========================================================
2651 case "$target" in
2652     *-linux*|*-kfreebsd*-gnu)
2653         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2654         ;;
2655     *-solaris*)
2656         if test -z "$GNU_CC"; then
2657          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2658         else
2659          if test -z "$GCC_USE_GNU_LD"; then
2660           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2661          else
2662           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2663          fi
2664         fi
2665         ;;
2666     *-nto*) 
2667         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2668         ;;
2669     *-darwin*)
2670         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2671         ;;
2672     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2673         if test -n "$GNU_CC"; then
2674            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2675         fi
2676         ;;
2677 esac
2679 if test -z "$COMPILE_ENVIRONMENT"; then
2680     SKIP_COMPILER_CHECKS=1
2681     SKIP_LIBRARY_CHECKS=1
2684 if test -z "$SKIP_COMPILER_CHECKS"; then
2685 dnl Checks for typedefs, structures, and compiler characteristics.
2686 dnl ========================================================
2687 AC_LANG_C
2688 AC_HEADER_STDC
2689 AC_C_CONST
2690 AC_TYPE_MODE_T
2691 AC_TYPE_OFF_T
2692 AC_TYPE_PID_T
2693 AC_TYPE_SIZE_T
2694 AC_STRUCT_ST_BLKSIZE
2695 AC_MSG_CHECKING(for siginfo_t)
2696 AC_CACHE_VAL(ac_cv_siginfo_t,
2697  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2698                   #include <signal.h>],
2699                  [siginfo_t* info;],
2700                  [ac_cv_siginfo_t=true],
2701                  [ac_cv_siginfo_t=false])])
2702 if test "$ac_cv_siginfo_t" = true ; then
2703   AC_DEFINE(HAVE_SIGINFO_T)
2704   AC_MSG_RESULT(yes)
2705 else
2706   AC_MSG_RESULT(no)
2709 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2710 dnl ========================================================
2711 AC_MSG_CHECKING(for int16_t)
2712 AC_CACHE_VAL(ac_cv_int16_t,
2713  [AC_TRY_COMPILE([#include <stdio.h>
2714                   #include <sys/types.h>],
2715                  [int16_t foo = 0;],
2716                  [ac_cv_int16_t=true],
2717                  [ac_cv_int16_t=false])])
2718 if test "$ac_cv_int16_t" = true ; then
2719   AC_DEFINE(HAVE_INT16_T)
2720   AC_MSG_RESULT(yes)
2721 else
2722   AC_MSG_RESULT(no)
2724 AC_MSG_CHECKING(for int32_t)
2725 AC_CACHE_VAL(ac_cv_int32_t,
2726  [AC_TRY_COMPILE([#include <stdio.h>
2727                   #include <sys/types.h>],
2728                  [int32_t foo = 0;],
2729                  [ac_cv_int32_t=true],
2730                  [ac_cv_int32_t=false])])
2731 if test "$ac_cv_int32_t" = true ; then
2732   AC_DEFINE(HAVE_INT32_T)
2733   AC_MSG_RESULT(yes)
2734 else
2735   AC_MSG_RESULT(no)
2737 AC_MSG_CHECKING(for int64_t)
2738 AC_CACHE_VAL(ac_cv_int64_t,
2739  [AC_TRY_COMPILE([#include <stdio.h>
2740                   #include <sys/types.h>],
2741                  [int64_t foo = 0;],
2742                  [ac_cv_int64_t=true],
2743                  [ac_cv_int64_t=false])])
2744 if test "$ac_cv_int64_t" = true ; then
2745   AC_DEFINE(HAVE_INT64_T)
2746   AC_MSG_RESULT(yes)
2747 else
2748   AC_MSG_RESULT(no)
2750 AC_MSG_CHECKING(for int64)
2751 AC_CACHE_VAL(ac_cv_int64,
2752  [AC_TRY_COMPILE([#include <stdio.h>
2753                   #include <sys/types.h>],
2754                  [int64 foo = 0;],
2755                  [ac_cv_int64=true],
2756                  [ac_cv_int64=false])])
2757 if test "$ac_cv_int64" = true ; then
2758   AC_DEFINE(HAVE_INT64)
2759   AC_MSG_RESULT(yes)
2760 else
2761   AC_MSG_RESULT(no)
2763 AC_MSG_CHECKING(for uint)
2764 AC_CACHE_VAL(ac_cv_uint,
2765  [AC_TRY_COMPILE([#include <stdio.h>
2766                   #include <sys/types.h>],
2767                  [uint foo = 0;],
2768                  [ac_cv_uint=true],
2769                  [ac_cv_uint=false])])
2770 if test "$ac_cv_uint" = true ; then
2771   AC_DEFINE(HAVE_UINT)
2772   AC_MSG_RESULT(yes)
2773 else
2774   AC_MSG_RESULT(no)
2776 AC_MSG_CHECKING(for uint_t)
2777 AC_CACHE_VAL(ac_cv_uint_t,
2778  [AC_TRY_COMPILE([#include <stdio.h>
2779                   #include <sys/types.h>],
2780                  [uint_t foo = 0;],
2781                  [ac_cv_uint_t=true],
2782                  [ac_cv_uint_t=false])])
2783 if test "$ac_cv_uint_t" = true ; then
2784   AC_DEFINE(HAVE_UINT_T)
2785   AC_MSG_RESULT(yes)
2786 else
2787   AC_MSG_RESULT(no)
2789 AC_MSG_CHECKING(for uint16_t)
2790 AC_CACHE_VAL(ac_cv_uint16_t,
2791  [AC_TRY_COMPILE([#include <stdio.h>
2792                   #include <sys/types.h>],
2793                  [uint16_t foo = 0;],
2794                  [ac_cv_uint16_t=true],
2795                  [ac_cv_uint16_t=false])])
2796 if test "$ac_cv_uint16_t" = true ; then
2797   AC_DEFINE(HAVE_UINT16_T)
2798   AC_MSG_RESULT(yes)
2799 else
2800   AC_MSG_RESULT(no)
2803 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2804 dnl are defined when compiling C++ but not C.  Since the result of this
2805 dnl test is used only in C++, do it in C++.
2806 AC_LANG_CPLUSPLUS
2808 AC_MSG_CHECKING(for uname.domainname)
2809 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2810     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2811         [ struct utsname *res; char *domain; 
2812             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2813         [ac_cv_have_uname_domainname_field=true],
2814         [ac_cv_have_uname_domainname_field=false])])
2816 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2817     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2818     AC_MSG_RESULT(yes)
2819 else
2820     AC_MSG_RESULT(no)
2823 AC_MSG_CHECKING(for uname.__domainname)
2824 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2825     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2826         [ struct utsname *res; char *domain; 
2827             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2828         [ac_cv_have_uname_us_domainname_field=true],
2829         [ac_cv_have_uname_us_domainname_field=false])])
2831 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2832     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2833     AC_MSG_RESULT(yes)
2834 else
2835     AC_MSG_RESULT(no)
2838 AC_LANG_C
2840 dnl Check for usable wchar_t (2 bytes, unsigned)
2841 dnl (we really don't need the unsignedness check anymore)
2842 dnl ========================================================
2844 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2845     ac_cv_have_usable_wchar_v2,
2846     [AC_TRY_COMPILE([#include <stddef.h>
2847                      $configure_static_assert_macros],
2848                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2849                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2850                     ac_cv_have_usable_wchar_v2="yes",
2851                     ac_cv_have_usable_wchar_v2="no")])
2852 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2853     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2854     HAVE_CPP_2BYTE_WCHAR_T=1
2855 else
2856 dnl This is really gcc-only
2857 dnl Do this test using CXX only since some versions of gcc
2858 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2859 dnl only have short-wchar support for c++.
2860 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2862     AC_LANG_SAVE
2863     AC_LANG_CPLUSPLUS
2864     _SAVE_CXXFLAGS=$CXXFLAGS
2865     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2867     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2868         ac_cv_have_usable_wchar_option_v2,
2869         [AC_TRY_LINK([#include <stddef.h>
2870                       $configure_static_assert_macros],
2871                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2872                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2873                      ac_cv_have_usable_wchar_option_v2="yes",
2874                      ac_cv_have_usable_wchar_option_v2="no")])
2876     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2877         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2878         HAVE_CPP_2BYTE_WCHAR_T=1
2879         WCHAR_CFLAGS="-fshort-wchar"
2880     else    
2881         CXXFLAGS=$_SAVE_CXXFLAGS
2882     fi
2883     AC_LANG_RESTORE
2886 dnl Check for .hidden assembler directive and visibility attribute.
2887 dnl Borrowed from glibc configure.in
2888 dnl ===============================================================
2889 if test "$GNU_CC"; then
2890   AC_CACHE_CHECK(for visibility(hidden) attribute,
2891                  ac_cv_visibility_hidden,
2892                  [cat > conftest.c <<EOF
2893                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2895                   ac_cv_visibility_hidden=no
2896                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2897                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2898                       ac_cv_visibility_hidden=yes
2899                     fi
2900                   fi
2901                   rm -f conftest.[cs]
2902                  ])
2903   if test "$ac_cv_visibility_hidden" = "yes"; then
2904     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2906     AC_CACHE_CHECK(for visibility(default) attribute,
2907                    ac_cv_visibility_default,
2908                    [cat > conftest.c <<EOF
2909                     int foo __attribute__ ((visibility ("default"))) = 1;
2911                     ac_cv_visibility_default=no
2912                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2913                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2914                         ac_cv_visibility_default=yes
2915                       fi
2916                     fi
2917                     rm -f conftest.[cs]
2918                    ])
2919     if test "$ac_cv_visibility_default" = "yes"; then
2920       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2922       AC_CACHE_CHECK(for visibility pragma support,
2923                      ac_cv_visibility_pragma,
2924                      [cat > conftest.c <<EOF
2925 #pragma GCC visibility push(hidden)
2926                       int foo_hidden = 1;
2927 #pragma GCC visibility push(default)
2928                       int foo_default = 1;
2930                       ac_cv_visibility_pragma=no
2931                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2932                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2933                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2934                             ac_cv_visibility_pragma=yes
2935                           fi
2936                         fi
2937                       fi
2938                       rm -f conftest.[cs]
2939                     ])
2940       if test "$ac_cv_visibility_pragma" = "yes"; then
2941         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2942                        ac_cv_have_visibility_class_bug,
2943                        [cat > conftest.c <<EOF
2944 #pragma GCC visibility push(hidden)
2945 struct __attribute__ ((visibility ("default"))) TestStruct {
2946   static void Init();
2948 __attribute__ ((visibility ("default"))) void TestFunc() {
2949   TestStruct::Init();
2952                        ac_cv_have_visibility_class_bug=no
2953                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2954                          ac_cv_have_visibility_class_bug=yes
2955                        else
2956                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2957                            ac_cv_have_visibility_class_bug=yes
2958                          fi
2959                        fi
2960                        rm -rf conftest.{c,S}
2961                        ])
2963         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2964                        ac_cv_have_visibility_builtin_bug,
2965                        [cat > conftest.c <<EOF
2966 #pragma GCC visibility push(hidden)
2967 #pragma GCC visibility push(default)
2968 #include <string.h>
2969 #pragma GCC visibility pop
2971 __attribute__ ((visibility ("default"))) void Func() {
2972   char c[[100]];
2973   memset(c, 0, sizeof(c));
2976                        ac_cv_have_visibility_builtin_bug=no
2977                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2978                          ac_cv_have_visibility_builtin_bug=yes
2979                        else
2980                          if test `grep -c "@PLT" conftest.S` = 0; then
2981                            ac_cv_visibility_builtin_bug=yes
2982                          fi
2983                        fi
2984                        rm -f conftest.{c,S}
2985                        ])
2986         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2987                 "$ac_cv_have_visibility_class_bug" = "no"; then
2988           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2989           WRAP_SYSTEM_INCLUDES=1
2990         else
2991           VISIBILITY_FLAGS='-fvisibility=hidden'
2992         fi # have visibility pragma bug
2993       fi   # have visibility pragma
2994     fi     # have visibility(default) attribute
2995   fi       # have visibility(hidden) attribute
2996 fi         # GNU_CC
2998 # visibility hidden flag for Sun Studio on Solaris
2999 if test "$SOLARIS_SUNPRO_CC"; then
3000 VISIBILITY_FLAGS='-xldscope=hidden'
3001 fi         # Sun Studio on Solaris
3003 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3004 AC_SUBST(VISIBILITY_FLAGS)
3006 dnl Checks for header files.
3007 dnl ========================================================
3008 AC_HEADER_DIRENT
3009 case "$target_os" in
3010 freebsd*)
3011 # for stuff like -lXshm
3012     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3013     ;;
3014 esac
3015 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3016 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3017 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3018 AC_CHECK_HEADERS(malloc.h)
3019 AC_CHECK_HEADERS(X11/XKBlib.h)
3020 AC_CHECK_HEADERS(io.h)
3022 dnl These are all the places some variant of statfs can be hiding.
3023 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3025 dnl Try for MMX support
3026 dnl NB - later gcc versions require -mmmx for this header to be successfully
3027 dnl included (or another option which implies it, such as -march=pentium-mmx)
3028 AC_CHECK_HEADERS(mmintrin.h)
3030 dnl Check whether the compiler supports the new-style C++ standard
3031 dnl library headers (i.e. <new>) or needs the old "new.h"
3032 AC_LANG_CPLUSPLUS
3033 NEW_H=new.h
3034 AC_CHECK_HEADER(new, [NEW_H=new])
3035 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3036 AC_LANG_C
3038 AC_ARG_ENABLE(dtrace,
3039               [  --enable-dtrace         build with dtrace support if available (default=no)],
3040               [enable_dtrace="yes"],)
3041 if test "x$enable_dtrace" = "xyes"; then
3042   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3043   if test -n "$HAVE_DTRACE"; then
3044       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3045   else
3046       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3047   fi
3049 AC_SUBST(HAVE_DTRACE)
3051 case $target in
3052 *-aix4.3*|*-aix5*)
3053         ;;
3055         AC_CHECK_HEADERS(sys/cdefs.h)
3056         ;;
3057 esac
3059 dnl Checks for libraries.
3060 dnl ========================================================
3061 case $target in
3062 *-hpux11.*)
3063         ;;
3065         AC_CHECK_LIB(c_r, gethostbyname_r)
3066         ;;
3067 esac
3069 dnl We don't want to link with libdl even if it's present on OS X, since
3070 dnl it's not used and not part of the default installation.
3071 dnl The same goes for BeOS.
3072 dnl We don't want to link against libm or libpthread on Darwin since
3073 dnl they both are just symlinks to libSystem and explicitly linking
3074 dnl against libSystem causes issues when debugging (see bug 299601).
3075 case $target in
3076 *-darwin*)
3077     ;;
3078 *-beos*)
3079     ;;
3081     AC_CHECK_LIB(m, atan)
3082     AC_CHECK_LIB(dl, dlopen,
3083     AC_CHECK_HEADER(dlfcn.h, 
3084         LIBS="-ldl $LIBS"
3085         AC_DEFINE(HAVE_LIBDL)))
3086     ;;
3087 esac
3089 _SAVE_CFLAGS="$CFLAGS"
3090 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3091 AC_CHECK_FUNCS(dladdr)
3092 CFLAGS="$_SAVE_CFLAGS"
3094 if test ! "$GNU_CXX"; then
3096     case $target in
3097     *-aix*)
3098         AC_CHECK_LIB(C_r, demangle)
3099         ;;
3100      *)
3101         AC_CHECK_LIB(C, demangle)
3102         ;;
3103      esac
3105 AC_CHECK_LIB(socket, socket)
3107 XLDFLAGS="$X_LIBS"
3108 XLIBS="$X_EXTRA_LIBS"
3110 dnl ========================================================
3111 dnl Checks for X libraries.
3112 dnl Ordering is important.
3113 dnl Xt is dependent upon SM as of X11R6
3114 dnl ========================================================
3115 if test "$no_x" = "yes"; then
3116     AC_DEFINE(NO_X11)
3117 else
3118     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3119         XLIBS="-lX11 $XLIBS"
3120         _SAVE_LDFLAGS="$LDFLAGS"
3121         LDFLAGS="$XLDFLAGS $LDFLAGS"
3122         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3123                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3124         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3125                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3126    
3127      
3128         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3129         unset ac_cv_lib_Xt_XtFree
3130             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3131             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3132         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3133                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3134         ])
3136     # AIX needs the motif library linked before libXt to prevent
3137     # crashes in plugins linked against Motif - Bug #98892
3138     case "${target_os}" in
3139     aix*)
3140         XT_LIBS="-lXm $XT_LIBS"
3141         ;;
3142     esac
3144     dnl ========================================================
3145     dnl = Check for XShm
3146     dnl ========================================================
3147     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3148         $XLIBS $XEXT_LIBS)
3149     AC_CHECK_HEADER(X11/extensions/XShm.h)
3150     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3151         test -n "$_HAVE_XSHM_XEXT"; then
3152         AC_DEFINE(HAVE_XSHM)
3153     fi
3155     dnl ========================================================
3156     dnl = Check for XIE
3157     dnl ========================================================
3158     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3159         $XLIBS $XEXT_LIBS)
3160     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3162     if test "$MOZ_XIE_LIBS"; then
3163         dnl ====================================================
3164         dnl = If XIE is present and is desired, turn it on
3165         dnl ====================================================
3166         case $target in
3167             *-hpux*)
3168                 ;;
3169             *)
3170                 HAVE_XIE=1
3171                 ;;
3172         esac
3173     fi
3175         LDFLAGS="$_SAVE_LDFLAGS"
3177     dnl ========================================================
3178     dnl = Check for freetype2 and its functionality
3179     dnl ========================================================
3180     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3182     if test "$_HAVE_FREETYPE2"; then
3183         _SAVE_LIBS="$LIBS"
3184         _SAVE_CFLAGS="$CFLAGS"
3185         LIBS="$LIBS $FT2_LIBS"
3186         CFLAGS="$CFLAGS $FT2_CFLAGS"
3188         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3189             ac_cv_member_FT_Bitmap_Size_y_ppem,
3190             [AC_TRY_COMPILE([#include <ft2build.h>
3191                              #include FT_FREETYPE_H],
3192                             [FT_Bitmap_Size s;
3193                              if (sizeof s.y_ppem) return 0;
3194                              return 1],
3195                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3196                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3197         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3198             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3199         else
3200             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3201         fi
3202         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3203                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3204                            [FT_Bitmap_Size structure includes y_ppem field])
3206         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3208         LIBS="$_SAVE_LIBS"
3209         CFLAGS="$_SAVE_CFLAGS"
3210     fi
3212 fi # $no_x
3214 AC_SUBST(XCFLAGS)
3215 AC_SUBST(XLDFLAGS)
3216 AC_SUBST(XLIBS)
3217 AC_SUBST(XT_LIBS)
3219 AC_MSG_CHECKING(for ARM SIMD support)
3220 AC_TRY_COMPILE([],
3221                [asm("uqadd8 r1, r1, r2");],
3222                result="yes", result="no")
3223 AC_MSG_RESULT("$result")
3224 if test "$result" = "yes"; then
3225     AC_DEFINE(HAVE_ARM_SIMD)
3226     HAVE_ARM_SIMD=1
3228 AC_SUBST(HAVE_ARM_SIMD)
3230 dnl ========================================================
3231 dnl = pthread support
3232 dnl = Start by checking whether the system support pthreads
3233 dnl ========================================================
3234 case "$target_os" in
3235 darwin*)
3236     USE_PTHREADS=1
3237     ;;
3239     MOZ_CHECK_PTHREADS(pthreads,
3240         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3241         MOZ_CHECK_PTHREADS(pthread,
3242             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3243             MOZ_CHECK_PTHREADS(c_r,
3244                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3245                 MOZ_CHECK_PTHREADS(c,
3246                     USE_PTHREADS=1
3247                 )
3248             )
3249         )
3250     )
3251     ;;
3252 esac
3254 dnl ========================================================
3255 dnl Check the command line for --with-pthreads 
3256 dnl ========================================================
3257 MOZ_ARG_WITH_BOOL(pthreads,
3258 [  --with-pthreads         Force use of system pthread library with NSPR ],
3259 [ if test "$USE_PTHREADS"x = x; then
3260     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3261 fi],
3262     USE_PTHREADS=
3263     _PTHREAD_LDFLAGS=
3266 dnl ========================================================
3267 dnl Do the platform specific pthread hackery
3268 dnl ========================================================
3269 if test "$USE_PTHREADS"x != x
3270 then
3271         dnl
3272         dnl See if -pthread is supported.
3273         dnl
3274         rm -f conftest*
3275         ac_cv_have_dash_pthread=no
3276         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3277         echo 'int main() { return 0; }' | cat > conftest.c
3278         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3279         if test $? -eq 0; then
3280                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3281                         ac_cv_have_dash_pthread=yes
3282                 case "$target_os" in
3283                 freebsd*)
3284 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3285                 ;;
3286                 *)
3287                             CFLAGS="$CFLAGS -pthread"
3288                             CXXFLAGS="$CXXFLAGS -pthread"
3289                 ;;
3290                 esac
3291                 fi
3292         fi
3293         rm -f conftest*
3294     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3296         dnl
3297         dnl See if -pthreads is supported.
3298         dnl
3299     ac_cv_have_dash_pthreads=no
3300     if test "$ac_cv_have_dash_pthread" = "no"; then
3301             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3302         echo 'int main() { return 0; }' | cat > conftest.c
3303             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3304         if test $? -eq 0; then
3305                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3306                             ac_cv_have_dash_pthreads=yes
3307                             CFLAGS="$CFLAGS -pthreads"
3308                             CXXFLAGS="$CXXFLAGS -pthreads"
3309                     fi
3310             fi
3311             rm -f conftest*
3312         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3313     fi
3315         case "$target" in
3316             *-*-freebsd*)
3317                         AC_DEFINE(_REENTRANT)
3318                         AC_DEFINE(_THREAD_SAFE)
3319                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3320                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3321                                 _PTHREAD_LDFLAGS="-pthread"
3322                         else
3323                                 _PTHREAD_LDFLAGS="-lc_r"
3324                         fi
3325                         ;;
3327             *-*-openbsd*|*-*-bsdi*)
3328                         AC_DEFINE(_REENTRANT)
3329                         AC_DEFINE(_THREAD_SAFE)
3330                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3331                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3332                 _PTHREAD_LDFLAGS="-pthread"
3333                         fi
3334                         ;;
3336             *-*-linux*|*-*-kfreebsd*-gnu)
3337                         AC_DEFINE(_REENTRANT) 
3338                         ;;
3340             *-*-nto*) 
3341                         AC_DEFINE(_REENTRANT) 
3342                         ;;
3344             *-aix4.3*|*-aix5*)
3345                         AC_DEFINE(_REENTRANT) 
3346                         ;;
3348             *-hpux11.*)
3349                         AC_DEFINE(_REENTRANT) 
3350                         ;;
3352             alpha*-*-osf*)
3353                         AC_DEFINE(_REENTRANT)
3354                         ;;
3356             *-*-solaris*) 
3357                         AC_DEFINE(_REENTRANT)
3358                         if test "$SOLARIS_SUNPRO_CC"; then
3359                                 CFLAGS="$CFLAGS -mt" 
3360                                 CXXFLAGS="$CXXFLAGS -mt" 
3361                         fi
3362                         ;;
3363         esac
3364     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3367 dnl ========================================================
3368 dnl See if mmap sees writes
3369 dnl For cross compiling, just define it as no, which is a safe default
3370 dnl ========================================================
3371 AC_MSG_CHECKING(whether mmap() sees write()s)
3373 changequote(,)
3374 mmap_test_prog='
3375     #include <stdlib.h>
3376     #include <unistd.h>
3377     #include <sys/mman.h>
3378     #include <sys/types.h>
3379     #include <sys/stat.h>
3380     #include <fcntl.h>
3382     char fname[] = "conftest.file";
3383     char zbuff[1024]; /* Fractional page is probably worst case */
3385     int main() {
3386         char *map;
3387         int fd;
3388         int i;
3389         unlink(fname);
3390         fd = open(fname, O_RDWR | O_CREAT, 0660);
3391         if(fd<0) return 1;
3392         unlink(fname);
3393         write(fd, zbuff, sizeof(zbuff));
3394         lseek(fd, 0, SEEK_SET);
3395         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3396         if(map==(char*)-1) return 2;
3397         for(i=0; fname[i]; i++) {
3398             int rc = write(fd, &fname[i], 1);
3399             if(map[i]!=fname[i]) return 4;
3400         }
3401         return 0;
3402     }
3404 changequote([,])
3406 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3408 AC_MSG_RESULT("$result")
3410 if test "$result" = "no"; then
3411     AC_DEFINE(MMAP_MISSES_WRITES)
3415 dnl Checks for library functions.
3416 dnl ========================================================
3417 AC_PROG_GCC_TRADITIONAL
3418 AC_FUNC_MEMCMP
3419 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3420 AC_CHECK_FUNCS(flockfile getpagesize)
3421 AC_CHECK_FUNCS(localtime_r strtok_r)
3423 dnl check for wcrtomb/mbrtowc
3424 dnl =======================================================================
3425 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3426 AC_LANG_SAVE
3427 AC_LANG_CPLUSPLUS
3428 AC_CACHE_CHECK(for wcrtomb,
3429     ac_cv_have_wcrtomb,
3430     [AC_TRY_LINK([#include <wchar.h>],
3431                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3432                  ac_cv_have_wcrtomb="yes",
3433                  ac_cv_have_wcrtomb="no")])
3434 if test "$ac_cv_have_wcrtomb" = "yes"; then
3435     AC_DEFINE(HAVE_WCRTOMB)
3437 AC_CACHE_CHECK(for mbrtowc,
3438     ac_cv_have_mbrtowc,
3439     [AC_TRY_LINK([#include <wchar.h>],
3440                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3441                  ac_cv_have_mbrtowc="yes",
3442                  ac_cv_have_mbrtowc="no")])
3443 if test "$ac_cv_have_mbrtowc" = "yes"; then
3444     AC_DEFINE(HAVE_MBRTOWC)
3446 AC_LANG_RESTORE
3449 AC_CACHE_CHECK(
3450     [for res_ninit()],
3451     ac_cv_func_res_ninit,
3452     [AC_TRY_LINK([
3453         #ifdef linux
3454         #define _BSD_SOURCE 1
3455         #endif
3456         #include <resolv.h>
3457         ],
3458         [int foo = res_ninit(&_res);],
3459         [ac_cv_func_res_ninit=yes],
3460         [ac_cv_func_res_ninit=no])
3461     ])
3463 if test "$ac_cv_func_res_ninit" = "yes"; then
3464     AC_DEFINE(HAVE_RES_NINIT)
3465 dnl must add the link line we do something as foolish as this... dougt
3466 dnl else
3467 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3468 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3471 AC_LANG_CPLUSPLUS
3472 AC_CACHE_CHECK(
3473     [for gnu_get_libc_version()],
3474     ac_cv_func_gnu_get_libc_version,
3475     [AC_TRY_LINK([
3476         #ifdef HAVE_GNU_LIBC_VERSION_H
3477         #include <gnu/libc-version.h>
3478         #endif
3479         ],
3480         [const char *glibc_version = gnu_get_libc_version();],
3481         [ac_cv_func_gnu_get_libc_version=yes],
3482         [ac_cv_func_gnu_get_libc_version=no] 
3483         )]
3484     )
3486 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3487     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3490 case $target_os in
3491     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3492         ;;
3493     *)
3494     
3495 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3496     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3497         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3498 _SAVE_LIBS=$LIBS
3499 LIBS="$LIBS $_ICONV_LIBS"
3500 AC_CACHE_CHECK(
3501     [for iconv()],
3502     ac_cv_func_iconv,
3503     [AC_TRY_LINK([
3504         #include <stdlib.h>
3505         #include <iconv.h>
3506         ],
3507         [
3508             iconv_t h = iconv_open("", "");
3509             iconv(h, NULL, NULL, NULL, NULL);
3510             iconv_close(h);
3511         ],
3512         [ac_cv_func_iconv=yes],
3513         [ac_cv_func_iconv=no] 
3514         )]
3515     )
3516 if test "$ac_cv_func_iconv" = "yes"; then
3517     AC_DEFINE(HAVE_ICONV)
3518     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3519     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3520     LIBICONV="$_ICONV_LIBS"
3521     AC_CACHE_CHECK(
3522         [for iconv() with const input],
3523         ac_cv_func_const_iconv,
3524         [AC_TRY_COMPILE([
3525             #include <stdlib.h>
3526             #include <iconv.h>
3527             ],
3528             [
3529                 const char *input = "testing";
3530                 iconv_t h = iconv_open("", "");
3531                 iconv(h, &input, NULL, NULL, NULL);
3532                 iconv_close(h);
3533             ],
3534             [ac_cv_func_const_iconv=yes],
3535             [ac_cv_func_const_iconv=no] 
3536             )]
3537         )
3538     if test "$ac_cv_func_const_iconv" = "yes"; then
3539         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3540     fi
3542 LIBS=$_SAVE_LIBS
3544     ;;
3545 esac
3547 AM_LANGINFO_CODESET
3549 AC_LANG_C
3551 dnl **********************
3552 dnl *** va_copy checks ***
3553 dnl **********************
3554 dnl we currently check for all three va_copy possibilities, so we get
3555 dnl all results in config.log for bug reports.
3556 AC_MSG_CHECKING(for an implementation of va_copy())
3557 AC_CACHE_VAL(ac_cv_va_copy,[
3558     AC_TRY_RUN([
3559         #include <stdarg.h>
3560         void f (int i, ...) {
3561             va_list args1, args2;
3562             va_start (args1, i);
3563             va_copy (args2, args1);
3564             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3565                 exit (1);
3566             va_end (args1); va_end (args2);
3567         }
3568         int main() { f (0, 42); return 0; }],
3569         ac_cv_va_copy=yes,
3570         ac_cv_va_copy=no,
3571         ac_cv_va_copy=no
3572     )
3574 AC_MSG_RESULT($ac_cv_va_copy)
3575 AC_MSG_CHECKING(for an implementation of __va_copy())
3576 AC_CACHE_VAL(ac_cv___va_copy,[
3577     AC_TRY_RUN([
3578         #include <stdarg.h>
3579         void f (int i, ...) {
3580             va_list args1, args2;
3581             va_start (args1, i);
3582             __va_copy (args2, args1);
3583             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3584                 exit (1);
3585             va_end (args1); va_end (args2);
3586         }
3587         int main() { f (0, 42); return 0; }],
3588         ac_cv___va_copy=yes,
3589         ac_cv___va_copy=no,
3590         ac_cv___va_copy=no
3591     )
3593 AC_MSG_RESULT($ac_cv___va_copy)
3594 AC_MSG_CHECKING(whether va_lists can be copied by value)
3595 AC_CACHE_VAL(ac_cv_va_val_copy,[
3596     AC_TRY_RUN([
3597         #include <stdarg.h>
3598         void f (int i, ...) {
3599             va_list args1, args2;
3600             va_start (args1, i);
3601             args2 = args1;
3602             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3603                 exit (1);
3604             va_end (args1); va_end (args2);
3605         }
3606         int main() { f (0, 42); return 0; }],
3607         ac_cv_va_val_copy=yes,
3608         ac_cv_va_val_copy=no,
3609         ac_cv_va_val_copy=yes
3610     )
3612 if test "x$ac_cv_va_copy" = "xyes"; then
3613     AC_DEFINE(VA_COPY, va_copy)
3614     AC_DEFINE(HAVE_VA_COPY)
3615 elif test "x$ac_cv___va_copy" = "xyes"; then
3616     AC_DEFINE(VA_COPY, __va_copy)
3617     AC_DEFINE(HAVE_VA_COPY)
3620 if test "x$ac_cv_va_val_copy" = "xno"; then
3621    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3623 AC_MSG_RESULT($ac_cv_va_val_copy)
3625 dnl Check for dll-challenged libc's.
3626 dnl This check is apparently only needed for Linux.
3627 case "$target" in
3628         *-linux*)
3629             dnl ===================================================================
3630             _curdir=`pwd`
3631             export _curdir
3632             rm -rf conftest* _conftest
3633             mkdir _conftest
3634             cat >> conftest.C <<\EOF
3635 #include <stdio.h>
3636 #include <link.h>
3637 #include <dlfcn.h>
3638 #ifdef _dl_loaded
3639 void __dump_link_map(void) {
3640   struct link_map *map = _dl_loaded;
3641   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3643 int main() {
3644   dlopen("./conftest1.so",RTLD_LAZY);
3645   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3646   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3647   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3648   __dump_link_map();
3650 #else
3651 /* _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).*/
3652 int main() { printf("./conftest1.so\n"); }
3653 #endif
3656             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3658             cat >> conftest1.C <<\EOF
3659 #include <stdio.h>
3660 void foo(void) {printf("foo in dll called\n");}
3662             ${CXX-g++} -fPIC -c -g conftest1.C
3663             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3664             ${CXX-g++} -g conftest.C -o conftest -ldl
3665             cp -f conftest1.so conftest _conftest
3666             cd _conftest
3667             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3668             then
3669                 echo
3670                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3671                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3672                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3673                 echo "*** will be excessive memory usage at runtime."
3674                 echo
3675             fi
3676             cd ${_curdir}
3677             rm -rf conftest* _conftest
3678             dnl ===================================================================
3679             ;;
3680 esac
3682 dnl ===================================================================
3683 dnl ========================================================
3684 dnl By default, turn rtti and exceptions off on g++/egcs
3685 dnl ========================================================
3686 if test "$GNU_CXX"; then
3688   AC_MSG_CHECKING(for C++ exceptions flag)
3690   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3691   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3692   [echo "int main() { return 0; }" | cat > conftest.C
3694   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3696   if egrep "warning.*renamed" conftest.out >/dev/null; then
3697     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3698   else
3699     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3700   fi
3702   rm -f conftest*])
3704   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3705   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3706   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3709 dnl ========================================================
3710 dnl Put your C++ language/feature checks below
3711 dnl ========================================================
3712 AC_LANG_CPLUSPLUS
3714 HAVE_GCC3_ABI=
3715 if test "$GNU_CC"; then
3716   AC_CACHE_CHECK(for gcc 3.0 ABI,
3717       ac_cv_gcc_three_abi,
3718       [AC_TRY_COMPILE([],
3719                       [
3720 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3721   return 0;
3722 #else
3723 #error Not gcc3.
3724 #endif
3725                       ],
3726                       ac_cv_gcc_three_abi="yes",
3727                       ac_cv_gcc_three_abi="no")])
3728   if test "$ac_cv_gcc_three_abi" = "yes"; then
3729       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3730       HAVE_GCC3_ABI=1
3731   else
3732       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3733   fi
3735 AC_SUBST(HAVE_GCC3_ABI)
3738 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3739                ac_cv_cpp_explicit,
3740                [AC_TRY_COMPILE(class X {
3741                                public: explicit X(int i) : i_(i) {}
3742                                private: int i_;
3743                                };,
3744                                X x(3);,
3745                                ac_cv_cpp_explicit=yes,
3746                                ac_cv_cpp_explicit=no)])
3747 if test "$ac_cv_cpp_explicit" = yes ; then
3748    AC_DEFINE(HAVE_CPP_EXPLICIT)
3751 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3752                ac_cv_cpp_typename,
3753                [AC_TRY_COMPILE(class param {
3754                                public:
3755                                    typedef unsigned long num_type;
3756                                };
3758                                template <class T> class tplt {
3759                                public:
3760                                    typedef typename T::num_type t_num_type;
3761                                    t_num_type foo(typename T::num_type num) {
3762                                        return num;
3763                                    }
3764                                };,
3765                                tplt<param> A;
3766                                A.foo(0);,
3767                                ac_cv_cpp_typename=yes,
3768                                ac_cv_cpp_typename=no)])
3769 if test "$ac_cv_cpp_typename" = yes ; then
3770    AC_DEFINE(HAVE_CPP_TYPENAME)
3773 dnl Check for support of modern template specialization syntax
3774 dnl Test code and requirement from scc@netscape.com.
3775 dnl Autoconf cut-and-paste job by waterson@netscape.com
3776 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3777                ac_cv_cpp_modern_specialize_template_syntax,
3778                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3779                                class Y {};
3780                                template <> struct X<Y> { double a; };,
3781                                X<int> int_x;
3782                                X<Y> y_x;,
3783                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3784                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3785 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3786   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3790 dnl Some compilers support only full specialization, and some don't.
3791 AC_CACHE_CHECK(whether partial template specialization works,
3792                ac_cv_cpp_partial_specialization,
3793                [AC_TRY_COMPILE(template <class T> class Foo {};
3794                                template <class T> class Foo<T*> {};,
3795                                return 0;,
3796                                ac_cv_cpp_partial_specialization=yes,
3797                                ac_cv_cpp_partial_specialization=no)])
3798 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3799   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3802 dnl Some compilers have limited support for operators with templates;
3803 dnl specifically, it is necessary to define derived operators when a base
3804 dnl class's operator declaration should suffice.
3805 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3806                ac_cv_need_derived_template_operators,
3807                [AC_TRY_COMPILE([template <class T> class Base { };
3808                                 template <class T>
3809                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3810                                 template <class T> class Derived : public Base<T> { };],
3811                                [Derived<char> a, b;
3812                                 Base<char> c = a + b;
3813                                 return 0;],
3814                                ac_cv_need_derived_template_operators=no,
3815                                ac_cv_need_derived_template_operators=yes)])
3816 if test "$ac_cv_need_derived_template_operators" = yes ; then
3817   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3821 dnl Some compilers have trouble detecting that a template class
3822 dnl that derives from another template is actually an instance
3823 dnl of the base class. This test checks for that.
3824 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3825                ac_cv_need_cpp_template_cast_to_base,
3826                [AC_TRY_COMPILE([template <class T> class Base { };
3827                                 template <class T> class Derived : public Base<T> { };
3828                                 template <class T> int foo(const Base<T>&) { return 0; }],
3829                                [Derived<char> bar; return foo(bar);],
3830                                ac_cv_need_cpp_template_cast_to_base=no,
3831                                ac_cv_need_cpp_template_cast_to_base=yes)])
3832 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3833   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3836 dnl Some compilers have trouble resolving the ambiguity between two
3837 dnl functions whose arguments differ only by cv-qualifications.
3838 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3839                ac_cv_can_resolve_const_ambiguity,
3840                [AC_TRY_COMPILE([
3841                                 template <class T> class ptrClass {
3842                                   public: T* ptr;
3843                                 };
3845                                 template <class T> T* a(ptrClass<T> *arg) {
3846                                   return arg->ptr;
3847                                 }
3849                                 template <class T>
3850                                 const T* a(const ptrClass<T> *arg) {
3851                                   return arg->ptr;
3852                                 }
3853                                ],
3854                                [ ptrClass<int> i;
3855                                  a(&i); ],
3856                                ac_cv_can_resolve_const_ambiguity=yes,
3857                                ac_cv_can_resolve_const_ambiguity=no)])
3858 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3859   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3863 dnl We don't do exceptions on unix.  The only reason this used to be here
3864 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3865 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3866 dnl So im commenting this out until someone writes some artificial 
3867 dnl intelligence to detect not only if the compiler has exceptions, but if 
3868 dnl they are enabled as well.
3869 dnl 
3870 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3871 dnl                ac_cv_cpp_exceptions,
3872 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3873 dnl                                static void F() { throw X(); },
3874 dnl                                try { F(); } catch(X & e) { },
3875 dnl                                ac_cv_cpp_exceptions=yes,
3876 dnl                                ac_cv_cpp_exceptions=no)])
3877 dnl if test $ac_cv_cpp_exceptions = yes ; then
3878 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3879 dnl fi
3881 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3882 dnl supports it well enough to allow us to use it to change access, but not
3883 dnl to resolve ambiguity. The next two tests determine how well the |using|
3884 dnl keyword is supported.
3886 dnl Check to see if we can change access with |using|.  Test both a
3887 dnl legal and an illegal example.
3888 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3889                ac_cv_cpp_access_changing_using2,
3890                [AC_TRY_COMPILE(
3891                    class A { protected: int foo() { return 0; } };
3892                    class B : public A { public: using A::foo; };,
3893                    B b; return b.foo();,
3894                    [AC_TRY_COMPILE(
3895                        class A { public: int foo() { return 1; } };
3896                        class B : public A { private: using A::foo; };,
3897                        B b; return b.foo();,
3898                        ac_cv_cpp_access_changing_using2=no,
3899                        ac_cv_cpp_access_changing_using2=yes)],
3900                    ac_cv_cpp_access_changing_using2=no)])
3901 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3902    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3905 dnl Check to see if we can resolve ambiguity with |using|.
3906 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3907                ac_cv_cpp_ambiguity_resolving_using,
3908                [AC_TRY_COMPILE(class X { 
3909                                  public: int go(const X&) {return 3;}
3910                                          int jo(const X&) {return 3;}
3911                                };
3912                                class Y : public X {
3913                                  public:  int go(int) {return 2;}
3914                                           int jo(int) {return 2;}
3915                                           using X::jo;
3916                                  private: using X::go;
3917                                };,
3918                                X x; Y y; y.jo(x);,
3919                                ac_cv_cpp_ambiguity_resolving_using=yes,
3920                                ac_cv_cpp_ambiguity_resolving_using=no)])
3921 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3922    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3925 dnl Check to see if the |std| namespace is supported. If so, we'll want
3926 dnl to qualify any standard library calls with "std::" to ensure that
3927 dnl those functions can be resolved.
3928 AC_CACHE_CHECK(for \"std::\" namespace,
3929                ac_cv_cpp_namespace_std,
3930                [AC_TRY_COMPILE([#include <algorithm>],
3931                                [return std::min(0, 1);],
3932                                ac_cv_cpp_namespace_std=yes,
3933                                ac_cv_cpp_namespace_std=no)])
3934 if test "$ac_cv_cpp_namespace_std" = yes ; then
3935    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3938 dnl Older compilers are overly ambitious with respect to using the standard
3939 dnl template library's |operator!=()| when |operator==()| is defined. In
3940 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3941 dnl ambiguity at compile-time. This test checks for that case.
3942 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3943                ac_cv_cpp_unambiguous_std_notequal,
3944                [AC_TRY_COMPILE([#include <algorithm>
3945                                 struct T1 {};
3946                                 int operator==(const T1&, const T1&) { return 0; }
3947                                 int operator!=(const T1&, const T1&) { return 0; }],
3948                                [T1 a,b; return a != b;],
3949                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3950                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3951 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3952   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3956 AC_CACHE_CHECK(for C++ reinterpret_cast,
3957                ac_cv_cpp_reinterpret_cast,
3958                [AC_TRY_COMPILE(struct X { int i; };
3959                                struct Y { int i; };,
3960                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3961                                ac_cv_cpp_reinterpret_cast=yes,
3962                                ac_cv_cpp_reinterpret_cast=no)])
3963 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3964    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3967 dnl See if a dynamic_cast to void* gives the most derived object.
3968 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3969                ac_cv_cpp_dynamic_cast_void_ptr,
3970                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3971                             class Y { int j; public: virtual ~Y() { } };
3972                             class Z : public X, public Y { int k; };
3974                             int main() {
3975                                  Z mdo;
3976                                  X *subx = (X*)&mdo;
3977                                  Y *suby = (Y*)&mdo;
3978                                  return !((((void*)&mdo != (void*)subx) &&
3979                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3980                                           (((void*)&mdo != (void*)suby) &&
3981                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3982                             }],
3983                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3984                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3985                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3986 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3987    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3991 dnl note that this one is reversed - if the test fails, then
3992 dnl we require implementations of unused virtual methods. Which
3993 dnl really blows because it means we'll have useless vtable
3994 dnl bloat.
3995 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3996                ac_cv_cpp_unused_required,
3997                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3998                                X x;,
3999                                ac_cv_cpp_unused_required=no,
4000                                ac_cv_cpp_unused_required=yes)])
4001 if test "$ac_cv_cpp_unused_required" = yes ; then
4002    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4006 dnl Some compilers have trouble comparing a constant reference to a templatized
4007 dnl class to zero, and require an explicit operator==() to be defined that takes
4008 dnl an int. This test separates the strong from the weak.
4010 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4011                ac_cv_trouble_comparing_to_zero,
4012                [AC_TRY_COMPILE([#include <algorithm>
4013                                 template <class T> class Foo {};
4014                                 class T2;
4015                                 template <class T> int operator==(const T2*, const T&) { return 0; }
4016                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4017                                [Foo<int> f; return (0 != f);],
4018                                ac_cv_trouble_comparing_to_zero=no,
4019                                ac_cv_trouble_comparing_to_zero=yes)])
4020 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4021   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4026 dnl End of C++ language/feature checks
4027 AC_LANG_C
4029 dnl ========================================================
4030 dnl =  Internationalization checks
4031 dnl ========================================================
4033 dnl Internationalization and Locale support is different
4034 dnl on various UNIX platforms.  Checks for specific i18n
4035 dnl features go here.
4037 dnl check for LC_MESSAGES
4038 AC_CACHE_CHECK(for LC_MESSAGES,
4039                 ac_cv_i18n_lc_messages,
4040                 [AC_TRY_COMPILE([#include <locale.h>],
4041                                 [int category = LC_MESSAGES;],
4042                                 ac_cv_i18n_lc_messages=yes,
4043                                 ac_cv_i18n_lc_messages=no)])
4044 if test "$ac_cv_i18n_lc_messages" = yes; then
4045    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4046 fi      
4048 fi # SKIP_COMPILER_CHECKS
4050 TARGET_XPCOM_ABI=
4051 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4052     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4055 dnl Mozilla specific options
4056 dnl ========================================================
4057 dnl The macros used for command line options
4058 dnl are defined in build/autoconf/altoptions.m4.
4061 dnl ========================================================
4062 dnl =
4063 dnl = Check for external package dependencies
4064 dnl =
4065 dnl ========================================================
4066 MOZ_ARG_HEADER(External Packages)
4068 MOZ_ENABLE_LIBXUL=
4070 MOZ_ARG_WITH_STRING(libxul-sdk,
4071 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4072   LIBXUL_SDK_DIR=$withval)
4074 if test "$LIBXUL_SDK_DIR" = "yes"; then
4075     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4076 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4077     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4079     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
4080         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
4081     fi
4083     MOZ_ENABLE_LIBXUL=1
4085 AC_SUBST(LIBXUL_SDK)
4087 if test -n "$LIBXUL_SDK"; then
4088     LIBXUL_DIST="$LIBXUL_SDK"
4089 else
4090     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4092 AC_SUBST(LIBXUL_DIST)
4094 SYSTEM_LIBXUL=
4096 MOZ_ARG_WITH_BOOL(system-libxul,
4097 [  --with-system-libxul   Use system installed libxul SDK],
4098     SYSTEM_LIBXUL=1)
4100 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4101     AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4104 dnl ========================================================
4105 dnl = If NSPR was not detected in the system, 
4106 dnl = use the one in the source tree (mozilla/nsprpub)
4107 dnl ========================================================
4108 MOZ_ARG_WITH_BOOL(system-nspr,
4109 [  --with-system-nspr      Use system installed NSPR],
4110     _USE_SYSTEM_NSPR=1 )
4112 if test -n "$_USE_SYSTEM_NSPR"; then
4113     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4116 if test -n "$MOZ_NATIVE_NSPR"; then
4117     _SAVE_CFLAGS=$CFLAGS
4118     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4119     AC_TRY_COMPILE([#include "prlog.h"],
4120                 [#ifndef PR_STATIC_ASSERT
4121                  #error PR_STATIC_ASSERT not defined
4122                  #endif],
4123                 [MOZ_NATIVE_NSPR=1],
4124                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4125     CFLAGS=$_SAVE_CFLAGS
4126 else
4127     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4128     if test "$OS_ARCH" = "WINCE"; then
4129         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4130         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4131     elif test "$OS_ARCH" = "WINNT"; then
4132         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4133         if test -n "$GNU_CC"; then
4134             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4135         else
4136             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4137         fi
4138     else
4139         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4140     fi
4143 dnl ========================================================
4144 dnl = If NSS was not detected in the system, 
4145 dnl = use the one in the source tree (mozilla/security/nss)
4146 dnl ========================================================
4148 MOZ_ARG_WITH_BOOL(system-nss,
4149 [  --with-system-nss      Use system installed NSS],
4150     _USE_SYSTEM_NSS=1 )
4152 if test -n "$_USE_SYSTEM_NSS"; then
4153     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4156 if test -n "$MOZ_NATIVE_NSS"; then
4157    NSS_LIBS="$NSS_LIBS -lcrmf"
4158 else
4159    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4160    NSS_DEP_LIBS="\
4161         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4162         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4163         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4164         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4165         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4166         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4168    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4169        NSS_LIBS="\
4170         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4171         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4172         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4173         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4174         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4175         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4176    else
4177        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4178    fi
4181 if test -z "$SKIP_LIBRARY_CHECKS"; then
4182 dnl system JPEG support
4183 dnl ========================================================
4184 MOZ_ARG_WITH_STRING(system-jpeg,
4185 [  --with-system-jpeg[=PFX]
4186                           Use system libjpeg [installed at prefix PFX]],
4187     JPEG_DIR=$withval)
4189 _SAVE_CFLAGS=$CFLAGS
4190 _SAVE_LDFLAGS=$LDFLAGS
4191 _SAVE_LIBS=$LIBS
4192 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4193     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4194     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4196 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4197     SYSTEM_JPEG=
4198 else
4199     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4202 if test "$SYSTEM_JPEG" = 1; then
4203     LIBS="$JPEG_LIBS $LIBS"
4204     AC_TRY_COMPILE([ #include <stdio.h>
4205                      #include <sys/types.h>
4206                      #include <jpeglib.h> ],
4207                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4208                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4209                      #endif ],
4210                    SYSTEM_JPEG=1,
4211                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4212 fi 
4213 CFLAGS=$_SAVE_CFLAGS
4214 LDFLAGS=$_SAVE_LDFLAGS
4215 LIBS=$_SAVE_LIBS
4217 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4218     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4219     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4222 dnl system ZLIB support
4223 dnl ========================================================
4224 MOZ_ARG_WITH_STRING(system-zlib,
4225 [  --with-system-zlib[=PFX]
4226                           Use system libz [installed at prefix PFX]],
4227     ZLIB_DIR=$withval)
4229 _SAVE_CFLAGS=$CFLAGS
4230 _SAVE_LDFLAGS=$LDFLAGS
4231 _SAVE_LIBS=$LIBS
4232 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4233     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4234     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4236 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4237     SYSTEM_ZLIB=
4238 else
4239     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4240         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4242 if test "$SYSTEM_ZLIB" = 1; then
4243     LIBS="$ZLIB_LIBS $LIBS"
4244     AC_TRY_COMPILE([ #include <stdio.h>
4245                      #include <string.h>
4246                      #include <zlib.h> ],
4247                    [ #if ZLIB_VERNUM < $MOZZLIB 
4248                      #error "Insufficient zlib version ($MOZZLIB required)."
4249                      #endif ],
4250                    SYSTEM_ZLIB=1,
4251                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4253 CFLAGS=$_SAVE_CFLAGS
4254 LDFLAGS=$_SAVE_LDFLAGS
4255 LIBS=$_SAVE_LIBS
4257 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4258     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4259     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4262 dnl system BZIP2 Support
4263 dnl ========================================================
4264 MOZ_ARG_WITH_STRING(system-bz2,
4265 [  --with-system-bz2[=PFX]
4266                           Use system libbz2 [installed at prefix PFX]],
4267     BZ2_DIR=$withval)
4269 _SAVE_CFLAGS=$CFLAGS
4270 _SAVE_LDFLAGS=$LDFLAGS
4271 _SAVE_LIBS=$LIBS
4272 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4273     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4274     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4276 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4277     SYSTEM_BZ2=
4278 else
4279     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4280         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4282 CFLAGS=$_SAVE_CFLAGS
4283 LDFLAGS=$_SAVE_LDFLAGS
4284 LIBS=$_SAVE_LIBS
4286 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4287     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4288     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4291 dnl system PNG Support
4292 dnl ========================================================
4293 MOZ_ARG_WITH_STRING(system-png, 
4294 [  --with-system-png[=PFX]
4295                           Use system libpng [installed at prefix PFX]],
4296     PNG_DIR=$withval)
4298 _SAVE_CFLAGS=$CFLAGS
4299 _SAVE_LDFLAGS=$LDFLAGS
4300 _SAVE_LIBS=$LIBS
4301 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4302 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4303 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4304     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4305     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4307 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4308     SYSTEM_PNG=
4309 else
4310     _SAVE_PNG_LIBS=$PNG_LIBS
4311     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4312                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4313                  $PNG_LIBS)
4314     AC_CHECK_LIB(png, png_get_acTL, ,
4315                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4316                  $_SAVE_PNG_LIBS)
4318 if test "$SYSTEM_PNG" = 1; then
4319     LIBS="$PNG_LIBS $LIBS"
4320     AC_TRY_COMPILE([ #include <stdio.h>
4321                      #include <sys/types.h>
4322                      #include <png.h> ],
4323                    [ #if PNG_LIBPNG_VER < $MOZPNG
4324                      #error "Insufficient libpng version ($MOZPNG required)."
4325                      #endif
4326                      #ifndef PNG_UINT_31_MAX
4327                      #error "Insufficient libpng version."
4328                      #endif ],
4329                    SYSTEM_PNG=1,
4330                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4332 CFLAGS=$_SAVE_CFLAGS
4333 LDFLAGS=$_SAVE_LDFLAGS
4334 LIBS=$_SAVE_LIBS
4336 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4337     PNG_CFLAGS="-I${PNG_DIR}/include"
4338     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4341 fi # SKIP_LIBRARY_CHECKS
4343 dnl system HunSpell Support
4344 dnl ========================================================
4345 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4346 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4347     SYSTEM_HUNSPELL=1 )
4349 if test -n "$SYSTEM_HUNSPELL"; then
4350     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4353 AC_SUBST(SYSTEM_HUNSPELL)
4355 dnl ========================================================
4356 dnl Java SDK support
4357 dnl ========================================================
4358 JAVA_INCLUDE_PATH=
4359 MOZ_ARG_WITH_STRING(java-include-path,
4360 [  --with-java-include-path=dir   Location of Java SDK headers],
4361     JAVA_INCLUDE_PATH=$withval)
4363 JAVA_BIN_PATH=
4364 MOZ_ARG_WITH_STRING(java-bin-path,
4365 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4366     JAVA_BIN_PATH=$withval)
4368 dnl ========================================================
4369 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4370 dnl their usage and use them in spidermonkey.
4371 dnl ========================================================
4372 MOZ_ARG_WITH_BOOL(arm-kuser,
4373 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4374     USE_ARM_KUSER=1,
4375     USE_ARM_KUSER=)
4376 if test -n "$USE_ARM_KUSER"; then
4377    AC_DEFINE(USE_ARM_KUSER)
4380 dnl ========================================================
4381 dnl =
4382 dnl = Application
4383 dnl =
4384 dnl ========================================================
4386 MOZ_ARG_HEADER(Application)
4388 BUILD_STATIC_LIBS=
4389 ENABLE_TESTS=1
4390 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4391 MOZ_BRANDING_DIRECTORY=
4392 MOZ_DBGRINFO_MODULES=
4393 MOZ_ENABLE_CANVAS=1
4394 MOZ_FEEDS=1
4395 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4396 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4397 MOZ_JAVAXPCOM=
4398 MOZ_JSDEBUGGER=1
4399 MOZ_JSLOADER=1
4400 MOZ_MATHML=1
4401 MOZ_MORK=1
4402 MOZ_MORKREADER=
4403 MOZ_AUTH_EXTENSION=1
4404 MOZ_NO_ACTIVEX_SUPPORT=1
4405 MOZ_NO_INSPECTOR_APIS=
4406 MOZ_NO_XPCOM_OBSOLETE=
4407 MOZ_NO_FAST_LOAD=
4408 MOZ_OGG=1
4409 MOZ_SYDNEYAUDIO=
4410 MOZ_WAVE=1
4411 MOZ_MEDIA=
4412 MOZ_OJI=1
4413 MOZ_PERMISSIONS=1
4414 MOZ_PLACES=
4415 MOZ_PLAINTEXT_EDITOR_ONLY=
4416 MOZ_PLUGINS=1
4417 MOZ_PREF_EXTENSIONS=1
4418 MOZ_PROFILELOCKING=1
4419 MOZ_PSM=1
4420 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4421 MOZ_PYTHON=
4422 MOZ_PYTHON_DEBUG_SUFFIX=
4423 MOZ_PYTHON_DLL_SUFFIX=
4424 MOZ_PYTHON_INCLUDES=
4425 MOZ_PYTHON_LIBS=
4426 MOZ_PYTHON_PREFIX=
4427 MOZ_PYTHON_VER=
4428 MOZ_PYTHON_VER_DOTTED=
4429 MOZ_RDF=1
4430 MOZ_REFLOW_PERF=
4431 MOZ_SAFE_BROWSING=
4432 MOZ_HELP_VIEWER=
4433 MOZ_SPELLCHECK=1
4434 MOZ_STATIC_MAIL_BUILD=
4435 MOZ_STORAGE=1
4436 MOZ_SVG=1
4437 MOZ_TIMELINE=
4438 MOZ_UI_LOCALE=en-US
4439 MOZ_UNIVERSALCHARDET=1
4440 MOZ_URL_CLASSIFIER=
4441 MOZ_USE_NATIVE_UCONV=
4442 MOZ_VIEW_SOURCE=1
4443 MOZ_XPFE_COMPONENTS=1
4444 MOZ_XPINSTALL=1
4445 MOZ_XSLT_STANDALONE=
4446 MOZ_XTF=1
4447 MOZ_XUL=1
4448 MOZ_ZIPWRITER=1
4449 NS_PRINTING=1
4450 NECKO_COOKIES=1
4451 NECKO_DISK_CACHE=1
4452 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4453 NECKO_SMALL_BUFFERS=
4454 XPC_IDISPATCH_SUPPORT=
4457 case "$target_os" in
4458 darwin*)
4459     ACCESSIBILITY=
4460     ;;
4462     ACCESSIBILITY=1
4463     ;;
4464 esac
4466 case "$target_os" in
4467     msvc*|mks*|cygwin*|mingw*)
4468         if test -z "$GNU_CC"; then 
4469             XPC_IDISPATCH_SUPPORT=1
4470             MOZ_NO_ACTIVEX_SUPPORT=
4471             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4472         fi
4473         ;;
4474 esac
4476 MOZ_ARG_ENABLE_STRING(application,
4477 [  --enable-application=APP
4478                           Options include:
4479                             browser (Firefox)
4480                             xulrunner
4481                             content/xslt (Standalone Transformiix XSLT)
4482                             netwerk (Standalone Necko)
4483                             tools/update-packaging (AUS-related packaging tools)
4484                             standalone (use this for standalone
4485                               xpcom/xpconnect or to manually drive a build)],
4486 [ MOZ_BUILD_APP=$enableval ] )
4488 MOZ_EMBEDDING_PROFILE=default
4489 MOZ_ARG_WITH_STRING(embedding-profile,
4490 [  --with-embedding-profile=default|basic|minimal
4491                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4492 [ MOZ_EMBEDDING_PROFILE=$withval ])
4494 case "$MOZ_EMBEDDING_PROFILE" in
4495 default)
4496   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4497   MOZ_EMBEDDING_LEVEL_BASIC=1
4498   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4499   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4500   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4501   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4502   ;;
4504 basic)
4505   MOZ_EMBEDDING_LEVEL_DEFAULT=
4506   MOZ_EMBEDDING_LEVEL_BASIC=1
4507   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4508   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4509   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4510   ENABLE_TESTS=
4511   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4512   MOZ_ENABLE_CANVAS=
4513   MOZ_ENABLE_POSTSCRIPT=
4514   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4515   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4516   MOZ_IMG_ENCODERS_DEFAULT=
4517   MOZ_IMG_ENCODERS=
4518   MOZ_INSTALLER=
4519   MOZ_JSDEBUGGER=
4520   MOZ_MATHML=
4521   MOZ_AUTH_EXTENSION=
4522   MOZ_NO_ACTIVEX_SUPPORT=1
4523   MOZ_NO_INSPECTOR_APIS=1
4524   MOZ_NO_XPCOM_OBSOLETE=1
4525   MOZ_NO_FAST_LOAD=1
4526   MOZ_OJI=
4527   MOZ_PLAINTEXT_EDITOR_ONLY=1
4528 #  MOZ_PLUGINS=
4529   MOZ_PREF_EXTENSIONS=
4530   MOZ_PROFILELOCKING=
4531   MOZ_SPELLCHECK=
4532   MOZ_SVG=
4533   MOZ_UNIVERSALCHARDET=
4534   MOZ_UPDATER=
4535   MOZ_USE_NATIVE_UCONV=
4536   MOZ_VIEW_SOURCE=
4537   MOZ_XPFE_COMPONENTS=
4538   MOZ_XPINSTALL=
4539   MOZ_XTF=
4540   MOZ_ZIPWRITER=
4541   NECKO_DISK_CACHE=
4542   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4543   NECKO_SMALL_BUFFERS=1
4544   NS_DISABLE_LOGGING=1
4545   NS_PRINTING=
4546   ;;
4548 minimal)
4549   MOZ_EMBEDDING_LEVEL_DEFAULT=
4550   MOZ_EMBEDDING_LEVEL_BASIC=
4551   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4552   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4553   ENABLE_TESTS=
4554   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4555   MOZ_ENABLE_CANVAS=
4556   MOZ_ENABLE_POSTSCRIPT=
4557   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4558   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4559   MOZ_IMG_ENCODERS_DEFAULT=
4560   MOZ_IMG_ENCODERS=
4561   MOZ_INSTALLER=
4562   MOZ_JSDEBUGGER=
4563   MOZ_MATHML=
4564   MOZ_AUTH_EXTENSION=
4565   MOZ_NO_ACTIVEX_SUPPORT=1
4566   MOZ_NO_INSPECTOR_APIS=1
4567   MOZ_NO_XPCOM_OBSOLETE=1
4568   MOZ_NO_FAST_LOAD=1
4569   MOZ_OJI=
4570   MOZ_PLAINTEXT_EDITOR_ONLY=1
4571   MOZ_PLUGINS=
4572   MOZ_PREF_EXTENSIONS=
4573   MOZ_PROFILELOCKING=
4574   MOZ_SPELLCHECK=
4575   MOZ_STORAGE=1
4576   MOZ_PLACES=
4577   MOZ_SVG=
4578   MOZ_UNIVERSALCHARDET=
4579   MOZ_UPDATER=
4580   MOZ_USE_NATIVE_UCONV=1
4581   MOZ_VIEW_SOURCE=
4582   MOZ_XPFE_COMPONENTS=
4583   MOZ_XPINSTALL=
4584   MOZ_XTF=
4585   MOZ_XUL=
4586   MOZ_ZIPWRITER=
4587   MOZ_RDF=
4588   NECKO_DISK_CACHE=
4589   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4590   NECKO_SMALL_BUFFERS=1
4591   NS_DISABLE_LOGGING=1
4592   NS_PRINTING=
4593   ;;
4596   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4597   ;;
4598 esac
4600 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4601 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4602 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4604 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4605 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4606   XULRUNNER_STUB_NAME=$withval)
4608 if test -z "$XULRUNNER_STUB_NAME"; then
4609   case "$target_os" in
4610   darwin*)
4611     XULRUNNER_STUB_NAME=xulrunner
4612     ;;
4613   *)
4614     XULRUNNER_STUB_NAME=xulrunner-stub
4615   esac
4617 AC_SUBST(XULRUNNER_STUB_NAME)
4619 if test -z "$MOZ_BUILD_APP"; then
4620   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4621 else
4622   # We have a valid application only if it has a build.mk file in its top
4623   # directory.
4624   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4625     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4626   fi
4629 # Allow the application to influence configure with a confvars.sh script.
4631 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4632 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4633   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4634   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4635 else
4636   AC_MSG_RESULT([no])
4639 # Now is a good time to test for logic errors, define mismatches, etc.
4640 case "$MOZ_BUILD_APP" in
4641 xulrunner)
4642   if test "$LIBXUL_SDK"; then
4643     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4644   fi
4645   ;;
4646 esac
4648 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4649 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4650 # MOZ_BUILD_APP.
4651 case "$MOZ_BUILD_APP" in
4652 browser)
4653   AC_DEFINE(MOZ_PHOENIX)
4654   ;;
4656 xulrunner)
4657   AC_DEFINE(MOZ_XULRUNNER)
4658   ;;
4660 content/xslt)
4661   AC_DEFINE(TX_EXE)
4662   ;;
4664 standalone) 
4665   MOZ_APP_NAME=mozilla
4666   MOZ_APP_DISPLAYNAME=Mozilla
4667   MOZ_APP_VERSION=$MOZILLA_VERSION
4668   ;;
4670 esac
4672 AC_SUBST(MOZ_BUILD_APP)
4673 AC_SUBST(MOZ_PHOENIX)
4674 AC_SUBST(MOZ_XULRUNNER)
4676 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4678 dnl ========================================================
4679 dnl = 
4680 dnl = Toolkit Options
4681 dnl = 
4682 dnl ========================================================
4683 MOZ_ARG_HEADER(Toolkit Options)
4685     dnl ========================================================
4686     dnl = Select the default toolkit
4687     dnl ========================================================
4688         MOZ_ARG_ENABLE_STRING(default-toolkit,
4689         [  --enable-default-toolkit=TK
4690                           Select default toolkit
4691                           Platform specific defaults:
4692                             BeOS - cairo-beos
4693                             Mac OS X - cairo-cocoa
4694                             Neutrino/QNX - photon
4695                             OS/2 - cairo-os2
4696                             Win32 - cairo-windows
4697                             WinCE - windows
4698                             Gtk2 with DirectFB - cairo-gtk2-dfb
4699                             * - cairo-gtk2
4700                             * - cairo-qt],
4701     [ _DEFAULT_TOOLKIT=$enableval ],
4702     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4704     if test "$_DEFAULT_TOOLKIT" = "photon" \
4705         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4706         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4707         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4708         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4709         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4710         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4711         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4712         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4713     then
4714         dnl nglayout only supports building with one toolkit,
4715         dnl so ignore everything after the first comma (",").
4716         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4717     else
4718         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4719     fi
4721 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4723 dnl ========================================================
4724 dnl = Enable the toolkit as needed                         =
4725 dnl ========================================================
4727 case "$MOZ_WIDGET_TOOLKIT" in
4728 photon)
4729         MOZ_ENABLE_PHOTON=1
4730         AC_DEFINE(MOZ_WIDGET_PHOTON)
4731     ;;
4733 cairo-windows)
4734     MOZ_WIDGET_TOOLKIT=windows
4735     MOZ_GFX_TOOLKIT=cairo
4736     ;;
4738 cairo-gtk2|cairo-gtk2-x11)
4739     MOZ_WIDGET_TOOLKIT=gtk2
4740     MOZ_GFX_TOOLKIT=cairo
4741     MOZ_ENABLE_GTK2=1
4742     MOZ_ENABLE_XREMOTE=1
4744     AC_DEFINE(MOZ_X11)
4745     MOZ_X11=1
4747     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4748     TK_LIBS='$(MOZ_GTK2_LIBS)'
4749     AC_DEFINE(MOZ_WIDGET_GTK2)
4750     ;;
4752 cairo-gtk2-dfb)
4753     MOZ_WIDGET_TOOLKIT=gtk2
4754     MOZ_GFX_TOOLKIT=cairo
4755     MOZ_ENABLE_GTK2=1
4757     AC_DEFINE(MOZ_DFB)
4758     MOZ_DFB=1
4760     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4761     TK_LIBS='$(MOZ_GTK2_LIBS)'
4762     AC_DEFINE(MOZ_WIDGET_GTK2)
4763     if test "$no_x" != "yes"; then
4764         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4765         no_x=yes
4766     fi
4767     ;;
4769 cairo-qt)
4770     MOZ_WIDGET_TOOLKIT=qt
4771     MOZ_GFX_TOOLKIT=cairo
4772     MOZ_ENABLE_QT=1
4773     MOZ_ENABLE_XREMOTE=1
4774     USE_ELF_DYNSTR_GC=
4775     NS_PRINTING=
4777     AC_DEFINE(MOZ_X11)
4778     MOZ_X11=1
4780     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4781     TK_LIBS='$(MOZ_QT_LIBS)'
4782     AC_DEFINE(MOZ_WIDGET_QT)
4783     ;;
4785 cairo-beos)
4786     MOZ_WIDGET_TOOLKIT=beos
4787     MOZ_GFX_TOOLKIT=cairo
4788     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4789     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4790     ;;
4792 cairo-os2)
4793     MOZ_WIDGET_TOOLKIT=os2
4794     MOZ_GFX_TOOLKIT=cairo
4795     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4796     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4797     ;;
4799 cairo-cocoa)
4800     MOZ_WIDGET_TOOLKIT=cocoa
4801     AC_DEFINE(MOZ_WIDGET_COCOA)
4802     MOZ_ENABLE_COCOA=1
4803     MOZ_GFX_TOOLKIT=cairo
4804     MOZ_USER_DIR="Mozilla"
4805     AC_DEFINE(XP_MACOSX)
4806     AC_DEFINE(TARGET_CARBON)
4807     AC_DEFINE(TARGET_API_MAC_CARBON)
4808     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4809     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4810     CFLAGS="$CFLAGS $TK_CFLAGS"
4811     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4812     ;;
4813 esac
4815 if test "$MOZ_ENABLE_XREMOTE"; then
4816     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4819 if test "$COMPILE_ENVIRONMENT"; then
4820   if test "$MOZ_ENABLE_GTK2"; then
4821     if test "$MOZ_X11"; then
4822       GDK_PACKAGES=gdk-x11-2.0
4823     elif test "$MOZ_DFB"; then
4824       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4825       GDK_PACKAGES=directfb
4826     fi
4828     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4829   fi
4831 fi # COMPILE_ENVIRONMENT
4833 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4835 dnl ========================================================
4836 dnl = startup-notification support module
4837 dnl ========================================================
4839 if test "$MOZ_ENABLE_GTK2"
4840 then
4841     MOZ_ENABLE_STARTUP_NOTIFICATION=
4843     MOZ_ARG_ENABLE_BOOL(startup-notification,
4844     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4845         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4846         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4847     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4848     then
4849         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4850                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4851         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4852             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4853             then
4854                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4855             fi
4856             MOZ_ENABLE_STARTUP_NOTIFICATION=
4857         ])
4858     fi
4860     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4861         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4862     fi
4864     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4866 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4867 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4868 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4870 dnl ========================================================
4871 dnl = QT support
4872 dnl ========================================================
4873 if test "$MOZ_ENABLE_QT"
4874 then
4875     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4876     AC_SUBST(MOZ_QT_CFLAGS)
4877     AC_SUBST(MOZ_QT_LIBS)
4879     MOZ_ARG_WITH_STRING(qtdir,
4880     [  --with-qtdir=\$dir       Specify Qt directory ],
4881     [ QTDIR=$withval])
4883     if test -z "$QTDIR"; then
4884       QTDIR="/usr"
4885     fi
4886     QTINCDIR="/include/qt"
4887     if test ! -d "$QTDIR$QTINCDIR"; then
4888        QTINCDIR="/include/X11/qt"
4889     fi
4890     if test ! -d "$QTDIR$QTINCDIR"; then
4891        QTINCDIR="/include"
4892     fi
4894     if test -x "$QTDIR/bin/moc-qt4"; then
4895       HOST_MOC="$QTDIR/bin/moc-qt4"
4896     else
4897       if test -x "$QTDIR/bin/moc"; then
4898         HOST_MOC="$QTDIR/bin/moc"
4899       else
4900         AC_CHECK_PROGS(HOST_MOC, moc, "")
4901       fi
4902     fi
4903     if test -z "$HOST_MOC"; then
4904       AC_MSG_ERROR([no acceptable moc preprocessor found])
4905     fi
4906     MOC=$HOST_MOC
4909 AC_SUBST(GTK_CONFIG)
4910 AC_SUBST(TK_CFLAGS)
4911 AC_SUBST(TK_LIBS)
4913 AC_SUBST(MOZ_ENABLE_GTK2)
4914 AC_SUBST(MOZ_ENABLE_PHOTON)
4915 AC_SUBST(MOZ_ENABLE_COCOA)
4916 AC_SUBST(MOZ_ENABLE_QT)
4917 AC_SUBST(MOZ_ENABLE_XREMOTE)
4918 AC_SUBST(MOZ_GTK2_CFLAGS)
4919 AC_SUBST(MOZ_GTK2_LIBS)
4920 AC_SUBST(MOZ_QT_CFLAGS)
4921 AC_SUBST(MOZ_QT_LIBS)
4923 AC_SUBST(MOC)
4925 AC_SUBST(MOZ_DFB)
4926 AC_SUBST(MOZ_X11)
4928 dnl ========================================================
4929 dnl =
4930 dnl = Components & Features
4931 dnl = 
4932 dnl ========================================================
4933 MOZ_ARG_HEADER(Components and Features)
4935 dnl ========================================================
4936 dnl = Localization
4937 dnl ========================================================
4938 MOZ_ARG_ENABLE_STRING(ui-locale,
4939 [  --enable-ui-locale=ab-CD
4940                           Select the user interface locale (default: en-US)],
4941     MOZ_UI_LOCALE=$enableval )
4942 AC_SUBST(MOZ_UI_LOCALE)
4944 dnl ========================================================
4945 dnl = Trademarked Branding 
4946 dnl ========================================================
4947 MOZ_ARG_ENABLE_BOOL(official-branding,
4948 [  --enable-official-branding Enable Official mozilla.org Branding
4949                           Do not distribute builds with
4950                           --enable-official-branding unless you have
4951                           permission to use trademarks per
4952                           http://www.mozilla.org/foundation/trademarks/ .],
4953 [case "$MOZ_BUILD_APP" in
4954 browser)
4955     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4956     MOZ_APP_DISPLAYNAME=Firefox
4957     ;;
4960     AC_MSG_ERROR([Official branding is only available for Firefox.])
4961 esac
4964 MOZ_ARG_WITH_STRING(branding,
4965 [  --with-branding=dir    Use branding from the specified directory.],
4966     MOZ_BRANDING_DIRECTORY=$withval)
4968 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4969 if test -z "$REAL_BRANDING_DIRECTORY"; then
4970   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4973 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4974   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4977 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4979 dnl ========================================================
4980 dnl = Distribution ID
4981 dnl ========================================================
4982 MOZ_ARG_WITH_STRING(distribution-id,
4983 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4984 [ val=`echo $withval`
4985     MOZ_DISTRIBUTION_ID="$val"])
4987 if test -z "$MOZ_DISTRIBUTION_ID"; then
4988    MOZ_DISTRIBUTION_ID="org.mozilla"
4991 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4992 AC_SUBST(MOZ_DISTRIBUTION_ID)
4995 dnl ========================================================
4996 dnl complex text support off by default
4997 dnl ========================================================
4998 MOZ_PANGO=1
4999 MOZ_ARG_DISABLE_BOOL(pango,
5000 [  --disable-pango Disable usage of Pango ],
5001     MOZ_PANGO=,
5002     MOZ_PANGO=1)
5005 dnl ========================================================
5006 dnl = Pango
5007 dnl ========================================================
5008 if test "$MOZ_ENABLE_GTK2"
5009 then
5010     AC_SUBST(MOZ_PANGO)
5012     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5014     if test "$MOZ_PANGO"
5015     then
5016         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5017         AC_SUBST(MOZ_PANGO_CFLAGS)
5018         AC_SUBST(MOZ_PANGO_LIBS)
5019         AC_DEFINE(MOZ_PANGO)
5020     else
5021         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5022         AC_SUBST(MOZ_PANGO_CFLAGS)
5023         AC_SUBST(MOZ_PANGO_LIBS)
5025         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5026         AC_SUBST(FT2_CFLAGS)
5027         AC_SUBST(FT2_LIBS)
5028     fi
5031 dnl ========================================================
5032 dnl = PostScript print module
5033 dnl ========================================================
5034 MOZ_ARG_DISABLE_BOOL(postscript,
5035 [  --disable-postscript    Disable PostScript printing support ],
5036     MOZ_ENABLE_POSTSCRIPT=,
5037     MOZ_ENABLE_POSTSCRIPT=1 )
5039 dnl ========================================================
5040 dnl = GnomeVFS support module
5041 dnl ========================================================
5043 if test "$MOZ_X11"
5044 then
5045     dnl build the gnomevfs extension by default only when the
5046     dnl GTK2 toolkit is in use.
5047     if test "$MOZ_ENABLE_GTK2"
5048     then
5049         MOZ_ENABLE_GNOMEVFS=1
5050         MOZ_ENABLE_GCONF=1
5051         MOZ_ENABLE_LIBGNOME=1
5052     fi
5054     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5055     [  --disable-gnomevfs      Disable GnomeVFS support ],
5056         MOZ_ENABLE_GNOMEVFS=,
5057         MOZ_ENABLE_GNOMEVFS=force)
5059     if test "$MOZ_ENABLE_GNOMEVFS"
5060     then
5061         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5062             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5063             MOZ_ENABLE_GNOMEVFS=1
5064         ],[
5065             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5066             then
5067                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5068             fi
5069             MOZ_ENABLE_GNOMEVFS=
5070         ])
5071     fi
5073     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5074     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5076     if test "$MOZ_ENABLE_GCONF"
5077     then
5078         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5079             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5080             MOZ_ENABLE_GCONF=1
5081         ],[
5082             MOZ_ENABLE_GCONF=
5083         ])
5084     fi
5086     if test "$MOZ_ENABLE_GCONF"; then
5087         AC_DEFINE(MOZ_ENABLE_GCONF)
5088     fi
5090     AC_SUBST(MOZ_ENABLE_GCONF)
5091     AC_SUBST(MOZ_GCONF_CFLAGS)
5092     AC_SUBST(MOZ_GCONF_LIBS)
5094     if test "$MOZ_ENABLE_LIBGNOME"
5095     then
5096         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5097             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5098             MOZ_ENABLE_LIBGNOME=1
5099         ],[
5100             MOZ_ENABLE_LIBGNOME=
5101         ])
5102     fi
5104     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5105     AC_SUBST(MOZ_LIBGNOME_LIBS)
5107     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5108     # are all available.
5110     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5111             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5112       MOZ_ENABLE_GNOME_COMPONENT=1
5113     else
5114       MOZ_ENABLE_GNOME_COMPONENT=
5115     fi
5117     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5120 dnl ========================================================
5121 dnl = libgnomeui support module
5122 dnl ========================================================
5124 if test "$MOZ_ENABLE_GTK2"
5125 then
5126     MOZ_ENABLE_GNOMEUI=1
5128     MOZ_ARG_DISABLE_BOOL(gnomeui,
5129     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5130         MOZ_ENABLE_GNOMEUI=,
5131         MOZ_ENABLE_GNOMEUI=force)
5133     if test "$MOZ_ENABLE_GNOMEUI"
5134     then
5135         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5136         [
5137             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5138             MOZ_ENABLE_GNOMEUI=1
5139         ],[
5140             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5141             then
5142                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5143             fi
5144             MOZ_ENABLE_GNOMEUI=
5145         ])
5146     fi
5148     if test "$MOZ_ENABLE_GNOMEUI"; then
5149         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5150     fi
5152 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5153 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5154 AC_SUBST(MOZ_GNOMEUI_LIBS)
5156 dnl ========================================================
5157 dnl = dbus support
5158 dnl ========================================================
5160 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5161 then
5162     MOZ_ENABLE_DBUS=1
5164     MOZ_ARG_DISABLE_BOOL(dbus,
5165     [  --disable-dbus       Disable dbus support ],
5166         MOZ_ENABLE_DBUS=,
5167         MOZ_ENABLE_DBUS=1)
5169     if test "$MOZ_ENABLE_DBUS"
5170     then
5171         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5172         AC_DEFINE(MOZ_ENABLE_DBUS)
5173     fi
5175 AC_SUBST(MOZ_ENABLE_DBUS)
5176 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5177 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5179 dnl ========================================================
5180 dnl = libnotify support
5181 dnl ========================================================
5183 MOZ_ARG_ENABLE_BOOL(libnotify,
5184 [  --enable-libnotify       Enable libnotify support ],
5185     MOZ_ENABLE_LIBNOTIFY=1,
5186     MOZ_ENABLE_LIBNOTIFY=)
5188 if test "$MOZ_ENABLE_GTK2"
5189 then
5190     if test "$MOZ_ENABLE_LIBNOTIFY"
5191     then
5192         AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5193     fi
5196 if test -z "$SKIP_LIBRARY_CHECKS"
5197 then
5198     if test "$MOZ_ENABLE_GTK2"
5199     then
5200         if test "$MOZ_ENABLE_LIBNOTIFY"
5201         then
5202             PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5203         fi
5204     fi
5206 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5207 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5208 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5210 dnl ========================================================
5211 dnl = Build Personal Security Manager
5212 dnl ========================================================
5213 MOZ_ARG_DISABLE_BOOL(crypto,
5214 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5215     MOZ_PSM=,
5216     MOZ_PSM=1 )
5218 dnl ========================================================
5219 dnl = JS Debugger XPCOM component (js/jsd)
5220 dnl ========================================================
5221 MOZ_ARG_DISABLE_BOOL(jsd,
5222 [  --disable-jsd           Disable JavaScript debug library],
5223     MOZ_JSDEBUGGER=,
5224     MOZ_JSDEBUGGER=1)
5227 dnl ========================================================
5228 dnl = Disable plugin support
5229 dnl ========================================================
5230 MOZ_ARG_DISABLE_BOOL(plugins,
5231 [  --disable-plugins       Disable plugins support],
5232     MOZ_PLUGINS=,
5233     MOZ_PLUGINS=1)
5235 dnl ========================================================
5236 dnl = Disable building dbm
5237 dnl ========================================================
5238 MOZ_ARG_DISABLE_BOOL(dbm,
5239 [  --disable-dbm       Disable building dbm],
5240     NSS_DISABLE_DBM=1,
5241     NSS_DISABLE_DBM=)
5243 dnl ========================================================
5244 dnl = Open JVM Interface (OJI) support
5245 dnl ========================================================
5246 MOZ_ARG_DISABLE_BOOL(oji,
5247 [  --disable-oji           Disable Open JVM Integration support],
5248     MOZ_OJI=,
5249     MOZ_OJI=1)
5250 if test -n "$MOZ_OJI"; then
5251     AC_DEFINE(OJI)
5254 dnl bi-directional support always on
5255 IBMBIDI=1
5256 AC_DEFINE(IBMBIDI)
5258 dnl ========================================================
5259 dnl view source support on by default
5260 dnl ========================================================
5261 MOZ_ARG_DISABLE_BOOL(view-source,
5262 [  --disable-view-source     Disable view source support],
5263     MOZ_VIEW_SOURCE=,
5264     MOZ_VIEW_SOURCE=1 )
5265 if test "$MOZ_VIEW_SOURCE"; then
5266     AC_DEFINE(MOZ_VIEW_SOURCE)
5270 dnl ========================================================
5271 dnl accessibility support on by default on all platforms 
5272 dnl except OS X.
5273 dnl ========================================================
5274 MOZ_ARG_DISABLE_BOOL(accessibility,
5275 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5276     ACCESSIBILITY=,
5277     ACCESSIBILITY=1 )
5278 if test "$ACCESSIBILITY"; then
5279     AC_DEFINE(ACCESSIBILITY)
5282 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5283 case "$target" in
5284 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5285     if test "$ac_cv_header_atlbase_h" = "no"; then
5286         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.])
5287     fi
5288     if test "$ac_cv_header_oleacc_idl" = "no"; then
5289         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.])
5290     fi
5291     ;;
5292 esac
5295 dnl ========================================================
5296 dnl xpfe/components on by default
5297 dnl ========================================================
5298 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5299 [  --disable-xpfe-components
5300                           Disable xpfe components],
5301     MOZ_XPFE_COMPONENTS=,
5302     MOZ_XPFE_COMPONENTS=1 )
5304 dnl ========================================================
5305 dnl xpinstall support on by default
5306 dnl ========================================================
5307 MOZ_ARG_DISABLE_BOOL(xpinstall,
5308 [  --disable-xpinstall     Disable xpinstall support],
5309     MOZ_XPINSTALL=,
5310     MOZ_XPINSTALL=1 )
5311 if test "$MOZ_XPINSTALL"; then
5312     AC_DEFINE(MOZ_XPINSTALL)
5315 dnl ========================================================
5316 dnl xpcom js loader support on by default
5317 dnl ========================================================
5318 MOZ_ARG_DISABLE_BOOL(jsloader,
5319 [  --disable-jsloader      Disable xpcom js loader support],
5320     MOZ_JSLOADER=,
5321     MOZ_JSLOADER=1 )
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 = Drop XPCOM Obsolete library
5374 dnl ========================================================
5375 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5376 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5377     MOZ_NO_XPCOM_OBSOLETE=1,
5378     MOZ_NO_XPCOM_OBSOLETE=)
5380 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5381     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5384 dnl ========================================================
5385 dnl = Disable Fast Load
5386 dnl ========================================================
5387 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5388 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5389     MOZ_NO_FAST_LOAD=1,
5390     MOZ_NO_FAST_LOAD=)
5392 AC_SUBST(MOZ_NO_FAST_LOAD)
5394 if test -n "$MOZ_NO_FAST_LOAD"; then
5395     AC_DEFINE(MOZ_NO_FAST_LOAD)
5398 dnl ========================================================
5399 dnl = Disable Ogg Codecs
5400 dnl ========================================================
5401 MOZ_ARG_DISABLE_BOOL(ogg,
5402 [  --disable-ogg           Disable Ogg Codec support],
5403     MOZ_OGG=,
5404     MOZ_OGG=1)
5406 AC_SUBST(MOZ_OGG)
5408 if test -n "$MOZ_OGG"; then
5409     AC_DEFINE(MOZ_OGG)
5410     MOZ_SYDNEYAUDIO=1
5411     MOZ_MEDIA=1
5414 dnl ========================================================
5415 dnl = Disable Wave decoder support
5416 dnl ========================================================
5417 MOZ_ARG_DISABLE_BOOL(wave,
5418 [  --disable-wave          Disable Wave decoder support],
5419     MOZ_WAVE=,
5420     MOZ_WAVE=1)
5422 AC_SUBST(MOZ_WAVE)
5424 if test -n "$MOZ_WAVE"; then
5425     AC_DEFINE(MOZ_WAVE)
5426     MOZ_SYDNEYAUDIO=1
5427     MOZ_MEDIA=1
5430 dnl ========================================================
5431 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5432 dnl ========================================================
5434 AC_SUBST(MOZ_SYDNEYAUDIO)
5436 if test -n "$MOZ_SYDNEYAUDIO"; then
5437     AC_DEFINE(MOZ_SYDNEYAUDIO)
5440 AC_SUBST(MOZ_MEDIA)
5442 if test -n "$MOZ_MEDIA"; then
5443     AC_DEFINE(MOZ_MEDIA)
5446 dnl ========================================================
5447 dnl = Check alsa availability on Linux if using sydneyaudio
5448 dnl ========================================================
5450 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5451 if test "$COMPILE_ENVIRONMENT"; then
5452 if test -n "$MOZ_SYDNEYAUDIO"; then
5453    case "$target_os" in
5454 linux*)
5455       AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5456       ;;
5457    esac
5461 dnl ========================================================
5462 dnl Permissions System
5463 dnl ========================================================
5464 MOZ_ARG_DISABLE_BOOL(permissions,
5465 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5466     MOZ_PERMISSIONS=,
5467     MOZ_PERMISSIONS=1
5470 dnl ========================================================
5471 dnl NegotiateAuth
5472 dnl ========================================================
5473 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5474 [  --disable-negotiateauth Disable GSS-API negotiation ],
5475     MOZ_AUTH_EXTENSION=,
5476     MOZ_AUTH_EXTENSION=1 )
5478 dnl ========================================================
5479 dnl XTF
5480 dnl ========================================================
5481 MOZ_ARG_DISABLE_BOOL(xtf,
5482 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5483     MOZ_XTF=,
5484     MOZ_XTF=1 )
5485 if test "$MOZ_XTF"; then
5486   AC_DEFINE(MOZ_XTF)
5489 dnl ========================================================
5490 dnl Inspector APIs
5491 dnl ========================================================
5492 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5493 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5494     MOZ_NO_INSPECTOR_APIS=1,
5495     MOZ_NO_INSPECTOR_APIS= )
5497 dnl ========================================================
5498 dnl Pref extensions (autoconfig and system-pref)
5499 dnl ========================================================
5500 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5501 [  --disable-pref-extensions
5502                           Disable pref extensions such as autoconfig and
5503                           system-pref],
5504   MOZ_PREF_EXTENSIONS=,
5505   MOZ_PREF_EXTENSIONS=1 )
5507 dnl ========================================================
5508 dnl = Universalchardet
5509 dnl ========================================================
5510 MOZ_ARG_DISABLE_BOOL(universalchardet,
5511 [  --disable-universalchardet
5512                           Disable universal encoding detection],
5513   MOZ_UNIVERSALCHARDET=,
5514   MOZ_UNIVERSALCHARDET=1 )
5516 dnl ========================================================
5517 dnl JavaXPCOM
5518 dnl ========================================================
5519 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5520 [  --enable-javaxpcom
5521                           Enable Java-XPCOM bridge],
5522     MOZ_JAVAXPCOM=1,
5523     MOZ_JAVAXPCOM= )
5525 if test -n "${MOZ_JAVAXPCOM}"; then
5526   case "$host_os" in
5527     cygwin*|msvc*|mks*)
5528       if test -n "$JAVA_HOME"; then
5529         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5530       fi
5531       ;;
5532     *mingw*)
5533       if test -n "$JAVA_HOME"; then
5534         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5535       fi
5536       ;;
5537   esac
5539   if test -n "${JAVA_INCLUDE_PATH}"; then
5540     dnl Make sure jni.h exists in the given include path.
5541     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5542       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5543     fi
5544   else
5545     case "$target_os" in
5546       darwin*)
5547         dnl Default to java system location
5548         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5549         ;;
5550       *)
5551         dnl Try $JAVA_HOME
5552         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5553         ;;
5554     esac
5555     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5556       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.])
5557     fi
5558   fi
5560   if test -n "${JAVA_BIN_PATH}"; then
5561     dnl Look for javac and jar in the specified path.
5562     JAVA_PATH="$JAVA_BIN_PATH"
5563   else
5564     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5565     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5566   fi
5568   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5569   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5570   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5571   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5572     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.])
5573   fi
5576 dnl ========================================================
5577 dnl = Breakpad crash reporting (on by default on supported platforms)
5578 dnl ========================================================
5580 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5581     || test "$OS_ARCH" = "Darwin" \
5582     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5583     || test "$OS_ARCH" = "SunOS") \
5584    && test -z "$HAVE_64BIT_OS"; then
5585    MOZ_CRASHREPORTER=1
5588 MOZ_ARG_DISABLE_BOOL(crashreporter,
5589 [  --disable-crashreporter          Disable breakpad crash reporting],
5590     MOZ_CRASHREPORTER=,
5591     MOZ_CRASHREPORTER=1)
5593 if test -n "$MOZ_CRASHREPORTER"; then
5594    AC_DEFINE(MOZ_CRASHREPORTER)
5596   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5597     test -z "$SKIP_LIBRARY_CHECKS"; then
5598     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5599     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5600     AC_SUBST(MOZ_GTHREAD_LIBS)
5602     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.])])
5603   fi
5606 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5607 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5608 [ val=`echo $withval | sed 's/[^0-9]//g'`
5609     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5611 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5612    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5614 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5616 dnl ========================================================
5617 dnl = Enable compilation of specific extension modules
5618 dnl ========================================================
5620 MOZ_ARG_ENABLE_STRING(extensions,
5621 [  --enable-extensions     Enable extensions],
5622 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5623     if test "$option" = "yes" || test "$option" = "all"; then
5624         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5625     elif test "$option" = "no" || test "$option" = "none"; then
5626         MOZ_EXTENSIONS=""
5627     elif test "$option" = "default"; then
5628         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5629     elif test `echo "$option" | grep -c \^-` != 0; then
5630         option=`echo $option | sed 's/^-//'`
5631         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5632     else
5633         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5634     fi
5635 done],
5636     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5638 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5639     # Suppress warning on non-X11 platforms
5640     if test -n "$MOZ_X11"; then
5641         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5642     fi
5643     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5646 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5647     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5648     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5651 dnl This might be temporary: build tridentprofile only on Windows
5652 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5653     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5654     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5657 dnl cookie must be built before tridentprofile. put it at list's end.
5658 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5659   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5660   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5663 dnl xforms requires xtf and schema-validation
5664 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5665     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5666     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5668 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5669     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5670     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5673 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5674     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5675     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5678 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5679     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5680     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5683 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5684     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5685     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5688 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5689     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5690     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5693 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5694     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5695     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5698 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5699     AC_MSG_WARN([spellcheck is no longer an extension.])
5700     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5703 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5704     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5705     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5708 dnl Remove dupes
5709 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5711 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5712 dnl when trying to build a non-existent extension.
5713 for extension in $MOZ_EXTENSIONS; do
5714     if test ! -d "${srcdir}/extensions/${extension}"; then
5715         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5716     fi
5717 done
5720 dnl ========================================================
5721 dnl Image decoders
5722 dnl ========================================================
5723 case "$MOZ_WIDGET_TOOLKIT" in
5724 beos|windows|os2|mac|cocoa)
5725     ;;
5727     if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5728        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5729     fi
5730     ;;
5731 esac
5733 MOZ_ARG_ENABLE_STRING(image-decoders,
5734 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5735                           Enable specific image decoders],
5736 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5737     if test "$option" = "yes" || test "$option" = "all"; then
5738         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5739     elif test "$option" = "no" || test "$option" = "none"; then
5740         MOZ_IMG_DECODERS=""
5741     elif test "$option" = "default"; then
5742         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5743     elif test `echo "$option" | grep -c \^-` != 0; then
5744         option=`echo $option | sed 's/^-//'`
5745         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5746     else
5747         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5748     fi
5749 done],
5750     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5752 dnl Dupes are removed in the encoder section because it will also add decoders
5754 dnl ========================================================
5755 dnl Image encoders
5756 dnl ========================================================
5757 MOZ_ARG_ENABLE_STRING(image-encoders,
5758 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5759                           Enable specific image encoders],
5760 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5761     if test "$option" = "yes" || test "$option" = "all"; then
5762         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5763     elif test "$option" = "no" || test "$option" = "none"; then
5764         MOZ_IMG_ENCODERS=""
5765         addencoder=""
5766     elif test "$option" = "default"; then
5767         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5768     elif test `echo "$option" | grep -c \^-` != 0; then
5769         option=`echo $option | sed 's/^-//'`
5770         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5771     else
5772         addencoder="$option"
5773     fi
5774     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5775 done],
5776     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5778 dnl Remove dupes
5779 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5780 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5782 dnl ========================================================
5783 dnl MathML on by default
5784 dnl ========================================================
5785 MOZ_ARG_DISABLE_BOOL(mathml,
5786 [  --disable-mathml        Disable MathML support],
5787     MOZ_MATHML=,
5788     MOZ_MATHML=1 )
5789 if test "$MOZ_MATHML"; then
5790   AC_DEFINE(MOZ_MATHML)
5793 dnl ========================================================
5794 dnl Canvas
5795 dnl ========================================================
5796 MOZ_ARG_DISABLE_BOOL(canvas,
5797 [  --disable-canvas          Disable html:canvas feature],
5798     MOZ_ENABLE_CANVAS=,
5799     MOZ_ENABLE_CANVAS=1 )
5800 if test -n "$MOZ_ENABLE_CANVAS"; then
5801     AC_DEFINE(MOZ_ENABLE_CANVAS)
5803 AC_SUBST(MOZ_ENABLE_CANVAS)
5805 dnl ========================================================
5806 dnl SVG
5807 dnl ========================================================
5808 MOZ_ARG_DISABLE_BOOL(svg,
5809 [  --disable-svg            Disable SVG support],
5810     MOZ_SVG=,
5811     MOZ_SVG=1 )
5812 if test -n "$MOZ_SVG"; then
5813   AC_DEFINE(MOZ_SVG)
5816 dnl ========================================================
5817 dnl SMIL
5818 dnl ========================================================
5819 MOZ_ARG_ENABLE_BOOL(smil,
5820 [  --enable-smil            Enable SMIL animation support],
5821     MOZ_SMIL=1,
5822     MOZ_SMIL= )
5823 if test -n "$MOZ_SMIL"; then
5824   AC_DEFINE(MOZ_SMIL)
5827 dnl ========================================================
5828 dnl Build Freetype in the tree
5829 dnl ========================================================
5830 MOZ_ARG_ENABLE_BOOL(tree-freetype,
5831 [  --enable-tree-freetype         Enable Tree FreeType],
5832     MOZ_TREE_FREETYPE=1,
5833     MOZ_TREE_FREETYPE= )
5834 if test -n "$MOZ_TREE_FREETYPE"; then
5835    AC_DEFINE(MOZ_TREE_FREETYPE)
5836    AC_SUBST(MOZ_TREE_FREETYPE)
5837    MOZ_ENABLE_CAIRO_FT=1       
5838    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5839    FC_FONT_FEATURE="#define CAIRO_DISABLE_FONTCONFIG 1"
5840    FT2_CFLAGS="-I${topsrcdir}/modules/freetype2/include"
5841    CAIRO_FT_CFLAGS="-I${topsrcdir}/modules/freetype2/include"
5842    FT2_LIBS="${LIBXUL_DIST}/lib/freetype2.lib"
5843    CAIRO_FT_LIBS = "${LIBXUL_DIST}/lib/freetype2.lib"
5844    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
5845    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
5846    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
5847    AC_SUBST(CAIRO_FT_CFLAGS)
5851 dnl ========================================================
5852 dnl Installer
5853 dnl ========================================================
5854 case "$target_os" in
5855     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5856         MOZ_INSTALLER=1
5857         ;;
5858 esac
5860 MOZ_ARG_DISABLE_BOOL(installer,
5861 [  --disable-installer     Disable building of installer],
5862     MOZ_INSTALLER=,
5863     MOZ_INSTALLER=1 )
5864 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
5865     # Disable installer for Windows builds that use the new toolkit if NSIS
5866     # isn't in the path.
5867     AC_PATH_PROGS(MAKENSIS, makensis)
5868     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5869         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5870     fi
5871     # The Windows build for NSIS requires the iconv command line utility to
5872     # convert the charset of the locale files.
5873     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5874     if test -z "$HOST_ICONV"; then
5875         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5876     fi
5879 # Automatically disable installer if xpinstall isn't built
5880 if test -z "$MOZ_XPINSTALL"; then
5881     MOZ_INSTALLER=
5883 AC_SUBST(MOZ_INSTALLER)
5885 AC_MSG_CHECKING([for tar archiver])
5886 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5887 if test -z "$TAR"; then
5888     AC_MSG_ERROR([no tar archiver found in \$PATH])
5890 AC_MSG_RESULT([$TAR])
5891 AC_SUBST(TAR)
5893 AC_MSG_CHECKING([for wget])
5894 AC_CHECK_PROGS(WGET, wget, "")
5895 AC_MSG_RESULT([$WGET])
5896 AC_SUBST(WGET)
5898 dnl ========================================================
5899 dnl Updater
5900 dnl ========================================================
5902 MOZ_ARG_DISABLE_BOOL(updater,
5903 [  --disable-updater       Disable building of updater],
5904     MOZ_UPDATER=,
5905     MOZ_UPDATER=1 )
5906 AC_SUBST(MOZ_UPDATER)
5908 # app update channel is 'default' when not supplied.
5909 MOZ_ARG_ENABLE_STRING([update-channel],
5910 [  --enable-update-channel=CHANNEL
5911                            Select application update channel (default=default)],
5912     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5914 if test -z "$MOZ_UPDATE_CHANNEL"; then
5915     MOZ_UPDATE_CHANNEL=default
5917 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5919 # tools/update-packaging is not checked out by default.
5920 MOZ_ARG_ENABLE_BOOL(update-packaging,
5921 [  --enable-update-packaging
5922                            Enable tools/update-packaging],
5923     MOZ_UPDATE_PACKAGING=1,
5924     MOZ_UPDATE_PACKAGING= )
5925 AC_SUBST(MOZ_UPDATE_PACKAGING)
5927 dnl ========================================================
5928 dnl ActiveX
5929 dnl ========================================================
5931 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5932 [  --disable-xpconnect-idispatch
5933                           Disable building of xpconnect support for IDispatch
5934                           (win32 only)],
5935     XPC_IDISPATCH_SUPPORT=,
5936     XPC_IDISPATCH_SUPPORT=1)
5937 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5939 MOZ_ARG_DISABLE_BOOL(activex,
5940 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5941     MOZ_NO_ACTIVEX_SUPPORT=1,
5942     MOZ_NO_ACTIVEX_SUPPORT= )
5943 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5945 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5946 [  --disable-activex-scripting
5947                           Disable building of ActiveX scripting support (win32)],
5948     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5949     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5950 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5952 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5953 then
5954     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5957 if test "$COMPILE_ENVIRONMENT" = "1"; then
5958 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5959 case "$target" in
5960 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5961     if test "$ac_cv_header_atlbase_h" = "no"; then
5962         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.])
5963     fi
5964     ;;
5965 esac
5969 dnl ========================================================
5970 dnl leaky
5971 dnl ========================================================
5972 MOZ_ARG_ENABLE_BOOL(leaky,
5973 [  --enable-leaky          Build leaky memory tool],
5974     MOZ_LEAKY=1,
5975     MOZ_LEAKY=)
5978 dnl ========================================================
5979 dnl xpctools
5980 dnl ========================================================
5981 MOZ_ARG_ENABLE_BOOL(xpctools,
5982 [  --enable-xpctools       Build JS profiling tool],
5983     MOZ_XPCTOOLS=1,
5984     MOZ_XPCTOOLS= )
5987 dnl ========================================================
5988 dnl build the tests by default
5989 dnl ========================================================
5990 MOZ_ARG_DISABLE_BOOL(tests,
5991 [  --disable-tests         Do not build test libraries & programs],
5992     ENABLE_TESTS=,
5993     ENABLE_TESTS=1 )
5995 dnl ========================================================
5996 dnl parental controls (for Windows Vista)
5997 dnl ========================================================
5998 MOZ_ARG_DISABLE_BOOL(parental-controls,
5999 [  --disable-parental-controls
6000                            Do not build parental controls],
6001    MOZ_DISABLE_PARENTAL_CONTROLS=1,
6002    MOZ_DISABLE_PARENTAL_CONTROLS=)
6003 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6004     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6007 dnl ========================================================
6008 dnl Vista SDK specific api
6009 dnl ========================================================
6010 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
6011 [  --disable-vista-sdk-requirements
6012                            Do not build Vista SDK specific code],
6013    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
6014    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
6015 if test -n "$COMPILE_ENVIRONMENT"; then
6016 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
6017     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
6018     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
6019     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6020         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6021     fi
6022     MOZ_DISABLE_PARENTAL_CONTROLS=1
6023 else
6024 case "$target" in
6025 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6026     if test "$ac_cv_header_wpcapi_h" = "no"; then
6027         AC_MSG_ERROR([System header wpcapi.h is not available. See updated http://developer.mozilla.org/en/docs/wpcapi.h for details on fixing this problem.])
6028     fi
6029     ;;
6030 esac
6033 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6034 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
6036 dnl ========================================================
6037 dnl =
6038 dnl = Module specific options
6039 dnl =
6040 dnl ========================================================
6041 MOZ_ARG_HEADER(Individual module options)
6043 dnl ========================================================
6044 dnl = Enable Lea malloc in xpcom. OFF by default.
6045 dnl ========================================================
6046 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
6047 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
6048     XPCOM_USE_LEA=1,
6049     XPCOM_USE_LEA= )
6050 if test -n "$XPCOM_USE_LEA"; then
6051     AC_DEFINE(XPCOM_USE_LEA)
6054 dnl ========================================================
6055 dnl = Enable places (new history/bookmarks)
6056 dnl ========================================================
6057 MOZ_ARG_ENABLE_BOOL(places,
6058 [  --enable-places        Enable 'places' bookmark/history implementation],
6059     MOZ_PLACES=1,
6060     MOZ_PLACES= )
6061 if test -n "$MOZ_PLACES"; then
6062     AC_DEFINE(MOZ_PLACES)
6063     if test -z "$MOZ_MAIL_NEWS"; then
6064       MOZ_MORK=
6065     fi
6066     MOZ_MORKREADER=1
6067 else
6068   if test "$MOZ_BUILD_APP" = "browser"; then
6069     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6070   fi
6073 dnl ========================================================
6074 dnl = Disable feed handling components
6075 dnl ========================================================
6076 MOZ_ARG_DISABLE_BOOL(feeds,
6077 [  --disable-feeds        Disable feed handling and processing components],
6078     MOZ_FEEDS=,
6079     MOZ_FEEDS=1 )
6080 if test -n "$MOZ_FEEDS"; then
6081     AC_DEFINE(MOZ_FEEDS)
6082 else
6083     if test "$MOZ_BUILD_APP" = "browser"; then
6084         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6085     fi
6088 dnl ========================================================
6089 dnl = Enable mozStorage
6090 dnl ========================================================
6091 dnl Implicitly enabled by default if building calendar or places
6092 MOZ_ARG_ENABLE_BOOL(storage,
6093 [  --enable-storage        Enable mozStorage module and related components],
6094     MOZ_STORAGE=1,
6095     MOZ_STORAGE= )
6096 if test -n "$MOZ_STORAGE"; then
6097     AC_DEFINE(MOZ_STORAGE)
6100 dnl ========================================================
6101 dnl Check for sqlite
6102 dnl ========================================================
6104 MOZ_NATIVE_SQLITE=
6105 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6106 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6107 MOZ_NATIVE_SQLITE=1,
6108 MOZ_NATIVE_SQLITE= )
6110 if test -z "$MOZ_NATIVE_SQLITE"
6111 then
6112     SQLITE_CFLAGS=
6113     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6114 else
6115     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6118 AC_SUBST(MOZ_NATIVE_SQLITE)
6120 dnl ========================================================
6121 dnl = Enable help viewer (off by default)
6122 dnl ========================================================
6123 MOZ_ARG_ENABLE_BOOL(help-viewer,
6124 [  --enable-help-viewer        Enable help viewer],
6125     MOZ_HELP_VIEWER=1,
6126     MOZ_HELP_VIEWER= )
6127 if test -n "$MOZ_HELP_VIEWER"; then
6128      AC_DEFINE(MOZ_HELP_VIEWER)
6130 AC_SUBST(MOZ_HELP_VIEWER)
6131 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6132     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6135 dnl ========================================================
6136 dnl = Enable safe browsing (anti-phishing)
6137 dnl ========================================================
6138 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6139 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6140     MOZ_SAFE_BROWSING=1,
6141     MOZ_SAFE_BROWSING= )
6142 if test -n "$MOZ_SAFE_BROWSING"; then
6143     AC_DEFINE(MOZ_SAFE_BROWSING)
6145 AC_SUBST(MOZ_SAFE_BROWSING)
6147 dnl ========================================================
6148 dnl = Enable url-classifier
6149 dnl ========================================================
6150 dnl Implicitly enabled by default if building with safe-browsing
6151 if test -n "$MOZ_SAFE_BROWSING"; then
6152     MOZ_URL_CLASSIFIER=1
6154 MOZ_ARG_ENABLE_BOOL(url-classifier,
6155 [  --enable-url-classifier        Enable url classifier module],
6156     MOZ_URL_CLASSIFIER=1,
6157     MOZ_URL_CLASSIFIER= )
6158 if test -n "$MOZ_URL_CLASSIFIER"; then
6159     AC_DEFINE(MOZ_URL_CLASSIFIER)
6161 AC_SUBST(MOZ_URL_CLASSIFIER)
6163 dnl ========================================================
6164 dnl = Disable zipwriter
6165 dnl ========================================================
6166 MOZ_ARG_DISABLE_BOOL(zipwriter,
6167 [  --disable-zipwriter             Disable zipwriter component],
6168     MOZ_ZIPWRITER=,
6169     MOZ_ZIPWRITER=1 )
6170 AC_SUBST(MOZ_ZIPWRITER)
6172 dnl ========================================================
6173 dnl = Enable Ultrasparc specific optimizations for JS
6174 dnl ========================================================
6175 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6176 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6177     JS_ULTRASPARC_OPTS=1,
6178     JS_ULTRASPARC_OPTS= )
6180 dnl only enable option for ultrasparcs
6181 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6182     "$OS_TEST" != "sun4u"; then
6183     JS_ULTRASPARC_OPTS=
6185 AC_SUBST(JS_ULTRASPARC_OPTS)
6187 dnl ========================================================
6188 dnl = Hildon and OSSO checks
6189 dnl ========================================================
6190 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6191                   MOZ_PLATFORM_HILDON=1,
6192                   MOZ_PLATFORM_HILDON=)
6193 if test $MOZ_PLATFORM_HILDON; then
6194    AC_DEFINE(MOZ_PLATFORM_HILDON)
6196 AC_SUBST(LIBHILDONMIME_CFLAGS)
6197 AC_SUBST(LIBHILDONMIME_LIBS)
6199 PKG_CHECK_MODULES(LIBOSSO,libosso,
6200                   NS_OSSO=1,
6201                   NS_OSSO=)
6203 if test $NS_OSSO; then
6204     if test -z "$MOZ_ENABLE_DBUS"; then
6205         AC_MSG_ERROR([DBus is required when building for OSSO])
6206     fi
6207     AC_DEFINE(NS_OSSO)
6208     MOZ_GFX_OPTIMIZE_MOBILE=1
6210 AC_SUBST(LIBOSSO_CFLAGS)
6211 AC_SUBST(LIBOSSO_LIBS)
6213 PKG_CHECK_MODULES(MOZ_LOCATION, [liblocation gpsbt],
6214                   NS_MAEMO_LOCATION=1,
6215                   NS_MAEMO_LOCATION=)
6217 if test $NS_MAEMO_LOCATION; then
6218   AC_DEFINE(NS_MAEMO_LOCATION)
6221 AC_SUBST(MOZ_LOCATION_CFLAGS)
6222 AC_SUBST(MOZ_LOCATION_LIBS)
6224 dnl ========================================================
6225 dnl =
6226 dnl = Feature options that require extra sources to be pulled
6227 dnl =
6228 dnl ========================================================
6229 dnl MOZ_ARG_HEADER(Features that require extra sources)
6231 dnl ========================================================
6232 dnl =
6233 dnl = Debugging Options
6234 dnl = 
6235 dnl ========================================================
6236 MOZ_ARG_HEADER(Debugging and Optimizations)
6238 dnl ========================================================
6239 dnl = Disable building with debug info.
6240 dnl = Debugging is OFF by default
6241 dnl ========================================================
6242 if test -z "$MOZ_DEBUG_FLAGS"
6243 then
6244     case "$target" in
6245     *-irix*)
6246         if test "$GNU_CC"; then
6247             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6248             case "$GCC_VERSION" in
6249             2.95.*)
6250                 MOZ_DEBUG_FLAGS=""
6251                 ;;
6252             *)
6253                 MOZ_DEBUG_FLAGS="-g"
6254                 ;;
6255             esac
6256         else
6257             MOZ_DEBUG_FLAGS="-g"
6258         fi
6259         ;;
6260     *)
6261         MOZ_DEBUG_FLAGS="-g"
6262         ;;
6263     esac
6266 MOZ_ARG_ENABLE_STRING(debug,
6267 [  --enable-debug[=DBG]    Enable building with developer debug info
6268                           (Using compiler flags DBG)],
6269 [ if test "$enableval" != "no"; then
6270     MOZ_DEBUG=1
6271     if test -n "$enableval" && test "$enableval" != "yes"; then
6272         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6273     fi
6274   else
6275     MOZ_DEBUG=
6276   fi ],
6277   MOZ_DEBUG=)
6279 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6280  case "${target_os}" in
6281     beos*)
6282         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6283         ;;
6284     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6285         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6286         ;;
6287     *) 
6288         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6289         ;;
6290   esac
6291 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6293 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6295 if test -n "$MOZ_DEBUG"; then
6296     AC_MSG_CHECKING([for valid debug flags])
6297     _SAVE_CFLAGS=$CFLAGS
6298     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6299     AC_TRY_COMPILE([#include <stdio.h>], 
6300         [printf("Hello World\n");],
6301         _results=yes,
6302         _results=no)
6303     AC_MSG_RESULT([$_results])
6304     if test "$_results" = "no"; then
6305         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6306     fi
6307     CFLAGS=$_SAVE_CFLAGS
6310 dnl ========================================================
6311 dnl enable mobile optimizations
6312 dnl ========================================================
6313 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6314 [  --enable-mobile-optimize   Enable mobile optimizations],
6315     MOZ_GFX_OPTIMIZE_MOBILE=1)
6317 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6319 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6320     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6323 dnl ========================================================
6324 dnl = Enable code optimization. ON by default.
6325 dnl ========================================================
6326 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6327         MOZ_OPTIMIZE_FLAGS="-O"
6330 MOZ_ARG_ENABLE_STRING(optimize,
6331 [  --disable-optimize      Disable compiler optimization
6332   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6333 [ if test "$enableval" != "no"; then
6334     MOZ_OPTIMIZE=1
6335     if test -n "$enableval" && test "$enableval" != "yes"; then
6336         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6337         MOZ_OPTIMIZE=2
6338     fi
6339 else
6340     MOZ_OPTIMIZE=
6341 fi ], MOZ_OPTIMIZE=1)
6343 if test "$COMPILE_ENVIRONMENT"; then
6344 if test -n "$MOZ_OPTIMIZE"; then
6345     AC_MSG_CHECKING([for valid optimization flags])
6346     _SAVE_CFLAGS=$CFLAGS
6347     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6348     AC_TRY_COMPILE([#include <stdio.h>], 
6349         [printf("Hello World\n");],
6350         _results=yes,
6351         _results=no)
6352     AC_MSG_RESULT([$_results])
6353     if test "$_results" = "no"; then
6354         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6355     fi
6356     CFLAGS=$_SAVE_CFLAGS
6358 fi # COMPILE_ENVIRONMENT
6360 AC_SUBST(MOZ_OPTIMIZE)
6361 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6362 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6363 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6365 dnl ========================================================
6366 dnl = Enable/disable debug for specific modules only
6367 dnl =   module names beginning with ^ will be disabled 
6368 dnl ========================================================
6369 MOZ_ARG_ENABLE_STRING(debug-modules,
6370 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6371 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6373 dnl ========================================================
6374 dnl = Enable/disable generation of debugger info for specific modules only
6375 dnl =    the special module name ALL_MODULES can be used to denote all modules
6376 dnl =    module names beginning with ^ will be disabled
6377 dnl ========================================================
6378 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6379 [  --enable-debugger-info-modules
6380                           Enable/disable debugger info for specific modules],
6381 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6382       dnl note that the list of module names is reversed as it is copied
6383       dnl this is important, as it will allow config.mk to interpret stuff like
6384       dnl "^ALL_MODULES xpcom" properly
6385       if test "$i" = "no"; then
6386         i="^ALL_MODULES"
6387       fi
6388       if test "$i" = "yes"; then
6389         i="ALL_MODULES"
6390       fi
6391       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6392     done ])
6394 dnl ========================================================
6395 dnl Enable garbage collector
6396 dnl ========================================================
6397 MOZ_ARG_ENABLE_BOOL(boehm,
6398 [  --enable-boehm          Enable the Boehm Garbage Collector],
6399     GC_LEAK_DETECTOR=1,
6400     GC_LEAK_DETECTOR= )
6401 if test -n "$GC_LEAK_DETECTOR"; then
6402     AC_DEFINE(GC_LEAK_DETECTOR)
6405 dnl ========================================================
6406 dnl Disable runtime logging checks
6407 dnl ========================================================
6408 MOZ_ARG_DISABLE_BOOL(logging,
6409 [  --disable-logging       Disable logging facilities],
6410     NS_DISABLE_LOGGING=1,
6411     NS_DISABLE_LOGGING= )
6412 if test "$NS_DISABLE_LOGGING"; then
6413     AC_DEFINE(NS_DISABLE_LOGGING)
6414 else
6415     AC_DEFINE(MOZ_LOGGING)
6418 dnl ========================================================
6419 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6420 dnl ========================================================
6421 _ENABLE_LOGREFCNT=42
6422 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6423 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6424     _ENABLE_LOGREFCNT=1,
6425     _ENABLE_LOGREFCNT= )
6426 if test "$_ENABLE_LOGREFCNT" = "1"; then
6427     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6428 elif test -z "$_ENABLE_LOGREFCNT"; then
6429     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6432 dnl ========================================================
6433 dnl = Enable trace malloc
6434 dnl ========================================================
6435 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6436 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6437 [  --enable-trace-malloc   Enable malloc tracing],
6438     NS_TRACE_MALLOC=1,
6439     NS_TRACE_MALLOC= )
6440 if test "$NS_TRACE_MALLOC"; then
6441   # Please, Mr. Linker Man, don't take away our symbol names
6442   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6443   USE_ELF_DYNSTR_GC=
6444   AC_DEFINE(NS_TRACE_MALLOC)
6446 AC_SUBST(NS_TRACE_MALLOC)
6448 dnl ========================================================
6449 dnl = Enable jemalloc
6450 dnl ========================================================
6451 MOZ_ARG_ENABLE_BOOL(jemalloc,
6452 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6453     MOZ_MEMORY=1,
6454     MOZ_MEMORY=)
6456 if test "$NS_TRACE_MALLOC"; then
6457     MOZ_MEMORY=
6460 if test "$MOZ_MEMORY"; then
6462   dnl Don't try to run compiler tests on Windows  
6463   if test "$OS_ARCH" = "WINNT"; then
6464     if test -z "$HAVE_64BIT_OS"; then
6465       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6466     else
6467       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6468     fi
6469   else
6470     AC_CHECK_SIZEOF([int *], [4])
6471     case "${ac_cv_sizeof_int_p}" in
6472     4)
6473       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6474       ;;
6475     8)
6476       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6477       ;;
6478     *)
6479       AC_MSG_ERROR([Unexpected pointer size])
6480       ;;
6481     esac
6482   fi
6484   AC_DEFINE(MOZ_MEMORY)
6485   if test "x$MOZ_DEBUG" = "x1"; then
6486     AC_DEFINE(MOZ_MEMORY_DEBUG)
6487   fi
6488   dnl The generic feature tests that determine how to compute ncpus are long and
6489   dnl complicated.  Therefore, simply define special cpp variables for the
6490   dnl platforms we have special knowledge of.
6491   case "${target_os}" in
6492   darwin*)
6493     AC_DEFINE(MOZ_MEMORY_DARWIN)
6494     ;;
6495   *freebsd*)
6496     AC_DEFINE(MOZ_MEMORY_BSD)
6497     ;;
6498   *linux*)
6499     AC_DEFINE(MOZ_MEMORY_LINUX)
6500     ;;
6501   netbsd*)
6502     AC_DEFINE(MOZ_MEMORY_BSD)
6503     ;;
6504   solaris*)
6505     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6506     ;;
6507   msvc*|mks*|cygwin*|mingw*)
6508     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6509     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6510     dnl will fail miserably
6511     if test "$_CC_SUITE" -lt "8"; then
6512         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6513     fi
6514     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6515       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6516         AC_MSG_ERROR([When building jemalloc, either set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src), or set WIN32_CUSTOM_CRT_DIR to the path to a folder containing a pre-built CRT DLL.])
6517       else
6518         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6519       fi
6520     fi
6521     if test -z "$WIN32_CRT_SRC_DIR"; then
6522       # pre-built dll
6523       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6524       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6525     else
6526       # CRT source directory
6527       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6528       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6529       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6530     fi
6531     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6532     dnl are to avoid m4
6533     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6534     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6535     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6536     dnl This needs to be unix style.
6537     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6538     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6539     AC_DEFINE(_STATIC_CPPLIB)
6540     dnl Don't generate a manifest, since we're linking to a custom CRT.
6541     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6542     dnl Also pass this to NSPR/NSS
6543     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6544     export DLLFLAGS
6545     ;;
6546   *)
6547     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6548     ;;
6549   esac
6551   AC_ARG_WITH([valgrind],
6552     [  --with-valgrind         Enable valgrind integration hooks],
6553     [enable_valgrind="yes"], [enable_valgrind="no"])
6554   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6555   if test "x$enable_valgrind" = "xyes" ; then
6556     AC_DEFINE(MOZ_VALGRIND)
6557   fi
6559 AC_SUBST(MOZ_MEMORY)
6560 AC_SUBST(WIN32_CRT_SRC_DIR)
6561 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6562 AC_SUBST(MOZ_LIB)
6563 AC_SUBST(MOZ_PATH)
6564 dnl Need to set this for make because NSS doesn't have configure
6565 AC_SUBST(DLLFLAGS)
6567 dnl ========================================================
6568 dnl = Use malloc wrapper lib
6569 dnl ========================================================
6570 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6571 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6572     _WRAP_MALLOC=1,
6573     _WRAP_MALLOC= )
6575 if test -n "$_WRAP_MALLOC"; then
6576     if test "$GNU_CC"; then
6577     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"
6578     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6579     fi
6582 dnl ========================================================
6583 dnl = Location of malloc wrapper lib
6584 dnl ========================================================
6585 MOZ_ARG_WITH_STRING(wrap-malloc,
6586 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6587     WRAP_MALLOC_LIB=$withval)
6589 dnl ========================================================
6590 dnl = Use Electric Fence
6591 dnl ========================================================
6592 MOZ_ARG_ENABLE_BOOL(efence,
6593 [  --enable-efence         Link with Electric Fence],
6594     _ENABLE_EFENCE=1,
6595     _ENABLE_EFENCE= )
6596 if test -n "$_ENABLE_EFENCE"; then
6597     AC_CHECK_LIB(efence,malloc)
6600 dnl ========================================================
6601 dnl jprof
6602 dnl ========================================================
6603 MOZ_ARG_ENABLE_BOOL(jprof,
6604 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6605     MOZ_JPROF=1,
6606     MOZ_JPROF= )
6607 if test -n "$MOZ_JPROF"; then
6608     AC_DEFINE(MOZ_JPROF)
6611 dnl ========================================================
6612 dnl shark
6613 dnl ========================================================
6614 MOZ_ARG_ENABLE_BOOL(shark,
6615 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6616     MOZ_SHARK=1,
6617     MOZ_SHARK= )
6618 if test -n "$MOZ_SHARK"; then
6619     AC_DEFINE(MOZ_SHARK)
6622 dnl ========================================================
6623 dnl callgrind
6624 dnl ========================================================
6625 MOZ_ARG_ENABLE_BOOL(callgrind,
6626 [  --enable-callgrind      Enable callgrind profiling],
6627     MOZ_CALLGRIND=1,
6628     MOZ_CALLGRIND= )
6629 if test -n "$MOZ_CALLGRIND"; then
6630     AC_DEFINE(MOZ_CALLGRIND)
6633 dnl ========================================================
6634 dnl vtune
6635 dnl ========================================================
6636 MOZ_ARG_ENABLE_BOOL(vtune,
6637 [  --enable-vtune          Enable vtune profiling],
6638     MOZ_VTUNE=1,
6639     MOZ_VTUNE= )
6640 if test -n "$MOZ_VTUNE"; then
6641     AC_DEFINE(MOZ_VTUNE)
6644 dnl ========================================================
6645 dnl Zealous JavaScript GC
6646 dnl ========================================================
6647 MOZ_ARG_ENABLE_BOOL(gczeal,
6648 [  --enable-gczeal          Enable zealous JavaScript GCing],
6649     JS_GC_ZEAL=1,
6650     JS_GC_ZEAL= )
6651 if test -n "$JS_GC_ZEAL"; then
6652     AC_DEFINE(JS_GC_ZEAL)
6655 dnl ========================================================
6656 dnl = Enable static checking using gcc-dehydra
6657 dnl ========================================================
6659 MOZ_ARG_WITH_STRING(static-checking,
6660 [  --with-static-checking=path/to/gcc_dehydra.so
6661                             Enable static checking of code using GCC-dehydra],
6662     DEHYDRA_PATH=$withval,
6663     DEHYDRA_PATH= )
6665 if test -n "$DEHYDRA_PATH"; then
6666     if test ! -f "$DEHYDRA_PATH"; then
6667         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6668     fi
6669     AC_DEFINE(NS_STATIC_CHECKING)
6671 AC_SUBST(DEHYDRA_PATH)
6673 dnl ========================================================
6674 dnl = Enable stripping of libs & executables
6675 dnl ========================================================
6676 MOZ_ARG_ENABLE_BOOL(strip,
6677 [  --enable-strip          Enable stripping of libs & executables ],
6678     ENABLE_STRIP=1,
6679     ENABLE_STRIP= )
6681 dnl ========================================================
6682 dnl = Enable stripping of libs & executables when packaging
6683 dnl ========================================================
6684 MOZ_ARG_ENABLE_BOOL(install-strip,
6685 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6686     PKG_SKIP_STRIP= ,
6687     PKG_SKIP_STRIP=1)
6689 dnl ========================================================
6690 dnl = --enable-elf-dynstr-gc
6691 dnl ========================================================
6692 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6693 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6694     USE_ELF_DYNSTR_GC=1,
6695     USE_ELF_DYNSTR_GC= )
6697 dnl ========================================================
6698 dnl = --enable-old-abi-compat-wrappers
6699 dnl ========================================================
6700 dnl on x86 linux, the current builds of some popular plugins (notably
6701 dnl flashplayer and real) expect a few builtin symbols from libgcc
6702 dnl which were available in some older versions of gcc.  However,
6703 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6704 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6705 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6706 dnl to true on x86 linux, and false everywhere else.
6709 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6710 [  --enable-old-abi-compat-wrappers
6711                           Support old GCC ABI symbols to ease the pain 
6712                           of the linux compiler change],
6713     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6714     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6715 if test "$COMPILE_ENVIRONMENT"; then
6716 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6717     AC_LANG_SAVE
6718     AC_LANG_CPLUSPLUS
6719     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6720     AC_LANG_RESTORE
6721     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6723 fi # COMPILE_ENVIRONMENT
6725 dnl ========================================================
6726 dnl = 
6727 dnl = Profiling and Instrumenting
6728 dnl = 
6729 dnl ========================================================
6730 MOZ_ARG_HEADER(Profiling and Instrumenting)
6732 dnl ========================================================
6733 dnl = Enable timeline service, which provides lightweight
6734 dnl = instrumentation of mozilla for performance measurement.
6735 dnl = Timeline is off by default.
6736 dnl ========================================================
6737 MOZ_ARG_ENABLE_BOOL(timeline,
6738 [  --enable-timeline       Enable timeline services ],
6739     MOZ_TIMELINE=1,
6740     MOZ_TIMELINE= )
6741 if test -n "$MOZ_TIMELINE"; then
6742     AC_DEFINE(MOZ_TIMELINE)
6745 dnl ========================================================
6746 dnl Turn on reflow counting
6747 dnl ========================================================
6748 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6749 [  --enable-reflow-perf    Enable reflow performance tracing],
6750     MOZ_REFLOW_PERF=1,
6751     MOZ_REFLOW_PERF= )
6752 if test -n "$MOZ_REFLOW_PREF"; then
6753     AC_DEFINE(MOZ_REFLOW_PREF)
6755 AC_SUBST(MOZ_REFLOW_PERF)
6757 dnl ========================================================
6758 dnl Enable performance metrics.
6759 dnl ========================================================
6760 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6761 [  --enable-perf-metrics   Enable performance metrics],
6762     MOZ_PERF_METRICS=1,
6763     MOZ_PERF_METRICS= )
6764 if test -n "$MOZ_PERF_METRICS"; then
6765     AC_DEFINE(MOZ_PERF_METRICS)
6768 dnl ========================================================
6769 dnl Enable code size metrics.
6770 dnl ========================================================
6771 MOZ_ARG_ENABLE_BOOL(codesighs,
6772 [  --enable-codesighs      Enable code size analysis tools],
6773     _ENABLE_CODESIGHS=1,
6774     _ENABLE_CODESIGHS= )
6775 if test -n "$_ENABLE_CODESIGHS"; then
6776     if test -d $srcdir/tools/codesighs; then 
6777         MOZ_MAPINFO=1
6778     else
6779         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6780     fi
6783 dnl ========================================================
6784 dnl = Add support for Eazel profiler
6785 dnl ========================================================
6786 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6787 [  --enable-eazel-profiler-support
6788                           Enable Corel/Eazel profiler support],
6789     ENABLE_EAZEL_PROFILER=1,
6790     ENABLE_EAZEL_PROFILER= )
6791 if test -n "$ENABLE_EAZEL_PROFILER"; then
6792     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6793     USE_ELF_DYNSTR_GC=
6794     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6795     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6796     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6799 MOZ_ARG_ENABLE_STRING(profile-modules,
6800 [  --enable-profile-modules
6801                           Enable/disable profiling for specific modules],
6802 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6804 MOZ_ARG_ENABLE_BOOL(insure,
6805 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6806     _ENABLE_INSURE=1,
6807     _ENABLE_INSURE= )
6808 if test -n "$_ENABLE_INSURE"; then
6809     MOZ_INSURE="insure"
6810     MOZ_INSURIFYING=1
6811     MOZ_INSURE_DIRS="."
6812     MOZ_INSURE_EXCLUDE_DIRS="config"
6815 MOZ_ARG_WITH_STRING(insure-dirs,
6816 [  --with-insure-dirs=DIRS
6817                           Dirs to instrument with insure ],
6818     MOZ_INSURE_DIRS=$withval )
6820 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6821 [  --with-insure-exclude-dirs=DIRS
6822                           Dirs to not instrument with insure ],
6823     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6825 dnl ========================================================
6826 dnl = Support for Quantify (Windows)
6827 dnl ========================================================
6828 MOZ_ARG_ENABLE_BOOL(quantify,
6829 [  --enable-quantify      Enable Quantify support (Windows only) ],
6830     MOZ_QUANTIFY=1,
6831     MOZ_QUANTIFY= )
6833 dnl ========================================================
6834 dnl = Support for demangling undefined symbols
6835 dnl ========================================================
6836 if test -z "$SKIP_LIBRARY_CHECKS"; then
6837     AC_LANG_SAVE
6838     AC_LANG_CPLUSPLUS
6839     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6840     AC_LANG_RESTORE
6843 # Demangle only for debug or trace-malloc builds
6844 MOZ_DEMANGLE_SYMBOLS=
6845 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6846     MOZ_DEMANGLE_SYMBOLS=1
6847     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6849 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6851 dnl ========================================================
6852 dnl = Support for gcc stack unwinding (from gcc 3.3)
6853 dnl ========================================================
6854 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6855     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6858 dnl ========================================================
6859 dnl =
6860 dnl = Misc. Options
6861 dnl = 
6862 dnl ========================================================
6863 MOZ_ARG_HEADER(Misc. Options)
6865 dnl ========================================================
6866 dnl update xterm title
6867 dnl ========================================================
6868 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6869 [  --enable-xterm-updates  Update XTERM titles with current command.],
6870     MOZ_UPDATE_XTERM=1,
6871     MOZ_UPDATE_XTERM= )
6873 dnl =========================================================
6874 dnl = Chrome format
6875 dnl =========================================================
6876 MOZ_ARG_ENABLE_STRING([chrome-format],
6877 [  --enable-chrome-format=jar|flat|both|symlink
6878                           Select FORMAT of chrome files (default=jar)],
6879     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6881 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6882     MOZ_CHROME_FILE_FORMAT=jar
6885 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6886     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6887     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6888     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6889     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6892 dnl ========================================================
6893 dnl = Define default location for MOZILLA_FIVE_HOME
6894 dnl ========================================================
6895 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6896 [  --with-default-mozilla-five-home
6897                           Set the default value for MOZILLA_FIVE_HOME],
6898 [ val=`echo $withval`
6899   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6901 dnl ========================================================
6902 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6903 dnl ========================================================
6904 MOZ_ARG_WITH_STRING(user-appdir,
6905 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6906 [ val=`echo $withval`
6907 if echo "$val" | grep "\/" >/dev/null; then
6908     AC_MSG_ERROR("Homedir must be single relative path.")
6909 else 
6910     MOZ_USER_DIR="$val"
6911 fi])
6913 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6915 dnl ========================================================
6916 dnl = Doxygen configuration
6917 dnl ========================================================
6918 dnl Use commas to specify multiple dirs to this arg
6919 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6920 MOZ_ARG_WITH_STRING(doc-input-dirs,
6921 [  --with-doc-input-dirs=DIRS
6922                           Header/idl dirs to create docs from],
6923 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6924 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6926 dnl Use commas to specify multiple dirs to this arg
6927 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6928 MOZ_ARG_WITH_STRING(doc-include-dirs,
6929 [  --with-doc-include-dirs=DIRS  
6930                           Include dirs to preprocess doc headers],
6931 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6932 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6934 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6935 MOZ_ARG_WITH_STRING(doc-output-dir,
6936 [  --with-doc-output-dir=DIR
6937                           Dir to generate docs into],
6938 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6939 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6941 if test -z "$SKIP_COMPILER_CHECKS"; then
6942 dnl ========================================================
6943 dnl =
6944 dnl = Compiler Options
6945 dnl = 
6946 dnl ========================================================
6947 MOZ_ARG_HEADER(Compiler Options)
6949 dnl ========================================================
6950 dnl Check for gcc -pipe support
6951 dnl ========================================================
6952 AC_MSG_CHECKING([for gcc -pipe support])
6953 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6954     echo '#include <stdio.h>' > dummy-hello.c
6955     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6956     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6957     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6958     if test $? = 0; then
6959         _res_as_stdin="yes"
6960     else
6961         _res_as_stdin="no"
6962     fi
6963     if test "$_res_as_stdin" = "yes"; then
6964         _SAVE_CFLAGS=$CFLAGS
6965         CFLAGS="$CFLAGS -pipe"
6966         AC_TRY_COMPILE( [ #include <stdio.h> ],
6967             [printf("Hello World\n");],
6968             [_res_gcc_pipe="yes"],
6969             [_res_gcc_pipe="no"] )
6970         CFLAGS=$_SAVE_CFLAGS
6971     fi
6972     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6973         _res="yes";
6974         CFLAGS="$CFLAGS -pipe"
6975         CXXFLAGS="$CXXFLAGS -pipe"
6976     else
6977         _res="no"
6978     fi
6979     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6980     AC_MSG_RESULT([$_res])
6981 else
6982     AC_MSG_RESULT([no])
6985 dnl pass -Wno-long-long to the compiler
6986 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6987 [  --enable-long-long-warning 
6988                           Warn about use of non-ANSI long long type],
6989     _IGNORE_LONG_LONG_WARNINGS=,
6990     _IGNORE_LONG_LONG_WARNINGS=1)
6992 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6993      _SAVE_CFLAGS="$CFLAGS"
6994      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6995      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6996      AC_TRY_COMPILE([], [return(0);], 
6997         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6998           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6999           result="yes" ], result="no")
7000      AC_MSG_RESULT([$result])
7001      CFLAGS="$_SAVE_CFLAGS"
7004 dnl ========================================================
7005 dnl Profile guided optimization
7006 dnl ========================================================
7007 dnl Test for profiling options
7008 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7009 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7011 dnl Provide a switch to disable PGO even when called via profiledbuild.
7012 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7013 [  --disable-profile-guided-optimization
7014                            Don't build with PGO even if called via make profiledbuild],
7015 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7016 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7018 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7020 _SAVE_CFLAGS="$CFLAGS"
7021 CFLAGS="$CFLAGS -fprofile-generate"
7023 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7024 AC_TRY_COMPILE([], [return 0;],
7025                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7026                  result="yes" ], result="no")
7027 AC_MSG_RESULT([$result])
7029 if test $result = "yes"; then
7030   PROFILE_GEN_LDFLAGS="-fprofile-generate"
7031   PROFILE_USE_CFLAGS="-fprofile-use"
7032   PROFILE_USE_LDFLAGS="-fprofile-use"
7033 else
7034   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7035   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7036   AC_TRY_COMPILE([], [return 0;],
7037                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7038                    result="yes" ], result="no")
7039   AC_MSG_RESULT([$result])
7040   if test $result = "yes"; then
7041     PROFILE_USE_CFLAGS="-fbranch-probabilities"
7042   fi
7043   # don't really care, this is an old GCC
7044   PROFILE_GEN_LDFLAGS=
7045   PROFILE_USE_LDFLAGS=
7048 CFLAGS="$_SAVE_CFLAGS"
7050 if test -n "$INTEL_CC"; then
7051   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7052   PROFILE_GEN_LDFLAGS=
7053   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7054   PROFILE_USE_LDFLAGS=
7057 dnl Sun Studio on Solaris
7058 if test "$SOLARIS_SUNPRO_CC"; then
7059   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7060   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7061   if test "$CPU_ARCH" != "sparc"; then
7062     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7063     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7064   else
7065     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7066     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7067   fi
7070 AC_SUBST(PROFILE_GEN_CFLAGS)
7071 AC_SUBST(PROFILE_GEN_LDFLAGS)
7072 AC_SUBST(PROFILE_USE_CFLAGS)
7073 AC_SUBST(PROFILE_USE_LDFLAGS)
7075 AC_LANG_CPLUSPLUS
7077 dnl ========================================================
7078 dnl Test for -pedantic bustage
7079 dnl ========================================================
7080 MOZ_ARG_DISABLE_BOOL(pedantic,
7081 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7082 _PEDANTIC= )
7083 if test "$_PEDANTIC"; then
7084     _SAVE_CXXFLAGS=$CXXFLAGS
7085     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7086     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7087     AC_TRY_COMPILE([$configure_static_assert_macros],
7088                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7089                    result="no", result="yes" )
7090     AC_MSG_RESULT([$result])
7091     CXXFLAGS="$_SAVE_CXXFLAGS"
7093     case "$result" in
7094     no)
7095         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7096         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7097         ;;
7098     yes)
7099         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7100         ;;
7101     esac
7104 dnl ========================================================
7105 dnl Test for correct temporary object destruction order
7106 dnl ========================================================
7107 dnl We want to make sure the compiler follows the C++ spec here as 
7108 dnl xpcom and the string classes depend on it (bug 235381).
7109 AC_MSG_CHECKING([for correct temporary object destruction order])
7110 AC_TRY_RUN([ class A {
7111              public:  A(int& x) : mValue(x) {}
7112                       ~A() { mValue--; }
7113                       operator char**() { return 0; }
7114              private:  int& mValue;
7115              };
7116              void func(char **arg) {}
7117              int m=2;
7118              void test() {
7119                   func(A(m));
7120                   if (m==1) m = 0;
7121              }
7122              int main() {
7123                  test();
7124                  return(m);
7125              }
7126              ],
7127      result="yes", result="no", result="maybe")
7128 AC_MSG_RESULT([$result])
7130 if test "$result" = "no"; then
7131     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7134 dnl ========================================================
7135 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7136 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7137 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7138 dnl ========================================================
7139 _SAVE_CXXFLAGS=$CXXFLAGS
7140 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7141 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7142     ac_nscap_nonconst_opeq_bug,
7143     [AC_TRY_COMPILE([
7144                       template <class T>
7145                       class Pointer
7146                         {
7147                         public:
7148                           T* myPtr;
7149                         };
7150                       
7151                       template <class T, class U>
7152                       int operator==(const Pointer<T>& rhs, U* lhs)
7153                         {
7154                           return rhs.myPtr == lhs;
7155                         }
7156                       
7157                       template <class T, class U>
7158                       int operator==(const Pointer<T>& rhs, const U* lhs)
7159                         {
7160                           return rhs.myPtr == lhs;
7161                         }
7162                     ],
7163                     [
7164                       Pointer<int> foo;
7165                       const int* bar;
7166                       return foo == bar;
7167                     ],
7168                     ac_nscap_nonconst_opeq_bug="no",
7169                     ac_nscap_nonconst_opeq_bug="yes")])
7170 CXXFLAGS="$_SAVE_CXXFLAGS"
7172 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7173     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7175 fi # SKIP_COMPILER_CHECKS
7177 dnl ========================================================
7178 dnl C++ rtti
7179 dnl Should be smarter and check that the compiler does indeed have rtti
7180 dnl ========================================================
7181 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7182 [  --enable-cpp-rtti       Enable C++ RTTI ],
7183 [ _MOZ_USE_RTTI=1 ],
7184 [ _MOZ_USE_RTTI= ])
7186 if test "$_MOZ_USE_RTTI"; then
7187    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7188 else
7189    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7192 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7194 dnl ========================================================
7195 dnl C++ exceptions (g++/egcs only - for now)
7196 dnl Should be smarter and check that the compiler does indeed have exceptions
7197 dnl ========================================================
7198 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7199 [  --enable-cpp-exceptions Enable C++ exceptions ],
7200 [ _MOZ_CPP_EXCEPTIONS=1 ],
7201 [ _MOZ_CPP_EXCEPTIONS= ])
7203 if test "$_MOZ_CPP_EXCEPTIONS"; then
7204     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7205 else
7206     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7209 # Irix & OSF native compilers do not like exception declarations 
7210 # when exceptions are disabled
7211 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7212     AC_DEFINE(CPP_THROW_NEW, [])
7213 else
7214     AC_DEFINE(CPP_THROW_NEW, [throw()])
7216 AC_LANG_C
7218 dnl ========================================================
7219 dnl =
7220 dnl = Build depencency options
7221 dnl =
7222 dnl ========================================================
7223 MOZ_ARG_HEADER(Build dependencies)
7225 dnl ========================================================
7226 dnl = Do not auto generate dependency info
7227 dnl ========================================================
7228 MOZ_AUTO_DEPS=1
7229 MOZ_ARG_DISABLE_BOOL(auto-deps,
7230 [  --disable-auto-deps     Do not automatically generate dependency info],
7231     MOZ_AUTO_DEPS=,
7232     MOZ_AUTO_DEPS=1)
7234 if test -n "$MOZ_AUTO_DEPS"; then
7235 dnl ========================================================
7236 dnl = Use mkdepend instead of $CC -MD for dependency generation
7237 dnl ========================================================
7238 _cpp_md_flag=
7239 MOZ_ARG_DISABLE_BOOL(md,
7240 [  --disable-md            Do not use compiler-based dependencies ],
7241   [_cpp_md_flag=],
7242   [_cpp_md_flag=1],
7243   [dnl Default is to turn on -MD if using GNU-compatible compilers
7244    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7245      _cpp_md_flag=1
7246    fi
7247   dnl Default is to use -xM if using Sun Studio on Solaris
7248    if test "$SOLARIS_SUNPRO_CC"; then
7249      _cpp_md_flag=1
7250    fi])
7251 if test "$_cpp_md_flag"; then
7252   COMPILER_DEPEND=1
7253   if test "$OS_ARCH" = "OpenVMS"; then
7254     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7255   else
7256     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7257   fi
7258   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7259   if test "$SOLARIS_SUNPRO_CC"; then
7260     _DEPEND_CFLAGS=
7261   fi
7262 else
7263   COMPILER_DEPEND=
7264   _USE_CPP_INCLUDE_FLAG=
7265   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7266   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7268 fi # MOZ_AUTO_DEPS
7269 MDDEPDIR='.deps'
7270 AC_SUBST(MOZ_AUTO_DEPS)
7271 AC_SUBST(COMPILER_DEPEND)
7272 AC_SUBST(MDDEPDIR)
7275 dnl ========================================================
7276 dnl =
7277 dnl = Static Build Options
7278 dnl =
7279 dnl ========================================================
7280 MOZ_ARG_HEADER(Static build options)
7282 MOZ_ARG_ENABLE_BOOL(static,
7283 [  --enable-static         Enable building of internal static libs],
7284     BUILD_STATIC_LIBS=1,
7285     BUILD_STATIC_LIBS=)
7287 dnl Disable libxul in debug builds, but not for xulrunner.
7288 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7289    MOZ_ENABLE_LIBXUL=
7292 MOZ_ARG_ENABLE_BOOL(libxul,
7293 [  --enable-libxul         Enable building of libxul],
7294     MOZ_ENABLE_LIBXUL=1,
7295     MOZ_ENABLE_LIBXUL=)
7297 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7298         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7301 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7302         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7305 AC_SUBST(LIBXUL_LIBS)
7307 if test -n "$MOZ_ENABLE_LIBXUL"; then
7308     XPCOM_LIBS="$LIBXUL_LIBS"
7309     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7310 else
7311     if test -n "$BUILD_STATIC_LIBS"; then
7312         AC_DEFINE(MOZ_STATIC_BUILD)
7313     fi
7314     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7317 dnl ========================================================
7318 dnl =
7319 dnl = Standalone module options
7320 dnl = 
7321 dnl ========================================================
7322 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7324 dnl Check for GLib and libIDL.
7325 dnl ========================================================
7326 case "$target_os" in
7327 msvc*|mks*|cygwin*|mingw*|wince*)
7328     SKIP_IDL_CHECK="yes"
7329     ;;
7331     SKIP_IDL_CHECK="no"
7332     ;;
7333 esac
7335 if test -z "$COMPILE_ENVIRONMENT"; then
7336     SKIP_IDL_CHECK="yes"
7339 dnl = Allow users to disable libIDL checking for standalone modules
7340 MOZ_ARG_WITHOUT_BOOL(libIDL,
7341 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7342         SKIP_IDL_CHECK="yes")
7344 if test "$SKIP_IDL_CHECK" = "no"
7345 then
7346     _LIBIDL_FOUND=
7347     if test "$MACOS_SDK_DIR"; then 
7348       dnl xpidl, and therefore libIDL, is only needed on the build host.
7349       dnl Don't build it against the SDK, as that causes problems.
7350       _MACSAVE_CFLAGS="$CFLAGS"
7351       _MACSAVE_LIBS="$LIBS"
7352       _MACSAVE_LDFLAGS="$LDFLAGS"
7353       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7354       changequote(,)
7355       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"`
7356       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7357       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7358       changequote([,])
7359       unset NEXT_ROOT
7360     fi
7362     if test "$MOZ_ENABLE_GTK2"; then
7363         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7364     fi
7365     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7366     dnl to either libIDL1 or libIDL2.
7367     if test -z "$_LIBIDL_FOUND"; then
7368         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7369         if test -z "$_LIBIDL_FOUND"; then
7370             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7371         fi
7372     fi
7373     dnl
7374     dnl If we don't have a libIDL config program & not cross-compiling, 
7375     dnl     look for orbit-config instead.
7376     dnl
7377     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7378         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7379         if test -n "$ORBIT_CONFIG"; then
7380             AC_MSG_CHECKING([for ORBit libIDL usability])
7381                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7382             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7383             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7384             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7385             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7386             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7387             LIBIDL_CONFIG=
7388             _SAVE_CFLAGS="$CFLAGS"
7389             _SAVE_LIBS="$LIBS"
7390             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7391             LIBS="$LIBIDL_LIBS $LIBS"
7392             AC_TRY_RUN([
7393 #include <stdlib.h>
7394 #include <libIDL/IDL.h>
7395 int main() {
7396   char *s;
7397   s=strdup(IDL_get_libver_string());
7398   if(s==NULL) {
7399     exit(1);
7400   }
7401   exit(0);
7403             ], [_LIBIDL_FOUND=1
7404                 result="yes"],
7405                [LIBIDL_CFLAGS=
7406                 LIBIDL_LIBS=
7407                 result="no"],
7408                [_LIBIDL_FOUND=1
7409                 result="maybe"] )
7410             AC_MSG_RESULT($result)
7411             CFLAGS="$_SAVE_CFLAGS"
7412             LIBS="$_SAVE_LIBS"
7413         fi
7414     fi
7415     if test -z "$_LIBIDL_FOUND"; then
7416         AC_MSG_ERROR([libIDL not found.
7417         libIDL $LIBIDL_VERSION or higher is required.])
7418     fi
7419     if test "$MACOS_SDK_DIR"; then
7420       CFLAGS="$_MACSAVE_CFLAGS"
7421       LIBS="$_MACSAVE_LIBS"
7422       LDFLAGS="$_MACSAVE_LDFLAGS"
7423       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7424         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7425       fi
7426     fi
7429 if test -n "$CROSS_COMPILE"; then
7430      if test -z "$HOST_LIBIDL_CONFIG"; then
7431         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7432     fi
7433     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7434         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7435         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7436     else
7437         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7438         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7439     fi
7442 if test -z "$SKIP_PATH_CHECKS"; then
7443 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7444     if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7445         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7446     else
7447         AM_PATH_GLIB(${GLIB_VERSION})
7448     fi
7452 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7453     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7456 AC_SUBST(LIBIDL_CFLAGS)
7457 AC_SUBST(LIBIDL_LIBS)
7458 AC_SUBST(STATIC_LIBIDL)
7459 AC_SUBST(GLIB_CFLAGS)
7460 AC_SUBST(GLIB_LIBS)
7461 AC_SUBST(GLIB_GMODULE_LIBS)
7462 AC_SUBST(HOST_LIBIDL_CONFIG)
7463 AC_SUBST(HOST_LIBIDL_CFLAGS)
7464 AC_SUBST(HOST_LIBIDL_LIBS)
7466 dnl ========================================================
7467 dnl Check for cairo
7468 dnl ========================================================
7469 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7471 MOZ_TREE_CAIRO=1
7472 MOZ_ARG_ENABLE_BOOL(system-cairo,
7473 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7474 MOZ_TREE_CAIRO=,
7475 MOZ_TREE_CAIRO=1 )
7477 # Check for headers defining standard int types.
7478 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7480 if test "$MOZ_TREE_CAIRO"; then
7481     AC_DEFINE(MOZ_TREE_CAIRO)
7483     # For now we assume that we will have a uint64_t available through
7484     # one of the above headers or mozstdint.h.
7485     AC_DEFINE(HAVE_UINT64_T)
7487     # Define macros for cairo-features.h
7488     if test "$MOZ_X11"; then
7489         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7490         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7491         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7492         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7493         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7494         MOZ_ENABLE_CAIRO_FT=1
7495         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7496     fi
7497     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7498         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7499     fi
7500     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7501         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7502         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7503         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7504     fi
7505     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7506         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7507         if test -z "$WINCE"; then
7508            WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7509         else
7510            WIN32_FONT_FEATURE=
7511         fi  
7512         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7513     fi
7514     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7515         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7516         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7517         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7518         MOZ_ENABLE_CAIRO_FT=1
7519         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7520         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7521     fi
7522     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7523         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7524         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7525         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7526         MOZ_ENABLE_CAIRO_FT=1
7527     fi
7528     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7529     AC_SUBST(CAIRO_FT_CFLAGS)
7531     if test "$MOZ_DEBUG"; then
7532       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7533     else
7534       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7535     fi
7537     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7539     AC_SUBST(PS_SURFACE_FEATURE)
7540     AC_SUBST(PDF_SURFACE_FEATURE)
7541     AC_SUBST(SVG_SURFACE_FEATURE)
7542     AC_SUBST(XLIB_SURFACE_FEATURE)
7543     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7544     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7545     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7546     AC_SUBST(XCB_SURFACE_FEATURE)
7547     AC_SUBST(WIN32_SURFACE_FEATURE)
7548     AC_SUBST(OS2_SURFACE_FEATURE)
7549     AC_SUBST(BEOS_SURFACE_FEATURE)
7550     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7551     AC_SUBST(FT_FONT_FEATURE)
7552     AC_SUBST(FC_FONT_FEATURE)
7553     AC_SUBST(WIN32_FONT_FEATURE)
7554     AC_SUBST(QUARTZ_FONT_FEATURE)
7555     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7556     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7558     if test "$_WIN32_MSVC"; then
7559         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7560     else
7561         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"
7563         if test "$MOZ_X11"; then
7564             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7565         fi
7566     fi
7568     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7569     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7571 else
7572    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7573    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7574    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7575    if test "$MOZ_X11"; then
7576         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7577         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7578         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7579    fi
7582 AC_SUBST(MOZ_TREE_CAIRO)
7583 AC_SUBST(MOZ_CAIRO_CFLAGS)
7584 AC_SUBST(MOZ_CAIRO_LIBS)
7586 dnl ========================================================
7587 dnl Check for lcms
7588 dnl ========================================================
7590 LCMS_CFLAGS=
7591 if test "$_WIN32_MSVC"; then
7592     if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7593         LCMS_CFLAGS=-DLCMS_DLL
7594     fi
7595     LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7596 else
7597     LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7600 AC_SUBST(LCMS_CFLAGS)
7601 AC_SUBST(LCMS_LIBS)
7603 dnl ========================================================
7604 dnl disable xul
7605 dnl ========================================================
7606 MOZ_ARG_DISABLE_BOOL(xul,
7607 [  --disable-xul           Disable XUL],
7608     MOZ_XUL= )
7609 if test "$MOZ_XUL"; then
7610   AC_DEFINE(MOZ_XUL)
7611 else
7612   dnl remove extensions that require XUL
7613   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7616 AC_SUBST(MOZ_XUL)
7618 dnl ========================================================
7619 dnl Two ways to enable Python support:
7620 dnl   --enable-extensions=python # select all available.
7621 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7622 dnl or:
7623 dnl   --enable-extensions=python/xpcom,... # select individual ones
7625 dnl If either is used, we locate the Python to use.
7626 dnl ========================================================
7628 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7629 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7630     dnl Allow PYTHON to point to the Python interpreter to use
7631     dnl (note that it must be the python executable - which we
7632     dnl run to locate the relevant paths etc)
7633     dnl If not set, we use whatever Python we can find.
7634     MOZ_PYTHON=$PYTHON
7635     dnl Ask Python what its version number is
7636     changequote(,)
7637     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7638     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7639     changequote([,])
7640     dnl Ask for the Python "prefix" (ie, home/source dir)
7641     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7642     dnl Setup the include and library directories.
7643     if test "$OS_ARCH" = "WINNT"; then
7644         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7645         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7646         dnl Binary trees have "include" for .h, and "libs" for .lib
7647         dnl We add 'em both - along with quotes, to handle spaces.
7648         MOZ_PYTHON_DLL_SUFFIX=.pyd
7649         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7650         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7651     else
7652         dnl Non-Windows include and libs
7653         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7654         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7655         dnl Check for dynamic Python lib
7656         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7657         dnl - core, xpcom loader, pydom etc) all need to share Python.
7658         dnl - Python 2.3's std --enable-shared configure option will
7659         dnl   create a libpython2.3.so.1.0. We should first try this
7660         dnl   dotted versioned .so file because this is the one that
7661         dnl   the PyXPCOM build mechanics tries to link to.
7662         dnl   XXX Should find a better way than hardcoding "1.0".
7663         dnl - Python developement tree dir layouts are NOT allowed here
7664         dnl   because the PyXPCOM build just dies on it later anyway.
7665         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7666         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7667             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7668         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7669             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7670         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7671             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7672         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7673             dnl Don't Python development tree directory layout.
7674             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7675             AC_MSG_ERROR([The Python at $MOZ_PYTHON_PREFIX looks like a dev tree. The PyXPCOM build cannot handle this yet. You must 'make install' Python and use the installed tree.])
7676         elif test "$OS_ARCH" = "Darwin"; then
7677             dnl We do Darwin last, so if a custom non-framework build of
7678             dnl python is used on OSX, then it will be picked up first by
7679             dnl the logic above.
7680             MOZ_PYTHON_LIBS="-framework Python"
7681         else
7682             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7683         fi
7684         if test "$OS_ARCH" = "Linux"; then
7685             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7686         fi
7687     fi
7688     dnl Handle "_d" on Windows
7689     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7690         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7691     else
7692         MOZ_PYTHON_DEBUG_SUFFIX=
7693     fi
7694     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7697 dnl If the user asks for the 'python' extension, then we add
7698 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7699 dnl Note the careful regex - it must match 'python' followed by anything
7700 dnl other than a '/', including the end-of-string.
7701 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7702     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7703         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7704     done
7706 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7707 dnl command-line, but not yet
7708 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7709 AC_SUBST(MOZ_PYTHON)
7710 AC_SUBST(MOZ_PYTHON_PREFIX)
7711 AC_SUBST(MOZ_PYTHON_INCLUDES)
7712 AC_SUBST(MOZ_PYTHON_LIBS)
7713 AC_SUBST(MOZ_PYTHON_VER)
7714 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7715 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7716 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7718 dnl ========================================================
7719 dnl disable profile locking
7720 dnl   do no use this in applications that can have more than
7721 dnl   one process accessing the profile directory.
7722 dnl ========================================================
7723 MOZ_ARG_DISABLE_BOOL(profilelocking,
7724 [  --disable-profilelocking           Disable profile locking],
7725     MOZ_PROFILELOCKING=,
7726     MOZ_PROFILELOCKING=1 )
7727 if test "$MOZ_PROFILELOCKING"; then
7728   AC_DEFINE(MOZ_PROFILELOCKING)
7731 dnl ========================================================
7732 dnl disable rdf services
7733 dnl ========================================================
7734 MOZ_ARG_DISABLE_BOOL(rdf,
7735 [  --disable-rdf           Disable RDF],
7736     MOZ_RDF= )
7737 if test "$MOZ_RDF"; then
7738   AC_DEFINE(MOZ_RDF)
7741 AC_SUBST(MOZ_RDF)
7743 dnl ========================================================
7744 dnl necko configuration options
7745 dnl ========================================================
7748 dnl option to disable various necko protocols
7750 MOZ_ARG_ENABLE_STRING(necko-protocols,
7751 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7752                           Enable/disable specific protocol handlers],
7753 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7754     if test "$option" = "yes" || test "$option" = "all"; then
7755         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7756     elif test "$option" = "no" || test "$option" = "none"; then
7757         NECKO_PROTOCOLS=""
7758     elif test "$option" = "default"; then
7759         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7760     elif test `echo "$option" | grep -c \^-` != 0; then
7761         option=`echo $option | sed 's/^-//'`
7762         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7763     else
7764         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7765     fi
7766 done],
7767     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7768 dnl Remove dupes
7769 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7770 AC_SUBST(NECKO_PROTOCOLS)
7771 for p in $NECKO_PROTOCOLS; do
7772     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7773 done
7776 dnl option to disable necko's disk cache
7778 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7779 [  --disable-necko-disk-cache
7780                           Disable necko disk cache],
7781     NECKO_DISK_CACHE=,
7782     NECKO_DISK_CACHE=1)
7783 AC_SUBST(NECKO_DISK_CACHE)
7784 if test "$NECKO_DISK_CACHE"; then
7785     AC_DEFINE(NECKO_DISK_CACHE)
7789 dnl option to minimize size of necko's i/o buffers
7791 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7792 [  --enable-necko-small-buffers
7793                           Minimize size of necko's i/o buffers],
7794     NECKO_SMALL_BUFFERS=1,
7795     NECKO_SMALL_BUFFERS=)
7796 AC_SUBST(NECKO_SMALL_BUFFERS)
7797 if test "$NECKO_SMALL_BUFFERS"; then
7798     AC_DEFINE(NECKO_SMALL_BUFFERS)
7799 fi 
7802 dnl option to disable cookies
7804 MOZ_ARG_DISABLE_BOOL(cookies,
7805 [  --disable-cookies       Disable cookie support],
7806     NECKO_COOKIES=,
7807     NECKO_COOKIES=1)
7808 AC_SUBST(NECKO_COOKIES)
7809 if test "$NECKO_COOKIES"; then
7810     AC_DEFINE(NECKO_COOKIES)
7813 dnl NECKO_ configuration options are not global
7814 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7816 dnl Only build Mork if it's required
7817 AC_SUBST(MOZ_MORK)
7818 if test "$MOZ_MORK"; then
7819   AC_DEFINE(MOZ_MORK)
7822 dnl Build the lightweight Mork reader if required
7823 AC_SUBST(MOZ_MORKREADER)
7824 if test "$MOZ_MORKREADER"; then
7825   AC_DEFINE(MOZ_MORKREADER)
7828 dnl ========================================================
7829 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7830     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7833 dnl ========================================================
7834 dnl =
7835 dnl = Maintainer debug option (no --enable equivalent)
7836 dnl =
7837 dnl ========================================================
7839 AC_SUBST(AR)
7840 AC_SUBST(AR_FLAGS)
7841 AC_SUBST(AR_LIST)
7842 AC_SUBST(AR_EXTRACT)
7843 AC_SUBST(AR_DELETE)
7844 AC_SUBST(AS)
7845 AC_SUBST(ASFLAGS)
7846 AC_SUBST(AS_DASH_C_FLAG)
7847 AC_SUBST(LD)
7848 AC_SUBST(RC)
7849 AC_SUBST(RCFLAGS)
7850 AC_SUBST(WINDRES)
7851 AC_SUBST(USE_SHORT_LIBNAME)
7852 AC_SUBST(IMPLIB)
7853 AC_SUBST(FILTER)
7854 AC_SUBST(BIN_FLAGS)
7855 AC_SUBST(NS_USE_NATIVE)
7856 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7857 AC_SUBST(MOZ_GFX_TOOLKIT)
7858 AC_SUBST(MOZ_UPDATE_XTERM)
7859 AC_SUBST(MINIMO)
7860 AC_SUBST(MOZ_PLATFORM_HILDON)
7861 AC_SUBST(NS_OSSO)
7862 AC_SUBST(NS_MAEMO_LOCATION)
7863 AC_SUBST(MOZ_AUTH_EXTENSION)
7864 AC_SUBST(MOZ_MATHML)
7865 AC_SUBST(MOZ_PERMISSIONS)
7866 AC_SUBST(MOZ_XTF)
7867 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7868 AC_SUBST(MOZ_PREF_EXTENSIONS)
7869 AC_SUBST(MOZ_SVG)
7870 AC_SUBST(MOZ_SMIL)
7871 AC_SUBST(MOZ_XSLT_STANDALONE)
7872 AC_SUBST(MOZ_JS_LIBS)
7873 AC_SUBST(MOZ_PSM)
7874 AC_SUBST(MOZ_DEBUG)
7875 AC_SUBST(MOZ_DEBUG_MODULES)
7876 AC_SUBST(MOZ_PROFILE_MODULES)
7877 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7878 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7879 AC_SUBST(MOZ_DEBUG_FLAGS)
7880 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7881 AC_SUBST(WARNINGS_AS_ERRORS)
7882 AC_SUBST(MOZ_DBGRINFO_MODULES)
7883 AC_SUBST(MOZ_EXTENSIONS)
7884 AC_SUBST(MOZ_IMG_DECODERS)
7885 AC_SUBST(MOZ_IMG_ENCODERS)
7886 AC_SUBST(MOZ_JSDEBUGGER)
7887 AC_SUBST(MOZ_OJI)
7888 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7889 AC_SUBST(MOZ_PLUGINS)
7890 AC_SUBST(ENABLE_EAZEL_PROFILER)
7891 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7892 AC_SUBST(EAZEL_PROFILER_LIBS)
7893 AC_SUBST(MOZ_PERF_METRICS)
7894 AC_SUBST(GC_LEAK_DETECTOR)
7895 AC_SUBST(MOZ_LOG_REFCNT)
7896 AC_SUBST(MOZ_LEAKY)
7897 AC_SUBST(MOZ_JPROF)
7898 AC_SUBST(MOZ_SHARK)
7899 AC_SUBST(MOZ_CALLGRIND)
7900 AC_SUBST(MOZ_VTUNE)
7901 AC_SUBST(MOZ_XPCTOOLS)
7902 AC_SUBST(MOZ_JSLOADER)
7903 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7904 AC_SUBST(MOZ_INSURE)
7905 AC_SUBST(MOZ_INSURE_DIRS)
7906 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7907 AC_SUBST(MOZ_QUANTIFY)
7908 AC_SUBST(MOZ_INSURIFYING)
7909 AC_SUBST(LIBICONV)
7910 AC_SUBST(MOZ_PLACES)
7911 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7912 AC_SUBST(MOZ_STORAGE)
7913 AC_SUBST(MOZ_FEEDS)
7914 AC_SUBST(NS_PRINTING)
7916 AC_SUBST(MOZ_JAVAXPCOM)
7917 AC_SUBST(JAVA_INCLUDE_PATH)
7918 AC_SUBST(JAVA)
7919 AC_SUBST(JAVAC)
7920 AC_SUBST(JAR)
7922 AC_SUBST(MOZ_PROFILELOCKING)
7924 AC_SUBST(HAVE_XIE)
7925 AC_SUBST(MOZ_XIE_LIBS)
7926 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7928 AC_SUBST(XPCOM_USE_LEA)
7929 AC_SUBST(BUILD_STATIC_LIBS)
7930 AC_SUBST(MOZ_ENABLE_LIBXUL)
7931 AC_SUBST(ENABLE_TESTS)
7932 AC_SUBST(IBMBIDI)
7933 AC_SUBST(MOZ_UNIVERSALCHARDET)
7934 AC_SUBST(ACCESSIBILITY)
7935 AC_SUBST(MOZ_XPINSTALL)
7936 AC_SUBST(MOZ_VIEW_SOURCE)
7937 AC_SUBST(MOZ_SPELLCHECK)
7938 AC_SUBST(MOZ_XPFE_COMPONENTS)
7939 AC_SUBST(MOZ_USER_DIR)
7940 AC_SUBST(MOZ_CRASHREPORTER)
7942 AC_SUBST(ENABLE_STRIP)
7943 AC_SUBST(PKG_SKIP_STRIP)
7944 AC_SUBST(USE_ELF_DYNSTR_GC)
7945 AC_SUBST(INCREMENTAL_LINKER)
7946 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7947 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7948 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7950 AC_SUBST(MOZ_FIX_LINK_PATHS)
7951 AC_SUBST(XPCOM_LIBS)
7952 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7953 AC_SUBST(XPCOM_GLUE_LDOPTS)
7954 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7956 AC_SUBST(USE_DEPENDENT_LIBS)
7958 AC_SUBST(MOZ_BUILD_ROOT)
7959 AC_SUBST(MOZ_OS2_TOOLS)
7960 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7962 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7963 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7964 AC_SUBST(MOZ_TIMELINE)
7965 AC_SUBST(WINCE)
7966 AC_SUBST(WINCE_SDK_DIR)
7967 AC_SUBST(TARGET_DEVICE)
7969 AC_SUBST(MOZ_APP_NAME)
7970 AC_SUBST(MOZ_APP_DISPLAYNAME)
7971 AC_SUBST(MOZ_APP_VERSION)
7972 AC_SUBST(FIREFOX_VERSION)
7974 AC_SUBST(MOZ_PKG_SPECIAL)
7976 AC_SUBST(MOZILLA_OFFICIAL)
7977 AC_SUBST(BUILD_OFFICIAL)
7978 AC_SUBST(MOZ_MILESTONE_RELEASE)
7980 dnl win32 options
7981 AC_SUBST(MOZ_PROFILE)
7982 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7983 AC_SUBST(MOZ_MAPINFO)
7984 AC_SUBST(MOZ_BROWSE_INFO)
7985 AC_SUBST(MOZ_TOOLS_DIR)
7986 AC_SUBST(CYGWIN_WRAPPER)
7987 AC_SUBST(AS_PERL)
7988 AC_SUBST(WIN32_REDIST_DIR)
7989 AC_SUBST(PYTHON)
7991 dnl Echo the CFLAGS to remove extra whitespace.
7992 CFLAGS=`echo \
7993         $_WARNINGS_CFLAGS \
7994         $CFLAGS`
7996 CXXFLAGS=`echo \
7997         $_MOZ_RTTI_FLAGS \
7998         $_MOZ_EXCEPTIONS_FLAGS \
7999         $_WARNINGS_CXXFLAGS \
8000         $CXXFLAGS`
8002 COMPILE_CFLAGS=`echo \
8003     $_DEFINES_CFLAGS \
8004         $_DEPEND_CFLAGS \
8005     $COMPILE_CFLAGS`
8007 COMPILE_CXXFLAGS=`echo \
8008     $_DEFINES_CXXFLAGS \
8009         $_DEPEND_CFLAGS \
8010     $COMPILE_CXXFLAGS`
8012 AC_SUBST(SYSTEM_MAKEDEPEND)
8013 AC_SUBST(SYSTEM_LIBXUL)
8014 AC_SUBST(SYSTEM_JPEG)
8015 AC_SUBST(SYSTEM_PNG)
8016 AC_SUBST(SYSTEM_ZLIB)
8017 AC_SUBST(SYSTEM_BZ2)
8019 AC_SUBST(JPEG_CFLAGS)
8020 AC_SUBST(JPEG_LIBS)
8021 AC_SUBST(ZLIB_CFLAGS)
8022 AC_SUBST(ZLIB_LIBS)
8023 AC_SUBST(BZ2_CFLAGS)
8024 AC_SUBST(BZ2_LIBS)
8025 AC_SUBST(PNG_CFLAGS)
8026 AC_SUBST(PNG_LIBS)
8028 AC_SUBST(MOZ_JPEG_CFLAGS)
8029 AC_SUBST(MOZ_JPEG_LIBS)
8030 AC_SUBST(MOZ_ZLIB_CFLAGS)
8031 AC_SUBST(MOZ_ZLIB_LIBS)
8032 AC_SUBST(MOZ_BZ2_CFLAGS)
8033 AC_SUBST(MOZ_BZ2_LIBS)
8034 AC_SUBST(MOZ_PNG_CFLAGS)
8035 AC_SUBST(MOZ_PNG_LIBS)
8037 AC_SUBST(NSPR_CFLAGS)
8038 AC_SUBST(NSPR_LIBS)
8039 AC_SUBST(MOZ_NATIVE_NSPR)
8041 AC_SUBST(NSS_CFLAGS)
8042 AC_SUBST(NSS_LIBS)
8043 AC_SUBST(NSS_DEP_LIBS)
8044 AC_SUBST(MOZ_NATIVE_NSS)
8045 AC_SUBST(NSS_DISABLE_DBM)
8047 AC_SUBST(CFLAGS)
8048 AC_SUBST(CXXFLAGS)
8049 AC_SUBST(CPPFLAGS)
8050 AC_SUBST(COMPILE_CFLAGS)
8051 AC_SUBST(COMPILE_CXXFLAGS)
8052 AC_SUBST(LDFLAGS)
8053 AC_SUBST(LIBS)
8054 AC_SUBST(CROSS_COMPILE)
8055 AC_SUBST(WCHAR_CFLAGS)
8057 AC_SUBST(HOST_CC)
8058 AC_SUBST(HOST_CXX)
8059 AC_SUBST(HOST_CFLAGS)
8060 AC_SUBST(HOST_CXXFLAGS)
8061 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8062 AC_SUBST(HOST_AR)
8063 AC_SUBST(HOST_AR_FLAGS)
8064 AC_SUBST(HOST_LD)
8065 AC_SUBST(HOST_RANLIB)
8066 AC_SUBST(HOST_NSPR_MDCPUCFG)
8067 AC_SUBST(HOST_BIN_SUFFIX)
8068 AC_SUBST(HOST_OS_ARCH)
8070 AC_SUBST(TARGET_CPU)
8071 AC_SUBST(TARGET_VENDOR)
8072 AC_SUBST(TARGET_OS)
8073 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8074 AC_SUBST(TARGET_MD_ARCH)
8075 AC_SUBST(TARGET_XPCOM_ABI)
8076 AC_SUBST(OS_TARGET)
8077 AC_SUBST(OS_ARCH)
8078 AC_SUBST(OS_RELEASE)
8079 AC_SUBST(OS_TEST)
8081 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8082 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8084 AC_SUBST(WRAP_MALLOC_CFLAGS)
8085 AC_SUBST(WRAP_MALLOC_LIB)
8086 AC_SUBST(MKSHLIB)
8087 AC_SUBST(MKCSHLIB)
8088 AC_SUBST(MKSHLIB_FORCE_ALL)
8089 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8090 AC_SUBST(DSO_CFLAGS)
8091 AC_SUBST(DSO_PIC_CFLAGS)
8092 AC_SUBST(DSO_LDOPTS)
8093 AC_SUBST(LIB_PREFIX)
8094 AC_SUBST(DLL_PREFIX)
8095 AC_SUBST(DLL_SUFFIX)
8096 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8097 AC_SUBST(LIB_SUFFIX)
8098 AC_SUBST(OBJ_SUFFIX)
8099 AC_SUBST(BIN_SUFFIX)
8100 AC_SUBST(ASM_SUFFIX)
8101 AC_SUBST(IMPORT_LIB_SUFFIX)
8102 AC_SUBST(USE_N32)
8103 AC_SUBST(CC_VERSION)
8104 AC_SUBST(CXX_VERSION)
8105 AC_SUBST(MSMANIFEST_TOOL)
8107 if test "$USING_HCC"; then
8108    CC='${topsrcdir}/build/hcc'
8109    CC="$CC '$_OLDCC'"
8110    CXX='${topsrcdir}/build/hcpp'
8111    CXX="$CXX '$_OLDCXX'"
8112    AC_SUBST(CC)
8113    AC_SUBST(CXX)
8116 dnl Check for missing components
8117 if test "$COMPILE_ENVIRONMENT"; then
8118 if test "$MOZ_X11"; then
8119     dnl ====================================================
8120     dnl = Check if X headers exist
8121     dnl ====================================================
8122     _SAVE_CFLAGS=$CFLAGS
8123     CFLAGS="$CFLAGS $XCFLAGS"
8124     AC_TRY_COMPILE([
8125         #include <stdio.h>
8126         #include <stdlib.h>
8127         #include <X11/Xlib.h>
8128         #include <X11/Intrinsic.h>
8129     ],
8130     [
8131         Display *dpy = 0;
8132         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8133             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8134             exit(1);
8135         }
8136     ], [], 
8137     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8138     CFLAGS="$_SAVE_CFLAGS"
8140     if test ! -z "$MISSING_X"; then
8141         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8142     fi
8144 fi # MOZ_X11
8145 fi # COMPILE_ENVIRONMENT
8147 dnl Set various defines and substitutions
8148 dnl ========================================================
8150 if test "$OS_ARCH" = "BeOS"; then
8151   AC_DEFINE(XP_BEOS)
8152   MOZ_MOVEMAIL=1
8153 elif test "$OS_ARCH" = "Darwin"; then
8154   AC_DEFINE(XP_UNIX)
8155   AC_DEFINE(UNIX_ASYNC_DNS)
8156   MOZ_MOVEMAIL=1
8157 elif test "$OS_ARCH" = "OpenVMS"; then
8158   AC_DEFINE(XP_UNIX)
8159 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8160   AC_DEFINE(XP_UNIX)
8161   AC_DEFINE(UNIX_ASYNC_DNS)
8162   MOZ_MOVEMAIL=1
8164 AC_SUBST(MOZ_MOVEMAIL)
8166 if test "$MOZ_DEBUG"; then
8167     AC_DEFINE(MOZ_REFLOW_PERF)
8168     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8171 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8172     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8173     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8174     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8175     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8176     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8177     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8178     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8179     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8182 # Used for LD_LIBRARY_PATH of run_viewer target
8183 LIBS_PATH=
8184 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8185   case $lib_arg in
8186     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8187       * ) ;;
8188   esac
8189 done
8190 AC_SUBST(LIBS_PATH)
8192 dnl ========================================================
8193 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8194 dnl ========================================================
8195 case "$host_os" in
8196 mingw*)
8197     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8198     ;;
8199 cygwin*|msvc*|mks*)
8200     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8201     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8202     CC="\$(CYGWIN_WRAPPER) $CC"
8203     CXX="\$(CYGWIN_WRAPPER) $CXX"
8204     CPP="\$(CYGWIN_WRAPPER) $CPP"
8205     LD="\$(CYGWIN_WRAPPER) $LD"
8206     AS="\$(CYGWIN_WRAPPER) $AS"
8207     RC="\$(CYGWIN_WRAPPER) $RC"
8208     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8209     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8210     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8211     ;;
8212 esac
8214 AC_SUBST(CYGDRIVE_MOUNT)
8215 AC_SUBST(WIN_TOP_SRC)
8217 AC_SUBST(MOZILLA_VERSION)
8219 AC_SUBST(ac_configure_args)
8221 dnl Spit out some output
8222 dnl ========================================================
8224 dnl The following defines are used by xpcom
8225 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8226 CPP_THROW_NEW
8227 HAVE_CPP_2BYTE_WCHAR_T
8228 HAVE_CPP_ACCESS_CHANGING_USING
8229 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8230 HAVE_CPP_BOOL
8231 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8232 HAVE_CPP_EXPLICIT
8233 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8234 HAVE_CPP_NAMESPACE_STD
8235 HAVE_CPP_NEW_CASTS
8236 HAVE_CPP_PARTIAL_SPECIALIZATION
8237 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8238 HAVE_CPP_TYPENAME
8239 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8240 HAVE_STATVFS
8241 NEED_CPP_UNUSED_IMPLEMENTATIONS
8242 NEW_H
8243 HAVE_GETPAGESIZE
8244 HAVE_ICONV
8245 HAVE_ICONV_WITH_CONST_INPUT
8246 HAVE_MBRTOWC
8247 HAVE_SYS_MOUNT_H
8248 HAVE_SYS_VFS_H
8249 HAVE_WCRTOMB
8252 AC_CONFIG_HEADER(
8253 netwerk/necko-config.h
8254 xpcom/xpcom-config.h
8255 xpcom/xpcom-private.h
8258 # Save the defines header file before autoconf removes it.
8259 # (Do not add AC_DEFINE calls after this line.)
8260   _CONFIG_TMP=confdefs-tmp.h
8261   _CONFIG_DEFS_H=mozilla-config.h
8263   cat > $_CONFIG_TMP <<\EOF
8264 /* List of defines generated by configure. Included with preprocessor flag,
8265  * -include, to avoid long list of -D defines on the compile command-line.
8266  * Do not edit.
8267  */
8269 #ifndef _MOZILLA_CONFIG_H_
8270 #define _MOZILLA_CONFIG_H_
8273 _EGREP_PATTERN='^#define ('
8274 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8275     for f in $_NON_GLOBAL_ACDEFINES; do
8276         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8277     done
8279 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8281   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8283   cat >> $_CONFIG_TMP <<\EOF
8285 #endif /* _MOZILLA_CONFIG_H_ */
8289   # Only write mozilla-config.h when something changes (or it doesn't exist)
8290   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8291     rm $_CONFIG_TMP
8292   else
8293     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8294     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8296     echo ==== $_CONFIG_DEFS_H =================================
8297     cat $_CONFIG_DEFS_H
8298   fi
8300 dnl Probably shouldn't call this manually but we always want the output of DEFS
8301 rm -f confdefs.h.save
8302 mv confdefs.h confdefs.h.save
8303 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8304 AC_OUTPUT_MAKE_DEFS()
8305 MOZ_DEFINES=$DEFS
8306 AC_SUBST(MOZ_DEFINES)
8307 rm -f confdefs.h
8308 mv confdefs.h.save confdefs.h
8310 dnl Load the list of Makefiles to generate.
8311 dnl   To add new Makefiles, edit allmakefiles.sh.
8312 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8313 . ${srcdir}/allmakefiles.sh
8314 dnl 
8315 dnl Run a perl script to quickly create the makefiles.
8316 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8317 dnl   for the files it cannot handle correctly. This way, config.status
8318 dnl   will handle these files.
8319 dnl If it fails, nothing is set and config.status will run as usual.
8321 dnl This does not change the $MAKEFILES variable.
8323 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8325 if test -z "${AS_PERL}"; then
8326 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8327 else
8328 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8330 . ./conftest.sh
8331 rm conftest.sh
8333 echo $MAKEFILES > unallmakefiles
8335 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8337 AC_OUTPUT($MAKEFILES)
8339 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8340 if test "$CAIRO_FEATURES_H"; then
8341   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8342     echo "$CAIRO_FEATURES_H is unchanged"
8343     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8344   else
8345     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8346   fi
8349 dnl ========================================================
8350 dnl = Setup a nice relatively clean build environment for
8351 dnl = sub-configures.
8352 dnl ========================================================
8353 CC="$_SUBDIR_CC" 
8354 CXX="$_SUBDIR_CXX" 
8355 CFLAGS="$_SUBDIR_CFLAGS" 
8356 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8357 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8358 LDFLAGS="$_SUBDIR_LDFLAGS"
8359 HOST_CC="$_SUBDIR_HOST_CC" 
8360 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8361 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8364 unset MAKEFILES
8365 unset CONFIG_FILES
8367 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8368 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8370 if test -z "$MOZ_NATIVE_NSPR"; then
8371     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8372     if test -z "$MOZ_DEBUG"; then
8373         ac_configure_args="$ac_configure_args --disable-debug"
8374     fi
8375     if test "$MOZ_OPTIMIZE" = "1"; then
8376         ac_configure_args="$ac_configure_args --enable-optimize"
8377     fi
8378     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8379        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8380     fi
8381     if test -n "$HAVE_64BIT_OS"; then
8382         ac_configure_args="$ac_configure_args --enable-64bit"
8383     fi
8384     if test -n "$USE_ARM_KUSER"; then
8385         ac_configure_args="$ac_configure_args --with-arm-kuser"
8386     fi
8387     AC_OUTPUT_SUBDIRS(nsprpub)
8388     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8391 if test -z "$MOZ_NATIVE_NSPR"; then
8392     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8393     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8394     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8395        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8396        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8397        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8398        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8399     fi
8400     rm -f config/autoconf.mk.bak
8403 # Run the SpiderMonkey 'configure' script.
8404 dist=$MOZ_BUILD_ROOT/dist
8405 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8406 ac_configure_args="$ac_configure_args --enable-threadsafe"
8407 if test -z "$MOZ_NATIVE_NSPR"; then
8408     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8409     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8411 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8412 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8413 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8414 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8415 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8416 if test "$MOZ_MEMORY"; then
8417    ac_configure_args="$ac_configure_args --enable-jemalloc"  
8419 AC_OUTPUT_SUBDIRS(js/src)
8420 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8422 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8424 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8425 dnl Needs to be at the end to respect possible changes from NSPR configure
8426 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8427   echo "config/autoconf.mk is unchanged"
8428   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8429 else
8430   rm -f config/autoconf.mk.orig 2> /dev/null