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