Builds against latest nanojit; merged VMSideExitInfo into SideExit
[mozilla-central.git] / configure.in
blob36dd3db00d8822a54dacd9198ae8bb39f020c2e2
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 GLITZ_VERSION=0.4.0
124 PANGO_VERSION=1.10.0
125 GTK2_VERSION=2.10.0
126 MAKE_VERSION=3.78
127 WINDRES_VERSION=2.14.90
128 W32API_VERSION=3.8
129 GNOMEVFS_VERSION=2.0
130 GNOMEUI_VERSION=2.2.0
131 GCONF_VERSION=1.2.1
132 LIBGNOME_VERSION=2.0
133 STARTUP_NOTIFICATION_VERSION=0.8
134 DBUS_VERSION=0.60
135 LCMS_VERSION=1.17
136 SQLITE_VERSION=3.5.9
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 dnl ========================================================
211 dnl Checks for compilers.
212 dnl ========================================================
213 dnl Set CROSS_COMPILE in the environment when running configure
214 dnl to use the cross-compile setup for now
215 dnl ========================================================
217 if test "$COMPILE_ENVIRONMENT"; then
219 dnl Do some special WinCE toolchain stuff
220 case "$target" in
221 *wince)
222     echo -----------------------------------------------------------------------------
223     echo Building Windows CE Shunt Library and Tool Chain
224     echo -----------------------------------------------------------------------------
226     ac_exeext=.exe
228     echo -n "#define TOPSRCDIR \"" > $srcdir/build/wince/tools/topsrcdir.h
229     echo `cd "$_topsrcdir" && pwd -W | tr '\n' '\"'` >> $srcdir/build/wince/tools/topsrcdir.h
230     make -C $srcdir/build/wince/tools
231     echo -----------------------------------------------------------------------------
232     ;;
233 esac
235 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
236     echo "cross compiling from $host to $target"
237     cross_compiling=yes
239     _SAVE_CC="$CC"
240     _SAVE_CFLAGS="$CFLAGS"
241     _SAVE_LDFLAGS="$LDFLAGS"
243     AC_MSG_CHECKING([for host c compiler])
244     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
245     if test -z "$HOST_CC"; then
246         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
247     fi
248     AC_MSG_RESULT([$HOST_CC])
249     AC_MSG_CHECKING([for host c++ compiler])
250     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
251     if test -z "$HOST_CXX"; then
252         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
253     fi
254     AC_MSG_RESULT([$HOST_CXX])
256     if test -z "$HOST_CFLAGS"; then
257         HOST_CFLAGS="$CFLAGS"
258     fi
259     if test -z "$HOST_CXXFLAGS"; then
260         HOST_CXXFLAGS="$CXXFLAGS"
261     fi
262     if test -z "$HOST_LDFLAGS"; then
263         HOST_LDFLAGS="$LDFLAGS"
264     fi
265     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
266     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
267     CC="$HOST_CC"
268     CFLAGS="$HOST_CFLAGS"
269     LDFLAGS="$HOST_LDFLAGS"
271     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
272     AC_TRY_COMPILE([], [return(0);], 
273         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
274         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
276     CC="$HOST_CXX"
277     CFLAGS="$HOST_CXXFLAGS"
279     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
280     AC_TRY_COMPILE([], [return(0);], 
281         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
282         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
283     
284     CC=$_SAVE_CC
285     CFLAGS=$_SAVE_CFLAGS
286     LDFLAGS=$_SAVE_LDFLAGS
288     case "$build:$target" in
289       powerpc-apple-darwin8*:i?86-apple-darwin*)
290         dnl The Darwin cross compiler doesn't necessarily point itself at a
291         dnl root that has libraries for the proper architecture, it defaults
292         dnl to the system root.  The libraries in the system root on current
293         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
294         dnl checks will fail.  Fake a working SDK in that case.
295         _SAVE_CFLAGS=$CFLAGS
296         _SAVE_CXXFLAGS=$CXXLAGS
297         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
298         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
299         ;;
300     esac
302     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
303     unset ac_cv_prog_CC
304     AC_PROG_CC
305     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
306     unset ac_cv_prog_CXX
307     AC_PROG_CXX
309     case "$build:$target" in
310       powerpc-apple-darwin8*:i?86-apple-darwin*)
311         dnl Revert the changes made above.  From this point on, the target
312         dnl compiler will never be used without applying the SDK to CFLAGS
313         dnl (see --with-macos-sdk below).
314         CFLAGS=$_SAVE_CFLAGS
315         CXXFLAGS=$_SAVE_CXXFLAGS
316         ;;
317     esac
319     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
320     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
321     AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
322     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
323     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
324     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
325     AC_DEFINE(CROSS_COMPILE)
326 else
327     AC_PROG_CC
328     AC_PROG_CXX
329     AC_PROG_RANLIB
330     AC_PATH_PROGS(AS, $AS as, $CC)
331     AC_CHECK_PROGS(AR, ar, :)
332     AC_CHECK_PROGS(LD, ld, :)
333     AC_CHECK_PROGS(STRIP, strip, :)
334     AC_CHECK_PROGS(WINDRES, windres, :)
335     if test -z "$HOST_CC"; then
336         HOST_CC="$CC"
337     fi
338     if test -z "$HOST_CFLAGS"; then
339         HOST_CFLAGS="$CFLAGS"
340     fi
341     if test -z "$HOST_CXX"; then
342         HOST_CXX="$CXX"
343     fi
344     if test -z "$HOST_CXXFLAGS"; then
345         HOST_CXXFLAGS="$CXXFLAGS"
346     fi
347     if test -z "$HOST_LDFLAGS"; then
348         HOST_LDFLAGS="$LDFLAGS"
349     fi
350     if test -z "$HOST_RANLIB"; then
351         HOST_RANLIB="$RANLIB"
352     fi
353     if test -z "$HOST_AR"; then
354        HOST_AR="$AR"
355     fi
358 GNU_AS=
359 GNU_LD=
360 GNU_CC=
361 GNU_CXX=
362 CC_VERSION='N/A'
363 CXX_VERSION='N/A'
364 if test "$GCC" = "yes"; then
365     GNU_CC=1
366     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
368 if test "$GXX" = "yes"; then
369     GNU_CXX=1
370     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
372 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
373     GNU_AS=1
375 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
376     GNU_LD=1
378 if test "$GNU_CC"; then
379     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
380         GCC_USE_GNU_LD=1
381     fi
384 INTEL_CC=
385 INTEL_CXX=
386 if test "$GCC" = yes; then
387    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
388      INTEL_CC=1
389    fi
392 if test "$GXX" = yes; then
393    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
394      INTEL_CXX=1
395    fi
398 dnl Special win32 checks
399 dnl ========================================================
400 case "$target" in
401 *-wince)
402     WINVER=500
403     ;;
405     if test -n "$GNU_CC"; then  
406         WINVER=501
407     else    
408         WINVER=500
409     fi
410     ;;
411 esac
413 MOZ_ARG_WITH_STRING(windows-version,
414 [  --with-windows-version=WINVER
415                           Minimum Windows version (WINVER) to support
416                               400: Windows 95
417                               500: Windows 2000
418                               501: Windows XP],
419   WINVER=$withval)
421 case "$WINVER" in
422 400|500|501)
423     ;;
426     AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
427     ;;
429 esac
431 case "$target" in
432 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
433     if test "$GCC" != "yes"; then
434         # Check to see if we are really running in a msvc environemnt
435         _WIN32_MSVC=1
436         AC_CHECK_PROGS(MIDL, midl)
438         # Make sure compilers are valid
439         CFLAGS="$CFLAGS -TC -nologo"
440         CXXFLAGS="$CXXFLAGS -TP -nologo"
441         AC_LANG_SAVE
442         AC_LANG_C
443         AC_TRY_COMPILE([#include <stdio.h>],
444             [ printf("Hello World\n"); ],,
445             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
447         AC_LANG_CPLUSPLUS
448         AC_TRY_COMPILE([#include <new.h>],
449             [ unsigned *test = new unsigned(42); ],,
450             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
451         AC_LANG_RESTORE
452         
453         changequote(,)
454         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
455         changequote([,])
456         
457         # Determine compiler version
458         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
459         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
460         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
461         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
462         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
463         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
465         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
466         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
468         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
469             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
470         fi
471         if test "$_CC_MAJOR_VERSION" = "12"; then
472             _CC_SUITE=6
473         elif test "$_CC_MAJOR_VERSION" = "13"; then
474             _CC_SUITE=7
475         elif test "$_CC_MAJOR_VERSION" = "14"; then
476             _CC_SUITE=8
477             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
478             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
479             dnl so be very specific here!
480             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
481             if test $_CC_RELEASE -gt 50727; then
482                _USE_DYNAMICBASE=1
483             elif test $_CC_BUILD -ge 762; then
484                _USE_DYNAMICBASE=1
485             fi
486             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
487             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
488         elif test "$_CC_MAJOR_VERSION" = "15"; then
489             _CC_SUITE=9
490             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
491             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
492             _USE_DYNAMICBASE=1
493             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
494             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
495         else
496             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
497         fi
499         _MOZ_RTTI_FLAGS_ON='-GR'
500         _MOZ_RTTI_FLAGS_OFF='-GR-'
501         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
502         _MOZ_EXCEPTIONS_FLAGS_OFF=''
504         if test -n "$WIN32_REDIST_DIR"; then
505             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
506         fi
507         
508         # bug #249782
509         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
510         if test "$_CC_SUITE" -ge "8"; then
511                 changequote(,)
512                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
513                 changequote([,])
515                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
516                 if test -n "$MSMT_TOOL"; then
517                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
518                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
519                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
520                         fi
521                         MSMANIFEST_TOOL=1
522                         unset MSMT_TOOL
523                 else
524                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
525                 fi
526         fi
528         # Check linker version
529         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
530         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
531         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
532             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
533         fi
534         INCREMENTAL_LINKER=1
536         # Check midl version
537         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
538         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
539         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
540         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
541          # Add flags if necessary
542          AC_MSG_CHECKING([for midl flags])
543          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
544              # Starting with MIDL version 6.0.359, the MIDL compiler
545              # generates /Oicf /robust stubs by default, which is not
546              # compatible with versions of Windows older than Win2k.
547              # This switches us back to the old behaviour. When we drop
548              # support for Windows older than Win2k, we should remove
549              # this.
550              MIDL_FLAGS="${MIDL_FLAGS} -no_robust"
551              AC_MSG_RESULT([need -no_robust])
552          else
553              MIDL_FLAGS="${MIDL_FLAGS}"
554              AC_MSG_RESULT([none needed])
555         fi
556         
557         unset _MSVC_VER_FILTER
558         
559     else
560         # Check w32api version
561         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
562         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
563         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
564         AC_TRY_COMPILE([#include <w32api.h>],
565             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
566                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
567                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
568                 #error "test failed."
569             #endif
570             , [ res=yes ], [ res=no ])
571         AC_MSG_RESULT([$res])
572         if test "$res" != "yes"; then
573             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
574         fi
575         # Check windres version
576         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
577         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
578         AC_MSG_RESULT([$_WINDRES_VERSION])
579         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
580         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
581         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
582         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
583         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
584         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
585         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
586                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
587                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
588                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
589                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
590                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
591         then
592             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
593         fi
594     fi # !GNU_CC
596     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
597     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
598     # Require OS features provided by IE 5.0
599     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
600     ;;
601 esac
603 dnl Test breaks icc on OS/2 && MSVC
604 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
605     AC_PROG_CC_C_O
606     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
607         USING_HCC=1
608         _OLDCC=$CC
609         _OLDCXX=$CXX
610         CC="${srcdir}/build/hcc '$CC'"
611         CXX="${srcdir}/build/hcpp '$CXX'"
612     fi
615 AC_PROG_CPP
616 AC_PROG_CXXCPP
618 if test -n "$_WIN32_MSVC"; then
619     SKIP_PATH_CHECKS=1
620     SKIP_COMPILER_CHECKS=1
621     SKIP_LIBRARY_CHECKS=1
624 fi # COMPILE_ENVIRONMENT
626 AC_SUBST(MIDL_FLAGS)
627 AC_SUBST(_MSC_VER)
629 AC_SUBST(GNU_AS)
630 AC_SUBST(GNU_LD)
631 AC_SUBST(GNU_CC)
632 AC_SUBST(GNU_CXX)
633 AC_SUBST(INTEL_CC)
634 AC_SUBST(INTEL_CXX)
636 dnl ========================================================
637 dnl Checks for programs.
638 dnl ========================================================
639 AC_PROG_INSTALL
640 AC_PROG_LN_S
641 AC_PATH_PROGS(PERL, $PERL perl5 perl )
642 if test -z "$PERL" || test "$PERL" = ":"; then
643     AC_MSG_ERROR([perl not found in \$PATH])
646 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
647 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
648 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
649 _perl_res=$?
650 AC_MSG_RESULT([$_perl_version])
652 if test "$_perl_res" != 0; then
653     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
657 AC_MSG_CHECKING([for full perl installation])
658 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
659 _perl_res=$?
660 if test "$_perl_res" != 0; then
661     AC_MSG_RESULT([no])
662     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
663 else
664     AC_MSG_RESULT([yes])    
667 AC_PATH_PROGS(PYTHON, $PYTHON python)
668 if test -z "$PYTHON"; then
669     AC_MSG_ERROR([python was not found in \$PATH])
671 echo PYTHON="$PYTHON"
673 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
674 if test -z "$COMPILE_ENVIRONMENT"; then
675 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
676     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
679 AC_SUBST(NSINSTALL_BIN)
681 AC_PATH_PROG(DOXYGEN, doxygen, :)
682 AC_PATH_PROG(WHOAMI, whoami, :)
683 AC_PATH_PROG(AUTOCONF, autoconf, :)
684 AC_PATH_PROG(UNZIP, unzip, :)
685 AC_PATH_PROGS(ZIP, zip)
686 if test -z "$ZIP" || test "$ZIP" = ":"; then
687     AC_MSG_ERROR([zip not found in \$PATH])
689 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
690 AC_PATH_PROG(XARGS, xargs)
691 if test -z "$XARGS" || test "$XARGS" = ":"; then
692     AC_MSG_ERROR([xargs not found in \$PATH .])
695 if test "$COMPILE_ENVIRONMENT"; then
697 dnl ========================================================
698 dnl = Mac OS X toolchain support
699 dnl ========================================================
701 case "$target_os" in
702 darwin*)
703     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
704     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
705     dnl the environment and includedir purposes (when using an SDK, below),
706     dnl but remember the full version number for the libdir (SDK).
707     changequote(,)
708     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
709     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
710     changequote([,])
711     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
712         dnl Bug 280479, but this keeps popping up in bug 292530 too because
713         dnl 4.0.0/4061 is the default compiler in Tiger.
714         changequote(,)
715         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
716         changequote([,])
717         if test "$GCC_BUILD" = "4061" ; then
718             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
719 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
720 from building Mozilla. Upgrade to Xcode 2.1 or later.])
721         fi
722     fi
724     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
725     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
726     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
727     AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
729     case "$PBBUILD" in
730       *xcodebuild*)
731         changequote(,)
732         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
733         changequote([,])
734         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
735           HAS_XCODE_2_1=1;
736         fi
737       ;;
738     esac
740     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
741     dnl it has moved into /usr/bin.
742     AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
743     ;;
744 esac
746 AC_SUBST(GCC_VERSION)
747 AC_SUBST(XCODEBUILD_VERSION)
748 AC_SUBST(HAS_XCODE_2_1)
750 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
751 dnl that a universal binary is being produced.
752 AC_SUBST(UNIVERSAL_BINARY)
754 dnl ========================================================
755 dnl Check for MacOS deployment target version
756 dnl ========================================================
758 MOZ_ARG_ENABLE_STRING(macos-target,
759                       [  --enable-macos-target=VER (default=10.4)
760                           Set the minimum MacOS version needed at runtime],
761                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
763 case "$target" in
764 *-darwin*)
765     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
766         dnl Use the specified value
767         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
768         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
769     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
770         dnl No value specified on the command line or in the environment,
771         dnl use the lesser of the application's minimum or the architecture's
772         dnl minimum.
773         export MACOSX_DEPLOYMENT_TARGET=10.4
774     fi
775     ;;
776 esac
778 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
780 dnl ========================================================
781 dnl = Mac OS X SDK support
782 dnl ========================================================
783 MACOS_SDK_DIR=
784 NEXT_ROOT=
785 MOZ_ARG_WITH_STRING(macos-sdk,
786 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
787     MACOS_SDK_DIR=$withval)
789 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
790 dnl NEXT_ROOT will be set and exported only if it's needed.
791 AC_SUBST(MACOS_SDK_DIR)
792 AC_SUBST(NEXT_ROOT)
794 if test "$MACOS_SDK_DIR"; then
795   dnl Sync this section with the ones in NSPR and NSS.
796   dnl Changes to the cross environment here need to be accounted for in
797   dnl the libIDL checks (below) and xpidl build.
799   if test ! -d "$MACOS_SDK_DIR"; then
800     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
801 specify a valid SDK.  SDKs are installed when the optional cross-development
802 tools are selected during the Xcode/Developer Tools installation.])
803   fi
805   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
806   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
807     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"
808     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
809       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
810     fi
811     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"
813     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
814     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
816     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
817     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
818     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
820     dnl ld support for -syslibroot is compiler-agnostic, but only available
821     dnl on Tiger.  Although it's possible to switch on the build host's
822     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
823     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
824     dnl set because both the compiler and linker use it.
825     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"
826     export NEXT_ROOT=$MACOS_SDK_DIR
828     if test -n "$CROSS_COMPILE" ; then
829       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
830       dnl the build host.  HOST_CXX is presently unused.
831       HOST_CC="NEXT_ROOT= $HOST_CC"
832       HOST_CXX="NEXT_ROOT= $HOST_CXX"
833     fi
834   else
835     dnl gcc >= 4.0 uses different paths than above, but knows how to find
836     dnl them itself.
837     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
838     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
840     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
841     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
842     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
844     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
845       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
846       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
847       dnl be ignored and cause warnings when -syslibroot is specified.
848       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
849       dnl the -isysroot it receives, so this is only needed with 4.0.0.
850       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
851     fi
852   fi
854   AC_LANG_SAVE
855   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
856   AC_LANG_CPLUSPLUS
857   AC_TRY_COMPILE([#include <new>
858                  int main() { return 0; }],
859    result=yes,
860    result=no)
861   AC_LANG_RESTORE
862   AC_MSG_RESULT($result)
864   if test "$result" = "no" ; then
865     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
866   fi
869 fi # COMPILE_ENVIRONMENT
871 dnl Be sure the make we use is GNU make.
872 dnl on win32, gmake.exe is the generally the wrong version
873 case "$host_os" in
874 cygwin*|mingw*|mks*|msvc*)
875     AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
876     ;;
878     AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
879     ;;
880 esac
881 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
882 if test ! "$_make_try"
883 then
884         echo
885         echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
886         echo
887         exit 1
889 dnl Now exit if version if < MAKE_VERSION
890 rm -f dummy.mk
891 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
892 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
893 rm -f dummy.mk
894 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
895 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
896 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
897 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
898 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
899    test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
900         "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
901    AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
903 AC_SUBST(MAKE)
905 if test "$COMPILE_ENVIRONMENT"; then
907 AC_PATH_XTRA
909 dnl Check in X11 include directory too.
910 if test "$no_x" != "yes"; then
911     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
914 XCFLAGS="$X_CFLAGS"
916 fi # COMPILE_ENVIRONMENT
918 dnl ========================================================
919 dnl set the defaults first
920 dnl ========================================================
921 AS_BIN=$AS
922 AR_FLAGS='cr $@'
923 AR_LIST='$(AR) t'
924 AR_EXTRACT='$(AR) x'
925 AR_DELETE='$(AR) d'
926 AS='$(CC)'
927 AS_DASH_C_FLAG='-c'
928 DLL_PREFIX=lib
929 LIB_PREFIX=lib
930 DLL_SUFFIX=.so
931 OBJ_SUFFIX=o
932 LIB_SUFFIX=a
933 ASM_SUFFIX=s
934 IMPORT_LIB_SUFFIX=
935 TARGET_MD_ARCH=unix
936 DIRENT_INO=d_ino
937 CYGWIN_WRAPPER=
938 WIN_TOP_SRC=
939 MOZ_USER_DIR=".mozilla"
940 HOST_AR='$(AR)'
941 HOST_AR_FLAGS='$(AR_FLAGS)'
943 MOZ_JPEG_CFLAGS=
944 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
945 MOZ_ZLIB_CFLAGS=
946 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
947 MOZ_BZ2_CFLAGS=
948 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
949 MOZ_PNG_CFLAGS=
950 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
952 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
953 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
954 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin'
955 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
956 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
957 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
958 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
960 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
961 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
963 USE_DEPENDENT_LIBS=1
965 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
966 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
968 MOZ_ENABLE_POSTSCRIPT=1 
970 if test -n "$CROSS_COMPILE"; then
971     OS_TARGET="${target_os}"
972     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
973     OS_RELEASE=
974     case "${target_os}" in
975         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
976         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
977         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
978         mingw*)       OS_ARCH=WINNT ;;
979         wince*)       OS_ARCH=WINCE ;;
980         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
981     esac
982 else
983     OS_TARGET=`uname -s`
984     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
985     OS_RELEASE=`uname -r`
988 # Before this used `uname -m` when not cross compiling
989 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
990 OS_TEST="${target_cpu}"
992 _COMPILER_PREFIX=
994 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
996 #######################################################################
997 # Master "Core Components" macros for getting the OS target           #
998 #######################################################################
1001 # Note: OS_TARGET should be specified on the command line for gmake.
1002 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
1003 # The difference between the Win95 target and the WinNT target is that
1004 # the WinNT target uses Windows NT specific features not available
1005 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1006 # at lesser performance (the Win95 target uses threads; the WinNT target
1007 # uses fibers).
1009 # When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
1010 # is built. See: win16_3.11.mk for lots more about the Win16 target.
1012 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1013 # cross-compilation.
1017 # The following hack allows one to build on a WIN95 machine (as if
1018 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1019 # It also accomodates for MKS's uname.exe.  If you never intend
1020 # to do development on a WIN95 machine, you don't need this hack.
1022 case "$OS_ARCH" in
1023 WIN95)
1024     OS_ARCH=WINNT
1025     OS_TARGET=WIN95
1026     ;;
1027 Windows_95)
1028     OS_ARCH=Windows_NT
1029     OS_TARGET=WIN95
1030     ;;
1031 Windows_98)
1032     OS_ARCH=Windows_NT
1033     OS_TARGET=WIN95
1034     ;;
1035 CYGWIN_9*|CYGWIN_ME*)
1036     OS_ARCH='CYGWIN_NT-4.0'
1037     OS_TARGET=WIN95
1038     ;;
1039 esac
1042 # Define and override various archtecture-specific variables, including
1043 # HOST_OS_ARCH
1044 # OS_ARCH
1045 # OS_TEST
1046 # OS_TARGET
1047 # OS_RELEASE
1048 # OS_MINOR_RELEASE
1051 case "$HOST_OS_ARCH" in
1052 cygwin*|mingw*|mks*|msvc*)
1053     HOST_OS_ARCH=WINNT
1054     ;;
1055 linux*)
1056     HOST_OS_ARCH=Linux
1057     ;;
1058 solaris*)
1059     HOST_OS_ARCH=SunOS
1060     ;;
1061 BSD_386)
1062     HOST_OS_ARCH=BSD
1063     ;;
1064 dgux)
1065     HOST_OS_ARCH=DGUX
1066     ;;
1067 IRIX64)
1068     HOST_OS_ARCH=IRIX
1069     ;;
1070 UNIX_SV)
1071     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1072         HOST_OS_ARCH=NCR
1073     else
1074         HOST_OS_ARCH=UNIXWARE
1075     fi
1076     ;;
1077 ncr)
1078     HOST_OS_ARCH=NCR
1079     ;;
1080 UNIX_SYSTEM_V)
1081     HOST_OS_ARCH=NEC
1082     ;;
1083 OSF1)
1084     ;;
1085 *OpenVMS*)
1086     HOST_OS_ARCH=OpenVMS
1087     ;;
1088 OS_2)
1089     HOST_OS_ARCH=OS2
1090     ;;
1091 QNX)
1092     ;;
1093 SCO_SV)
1094     HOST_OS_ARCH=SCOOS
1095     ;;
1096 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1097     HOST_OS_ARCH=SINIX
1098     ;;
1099 UnixWare)
1100     HOST_OS_ARCH=UNIXWARE
1101     ;;
1102 esac
1104 case "$OS_ARCH" in
1105 WINNT)
1106     OS_TEST=`uname -p`
1107     ;;
1108 Windows_NT)
1110 # If uname -s returns "Windows_NT", we assume that we are using
1111 # the uname.exe in MKS toolkit.
1113 # The -r option of MKS uname only returns the major version number.
1114 # So we need to use its -v option to get the minor version number.
1115 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1117     OS_ARCH=WINNT
1118     OS_TARGET=WINNT
1119     OS_MINOR_RELEASE=`uname -v`
1120     if test "$OS_MINOR_RELEASE" = "00"; then
1121         OS_MINOR_RELEASE=0
1122     fi
1123     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1124     ;;
1125 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1127 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1128 # the uname.exe in the Cygwin tools.
1129 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1130 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1131 # the uname.exe in the GNU-Win32 tools.
1132 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1133 # the uname.exe in the MSYS tools.
1135     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1136     OS_ARCH=WINNT
1137     OS_TARGET=WINNT
1138     ;;
1139 AIX)
1140     OS_RELEASE=`uname -v`.`uname -r`
1141     OS_TEST=`uname -p`
1142     ;;
1143 BSD_386)
1144     OS_ARCH=BSD
1145     ;;
1146 dgux)
1147     OS_ARCH=DGUX
1148     ;;
1149 IRIX64)
1150     OS_ARCH=IRIX
1151     ;;
1152 UNIX_SV)
1153     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1154         OS_ARCH=NCR
1155     else
1156         OS_ARCH=UNIXWARE
1157         OS_RELEASE=`uname -v`
1158     fi
1159     ;;
1160 ncr)
1161     OS_ARCH=NCR
1162     ;;
1163 UNIX_SYSTEM_V)
1164     OS_ARCH=NEC
1165     ;;
1166 OSF1)
1167     case `uname -v` in
1168     148)
1169         OS_RELEASE=V3.2C
1170         ;;
1171     564)
1172         OS_RELEASE=V4.0B
1173         ;;
1174     878)
1175         OS_RELEASE=V4.0D
1176         ;;
1177     esac
1178     ;;
1179 *OpenVMS*)
1180     OS_ARCH=OpenVMS
1181     OS_RELEASE=`uname -v`
1182     OS_TEST=`uname -p`
1183     ;;
1184 OS_2)
1185     OS_ARCH=OS2
1186     OS_TARGET=OS2
1187     OS_RELEASE=`uname -v`
1188     ;;
1189 QNX)
1190     if test "$OS_TARGET" != "NTO"; then
1191         changequote(,)
1192         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1193         changequote([,])
1194     fi
1195     OS_TEST=x86
1196     ;;
1197 SCO_SV)
1198     OS_ARCH=SCOOS
1199     OS_RELEASE=5.0
1200     ;;
1201 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1202     OS_ARCH=SINIX
1203     OS_TEST=`uname -p`
1204     ;;
1205 UnixWare)
1206     OS_ARCH=UNIXWARE
1207     OS_RELEASE=`uname -v`
1208     ;;
1209 WINCE)
1210     OS_ARCH=WINCE
1211     OS_TARGET=WINCE
1212     ;;
1213 Darwin)
1214     case "${target_cpu}" in
1215     powerpc*)
1216         OS_TEST=ppc
1217         ;;
1218     i*86*)
1219         OS_TEST=i386 
1220         ;;
1221     *)
1222         if test -z "$CROSS_COMPILE" ; then
1223             OS_TEST=`uname -p`
1224         fi
1225         ;;
1226     esac
1227     ;;
1228 esac
1230 if test "$OS_ARCH" = "NCR"; then
1231     changequote(,)
1232     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1233     changequote([,])
1236 # Only set CPU_ARCH if we recognize the value of OS_TEST
1238 case "$OS_TEST" in
1239 *86 | i86pc)
1240     CPU_ARCH=x86
1241     ;;
1243 powerpc* | ppc)
1244     CPU_ARCH=ppc
1245     ;;
1247 Alpha | alpha | ALPHA)
1248     CPU_ARCH=Alpha
1249     ;;
1251 sun4u | sparc*)
1252     CPU_ARCH=sparc
1253     ;;
1255 x86_64 | ia64)
1256     CPU_ARCH="$OS_TEST"
1257     ;;
1258 esac
1260 if test -z "$OS_TARGET"; then
1261     OS_TARGET=$OS_ARCH
1263 if test "$OS_TARGET" = "WIN95"; then
1264     OS_RELEASE="4.0"
1266 if test "$OS_TARGET" = "WIN16"; then
1267     OS_RELEASE=
1269 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1271 dnl ========================================================
1272 dnl GNU specific defaults
1273 dnl ========================================================
1274 if test "$GNU_CC"; then
1275     # FIXME: Let us build with strict aliasing. bug 414641.
1276     CFLAGS="$CFLAGS -fno-strict-aliasing"
1277     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1278     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1279     DSO_LDOPTS='-shared'
1280     if test "$GCC_USE_GNU_LD"; then
1281         # Don't allow undefined symbols in libraries
1282         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1283     fi
1284     WARNINGS_AS_ERRORS='-Werror'
1285     DSO_CFLAGS=''
1286     DSO_PIC_CFLAGS='-fPIC'
1287     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1288     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1289     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1290     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1292     # Turn on GNU specific features
1293     # -Wall - turn on all warnings
1294     # -pedantic - make compiler warn about non-ANSI stuff, and
1295     #             be a little bit stricter
1296     # Warnings slamm took out for now (these were giving more noise than help):
1297     # -Wbad-function-cast - warns when casting a function to a new return type
1298     # -Wconversion - complained when char's or short's were used a function args
1299     # -Wshadow - removed because it generates more noise than help --pete
1300     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1301     if test "$CPU_ARCH" != "ia64" && test "$CPU_ARCH" != "sparc" \
1302        && test -z "$INTEL_CC"; then
1303         # don't use -Wcast-align on ia64 or sparc, it's noisy on those platforms
1304         # icc doesn't support this flag.
1305         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1306     fi
1308     dnl Turn pedantic on but disable the warnings for long long
1309     _PEDANTIC=1
1311     if test -z "$INTEL_CC"; then
1312       _IGNORE_LONG_LONG_WARNINGS=1
1313       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1314     else
1315       _IGNORE_LONG_LONG_WARNINGS=
1316     fi
1319     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1320     _USE_CPP_INCLUDE_FLAG=1
1321 else
1322     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1323     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1325     DSO_LDOPTS='-shared'
1326     if test "$GNU_LD"; then
1327         # Don't allow undefined symbols in libraries
1328         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1329     fi
1331     DSO_CFLAGS=''
1332     DSO_PIC_CFLAGS='-KPIC'
1333     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1336 if test "$GNU_CXX"; then
1337     # FIXME: Let us build with strict aliasing. bug 414641.
1338     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1339     # Turn on GNU specific features
1340     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1341     if test "$CPU_ARCH" != "ia64" && test "$CPU_ARCH" != "sparc" \
1342        && test -z "$INTEL_CC"; then
1343         # don't use -Wcast-align on ia64 or sparc, it's noisy on those platforms
1344         # icc doesn't support this flag.
1345         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1346     fi
1348     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1349     _USE_CPP_INCLUDE_FLAG=1
1350 else
1351     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1354 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1355 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1356 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1357 dnl normal behavior.
1358 dnl ========================================================
1359 MKSHLIB_FORCE_ALL=
1360 MKSHLIB_UNFORCE_ALL=
1362 if test "$COMPILE_ENVIRONMENT"; then
1363 if test "$GNU_CC"; then
1364   AC_MSG_CHECKING(whether ld has archive extraction flags)
1365   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1366    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1367     ac_cv_mkshlib_force_and_unforce="no"
1368     exec 3<&0 <<LOOP_INPUT
1369         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1370         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1371         force="-Wl,-all";              unforce="-Wl,-none"
1372 LOOP_INPUT
1373     while read line
1374     do
1375       eval $line
1376       LDFLAGS=$force
1377       LIBS=$unforce
1378       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1379     done
1380     exec 0<&3 3<&-
1381     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1382    ])
1383   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1384     AC_MSG_RESULT(no)
1385   else
1386     AC_MSG_RESULT(yes)
1387     eval $ac_cv_mkshlib_force_and_unforce
1388     MKSHLIB_FORCE_ALL=$force
1389     MKSHLIB_UNFORCE_ALL=$unforce
1390   fi
1391 fi # GNU_CC
1392 fi # COMPILE_ENVIRONMENT
1394 dnl =================================================================
1395 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1396 dnl which is bad when cross compiling.
1397 dnl =================================================================
1398 if test "$COMPILE_ENVIRONMENT"; then
1399 configure_static_assert_macros='
1400 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1401 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1402 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1405 dnl test that the macros actually work:
1406 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1407 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1408  [AC_LANG_SAVE
1409   AC_LANG_C
1410   ac_cv_static_assertion_macros_work="yes"
1411   AC_TRY_COMPILE([$configure_static_assert_macros],
1412                  [CONFIGURE_STATIC_ASSERT(1)],
1413                  ,
1414                  ac_cv_static_assertion_macros_work="no")
1415   AC_TRY_COMPILE([$configure_static_assert_macros],
1416                  [CONFIGURE_STATIC_ASSERT(0)],
1417                  ac_cv_static_assertion_macros_work="no",
1418                  )
1419   AC_LANG_CPLUSPLUS
1420   AC_TRY_COMPILE([$configure_static_assert_macros],
1421                  [CONFIGURE_STATIC_ASSERT(1)],
1422                  ,
1423                  ac_cv_static_assertion_macros_work="no")
1424   AC_TRY_COMPILE([$configure_static_assert_macros],
1425                  [CONFIGURE_STATIC_ASSERT(0)],
1426                  ac_cv_static_assertion_macros_work="no",
1427                  )
1428   AC_LANG_RESTORE
1429  ])
1430 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1431 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1432     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1435 fi # COMPILE_ENVIRONMENT
1437 dnl ========================================================
1438 dnl Checking for 64-bit OS
1439 dnl ========================================================
1440 if test "$COMPILE_ENVIRONMENT"; then
1441 AC_LANG_SAVE
1442 AC_LANG_C
1443 AC_MSG_CHECKING(for 64-bit OS)
1444 AC_TRY_COMPILE([$configure_static_assert_macros],
1445                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1446                result="yes", result="no")
1447 AC_MSG_RESULT("$result")
1448 if test "$result" = "yes"; then
1449     AC_DEFINE(HAVE_64BIT_OS)
1450     HAVE_64BIT_OS=1
1452 AC_SUBST(HAVE_64BIT_OS)
1453 AC_LANG_RESTORE
1454 fi # COMPILE_ENVIRONMENT
1456 dnl ========================================================
1457 dnl Enable high-memory support on OS/2 by default.
1458 dnl ========================================================
1459 MOZ_OS2_HIGH_MEMORY=1
1460 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1461 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1462     MOZ_OS2_HIGH_MEMORY=,
1463     MOZ_OS2_HIGH_MEMORY=1 )
1464 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1466 dnl ========================================================
1467 dnl System overrides of the defaults for host
1468 dnl ========================================================
1469 case "$host" in
1470 *-beos*)
1471     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1472     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1473     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1474     ;;
1476 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1477     if test -n "$_WIN32_MSVC"; then
1478         HOST_AR=lib
1479         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1480         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1481         HOST_RANLIB='echo ranlib'
1482     else
1483         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1484     fi
1485     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1486     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1487     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1488     HOST_BIN_SUFFIX=.exe
1489     case "$host" in
1490     *mingw*)
1491     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1492         ;;
1493     *)
1494         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1495         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1496             _pwd=`pwd`
1497             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1498         fi
1499         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1500             AS_PERL=1
1501             PERL="${CYGWIN_WRAPPER} $PERL"
1502         fi
1504         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1505             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1506         fi
1507         ;;
1508     esac
1509     ;;
1511 *-darwin*)
1512     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1513     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1514     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1515     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1516     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1517     ;;
1519 *-linux*|*-kfreebsd*-gnu)
1520     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1521     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1522     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1523     ;;
1525 *os2*)
1526     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1527     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1528     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1529     HOST_BIN_SUFFIX=.exe
1530     MOZ_FIX_LINK_PATHS=
1531     ;;
1533 *-osf*)
1534     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1535     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1536     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1537     ;;
1540     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1541     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1542     ;;
1543 esac
1545 dnl Get mozilla version from central milestone file
1546 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1548 dnl Get version of various core apps from the version files.
1549 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1550 THUNDERBIRD_VERSION=`cat $topsrcdir/mail/config/version.txt`
1551 SUNBIRD_VERSION=`cat $topsrcdir/calendar/sunbird/config/version.txt`
1552 SEAMONKEY_VERSION=`cat $topsrcdir/suite/config/version.txt`
1554 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1555 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1557 dnl ========================================================
1558 dnl System overrides of the defaults for target
1559 dnl ========================================================
1561 case "$target" in
1562 *-aix*)
1563     AC_DEFINE(AIX)
1564     if test ! "$GNU_CC"; then
1565         if test ! "$HAVE_64BIT_OS"; then
1566             # Compiling with Visual Age C++ object model compat is the
1567             # default. To compile with object model ibm, add 
1568             # AIX_OBJMODEL=ibm to .mozconfig.
1569             if test "$AIX_OBJMODEL" = "ibm"; then
1570                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1571             else
1572                 AIX_OBJMODEL=compat
1573             fi
1574         else
1575             AIX_OBJMODEL=compat
1576         fi
1577         AC_SUBST(AIX_OBJMODEL)
1578         DSO_LDOPTS='-qmkshrobj=1'
1579         DSO_CFLAGS='-qflag=w:w'
1580         DSO_PIC_CFLAGS=
1581         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1582         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1583         MOZ_FIX_LINK_PATHS=
1584         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1585         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1586         if test "$COMPILE_ENVIRONMENT"; then
1587             AC_LANG_SAVE
1588             AC_LANG_CPLUSPLUS
1589             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
1590             AC_TRY_COMPILE([],
1591                 [#if (__IBMCPP__ < 502)
1592                  #error "Bad compiler"
1593                  #endif],
1594                 _BAD_COMPILER=,_BAD_COMPILER=1)
1595             if test -n "$_BAD_COMPILER"; then
1596                 AC_MSG_RESULT([no])    
1597                 AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
1598             else
1599                 AC_MSG_RESULT([yes])    
1600             fi
1601             AC_LANG_RESTORE
1602             TARGET_COMPILER_ABI="ibmc"
1603             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1604             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1605         fi
1606     fi
1607     case "${target_os}" in
1608     aix4.1*)
1609         DLL_SUFFIX='_shr.a'
1610         ;;
1611     esac
1612     if test "$COMPILE_ENVIRONMENT"; then
1613         AC_CHECK_HEADERS(sys/inttypes.h)
1614     fi
1615     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1616     ;;
1618 *-beos*)
1619     no_x=yes
1620     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1621     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1622     DSO_LDOPTS='-nostart'
1623     TK_LIBS='-lbe -lroot'
1624     LIBS="$LIBS -lbe"
1625     if test "$COMPILE_ENVIRONMENT"; then
1626         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1627         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1628     fi
1629     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1630     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1631     _MOZ_USE_RTTI=1
1632     USE_DEPENDENT_LIBS=
1633     MOZ_USER_DIR="Mozilla"
1634     ;;
1636 *-bsdi*)
1637     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1638     _PEDANTIC=
1639     _IGNORE_LONG_LONG_WARNINGS=
1640     case $OS_RELEASE in
1641         4.*|5.*)
1642             STRIP="$STRIP -d"
1643             ;;
1644         *)
1645             DSO_CFLAGS=''
1646             DSO_LDOPTS='-r'
1647             _WARNINGS_CFLAGS="-Wall"
1648             _WARNINGS_CXXFLAGS="-Wall"
1649             # The test above doesn't work properly, at least on 3.1.
1650             MKSHLIB_FORCE_ALL=''
1651             MKSHLIB_UNFORCE_ALL=''
1652         ;;
1653     esac
1654     ;;
1656 *-darwin*) 
1657     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1658     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1659     MOZ_OPTIMIZE_FLAGS="-O2"
1660     _PEDANTIC=
1661     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1662     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1663     DLL_SUFFIX=".dylib"
1664     DSO_LDOPTS=''
1665     STRIP="$STRIP -x -S"
1666     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1667     MOZ_ENABLE_POSTSCRIPT=
1668     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1669     LDFLAGS="$LDFLAGS -framework Cocoa"
1670     # The ExceptionHandling framework is needed for Objective-C exception
1671     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1672     # builds.
1673     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1674     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1675     MACOSX=1
1677     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1678     dnl ===================================================================
1679     if test "x$enable_dtrace" = "xyes"; then
1680         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1681     else
1682         dnl check for the presence of the -dead_strip linker flag
1683         AC_MSG_CHECKING([for -dead_strip option to ld])
1684         _SAVE_LDFLAGS=$LDFLAGS
1685         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1686         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1687         if test -n "$_HAVE_DEAD_STRIP" ; then
1688             AC_MSG_RESULT([yes])
1689             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1690         else
1691             AC_MSG_RESULT([no])
1692         fi
1693         
1694         LDFLAGS=$_SAVE_LDFLAGS
1695     fi
1696     ;;
1698 *-freebsd*)
1699     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
1700         DLL_SUFFIX=".so.1.0"
1701         DSO_LDOPTS="-shared"
1702     fi
1703     if test ! "$GNU_CC"; then
1704         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1705     fi
1706 # Can't have force w/o an unforce.
1707 #    # Hack for FreeBSD 2.2
1708 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1709 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1710 #       MKSHLIB_UNFORCE_ALL=''
1711 #    fi
1712     ;; 
1714 *-hpux*)
1715     DLL_SUFFIX=".sl"
1716     if test ! "$GNU_CC"; then
1717         DSO_LDOPTS='-b -Wl,+s'
1718         DSO_CFLAGS=""
1719         DSO_PIC_CFLAGS="+Z"
1720         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1721         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1722         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1723     else
1724         DSO_LDOPTS='-b -E +s'
1725         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1726         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1727     fi
1728     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1729     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1730     ;;
1732 *-irix5*)
1733     AC_DEFINE(IRIX)
1734     DSO_LDOPTS='-elf -shared'
1736     if test "$GNU_CC"; then
1737        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1738        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1739        MKSHLIB_FORCE_ALL='-Wl,-all'
1740        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1741        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1742     else
1743        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1744        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1745        MKSHLIB_FORCE_ALL='-all'
1746        MKSHLIB_UNFORCE_ALL='-none'
1747     fi
1748     ;;
1750 *-irix6*)
1751     AC_DEFINE(IRIX)
1752     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1753     dnl compile and link using -n32
1754     USE_N32=1
1755     TARGET_COMPILER_ABI=n32
1756     DSO_LDOPTS='-elf -shared'
1757     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1758     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1759     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1760     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1761     if test "$GNU_CC"; then
1762        MKSHLIB_FORCE_ALL='-Wl,-all'
1763        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1764        _WARNINGS_CFLAGS="-Wall"
1765        _WARNINGS_CXXFLAGS="-Wall"
1766        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1767     else
1768        MKSHLIB_FORCE_ALL='-all'
1769        MKSHLIB_UNFORCE_ALL='-none'
1770            AR_LIST="$AR t"
1771            AR_EXTRACT="$AR x"
1772            AR_DELETE="$AR d"
1773            AR='$(CXX) -ar'
1774            AR_FLAGS='-o $@'
1775        CFLAGS="$CFLAGS -woff 3262 -G 4"
1776        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1777        if test -n "$USE_N32"; then
1778            ASFLAGS="$ASFLAGS -n32"
1779            CFLAGS="$CFLAGS -n32"
1780            CXXFLAGS="$CXXFLAGS -n32"
1781            LDFLAGS="$LDFLAGS -n32"
1782        fi
1783        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1784        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1785        MOZ_FIX_LINK_PATHS=
1786     fi
1787     if test -z "$GNU_CXX"; then
1788       MIPSPRO_CXX=1
1789     fi
1790     ;;
1792 *-*linux*)
1793     if test "$GNU_CC"; then
1794         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1795         case $GCC_VERSION in
1796         4.1.*|4.2.*)
1797             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1798             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1799         esac
1800     fi
1802     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1803     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1804     MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1805                                       # and that combo is not yet good at
1806                                       # debugging inlined functions (even
1807                                       # when using DWARF2 as the debugging
1808                                       # format)    
1810     MOZ_MEMORY=1
1812     case "${target_cpu}" in
1813     alpha*)
1814         CFLAGS="$CFLAGS -mieee"
1815         CXXFLAGS="$CXXFLAGS -mieee"
1816     ;;
1817     i*86)
1818         USE_ELF_DYNSTR_GC=1
1819         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1820     ;;
1821     mips*)
1822         CFLAGS="$CFLAGS -Wa,-xgot"
1823         CXXFLAGS="$CXXFLAGS -Wa,-xgot"
1824     ;;
1825     esac
1826     ;;
1828 *-wince*)
1830     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1831     AR_LIST="$AR -list"
1832     AR_EXTRACT="$AR -extract"
1833     AR_DELETE="$AR d"
1834     AR_FLAGS='-OUT:"$@"'
1836     DSO_CFLAGS=
1837     DSO_PIC_CFLAGS=
1838     DLL_SUFFIX=.dll
1839     BIN_SUFFIX='.exe'
1840     RC=rc.exe
1841     # certain versions of cygwin's makedepend barf on the 
1842     # #include <string> vs -I./dist/include/string issue so don't use it
1843     SYSTEM_MAKEDEPEND=
1845     HOST_CC=cl
1846     HOST_CXX=cl
1847     HOST_LD=link
1848     HOST_AR='lib -OUT:$@'
1849     HOST_RANLIB='echo ranlib'
1850     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1851         
1852         
1853     WARNINGS_AS_ERRORS='-WX'
1854         MOZ_OPTIMIZE_FLAGS='-O1'
1855     AR_FLAGS='-NOLOGO -OUT:"$@"'
1856     ASM_SUFFIX=asm
1857     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1858     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1859     DLL_PREFIX=
1860     DOXYGEN=:
1861     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1862     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1863     GARBAGE=
1864     IMPORT_LIB_SUFFIX=lib
1865     LIBS="$LIBS"
1866     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1867     LIB_PREFIX=
1868     LIB_SUFFIX=lib 
1869     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1870     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1871     MKSHLIB_FORCE_ALL=
1872     MKSHLIB_UNFORCE_ALL=
1873     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1874     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1875     MOZ_DEBUG_FLAGS='-Zi'
1876     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1877     MOZ_FIX_LINK_PATHS=
1878     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1879     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1880     OBJ_SUFFIX=obj
1881     RANLIB='echo not_ranlib'
1882     STRIP='echo not_strip'
1883     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1884     UNZIP=unzip
1885     XARGS=xargs
1886     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1887     ZIP=zip
1888     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1889     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1890     STATIC_LIBIDL=1
1892     AC_DEFINE(HAVE_SNPRINTF)
1893     AC_DEFINE(_WINDOWS)
1894     AC_DEFINE(_WIN32)
1895     AC_DEFINE(WIN32)
1896     AC_DEFINE(XP_WIN)
1897     AC_DEFINE(XP_WIN32)
1898     AC_DEFINE(HW_THREADS)
1899     AC_DEFINE(STDC_HEADERS)
1900     AC_DEFINE(NEW_H, <new>)
1901     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1903     TARGET_MD_ARCH=win32
1904     _PLATFORM_DEFAULT_TOOLKIT='windows'
1905     BIN_SUFFIX='.exe'
1906     USE_SHORT_LIBNAME=1
1907     MOZ_ENABLE_POSTSCRIPT=
1908     MOZ_USER_DIR="Mozilla"
1912 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1913     DSO_CFLAGS=
1914     DSO_PIC_CFLAGS=
1915     DLL_SUFFIX=.dll
1916     RC=rc.exe
1917     # certain versions of cygwin's makedepend barf on the 
1918     # #include <string> vs -I./dist/include/string issue so don't use it
1919     SYSTEM_MAKEDEPEND=
1920     if test -n "$GNU_CC"; then
1921         CC="$CC -mno-cygwin"
1922         CXX="$CXX -mno-cygwin"
1923         CPP="$CPP -mno-cygwin"
1924         CFLAGS="$CFLAGS -mms-bitfields"
1925         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1926         DSO_LDOPTS='-shared'
1927         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1928         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1929         RC='$(WINDRES)'
1930         # Use temp file for windres (bug 213281)
1931         RCFLAGS='-O coff --use-temp-file'
1932         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1933         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1934         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1935         MOZ_FIX_LINK_PATHS=
1936         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1937         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1938         DLL_PREFIX=
1939         IMPORT_LIB_SUFFIX=dll.a
1940     else
1941         TARGET_COMPILER_ABI=msvc
1942         HOST_CC='$(CC)'
1943         HOST_CXX='$(CXX)'
1944         HOST_LD='$(LD)'
1945         AR='lib -NOLOGO -OUT:"$@"'
1946         AR_FLAGS=
1947         RANLIB='echo not_ranlib'
1948         STRIP='echo not_strip'
1949         XARGS=xargs
1950         ZIP=zip
1951         UNZIP=unzip
1952         DOXYGEN=:
1953         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1954         OBJ_SUFFIX=obj
1955         LIB_SUFFIX=lib
1956         DLL_PREFIX=
1957         LIB_PREFIX=
1958         IMPORT_LIB_SUFFIX=lib
1959         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1960         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1961         MKSHLIB_FORCE_ALL=
1962         MKSHLIB_UNFORCE_ALL=
1963         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1964         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1965         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1966         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1967         MOZ_DEBUG_FLAGS='-Zi'
1968         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1969         WARNINGS_AS_ERRORS='-WX'
1970         MOZ_OPTIMIZE_FLAGS='-O1'
1971         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1972         MOZ_FIX_LINK_PATHS=
1973         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1974         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1975         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1976         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1977         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1978         if test $_MSC_VER -ge 1400; then
1979             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
1980             dnl For profile-guided optimization
1981             PROFILE_GEN_CFLAGS="-GL"
1982             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1983             dnl XXX: PGO builds can fail with warnings treated as errors,
1984             dnl specifically "no profile data available" appears to be
1985             dnl treated as an error sometimes. This might be a consequence
1986             dnl of using WARNINGS_AS_ERRORS in some modules, combined
1987             dnl with the linker doing most of the work in the whole-program
1988             dnl optimization/PGO case. I think it's probably a compiler bug,
1989             dnl but we work around it here.
1990             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1991             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1992             dnl Probably also a compiler bug, but what can you do?
1993             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1994             if test -n "$_USE_DYNAMICBASE"; then
1995                LDFLAGS="$LDFLAGS -DYNAMICBASE"
1996             fi
1997         fi
1998     fi
1999     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2000     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2001     AC_DEFINE(HAVE_SNPRINTF)
2002     AC_DEFINE(_WINDOWS)
2003     AC_DEFINE(_WIN32)
2004     AC_DEFINE(WIN32)
2005     AC_DEFINE(XP_WIN)
2006     AC_DEFINE(XP_WIN32)
2007     AC_DEFINE(HW_THREADS)
2008     AC_DEFINE(STDC_HEADERS)
2009     AC_DEFINE(NEW_H, <new>)
2010     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2011     TARGET_MD_ARCH=win32
2012     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2013     BIN_SUFFIX='.exe'
2014     USE_SHORT_LIBNAME=1
2015     MOZ_ENABLE_POSTSCRIPT=
2016     MOZ_USER_DIR="Mozilla"
2018     dnl Hardcode to win95 for now - cls
2019     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2021     dnl set NO_X11 defines here as the general check is skipped on win32
2022     no_x=yes
2023     AC_DEFINE(NO_X11)
2025     dnl MinGW/MSYS doesn't provide or need cygpath
2026     case "$host" in
2027     *-mingw*)
2028         CYGPATH_W=echo
2029         CYGPATH_S=cat
2030         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2031         ;;
2032     *-cygwin*|*-msvc*|*-mks*)
2033         CYGPATH_W="cygpath -a -w"
2034         CYGPATH_S="sed -e s|\\\\|/|g"
2035         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2036         ;;
2037     esac
2038     case "$host" in
2039     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2041     if test -z "$MOZ_TOOLS"; then
2042         AC_MSG_ERROR([MOZ_TOOLS is not set])
2043     fi
2045     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2046     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2047         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2048     fi
2049     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2050         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2051     fi
2052     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2054     if test -n "$GLIB_PREFIX"; then
2055         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2056         if test "$?" = "0"; then
2057             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2058                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2059             fi
2060             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2061         else
2062             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2063         fi
2064     else
2065         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2066     fi
2067     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2068         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2069     fi
2070     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2071     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2072         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2073     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2074         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2075     else
2076         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2077     fi
2079     if test -n "$LIBIDL_PREFIX"; then
2080         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2081         if test "$?" = "0"; then
2082             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2083                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2084             fi
2085             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2086         else
2087             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2088         fi
2089     else
2090         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2091     fi        
2092     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2093         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2094     fi
2095     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2096     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2097         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2098         STATIC_LIBIDL=1
2099     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2100         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2101     else
2102         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2103     fi
2104     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2105     ;;
2107     *) # else cross-compiling
2108         if test -n "$GLIB_PREFIX"; then
2109             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2110             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2111                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2112             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2113                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2114             else
2115                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2116             fi
2117         fi
2118         if test -n "$LIBIDL_PREFIX"; then
2119             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2120             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2121                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2122                 STATIC_LIBIDL=1
2123             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2124                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2125             else
2126                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2127             fi
2128         fi
2129         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2130         ;;
2131     esac 
2134     case "$host_os" in
2135     cygwin*|msvc*|mks*)
2136         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])
2137         ;;
2139     *)
2140         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2142         AC_LANG_SAVE
2143         AC_LANG_CPLUSPLUS
2144         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2145         AC_LANG_RESTORE
2146         ;;
2147     esac
2149     case "$target" in
2150     i*86-*)
2151         AC_DEFINE(_X86_)
2152         ;;
2153     alpha-*)
2154         AC_DEFINE(_ALPHA_)
2155         ;;
2156     mips-*)
2157         AC_DEFINE(_MIPS_)
2158         ;;
2159     *)
2160         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2161         ;;
2162     esac
2163     ;;
2165 *-netbsd*)
2166     DSO_CFLAGS=''
2167     CFLAGS="$CFLAGS -Dunix"
2168     CXXFLAGS="$CXXFLAGS -Dunix"
2169     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2170         DLL_SUFFIX=".so"
2171         DSO_PIC_CFLAGS='-fPIC -DPIC'
2172         DSO_LDOPTS='-shared'
2173         BIN_FLAGS='-Wl,--export-dynamic'
2174     else
2175         DSO_PIC_CFLAGS='-fPIC -DPIC'
2176         DLL_SUFFIX=".so.1.0"
2177         DSO_LDOPTS='-shared'
2178     fi
2179     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2180     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2181     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2182     if test "$LIBRUNPATH"; then
2183         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2184     fi
2185     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2186     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2187     ;;
2189 *-nto*) 
2190         AC_DEFINE(NTO)  
2191         AC_DEFINE(_QNX_SOURCE)
2192         AC_DEFINE(_i386)
2193         OS_TARGET=NTO
2194         WARNINGS_AS_ERRORS=''
2195         MOZ_OPTIMIZE_FLAGS="-O"
2196         MOZ_DEBUG_FLAGS="-gstabs"
2197         USE_PTHREADS=1
2198         _PEDANTIC=
2199         LIBS="$LIBS -lsocket -lstdc++"
2200         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2201         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2202         if test "$with_x" != "yes"
2203         then
2204                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2205             TK_CFLAGS='-I/usr/include/photon'
2206                 TK_LIBS='-lph'
2207         fi
2208         case "${target_cpu}" in
2209         ppc*)
2210         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2211         ;;
2212         esac
2213         case "${host_cpu}" in
2214         i*86)
2215         USE_ELF_DYNSTR_GC=1
2216         ;;
2217         esac
2218         ;;
2220 *-openbsd*)
2221     DLL_SUFFIX=".so.1.0"
2222     DSO_CFLAGS=''
2223     DSO_PIC_CFLAGS='-fPIC'
2224     DSO_LDOPTS='-shared -fPIC'
2225     if test "$LIBRUNPATH"; then
2226         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2227     fi
2228     ;;
2230 *-openvms*) 
2231     AC_DEFINE(NO_PW_GECOS)
2232     AC_DEFINE(NO_UDSOCK)
2233     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2234     USE_PTHREADS=1
2235     MKSHLIB_FORCE_ALL='-all'
2236     MKSHLIB_UNFORCE_ALL='-none'
2237     AS='as'
2238     AS_DASH_C_FLAG='-Wc/names=as_is'
2239     AR_FLAGS='c $@'
2240     DSO_LDOPTS='-shared -auto_symvec'
2241     DSO_PIC_CFLAGS=
2242     MOZ_DEBUG_LDFLAGS='-g'
2243     COMPAQ_CXX=1
2244     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2245     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2246     ;;
2249 *-os2*)
2250     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2251     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2252     AC_DEFINE(XP_OS2)
2253     USE_SHORT_LIBNAME=1
2254     DLL_PREFIX=
2255     LIB_PREFIX=
2256     LIB_SUFFIX=lib
2257     BIN_SUFFIX=".exe"
2258     DLL_SUFFIX=".dll"
2259     IMPORT_LIB_SUFFIX=lib
2260     DSO_PIC_CFLAGS=
2261     TARGET_MD_ARCH=os2
2262     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2263     MOZ_ENABLE_POSTSCRIPT=
2264     RC=rc.exe
2265     RCFLAGS='-n'
2266     MOZ_USER_DIR="Mozilla"
2268     if test "$MOZTOOLS"; then
2269         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2270     else
2271         AC_MSG_ERROR([MOZTOOLS is not set])
2272     fi
2274     # EMX/GCC build
2275     if test -n "$GNU_CC"; then
2276         AC_DEFINE(OS2)
2277         AC_DEFINE(XP_OS2_EMX)
2278         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2279         AC_DEFINE(TCPV40HDRS)
2280         AR=emxomfar
2281         AR_FLAGS='r $@'
2282         CFLAGS="$CFLAGS -Zomf"
2283         CXXFLAGS="$CXXFLAGS -Zomf"
2284         DSO_LDOPTS='-Zdll'
2285         BIN_FLAGS='-Zlinker /ST:0x100000'
2286         IMPLIB='emximp -o'
2287         FILTER='emxexp -o'
2288         LDFLAGS='-Zmap'
2289         WARNINGS_AS_ERRORS='-Werror'
2290         MOZ_DEBUG_FLAGS="-g -fno-inline"
2291         MOZ_OPTIMIZE_FLAGS="-O2"
2292         MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2293         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2294         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2295         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2296         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2297           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2298           LDFLAGS="$LDFLAGS -Zhigh-mem"
2299           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2300           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2301         fi
2303         # GCC for OS/2 currently predefines these, but we don't want them
2304         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2305         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2307         AC_CACHE_CHECK(for __declspec(dllexport),
2308            ac_os2_declspec,
2309            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2310                            [return 0;],
2311                            ac_os2_declspec="yes",
2312                            ac_os2_declspec="no")])
2313         if test "$ac_os2_declspec" = "yes"; then
2314            FILTER='true'
2315            MOZ_OS2_USE_DECLSPEC='1'
2316         fi
2317         
2318     # Visual Age C++ build
2319     elif test "$VACPP" = "yes"; then
2320         MOZ_BUILD_ROOT=`pwd -D`
2321         OBJ_SUFFIX=obj
2322         AR=-ilib
2323         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2324         AR_LIST='/L'
2325         AR_EXTRACT='-*'
2326         AR_DELETE='-'
2327         AS=alp
2328         ASFLAGS='-Mb'
2329         AS_DASH_C_FLAG=''
2330         ASM_SUFFIX=asm
2331         LD='-ilink'
2332         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2333         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2334         MOZ_DEBUG_FLAGS="/Ti+"
2335         WARNINGS_AS_ERRORS='-WX'
2336         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2337         LDFLAGS="/NOL /M"
2338         MOZ_DEBUG_LDFLAGS="/DE"
2339         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2340         DSO_LDOPTS=''
2341         DSO_PIC_CFLAGS=
2342         IMPLIB='implib /NOL /NOI'
2343         FILTER='cppfilt -q -B -P'
2344         AC_DEFINE(NO_ANSI_KEYWORDS)
2345         AC_DEFINE(OS2,4)
2346         AC_DEFINE(_X86_)
2347         AC_DEFINE(XP_OS2_VACPP)
2348         AC_DEFINE(TCPV40HDRS)
2349         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2350         AC_DEFINE(STDC_HEADERS)
2351         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2352         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2353         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2354         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2355         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2356         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2357         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2358     fi
2359     ;;
2361 alpha*-*-osf*)
2362     if test "$GNU_CC"; then
2363       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2364       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2366     else
2367         MOZ_DEBUG_FLAGS='-g'
2368         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2369         CFLAGS="$CFLAGS -ieee"
2370         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2371         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2372         DSO_CFLAGS=
2373         DSO_PIC_CFLAGS=
2374         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2375         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2376         MKSHLIB_FORCE_ALL='-all'
2377         MKSHLIB_UNFORCE_ALL='-none'
2378         dnl Might fix the libxpcom.so breakage on this platform as well....
2379         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2380         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2381     fi
2382     if test -z "$GNU_CXX"; then
2383       COMPAQ_CXX=1
2384     fi
2385     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2386     ;;
2388 *-qnx*) 
2389     DIRENT_INO=d_stat.st_ino
2390     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2391     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2392     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2393     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2394     AC_DEFINE(STDC_HEADERS)
2395     if test "$no_x" = "yes"; then
2396             _PLATFORM_DEFAULT_TOOLKIT='photon'
2397             TK_CFLAGS='-I/usr/nto/include/photon'
2398             TK_LIBS='-lphoton -lphrender'
2399     fi
2400     ;;
2402 *-sco*) 
2403     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2404     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2405     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2406     if test ! "$GNU_CC"; then
2407        DSO_LDOPTS='-G'
2408     fi
2409     ;;
2411 dnl the qsort routine under solaris is faulty
2412 *-solaris*) 
2413     AC_DEFINE(SOLARIS)
2414     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2415     SYSTEM_MAKEDEPEND=
2416     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2417     # libraries one level up (e.g. libnspr4.so)
2418     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2419     MOZ_MEMORY=1
2420     if test -z "$GNU_CC"; then
2421        NS_USE_NATIVE=1
2422        MOZ_FIX_LINK_PATHS='-R $(LIBXUL_DIST)/bin'
2423        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2425        if test "$CPU_ARCH" != "sparc"; then
2426           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2427           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2428        else
2429           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2430           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2431           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2432        fi
2434        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2435        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2436            _SAVE_LDFLAGS=$LDFLAGS
2437            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2438            AC_TRY_LINK([#include <stdio.h>],
2439                        [printf("Hello World\n");],
2440                        ,
2441                        [LDFLAGS=$_SAVE_LDFLAGS])
2442        fi
2443        WARNINGS_AS_ERRORS='-Werror'
2444        MOZ_OPTIMIZE_FLAGS="-xO4"
2445        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2446        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2447        MKSHLIB_FORCE_ALL='-z allextract'
2448        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2449        DSO_LDOPTS='-G -z muldefs'
2450        AR_LIST="$AR t"
2451        AR_EXTRACT="$AR x"
2452        AR_DELETE="$AR d"
2453        AR='$(CXX) -xar'
2454        AR_FLAGS='-o $@'
2455        AS='/usr/ccs/bin/as'
2456        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2457        AS_DASH_C_FLAG=''
2458        TARGET_COMPILER_ABI="sunc"
2459         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2460         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2461        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2462        AC_LANG_SAVE
2463        AC_LANG_CPLUSPLUS
2464        AC_TRY_COMPILE([],
2465            [#if (__SUNPRO_CC < 0x530)
2466            #error "Denied"
2467            #endif],
2468            _BAD_COMPILER=,_BAD_COMPILER=1)
2469         if test -n "$_BAD_COMPILER"; then
2470             _res="no"
2471             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2472         else
2473             _res="yes"
2474         fi
2475         AC_MSG_RESULT([$_res])
2476         AC_LANG_RESTORE
2477     else
2478        ASFLAGS="$ASFLAGS -fPIC"
2479        DSO_LDOPTS='-G'
2480        _WARNINGS_CFLAGS=''
2481        _WARNINGS_CXXFLAGS=''
2482        if test "$OS_RELEASE" = "5.3"; then
2483           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2484        fi
2485     fi
2486     if test "$OS_RELEASE" = "5.5.1"; then
2487        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2488     fi
2489     ;;
2491 *-sunos*) 
2492     DSO_LDOPTS='-Bdynamic'
2493     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2494     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2495     AC_DEFINE(SUNOS4)
2496     AC_DEFINE(SPRINTF_RETURNS_STRING)
2497     case "$(target_os)" in
2498     sunos4.1*)
2499         DLL_SUFFIX='.so.1.0'
2500         ;;
2501     esac
2502     ;;
2504 *-sysv4.2uw7*) 
2505         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2506     ;;
2508 *-os2*)
2509     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2510     ;;
2512 esac
2514 dnl Only one oddball right now (QNX), but this gives us flexibility
2515 dnl if any other platforms need to override this in the future.
2516 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2518 dnl ========================================================
2519 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2520 dnl by now will not have any way to link most binaries (tests
2521 dnl as well as viewer, apprunner, etc.), because some symbols
2522 dnl will be left out of the "composite" .so's by ld as unneeded.
2523 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2524 dnl they can link in the static libs that provide the missing
2525 dnl symbols.
2526 dnl ========================================================
2527 NO_LD_ARCHIVE_FLAGS=
2528 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2529     NO_LD_ARCHIVE_FLAGS=1
2531 case "$target" in
2532 *-os2*)
2533     NO_LD_ARCHIVE_FLAGS=
2534     ;;
2535 *-aix4.3*|*-aix5*)
2536     NO_LD_ARCHIVE_FLAGS=
2537     ;;
2538 *-openvms*)
2539     NO_LD_ARCHIVE_FLAGS=
2540     ;;
2541 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2542     if test -z "$GNU_CC"; then
2543         NO_LD_ARCHIVE_FLAGS=
2544     fi
2545     ;;
2546 esac
2547 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2550 dnl Indicate that platform requires special thread safe 
2551 dnl locking when starting up the OJI JVM 
2552 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2553 dnl ========================================================
2554 case "$target" in
2555     *-hpux*)      
2556         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2557         ;;
2558 esac
2560 dnl ========================================================
2561 dnl = Flags to strip unused symbols from .so components
2562 dnl ========================================================
2563 case "$target" in
2564     *-linux*|*-kfreebsd*-gnu)
2565         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2566         ;;
2567     *-solaris*)
2568         if test -z "$GNU_CC"; then
2569          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2570         else
2571          if test -z "$GCC_USE_GNU_LD"; then
2572           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2573          else
2574           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2575          fi
2576         fi
2577         ;;
2578     *-nto*) 
2579         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2580         ;;
2581     *-darwin*)
2582         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2583         ;;
2584     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2585         if test -n "$GNU_CC"; then
2586            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2587         fi
2588         ;;
2589 esac
2591 if test -z "$COMPILE_ENVIRONMENT"; then
2592     SKIP_COMPILER_CHECKS=1
2593     SKIP_LIBRARY_CHECKS=1
2596 if test -z "$SKIP_COMPILER_CHECKS"; then
2597 dnl Checks for typedefs, structures, and compiler characteristics.
2598 dnl ========================================================
2599 AC_LANG_C
2600 AC_HEADER_STDC
2601 AC_C_CONST
2602 AC_TYPE_MODE_T
2603 AC_TYPE_OFF_T
2604 AC_TYPE_PID_T
2605 AC_TYPE_SIZE_T
2606 AC_STRUCT_ST_BLKSIZE
2607 AC_MSG_CHECKING(for siginfo_t)
2608 AC_CACHE_VAL(ac_cv_siginfo_t,
2609  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2610                   #include <signal.h>],
2611                  [siginfo_t* info;],
2612                  [ac_cv_siginfo_t=true],
2613                  [ac_cv_siginfo_t=false])])
2614 if test "$ac_cv_siginfo_t" = true ; then
2615   AC_DEFINE(HAVE_SIGINFO_T)
2616   AC_MSG_RESULT(yes)
2617 else
2618   AC_MSG_RESULT(no)
2621 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2622 dnl  header files.  These defines make Visual Age use the mozilla
2623 dnl  defines types.
2624 if test "$VACPP" = "yes"; then
2625    AC_DEFINE(__size_t)
2626    AC_DEFINE(__off_t)
2629 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2630 dnl ========================================================
2631 AC_MSG_CHECKING(for int16_t)
2632 AC_CACHE_VAL(ac_cv_int16_t,
2633  [AC_TRY_COMPILE([#include <stdio.h>
2634                   #include <sys/types.h>],
2635                  [int16_t foo = 0;],
2636                  [ac_cv_int16_t=true],
2637                  [ac_cv_int16_t=false])])
2638 if test "$ac_cv_int16_t" = true ; then
2639   AC_DEFINE(HAVE_INT16_T)
2640   AC_MSG_RESULT(yes)
2641 else
2642   AC_MSG_RESULT(no)
2644 AC_MSG_CHECKING(for int32_t)
2645 AC_CACHE_VAL(ac_cv_int32_t,
2646  [AC_TRY_COMPILE([#include <stdio.h>
2647                   #include <sys/types.h>],
2648                  [int32_t foo = 0;],
2649                  [ac_cv_int32_t=true],
2650                  [ac_cv_int32_t=false])])
2651 if test "$ac_cv_int32_t" = true ; then
2652   AC_DEFINE(HAVE_INT32_T)
2653   AC_MSG_RESULT(yes)
2654 else
2655   AC_MSG_RESULT(no)
2657 AC_MSG_CHECKING(for int64_t)
2658 AC_CACHE_VAL(ac_cv_int64_t,
2659  [AC_TRY_COMPILE([#include <stdio.h>
2660                   #include <sys/types.h>],
2661                  [int64_t foo = 0;],
2662                  [ac_cv_int64_t=true],
2663                  [ac_cv_int64_t=false])])
2664 if test "$ac_cv_int64_t" = true ; then
2665   AC_DEFINE(HAVE_INT64_T)
2666   AC_MSG_RESULT(yes)
2667 else
2668   AC_MSG_RESULT(no)
2670 AC_MSG_CHECKING(for int64)
2671 AC_CACHE_VAL(ac_cv_int64,
2672  [AC_TRY_COMPILE([#include <stdio.h>
2673                   #include <sys/types.h>],
2674                  [int64 foo = 0;],
2675                  [ac_cv_int64=true],
2676                  [ac_cv_int64=false])])
2677 if test "$ac_cv_int64" = true ; then
2678   AC_DEFINE(HAVE_INT64)
2679   AC_MSG_RESULT(yes)
2680 else
2681   AC_MSG_RESULT(no)
2683 AC_MSG_CHECKING(for uint)
2684 AC_CACHE_VAL(ac_cv_uint,
2685  [AC_TRY_COMPILE([#include <stdio.h>
2686                   #include <sys/types.h>],
2687                  [uint foo = 0;],
2688                  [ac_cv_uint=true],
2689                  [ac_cv_uint=false])])
2690 if test "$ac_cv_uint" = true ; then
2691   AC_DEFINE(HAVE_UINT)
2692   AC_MSG_RESULT(yes)
2693 else
2694   AC_MSG_RESULT(no)
2696 AC_MSG_CHECKING(for uint_t)
2697 AC_CACHE_VAL(ac_cv_uint_t,
2698  [AC_TRY_COMPILE([#include <stdio.h>
2699                   #include <sys/types.h>],
2700                  [uint_t foo = 0;],
2701                  [ac_cv_uint_t=true],
2702                  [ac_cv_uint_t=false])])
2703 if test "$ac_cv_uint_t" = true ; then
2704   AC_DEFINE(HAVE_UINT_T)
2705   AC_MSG_RESULT(yes)
2706 else
2707   AC_MSG_RESULT(no)
2709 AC_MSG_CHECKING(for uint16_t)
2710 AC_CACHE_VAL(ac_cv_uint16_t,
2711  [AC_TRY_COMPILE([#include <stdio.h>
2712                   #include <sys/types.h>],
2713                  [uint16_t foo = 0;],
2714                  [ac_cv_uint16_t=true],
2715                  [ac_cv_uint16_t=false])])
2716 if test "$ac_cv_uint16_t" = true ; then
2717   AC_DEFINE(HAVE_UINT16_T)
2718   AC_MSG_RESULT(yes)
2719 else
2720   AC_MSG_RESULT(no)
2723 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2724 dnl are defined when compiling C++ but not C.  Since the result of this
2725 dnl test is used only in C++, do it in C++.
2726 AC_LANG_CPLUSPLUS
2728 AC_MSG_CHECKING(for uname.domainname)
2729 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2730     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2731         [ struct utsname *res; char *domain; 
2732             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2733         [ac_cv_have_uname_domainname_field=true],
2734         [ac_cv_have_uname_domainname_field=false])])
2736 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2737     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2738     AC_MSG_RESULT(yes)
2739 else
2740     AC_MSG_RESULT(no)
2743 AC_MSG_CHECKING(for uname.__domainname)
2744 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2745     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2746         [ struct utsname *res; char *domain; 
2747             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2748         [ac_cv_have_uname_us_domainname_field=true],
2749         [ac_cv_have_uname_us_domainname_field=false])])
2751 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2752     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2753     AC_MSG_RESULT(yes)
2754 else
2755     AC_MSG_RESULT(no)
2758 AC_LANG_C
2760 dnl Check for usable wchar_t (2 bytes, unsigned)
2761 dnl (we really don't need the unsignedness check anymore)
2762 dnl ========================================================
2764 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2765     ac_cv_have_usable_wchar_v2,
2766     [AC_TRY_COMPILE([#include <stddef.h>
2767                      $configure_static_assert_macros],
2768                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2769                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2770                     ac_cv_have_usable_wchar_v2="yes",
2771                     ac_cv_have_usable_wchar_v2="no")])
2772 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2773     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2774     HAVE_CPP_2BYTE_WCHAR_T=1
2775 else
2776 dnl This is really gcc-only
2777 dnl Do this test using CXX only since some versions of gcc
2778 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2779 dnl only have short-wchar support for c++.
2780 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2782     AC_LANG_SAVE
2783     AC_LANG_CPLUSPLUS
2784     _SAVE_CXXFLAGS=$CXXFLAGS
2785     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2787     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2788         ac_cv_have_usable_wchar_option_v2,
2789         [AC_TRY_LINK([#include <stddef.h>
2790                       $configure_static_assert_macros],
2791                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2792                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2793                      ac_cv_have_usable_wchar_option_v2="yes",
2794                      ac_cv_have_usable_wchar_option_v2="no")])
2796     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2797         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2798         HAVE_CPP_2BYTE_WCHAR_T=1
2799     else    
2800         CXXFLAGS=$_SAVE_CXXFLAGS
2801     fi
2802     AC_LANG_RESTORE
2805 dnl Check for .hidden assembler directive and visibility attribute.
2806 dnl Borrowed from glibc configure.in
2807 dnl ===============================================================
2808 if test "$GNU_CC"; then
2809   AC_CACHE_CHECK(for visibility(hidden) attribute,
2810                  ac_cv_visibility_hidden,
2811                  [cat > conftest.c <<EOF
2812                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2814                   ac_cv_visibility_hidden=no
2815                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2816                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2817                       ac_cv_visibility_hidden=yes
2818                     fi
2819                   fi
2820                   rm -f conftest.[cs]
2821                  ])
2822   if test "$ac_cv_visibility_hidden" = "yes"; then
2823     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2825     AC_CACHE_CHECK(for visibility(default) attribute,
2826                    ac_cv_visibility_default,
2827                    [cat > conftest.c <<EOF
2828                     int foo __attribute__ ((visibility ("default"))) = 1;
2830                     ac_cv_visibility_default=no
2831                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2832                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2833                         ac_cv_visibility_default=yes
2834                       fi
2835                     fi
2836                     rm -f conftest.[cs]
2837                    ])
2838     if test "$ac_cv_visibility_default" = "yes"; then
2839       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2841       AC_CACHE_CHECK(for visibility pragma support,
2842                      ac_cv_visibility_pragma,
2843                      [cat > conftest.c <<EOF
2844 #pragma GCC visibility push(hidden)
2845                       int foo_hidden = 1;
2846 #pragma GCC visibility push(default)
2847                       int foo_default = 1;
2849                       ac_cv_visibility_pragma=no
2850                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2851                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2852                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2853                             ac_cv_visibility_pragma=yes
2854                           fi
2855                         fi
2856                       fi
2857                       rm -f conftest.[cs]
2858                     ])
2859       if test "$ac_cv_visibility_pragma" = "yes"; then
2860         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2861                        ac_cv_have_visibility_class_bug,
2862                        [cat > conftest.c <<EOF
2863 #pragma GCC visibility push(hidden)
2864 struct __attribute__ ((visibility ("default"))) TestStruct {
2865   static void Init();
2867 __attribute__ ((visibility ("default"))) void TestFunc() {
2868   TestStruct::Init();
2871                        ac_cv_have_visibility_class_bug=no
2872                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2873                          ac_cv_have_visibility_class_bug=yes
2874                        else
2875                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2876                            ac_cv_have_visibility_class_bug=yes
2877                          fi
2878                        fi
2879                        rm -rf conftest.{c,S}
2880                        ])
2882         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2883                        ac_cv_have_visibility_builtin_bug,
2884                        [cat > conftest.c <<EOF
2885 #pragma GCC visibility push(hidden)
2886 #pragma GCC visibility push(default)
2887 #include <string.h>
2888 #pragma GCC visibility pop
2890 __attribute__ ((visibility ("default"))) void Func() {
2891   char c[[100]];
2892   memset(c, 0, sizeof(c));
2895                        ac_cv_have_visibility_builtin_bug=no
2896                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2897                          ac_cv_have_visibility_builtin_bug=yes
2898                        else
2899                          if test `grep -c "@PLT" conftest.S` = 0; then
2900                            ac_cv_visibility_builtin_bug=yes
2901                          fi
2902                        fi
2903                        rm -f conftest.{c,S}
2904                        ])
2905         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2906                 "$ac_cv_have_visibility_class_bug" = "no"; then
2907           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2908           WRAP_SYSTEM_INCLUDES=1
2909         else
2910           VISIBILITY_FLAGS='-fvisibility=hidden'
2911         fi # have visibility pragma bug
2912       fi   # have visibility pragma
2913     fi     # have visibility(default) attribute
2914   fi       # have visibility(hidden) attribute
2915 fi         # GNU_CC
2917 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2918 AC_SUBST(VISIBILITY_FLAGS)
2920 dnl Checks for header files.
2921 dnl ========================================================
2922 AC_HEADER_DIRENT
2923 case "$target_os" in
2924 freebsd*)
2925 # for stuff like -lXshm
2926     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2927     ;;
2928 esac
2929 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2930 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2931 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2932 AC_CHECK_HEADERS(malloc.h)
2933 AC_CHECK_HEADERS(X11/XKBlib.h)
2935 dnl These are all the places some variant of statfs can be hiding.
2936 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2938 dnl Try for MMX support
2939 dnl NB - later gcc versions require -mmmx for this header to be successfully
2940 dnl included (or another option which implies it, such as -march=pentium-mmx)
2941 AC_CHECK_HEADERS(mmintrin.h)
2943 dnl Check whether the compiler supports the new-style C++ standard
2944 dnl library headers (i.e. <new>) or needs the old "new.h"
2945 AC_LANG_CPLUSPLUS
2946 NEW_H=new.h
2947 AC_CHECK_HEADER(new, [NEW_H=new])
2948 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2949 AC_LANG_C
2951 AC_ARG_ENABLE(dtrace,
2952               [  --enable-dtrace         build with dtrace support if available (default=no)],
2953               [enable_dtrace="yes"],)
2954 if test "x$enable_dtrace" = "xyes"; then
2955   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2956   if test -n "$HAVE_DTRACE"; then
2957       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2958   else
2959       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2960   fi
2962 AC_SUBST(HAVE_DTRACE)
2964 case $target in
2965 *-aix4.3*|*-aix5*)
2966         ;;
2968         AC_CHECK_HEADERS(sys/cdefs.h)
2969         ;;
2970 esac
2972 dnl Checks for libraries.
2973 dnl ========================================================
2974 case $target in
2975 *-hpux11.*)
2976         ;;
2978         AC_CHECK_LIB(c_r, gethostbyname_r)
2979         ;;
2980 esac
2982 dnl We don't want to link with libdl even if it's present on OS X, since
2983 dnl it's not used and not part of the default installation.
2984 dnl The same goes for BeOS.
2985 dnl We don't want to link against libm or libpthread on Darwin since
2986 dnl they both are just symlinks to libSystem and explicitly linking
2987 dnl against libSystem causes issues when debugging (see bug 299601).
2988 case $target in
2989 *-darwin*)
2990     ;;
2991 *-beos*)
2992     ;;
2994     AC_CHECK_LIB(m, atan)
2995     AC_CHECK_LIB(dl, dlopen,
2996     AC_CHECK_HEADER(dlfcn.h, 
2997         LIBS="-ldl $LIBS"
2998         AC_DEFINE(HAVE_LIBDL)))
2999     ;;
3000 esac
3002 _SAVE_CFLAGS="$CFLAGS"
3003 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3004 AC_CHECK_FUNCS(dladdr)
3005 CFLAGS="$_SAVE_CFLAGS"
3007 if test ! "$GNU_CXX"; then
3009     case $target in
3010     *-aix*)
3011         AC_CHECK_LIB(C_r, demangle)
3012         ;;
3013      *)
3014         AC_CHECK_LIB(C, demangle)
3015         ;;
3016      esac
3018 AC_CHECK_LIB(socket, socket)
3020 XLDFLAGS="$X_LIBS"
3021 XLIBS="$X_EXTRA_LIBS"
3023 dnl ========================================================
3024 dnl Checks for X libraries.
3025 dnl Ordering is important.
3026 dnl Xt is dependent upon SM as of X11R6
3027 dnl ========================================================
3028 if test "$no_x" = "yes"; then
3029     AC_DEFINE(NO_X11)
3030 else
3031     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3032         XLIBS="-lX11 $XLIBS"
3033         _SAVE_LDFLAGS="$LDFLAGS"
3034         LDFLAGS="$XLDFLAGS $LDFLAGS"
3035         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3036                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3037         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3038                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3039    
3040      
3041         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3042         unset ac_cv_lib_Xt_XtFree
3043             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3044             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3045         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3046                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3047         ])
3049     # AIX needs the motif library linked before libXt to prevent
3050     # crashes in plugins linked against Motif - Bug #98892
3051     case "${target_os}" in
3052     aix*)
3053         XT_LIBS="-lXm $XT_LIBS"
3054         ;;
3055     esac
3057     dnl ========================================================
3058     dnl = Check for XShm
3059     dnl ========================================================
3060     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3061         $XLIBS $XEXT_LIBS)
3062     AC_CHECK_HEADER(X11/extensions/XShm.h)
3063     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3064         test -n "$_HAVE_XSHM_XEXT"; then
3065         AC_DEFINE(HAVE_XSHM)
3066     fi
3068     dnl ========================================================
3069     dnl = Check for XIE
3070     dnl ========================================================
3071     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3072         $XLIBS $XEXT_LIBS)
3073     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3075     if test "$MOZ_XIE_LIBS"; then
3076         dnl ====================================================
3077         dnl = If XIE is present and is desired, turn it on
3078         dnl ====================================================
3079         case $target in
3080             *-hpux*)
3081                 ;;
3082             *)
3083                 HAVE_XIE=1
3084                 ;;
3085         esac
3086     fi
3088         LDFLAGS="$_SAVE_LDFLAGS"
3090     dnl ========================================================
3091     dnl = Check for freetype2 and its functionality
3092     dnl ========================================================
3093     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3095     if test "$_HAVE_FREETYPE2"; then
3096         _SAVE_LIBS="$LIBS"
3097         _SAVE_CFLAGS="$CFLAGS"
3098         LIBS="$LIBS $FT2_LIBS"
3099         CFLAGS="$CFLAGS $FT2_CFLAGS"
3101         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3102             ac_cv_member_FT_Bitmap_Size_y_ppem,
3103             [AC_TRY_COMPILE([#include <ft2build.h>
3104                              #include FT_FREETYPE_H],
3105                             [FT_Bitmap_Size s;
3106                              if (sizeof s.y_ppem) return 0;
3107                              return 1],
3108                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3109                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3110         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3111             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3112         else
3113             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3114         fi
3115         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3116                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3117                            [FT_Bitmap_Size structure includes y_ppem field])
3119         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3121         LIBS="$_SAVE_LIBS"
3122         CFLAGS="$_SAVE_CFLAGS"
3123     fi
3125 fi # $no_x
3127 AC_SUBST(XCFLAGS)
3128 AC_SUBST(XLDFLAGS)
3129 AC_SUBST(XLIBS)
3130 AC_SUBST(XT_LIBS)
3132 dnl ========================================================
3133 dnl = pthread support
3134 dnl = Start by checking whether the system support pthreads
3135 dnl ========================================================
3136 case "$target_os" in
3137 darwin*)
3138     USE_PTHREADS=1
3139     ;;
3141     MOZ_CHECK_PTHREADS(pthreads,
3142         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3143         MOZ_CHECK_PTHREADS(pthread,
3144             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3145             MOZ_CHECK_PTHREADS(c_r,
3146                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3147                 MOZ_CHECK_PTHREADS(c,
3148                     USE_PTHREADS=1
3149                 )
3150             )
3151         )
3152     )
3153     ;;
3154 esac
3156 dnl ========================================================
3157 dnl Check the command line for --with-pthreads 
3158 dnl ========================================================
3159 MOZ_ARG_WITH_BOOL(pthreads,
3160 [  --with-pthreads         Force use of system pthread library with NSPR ],
3161 [ if test "$USE_PTHREADS"x = x; then
3162     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3163 fi],
3164     USE_PTHREADS=
3165     _PTHREAD_LDFLAGS=
3168 dnl ========================================================
3169 dnl Do the platform specific pthread hackery
3170 dnl ========================================================
3171 if test "$USE_PTHREADS"x != x
3172 then
3173         dnl
3174         dnl See if -pthread is supported.
3175         dnl
3176         rm -f conftest*
3177         ac_cv_have_dash_pthread=no
3178         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3179         echo 'int main() { return 0; }' | cat > conftest.c
3180         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3181         if test $? -eq 0; then
3182                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3183                         ac_cv_have_dash_pthread=yes
3184                 case "$target_os" in
3185                 freebsd*)
3186 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3187                 ;;
3188                 *)
3189                             CFLAGS="$CFLAGS -pthread"
3190                             CXXFLAGS="$CXXFLAGS -pthread"
3191                 ;;
3192                 esac
3193                 fi
3194         fi
3195         rm -f conftest*
3196     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3198         dnl
3199         dnl See if -pthreads is supported.
3200         dnl
3201     ac_cv_have_dash_pthreads=no
3202     if test "$ac_cv_have_dash_pthread" = "no"; then
3203             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3204         echo 'int main() { return 0; }' | cat > conftest.c
3205             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3206         if test $? -eq 0; then
3207                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3208                             ac_cv_have_dash_pthreads=yes
3209                             CFLAGS="$CFLAGS -pthreads"
3210                             CXXFLAGS="$CXXFLAGS -pthreads"
3211                     fi
3212             fi
3213             rm -f conftest*
3214         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3215     fi
3217         case "$target" in
3218             *-*-freebsd*)
3219                         AC_DEFINE(_REENTRANT)
3220                         AC_DEFINE(_THREAD_SAFE)
3221                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3222                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3223                                 _PTHREAD_LDFLAGS="-pthread"
3224                         else
3225                                 _PTHREAD_LDFLAGS="-lc_r"
3226                         fi
3227                         ;;
3229             *-*-openbsd*|*-*-bsdi*)
3230                         AC_DEFINE(_REENTRANT)
3231                         AC_DEFINE(_THREAD_SAFE)
3232                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3233                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3234                 _PTHREAD_LDFLAGS="-pthread"
3235                         fi
3236                         ;;
3238             *-*-linux*|*-*-kfreebsd*-gnu)
3239                         AC_DEFINE(_REENTRANT) 
3240                         ;;
3242             *-*-nto*) 
3243                         AC_DEFINE(_REENTRANT) 
3244                         ;;
3246             *-aix4.3*|*-aix5*)
3247                         AC_DEFINE(_REENTRANT) 
3248                         ;;
3250             *-hpux11.*)
3251                         AC_DEFINE(_REENTRANT) 
3252                         ;;
3254             alpha*-*-osf*)
3255                         AC_DEFINE(_REENTRANT)
3256                         ;;
3258             *-*-solaris*) 
3259                         AC_DEFINE(_REENTRANT) 
3260                         if test ! "$GNU_CC"; then
3261                                 CFLAGS="$CFLAGS -mt" 
3262                                 CXXFLAGS="$CXXFLAGS -mt" 
3263                         fi
3264                         ;;
3265         esac
3266     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3269 dnl ========================================================
3270 dnl See if mmap sees writes
3271 dnl For cross compiling, just define it as no, which is a safe default
3272 dnl ========================================================
3273 AC_MSG_CHECKING(whether mmap() sees write()s)
3275 changequote(,)
3276 mmap_test_prog='
3277     #include <stdlib.h>
3278     #include <unistd.h>
3279     #include <sys/mman.h>
3280     #include <sys/types.h>
3281     #include <sys/stat.h>
3282     #include <fcntl.h>
3284     char fname[] = "conftest.file";
3285     char zbuff[1024]; /* Fractional page is probably worst case */
3287     int main() {
3288         char *map;
3289         int fd;
3290         int i;
3291         unlink(fname);
3292         fd = open(fname, O_RDWR | O_CREAT, 0660);
3293         if(fd<0) return 1;
3294         unlink(fname);
3295         write(fd, zbuff, sizeof(zbuff));
3296         lseek(fd, 0, SEEK_SET);
3297         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3298         if(map==(char*)-1) return 2;
3299         for(i=0; fname[i]; i++) {
3300             int rc = write(fd, &fname[i], 1);
3301             if(map[i]!=fname[i]) return 4;
3302         }
3303         return 0;
3304     }
3306 changequote([,])
3308 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3310 AC_MSG_RESULT("$result")
3312 if test "$result" = "no"; then
3313     AC_DEFINE(MMAP_MISSES_WRITES)
3317 dnl Checks for library functions.
3318 dnl ========================================================
3319 AC_PROG_GCC_TRADITIONAL
3320 AC_FUNC_MEMCMP
3321 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3322 AC_CHECK_FUNCS(flockfile getpagesize)
3324 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3325 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3326   AC_CHECK_FUNCS(localtime_r strtok_r)
3329 dnl check for wcrtomb/mbrtowc
3330 dnl =======================================================================
3331 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3332 AC_LANG_SAVE
3333 AC_LANG_CPLUSPLUS
3334 AC_CACHE_CHECK(for wcrtomb,
3335     ac_cv_have_wcrtomb,
3336     [AC_TRY_LINK([#include <wchar.h>],
3337                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3338                  ac_cv_have_wcrtomb="yes",
3339                  ac_cv_have_wcrtomb="no")])
3340 if test "$ac_cv_have_wcrtomb" = "yes"; then
3341     AC_DEFINE(HAVE_WCRTOMB)
3343 AC_CACHE_CHECK(for mbrtowc,
3344     ac_cv_have_mbrtowc,
3345     [AC_TRY_LINK([#include <wchar.h>],
3346                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3347                  ac_cv_have_mbrtowc="yes",
3348                  ac_cv_have_mbrtowc="no")])
3349 if test "$ac_cv_have_mbrtowc" = "yes"; then
3350     AC_DEFINE(HAVE_MBRTOWC)
3352 AC_LANG_RESTORE
3355 AC_CACHE_CHECK(
3356     [for res_ninit()],
3357     ac_cv_func_res_ninit,
3358     [AC_TRY_LINK([
3359         #ifdef linux
3360         #define _BSD_SOURCE 1
3361         #endif
3362         #include <resolv.h>
3363         ],
3364         [int foo = res_ninit(&_res);],
3365         [ac_cv_func_res_ninit=yes],
3366         [ac_cv_func_res_ninit=no])
3367     ])
3369 if test "$ac_cv_func_res_ninit" = "yes"; then
3370     AC_DEFINE(HAVE_RES_NINIT)
3371 dnl must add the link line we do something as foolish as this... dougt
3372 dnl else
3373 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3374 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3377 AC_LANG_CPLUSPLUS
3378 AC_CACHE_CHECK(
3379     [for gnu_get_libc_version()],
3380     ac_cv_func_gnu_get_libc_version,
3381     [AC_TRY_LINK([
3382         #ifdef HAVE_GNU_LIBC_VERSION_H
3383         #include <gnu/libc-version.h>
3384         #endif
3385         ],
3386         [const char *glibc_version = gnu_get_libc_version();],
3387         [ac_cv_func_gnu_get_libc_version=yes],
3388         [ac_cv_func_gnu_get_libc_version=no] 
3389         )]
3390     )
3392 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3393     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3396 case $target_os in
3397     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3398         ;;
3399     *)
3400     
3401 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3402     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3403         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3404 _SAVE_LIBS=$LIBS
3405 LIBS="$LIBS $_ICONV_LIBS"
3406 AC_CACHE_CHECK(
3407     [for iconv()],
3408     ac_cv_func_iconv,
3409     [AC_TRY_LINK([
3410         #include <stdlib.h>
3411         #include <iconv.h>
3412         ],
3413         [
3414             iconv_t h = iconv_open("", "");
3415             iconv(h, NULL, NULL, NULL, NULL);
3416             iconv_close(h);
3417         ],
3418         [ac_cv_func_iconv=yes],
3419         [ac_cv_func_iconv=no] 
3420         )]
3421     )
3422 if test "$ac_cv_func_iconv" = "yes"; then
3423     AC_DEFINE(HAVE_ICONV)
3424     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3425     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3426     LIBICONV="$_ICONV_LIBS"
3427     AC_CACHE_CHECK(
3428         [for iconv() with const input],
3429         ac_cv_func_const_iconv,
3430         [AC_TRY_COMPILE([
3431             #include <stdlib.h>
3432             #include <iconv.h>
3433             ],
3434             [
3435                 const char *input = "testing";
3436                 iconv_t h = iconv_open("", "");
3437                 iconv(h, &input, NULL, NULL, NULL);
3438                 iconv_close(h);
3439             ],
3440             [ac_cv_func_const_iconv=yes],
3441             [ac_cv_func_const_iconv=no] 
3442             )]
3443         )
3444     if test "$ac_cv_func_const_iconv" = "yes"; then
3445         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3446     fi
3448 LIBS=$_SAVE_LIBS
3450     ;;
3451 esac
3453 AM_LANGINFO_CODESET
3455 AC_LANG_C
3457 dnl **********************
3458 dnl *** va_copy checks ***
3459 dnl **********************
3460 dnl we currently check for all three va_copy possibilities, so we get
3461 dnl all results in config.log for bug reports.
3462 AC_MSG_CHECKING(for an implementation of va_copy())
3463 AC_CACHE_VAL(ac_cv_va_copy,[
3464     AC_TRY_RUN([
3465         #include <stdarg.h>
3466         void f (int i, ...) {
3467             va_list args1, args2;
3468             va_start (args1, i);
3469             va_copy (args2, args1);
3470             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3471                 exit (1);
3472             va_end (args1); va_end (args2);
3473         }
3474         int main() { f (0, 42); return 0; }],
3475         ac_cv_va_copy=yes,
3476         ac_cv_va_copy=no,
3477         ac_cv_va_copy=no
3478     )
3480 AC_MSG_RESULT($ac_cv_va_copy)
3481 AC_MSG_CHECKING(for an implementation of __va_copy())
3482 AC_CACHE_VAL(ac_cv___va_copy,[
3483     AC_TRY_RUN([
3484         #include <stdarg.h>
3485         void f (int i, ...) {
3486             va_list args1, args2;
3487             va_start (args1, i);
3488             __va_copy (args2, args1);
3489             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3490                 exit (1);
3491             va_end (args1); va_end (args2);
3492         }
3493         int main() { f (0, 42); return 0; }],
3494         ac_cv___va_copy=yes,
3495         ac_cv___va_copy=no,
3496         ac_cv___va_copy=no
3497     )
3499 AC_MSG_RESULT($ac_cv___va_copy)
3500 AC_MSG_CHECKING(whether va_lists can be copied by value)
3501 AC_CACHE_VAL(ac_cv_va_val_copy,[
3502     AC_TRY_RUN([
3503         #include <stdarg.h>
3504         void f (int i, ...) {
3505             va_list args1, args2;
3506             va_start (args1, i);
3507             args2 = args1;
3508             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3509                 exit (1);
3510             va_end (args1); va_end (args2);
3511         }
3512         int main() { f (0, 42); return 0; }],
3513         ac_cv_va_val_copy=yes,
3514         ac_cv_va_val_copy=no,
3515         ac_cv_va_val_copy=yes
3516     )
3518 if test "x$ac_cv_va_copy" = "xyes"; then
3519     AC_DEFINE(VA_COPY, va_copy)
3520     AC_DEFINE(HAVE_VA_COPY)
3521 elif test "x$ac_cv___va_copy" = "xyes"; then
3522     AC_DEFINE(VA_COPY, __va_copy)
3523     AC_DEFINE(HAVE_VA_COPY)
3526 if test "x$ac_cv_va_val_copy" = "xno"; then
3527    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3529 AC_MSG_RESULT($ac_cv_va_val_copy)
3531 dnl Check for dll-challenged libc's.
3532 dnl This check is apparently only needed for Linux.
3533 case "$target" in
3534         *-linux*)
3535             dnl ===================================================================
3536             _curdir=`pwd`
3537             export _curdir
3538             rm -rf conftest* _conftest
3539             mkdir _conftest
3540             cat >> conftest.C <<\EOF
3541 #include <stdio.h>
3542 #include <link.h>
3543 #include <dlfcn.h>
3544 #ifdef _dl_loaded
3545 void __dump_link_map(void) {
3546   struct link_map *map = _dl_loaded;
3547   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3549 int main() {
3550   dlopen("./conftest1.so",RTLD_LAZY);
3551   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3552   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3553   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3554   __dump_link_map();
3556 #else
3557 /* _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).*/
3558 int main() { printf("./conftest1.so\n"); }
3559 #endif
3562             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3564             cat >> conftest1.C <<\EOF
3565 #include <stdio.h>
3566 void foo(void) {printf("foo in dll called\n");}
3568             ${CXX-g++} -fPIC -c -g conftest1.C
3569             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3570             ${CXX-g++} -g conftest.C -o conftest -ldl
3571             cp -f conftest1.so conftest _conftest
3572             cd _conftest
3573             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3574             then
3575                 echo
3576                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3577                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3578                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3579                 echo "*** will be excessive memory usage at runtime."
3580                 echo
3581             fi
3582             cd ${_curdir}
3583             rm -rf conftest* _conftest
3584             dnl ===================================================================
3585             ;;
3586 esac
3588 dnl ===================================================================
3589 dnl ========================================================
3590 dnl By default, turn rtti and exceptions off on g++/egcs
3591 dnl ========================================================
3592 if test "$GNU_CXX"; then
3594   AC_MSG_CHECKING(for C++ exceptions flag)
3596   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3597   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3598   [echo "int main() { return 0; }" | cat > conftest.C
3600   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3602   if egrep "warning.*renamed" conftest.out >/dev/null; then
3603     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3604   else
3605     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3606   fi
3608   rm -f conftest*])
3610   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3611   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3612   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3615 dnl ========================================================
3616 dnl Put your C++ language/feature checks below
3617 dnl ========================================================
3618 AC_LANG_CPLUSPLUS
3620 HAVE_GCC3_ABI=
3621 if test "$GNU_CC"; then
3622   AC_CACHE_CHECK(for gcc 3.0 ABI,
3623       ac_cv_gcc_three_abi,
3624       [AC_TRY_COMPILE([],
3625                       [
3626 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3627   return 0;
3628 #else
3629 #error Not gcc3.
3630 #endif
3631                       ],
3632                       ac_cv_gcc_three_abi="yes",
3633                       ac_cv_gcc_three_abi="no")])
3634   if test "$ac_cv_gcc_three_abi" = "yes"; then
3635       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3636       HAVE_GCC3_ABI=1
3637   else
3638       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3639   fi
3641 AC_SUBST(HAVE_GCC3_ABI)
3644 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3645                ac_cv_cpp_explicit,
3646                [AC_TRY_COMPILE(class X {
3647                                public: explicit X(int i) : i_(i) {}
3648                                private: int i_;
3649                                };,
3650                                X x(3);,
3651                                ac_cv_cpp_explicit=yes,
3652                                ac_cv_cpp_explicit=no)])
3653 if test "$ac_cv_cpp_explicit" = yes ; then
3654    AC_DEFINE(HAVE_CPP_EXPLICIT)
3657 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3658                ac_cv_cpp_typename,
3659                [AC_TRY_COMPILE(class param {
3660                                public:
3661                                    typedef unsigned long num_type;
3662                                };
3664                                template <class T> class tplt {
3665                                public:
3666                                    typedef typename T::num_type t_num_type;
3667                                    t_num_type foo(typename T::num_type num) {
3668                                        return num;
3669                                    }
3670                                };,
3671                                tplt<param> A;
3672                                A.foo(0);,
3673                                ac_cv_cpp_typename=yes,
3674                                ac_cv_cpp_typename=no)])
3675 if test "$ac_cv_cpp_typename" = yes ; then
3676    AC_DEFINE(HAVE_CPP_TYPENAME)
3679 dnl Check for support of modern template specialization syntax
3680 dnl Test code and requirement from scc@netscape.com.
3681 dnl Autoconf cut-and-paste job by waterson@netscape.com
3682 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3683                ac_cv_cpp_modern_specialize_template_syntax,
3684                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3685                                class Y {};
3686                                template <> struct X<Y> { double a; };,
3687                                X<int> int_x;
3688                                X<Y> y_x;,
3689                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3690                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3691 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3692   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3696 dnl Some compilers support only full specialization, and some don't.
3697 AC_CACHE_CHECK(whether partial template specialization works,
3698                ac_cv_cpp_partial_specialization,
3699                [AC_TRY_COMPILE(template <class T> class Foo {};
3700                                template <class T> class Foo<T*> {};,
3701                                return 0;,
3702                                ac_cv_cpp_partial_specialization=yes,
3703                                ac_cv_cpp_partial_specialization=no)])
3704 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3705   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3708 dnl Some compilers have limited support for operators with templates;
3709 dnl specifically, it is necessary to define derived operators when a base
3710 dnl class's operator declaration should suffice.
3711 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3712                ac_cv_need_derived_template_operators,
3713                [AC_TRY_COMPILE([template <class T> class Base { };
3714                                 template <class T>
3715                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3716                                 template <class T> class Derived : public Base<T> { };],
3717                                [Derived<char> a, b;
3718                                 Base<char> c = a + b;
3719                                 return 0;],
3720                                ac_cv_need_derived_template_operators=no,
3721                                ac_cv_need_derived_template_operators=yes)])
3722 if test "$ac_cv_need_derived_template_operators" = yes ; then
3723   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3727 dnl Some compilers have trouble detecting that a template class
3728 dnl that derives from another template is actually an instance
3729 dnl of the base class. This test checks for that.
3730 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3731                ac_cv_need_cpp_template_cast_to_base,
3732                [AC_TRY_COMPILE([template <class T> class Base { };
3733                                 template <class T> class Derived : public Base<T> { };
3734                                 template <class T> int foo(const Base<T>&) { return 0; }],
3735                                [Derived<char> bar; return foo(bar);],
3736                                ac_cv_need_cpp_template_cast_to_base=no,
3737                                ac_cv_need_cpp_template_cast_to_base=yes)])
3738 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3739   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3742 dnl Some compilers have trouble resolving the ambiguity between two
3743 dnl functions whose arguments differ only by cv-qualifications.
3744 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3745                ac_cv_can_resolve_const_ambiguity,
3746                [AC_TRY_COMPILE([
3747                                 template <class T> class ptrClass {
3748                                   public: T* ptr;
3749                                 };
3751                                 template <class T> T* a(ptrClass<T> *arg) {
3752                                   return arg->ptr;
3753                                 }
3755                                 template <class T>
3756                                 const T* a(const ptrClass<T> *arg) {
3757                                   return arg->ptr;
3758                                 }
3759                                ],
3760                                [ ptrClass<int> i;
3761                                  a(&i); ],
3762                                ac_cv_can_resolve_const_ambiguity=yes,
3763                                ac_cv_can_resolve_const_ambiguity=no)])
3764 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3765   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3769 dnl We don't do exceptions on unix.  The only reason this used to be here
3770 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3771 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3772 dnl So im commenting this out until someone writes some artificial 
3773 dnl intelligence to detect not only if the compiler has exceptions, but if 
3774 dnl they are enabled as well.
3775 dnl 
3776 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3777 dnl                ac_cv_cpp_exceptions,
3778 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3779 dnl                                static void F() { throw X(); },
3780 dnl                                try { F(); } catch(X & e) { },
3781 dnl                                ac_cv_cpp_exceptions=yes,
3782 dnl                                ac_cv_cpp_exceptions=no)])
3783 dnl if test $ac_cv_cpp_exceptions = yes ; then
3784 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3785 dnl fi
3787 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3788 dnl supports it well enough to allow us to use it to change access, but not
3789 dnl to resolve ambiguity. The next two tests determine how well the |using|
3790 dnl keyword is supported.
3792 dnl Check to see if we can change access with |using|.  Test both a
3793 dnl legal and an illegal example.
3794 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3795                ac_cv_cpp_access_changing_using2,
3796                [AC_TRY_COMPILE(
3797                    class A { protected: int foo() { return 0; } };
3798                    class B : public A { public: using A::foo; };,
3799                    B b; return b.foo();,
3800                    [AC_TRY_COMPILE(
3801                        class A { public: int foo() { return 1; } };
3802                        class B : public A { private: using A::foo; };,
3803                        B b; return b.foo();,
3804                        ac_cv_cpp_access_changing_using2=no,
3805                        ac_cv_cpp_access_changing_using2=yes)],
3806                    ac_cv_cpp_access_changing_using2=no)])
3807 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3808    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3811 dnl Check to see if we can resolve ambiguity with |using|.
3812 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3813                ac_cv_cpp_ambiguity_resolving_using,
3814                [AC_TRY_COMPILE(class X { 
3815                                  public: int go(const X&) {return 3;}
3816                                          int jo(const X&) {return 3;}
3817                                };
3818                                class Y : public X {
3819                                  public:  int go(int) {return 2;}
3820                                           int jo(int) {return 2;}
3821                                           using X::jo;
3822                                  private: using X::go;
3823                                };,
3824                                X x; Y y; y.jo(x);,
3825                                ac_cv_cpp_ambiguity_resolving_using=yes,
3826                                ac_cv_cpp_ambiguity_resolving_using=no)])
3827 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3828    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3831 dnl Check to see if the |std| namespace is supported. If so, we'll want
3832 dnl to qualify any standard library calls with "std::" to ensure that
3833 dnl those functions can be resolved.
3834 AC_CACHE_CHECK(for \"std::\" namespace,
3835                ac_cv_cpp_namespace_std,
3836                [AC_TRY_COMPILE([#include <algorithm>],
3837                                [return std::min(0, 1);],
3838                                ac_cv_cpp_namespace_std=yes,
3839                                ac_cv_cpp_namespace_std=no)])
3840 if test "$ac_cv_cpp_namespace_std" = yes ; then
3841    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3844 dnl Older compilers are overly ambitious with respect to using the standard
3845 dnl template library's |operator!=()| when |operator==()| is defined. In
3846 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3847 dnl ambiguity at compile-time. This test checks for that case.
3848 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3849                ac_cv_cpp_unambiguous_std_notequal,
3850                [AC_TRY_COMPILE([#include <algorithm>
3851                                 struct T1 {};
3852                                 int operator==(const T1&, const T1&) { return 0; }
3853                                 int operator!=(const T1&, const T1&) { return 0; }],
3854                                [T1 a,b; return a != b;],
3855                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3856                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3857 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3858   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3862 AC_CACHE_CHECK(for C++ reinterpret_cast,
3863                ac_cv_cpp_reinterpret_cast,
3864                [AC_TRY_COMPILE(struct X { int i; };
3865                                struct Y { int i; };,
3866                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3867                                ac_cv_cpp_reinterpret_cast=yes,
3868                                ac_cv_cpp_reinterpret_cast=no)])
3869 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3870    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3873 dnl See if a dynamic_cast to void* gives the most derived object.
3874 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3875                ac_cv_cpp_dynamic_cast_void_ptr,
3876                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3877                             class Y { int j; public: virtual ~Y() { } };
3878                             class Z : public X, public Y { int k; };
3880                             int main() {
3881                                  Z mdo;
3882                                  X *subx = (X*)&mdo;
3883                                  Y *suby = (Y*)&mdo;
3884                                  return !((((void*)&mdo != (void*)subx) &&
3885                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3886                                           (((void*)&mdo != (void*)suby) &&
3887                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3888                             }],
3889                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3890                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3891                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3892 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3893    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3897 dnl note that this one is reversed - if the test fails, then
3898 dnl we require implementations of unused virtual methods. Which
3899 dnl really blows because it means we'll have useless vtable
3900 dnl bloat.
3901 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3902                ac_cv_cpp_unused_required,
3903                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3904                                X x;,
3905                                ac_cv_cpp_unused_required=no,
3906                                ac_cv_cpp_unused_required=yes)])
3907 if test "$ac_cv_cpp_unused_required" = yes ; then
3908    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3912 dnl Some compilers have trouble comparing a constant reference to a templatized
3913 dnl class to zero, and require an explicit operator==() to be defined that takes
3914 dnl an int. This test separates the strong from the weak.
3916 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3917                ac_cv_trouble_comparing_to_zero,
3918                [AC_TRY_COMPILE([#include <algorithm>
3919                                 template <class T> class Foo {};
3920                                 class T2;
3921                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3922                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3923                                [Foo<int> f; return (0 != f);],
3924                                ac_cv_trouble_comparing_to_zero=no,
3925                                ac_cv_trouble_comparing_to_zero=yes)])
3926 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3927   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3932 dnl End of C++ language/feature checks
3933 AC_LANG_C
3935 dnl ========================================================
3936 dnl =  Internationalization checks
3937 dnl ========================================================
3939 dnl Internationalization and Locale support is different
3940 dnl on various UNIX platforms.  Checks for specific i18n
3941 dnl features go here.
3943 dnl check for LC_MESSAGES
3944 AC_CACHE_CHECK(for LC_MESSAGES,
3945                 ac_cv_i18n_lc_messages,
3946                 [AC_TRY_COMPILE([#include <locale.h>],
3947                                 [int category = LC_MESSAGES;],
3948                                 ac_cv_i18n_lc_messages=yes,
3949                                 ac_cv_i18n_lc_messages=no)])
3950 if test "$ac_cv_i18n_lc_messages" = yes; then
3951    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3952 fi      
3954 fi # SKIP_COMPILER_CHECKS
3956 TARGET_XPCOM_ABI=
3957 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3958     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3961 dnl Mozilla specific options
3962 dnl ========================================================
3963 dnl The macros used for command line options
3964 dnl are defined in build/autoconf/altoptions.m4.
3967 dnl ========================================================
3968 dnl =
3969 dnl = Check for external package dependencies
3970 dnl =
3971 dnl ========================================================
3972 MOZ_ARG_HEADER(External Packages)
3974 MOZ_ENABLE_LIBXUL=
3976 MOZ_ARG_WITH_STRING(libxul-sdk,
3977 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3978   LIBXUL_SDK_DIR=$withval)
3980 if test "$LIBXUL_SDK_DIR" = "yes"; then
3981     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3982 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3983     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3985     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
3986         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
3987     fi
3989     MOZ_ENABLE_LIBXUL=1
3991 AC_SUBST(LIBXUL_SDK)
3993 dnl ========================================================
3994 dnl = If NSPR was not detected in the system, 
3995 dnl = use the one in the source tree (mozilla/nsprpub)
3996 dnl ========================================================
3997 MOZ_ARG_WITH_BOOL(system-nspr,
3998 [  --with-system-nspr      Use system installed NSPR],
3999     _USE_SYSTEM_NSPR=1 )
4001 if test -n "$_USE_SYSTEM_NSPR"; then
4002     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4005 if test -n "$MOZ_NATIVE_NSPR"; then
4006     _SAVE_CFLAGS=$CFLAGS
4007     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4008     AC_TRY_COMPILE([#include "prlog.h"],
4009                 [#ifndef PR_STATIC_ASSERT
4010                  #error PR_STATIC_ASSERT not defined
4011                  #endif],
4012                 [MOZ_NATIVE_NSPR=1],
4013                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4014     CFLAGS=$_SAVE_CFLAGS
4015 else
4016     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --includedir=$(LIBXUL_DIST)/include/nspr --cflags`'
4017     # explicitly set libs for Visual Age C++ for OS/2
4018     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
4019         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '$_PTHREAD_LDFLAGS''
4020     elif test "$OS_ARCH" = "WINCE"; then
4021         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4022         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4023     elif test "$OS_ARCH" = "WINNT"; then
4024         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4025         if test -n "$GNU_CC"; then
4026             NSPR_LIBS="-L\$(LIBXUL_DIST)/lib -lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
4027         else
4028             NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4029         fi
4030     else
4031         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --libdir=$(LIBXUL_DIST)/lib --libs`'
4032     fi
4035 dnl ========================================================
4036 dnl = If NSS was not detected in the system, 
4037 dnl = use the one in the source tree (mozilla/security/nss)
4038 dnl ========================================================
4040 MOZ_ARG_WITH_BOOL(system-nss,
4041 [  --with-system-nss      Use system installed NSS],
4042     _USE_SYSTEM_NSS=1 )
4044 if test -n "$_USE_SYSTEM_NSS"; then
4045     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4048 if test -n "$MOZ_NATIVE_NSS"; then
4049    NSS_LIBS="$NSS_LIBS -lcrmf"
4050 else
4051    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4052    NSS_DEP_LIBS="\
4053         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4054         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4055         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4056         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4057         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4058         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4060    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4061        NSS_LIBS="\
4062         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4063         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4064         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4065         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4066         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4067         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4068    else
4069        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4070    fi
4073 if test -z "$SKIP_LIBRARY_CHECKS"; then
4074 dnl system JPEG support
4075 dnl ========================================================
4076 MOZ_ARG_WITH_STRING(system-jpeg,
4077 [  --with-system-jpeg[=PFX]
4078                           Use system libjpeg [installed at prefix PFX]],
4079     JPEG_DIR=$withval)
4081 _SAVE_CFLAGS=$CFLAGS
4082 _SAVE_LDFLAGS=$LDFLAGS
4083 _SAVE_LIBS=$LIBS
4084 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4085     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4086     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4088 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4089     SYSTEM_JPEG=
4090 else
4091     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4094 if test "$SYSTEM_JPEG" = 1; then
4095     LIBS="$JPEG_LIBS $LIBS"
4096     AC_TRY_COMPILE([ #include <stdio.h>
4097                      #include <sys/types.h>
4098                      #include <jpeglib.h> ],
4099                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4100                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4101                      #endif ],
4102                    SYSTEM_JPEG=1,
4103                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4104 fi 
4105 CFLAGS=$_SAVE_CFLAGS
4106 LDFLAGS=$_SAVE_LDFLAGS
4107 LIBS=$_SAVE_LIBS
4109 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4110     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4111     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4114 dnl system ZLIB support
4115 dnl ========================================================
4116 MOZ_ARG_WITH_STRING(system-zlib,
4117 [  --with-system-zlib[=PFX]
4118                           Use system libz [installed at prefix PFX]],
4119     ZLIB_DIR=$withval)
4121 _SAVE_CFLAGS=$CFLAGS
4122 _SAVE_LDFLAGS=$LDFLAGS
4123 _SAVE_LIBS=$LIBS
4124 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4125     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4126     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4128 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4129     SYSTEM_ZLIB=
4130 else
4131     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4132         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4134 if test "$SYSTEM_ZLIB" = 1; then
4135     LIBS="$ZLIB_LIBS $LIBS"
4136     AC_TRY_COMPILE([ #include <stdio.h>
4137                      #include <string.h>
4138                      #include <zlib.h> ],
4139                    [ #if ZLIB_VERNUM < $MOZZLIB 
4140                      #error "Insufficient zlib version ($MOZZLIB required)."
4141                      #endif ],
4142                    SYSTEM_ZLIB=1,
4143                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4145 CFLAGS=$_SAVE_CFLAGS
4146 LDFLAGS=$_SAVE_LDFLAGS
4147 LIBS=$_SAVE_LIBS
4149 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4150     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4151     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4154 dnl system BZIP2 Support
4155 dnl ========================================================
4156 MOZ_ARG_WITH_STRING(system-bz2,
4157 [  --with-system-bz2[=PFX]
4158                           Use system libbz2 [installed at prefix PFX]],
4159     BZ2_DIR=$withval)
4161 _SAVE_CFLAGS=$CFLAGS
4162 _SAVE_LDFLAGS=$LDFLAGS
4163 _SAVE_LIBS=$LIBS
4164 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4165     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4166     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4168 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4169     SYSTEM_BZ2=
4170 else
4171     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4172         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4174 CFLAGS=$_SAVE_CFLAGS
4175 LDFLAGS=$_SAVE_LDFLAGS
4176 LIBS=$_SAVE_LIBS
4178 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4179     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4180     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4183 dnl system PNG Support
4184 dnl ========================================================
4185 MOZ_ARG_WITH_STRING(system-png, 
4186 [  --with-system-png[=PFX]
4187                           Use system libpng [installed at prefix PFX]],
4188     PNG_DIR=$withval)
4190 _SAVE_CFLAGS=$CFLAGS
4191 _SAVE_LDFLAGS=$LDFLAGS
4192 _SAVE_LIBS=$LIBS
4193 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4194 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4195 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4196     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4197     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4199 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4200     SYSTEM_PNG=
4201 else
4202     _SAVE_PNG_LIBS=$PNG_LIBS
4203     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4204                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4205                  $PNG_LIBS)
4206     AC_CHECK_LIB(png, png_get_acTL, ,
4207                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4208                  $_SAVE_PNG_LIBS)
4210 if test "$SYSTEM_PNG" = 1; then
4211     LIBS="$PNG_LIBS $LIBS"
4212     AC_TRY_COMPILE([ #include <stdio.h>
4213                      #include <sys/types.h>
4214                      #include <png.h> ],
4215                    [ #if PNG_LIBPNG_VER < $MOZPNG
4216                      #error "Insufficient libpng version ($MOZPNG required)."
4217                      #endif
4218                      #ifndef PNG_UINT_31_MAX
4219                      #error "Insufficient libpng version."
4220                      #endif ],
4221                    SYSTEM_PNG=1,
4222                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4224 CFLAGS=$_SAVE_CFLAGS
4225 LDFLAGS=$_SAVE_LDFLAGS
4226 LIBS=$_SAVE_LIBS
4228 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4229     PNG_CFLAGS="-I${PNG_DIR}/include"
4230     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4233 fi # SKIP_LIBRARY_CHECKS
4235 dnl system HunSpell Support
4236 dnl ========================================================
4237 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4238 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4239     SYSTEM_HUNSPELL=1 )
4241 if test -n "$SYSTEM_HUNSPELL"; then
4242     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4245 AC_SUBST(SYSTEM_HUNSPELL)
4247 dnl check whether to enable glitz
4248 dnl ========================================================
4249 MOZ_ARG_ENABLE_BOOL(glitz,
4250 [  --enable-glitz          Enable Glitz for use with Cairo],
4251     MOZ_ENABLE_GLITZ=1,
4252     MOZ_ENABLE_GLITZ= )
4253 if test "$MOZ_ENABLE_GLITZ"; then
4254     AC_DEFINE(MOZ_ENABLE_GLITZ)
4257 dnl ========================================================
4258 dnl Java SDK support
4259 dnl ========================================================
4260 JAVA_INCLUDE_PATH=
4261 MOZ_ARG_WITH_STRING(java-include-path,
4262 [  --with-java-include-path=dir   Location of Java SDK headers],
4263     JAVA_INCLUDE_PATH=$withval)
4265 JAVA_BIN_PATH=
4266 MOZ_ARG_WITH_STRING(java-bin-path,
4267 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4268     JAVA_BIN_PATH=$withval)
4270 dnl ========================================================
4271 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4272 dnl their usage and use them in spidermonkey.
4273 dnl ========================================================
4274 MOZ_ARG_WITH_BOOL(arm-kuser,
4275 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4276     USE_ARM_KUSER=1,
4277     USE_ARM_KUSER=)
4278 if test -n "$USE_ARM_KUSER"; then
4279    AC_DEFINE(USE_ARM_KUSER)
4282 dnl ========================================================
4283 dnl =
4284 dnl = Application
4285 dnl =
4286 dnl ========================================================
4288 MOZ_ARG_HEADER(Application)
4290 BUILD_STATIC_LIBS=
4291 ENABLE_TESTS=1
4292 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4293 MOZ_BRANDING_DIRECTORY=
4294 MOZ_CALENDAR=
4295 MOZ_DBGRINFO_MODULES=
4296 MOZ_ENABLE_CANVAS=1
4297 MOZ_EXTENSIONS_ALL=" wallet p3p venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4298 MOZ_FEEDS=1
4299 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4300 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4301 MOZ_IPCD=
4302 MOZ_JAVAXPCOM=
4303 MOZ_JSDEBUGGER=1
4304 MOZ_JSLOADER=1
4305 MOZ_LDAP_XPCOM=
4306 MOZ_LIBART_CFLAGS=
4307 MOZ_LIBART_LIBS=
4308 MOZ_MAIL_NEWS=
4309 MOZ_MATHML=1
4310 MOZ_MOCHITEST=1
4311 MOZ_MORK=1
4312 MOZ_MORKREADER=
4313 MOZ_AUTH_EXTENSION=1
4314 MOZ_NO_ACTIVEX_SUPPORT=1
4315 MOZ_NO_INSPECTOR_APIS=
4316 MOZ_NO_XPCOM_OBSOLETE=
4317 MOZ_NO_FAST_LOAD=
4318 MOZ_OJI=
4319 MOZ_PERMISSIONS=1
4320 MOZ_PLACES=
4321 MOZ_PLAINTEXT_EDITOR_ONLY=
4322 MOZ_PLUGINS=1
4323 MOZ_PREF_EXTENSIONS=1
4324 MOZ_PROFILELOCKING=1
4325 MOZ_PROFILESHARING=1
4326 MOZ_PSM=1
4327 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4328 MOZ_PYTHON=
4329 MOZ_PYTHON_DEBUG_SUFFIX=
4330 MOZ_PYTHON_DLL_SUFFIX=
4331 MOZ_PYTHON_INCLUDES=
4332 MOZ_PYTHON_LIBS=
4333 MOZ_PYTHON_PREFIX=
4334 MOZ_PYTHON_VER=
4335 MOZ_PYTHON_VER_DOTTED=
4336 MOZ_RDF=1
4337 MOZ_REFLOW_PERF=
4338 MOZ_SAFE_BROWSING=
4339 MOZ_HELP_VIEWER=
4340 MOZ_SPELLCHECK=1
4341 MOZ_STATIC_MAIL_BUILD=
4342 MOZ_STORAGE=1
4343 MOZ_SVG=1
4344 MOZ_TIMELINE=
4345 MOZ_UI_LOCALE=en-US
4346 MOZ_UNIVERSALCHARDET=1
4347 MOZ_URL_CLASSIFIER=
4348 MOZ_USE_NATIVE_UCONV=
4349 MOZ_V1_STRING_ABI=
4350 MOZ_VIEW_SOURCE=1
4351 MOZ_XPFE_COMPONENTS=1
4352 MOZ_XPINSTALL=1
4353 MOZ_XSLT_STANDALONE=
4354 MOZ_XTF=1
4355 MOZ_XUL=1
4356 MOZ_XUL_APP=1
4357 MOZ_ZIPWRITER=1
4358 NS_PRINTING=1
4359 NECKO_COOKIES=1
4360 NECKO_DISK_CACHE=1
4361 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4362 NECKO_SMALL_BUFFERS=
4363 SUNCTL=
4364 JS_STATIC_BUILD=
4365 XPC_IDISPATCH_SUPPORT=
4368 case "$target_os" in
4369 darwin*)
4370     ACCESSIBILITY=
4371     ;;
4373     ACCESSIBILITY=1
4374     ;;
4375 esac
4377 case "$target_os" in
4378     msvc*|mks*|cygwin*|mingw*)
4379         if test -z "$GNU_CC"; then 
4380             XPC_IDISPATCH_SUPPORT=1
4381             MOZ_NO_ACTIVEX_SUPPORT=
4382             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4383         fi
4384         ;;
4385 esac
4387 MOZ_ARG_ENABLE_STRING(application,
4388 [  --enable-application=APP
4389                           Options include:
4390                             suite
4391                             browser (Firefox)
4392                             mail (Thunderbird)
4393                             composer
4394                             calendar (Sunbird)
4395                             xulrunner
4396                             camino
4397                             content/xslt (Standalone Transformiix XSLT)
4398                             netwerk (Standalone Necko)
4399                             tools/update-packaging (AUS-related packaging tools)
4400                             standalone (use this for standalone
4401                               xpcom/xpconnect or to manually drive a build)],
4402 [ MOZ_BUILD_APP=$enableval ] )
4404 if test "$MOZ_BUILD_APP" = "macbrowser"; then
4405     AC_MSG_WARN([--enable-application=macbrowser is deprecated. Use --enable-application=camino.])
4406     MOZ_BUILD_APP=camino
4409 MOZ_EMBEDDING_PROFILE=default
4410 MOZ_ARG_WITH_STRING(embedding-profile,
4411 [  --with-embedding-profile=default|basic|minimal
4412                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4413 [ MOZ_EMBEDDING_PROFILE=$withval ])
4415 case "$MOZ_EMBEDDING_PROFILE" in
4416 default)
4417   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4418   MOZ_EMBEDDING_LEVEL_BASIC=1
4419   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4420   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4421   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4422   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4423   ;;
4425 basic)
4426   MOZ_EMBEDDING_LEVEL_DEFAULT=
4427   MOZ_EMBEDDING_LEVEL_BASIC=1
4428   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4429   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4430   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4431   ENABLE_TESTS=
4432   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4433   MOZ_COMPOSER=
4434   MOZ_ENABLE_CANVAS=
4435   MOZ_ENABLE_POSTSCRIPT=
4436   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4437   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4438   MOZ_IMG_ENCODERS_DEFAULT=
4439   MOZ_IMG_ENCODERS=
4440   MOZ_INSTALLER=
4441   MOZ_JSDEBUGGER=
4442   MOZ_LDAP_XPCOM=
4443   MOZ_MAIL_NEWS=
4444   MOZ_MATHML=
4445   MOZ_AUTH_EXTENSION=
4446   MOZ_NO_ACTIVEX_SUPPORT=1
4447   MOZ_NO_INSPECTOR_APIS=1
4448   MOZ_NO_XPCOM_OBSOLETE=1
4449   MOZ_NO_FAST_LOAD=1
4450   MOZ_OJI=
4451   MOZ_PLAINTEXT_EDITOR_ONLY=1
4452 #  MOZ_PLUGINS=
4453   MOZ_PREF_EXTENSIONS=
4454   MOZ_PROFILELOCKING=
4455   MOZ_PROFILESHARING=
4456   MOZ_SPELLCHECK=
4457   MOZ_SVG=
4458   MOZ_UNIVERSALCHARDET=
4459   MOZ_UPDATER=
4460   MOZ_USE_NATIVE_UCONV=
4461   MOZ_VIEW_SOURCE=
4462   MOZ_XPFE_COMPONENTS=
4463   MOZ_XPINSTALL=
4464   MOZ_XTF=
4465   MOZ_ZIPWRITER=
4466   NECKO_DISK_CACHE=
4467   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4468   NECKO_SMALL_BUFFERS=1
4469   NS_DISABLE_LOGGING=1
4470   NS_PRINTING=
4471   JS_STATIC_BUILD=1
4472   ;;
4474 minimal)
4475   MOZ_EMBEDDING_LEVEL_DEFAULT=
4476   MOZ_EMBEDDING_LEVEL_BASIC=
4477   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4478   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4479   ENABLE_TESTS=
4480   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4481   MOZ_COMPOSER=
4482   MOZ_ENABLE_CANVAS=
4483   MOZ_ENABLE_POSTSCRIPT=
4484   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4485   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4486   MOZ_IMG_ENCODERS_DEFAULT=
4487   MOZ_IMG_ENCODERS=
4488   MOZ_INSTALLER=
4489   MOZ_JSDEBUGGER=
4490   MOZ_LDAP_XPCOM=
4491   MOZ_MAIL_NEWS=
4492   MOZ_MATHML=
4493   MOZ_AUTH_EXTENSION=
4494   MOZ_NO_ACTIVEX_SUPPORT=1
4495   MOZ_NO_INSPECTOR_APIS=1
4496   MOZ_NO_XPCOM_OBSOLETE=1
4497   MOZ_NO_FAST_LOAD=1
4498   MOZ_OJI=
4499   MOZ_PLAINTEXT_EDITOR_ONLY=1
4500   MOZ_PLUGINS=
4501   MOZ_PREF_EXTENSIONS=
4502   MOZ_PROFILELOCKING=
4503   MOZ_PROFILESHARING=
4504   MOZ_SPELLCHECK=
4505   MOZ_STORAGE=1
4506   MOZ_PLACES=
4507   MOZ_SVG=
4508   MOZ_UNIVERSALCHARDET=
4509   MOZ_UPDATER=
4510   MOZ_USE_NATIVE_UCONV=1
4511   MOZ_VIEW_SOURCE=
4512   MOZ_XPFE_COMPONENTS=
4513   MOZ_XPINSTALL=
4514   MOZ_XTF=
4515   MOZ_XUL=
4516   MOZ_ZIPWRITER=
4517   MOZ_RDF=
4518   NECKO_DISK_CACHE=
4519   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4520   NECKO_SMALL_BUFFERS=1
4521   NS_DISABLE_LOGGING=1
4522   NS_PRINTING=
4523   JS_STATIC_BUILD=1
4524   ;;
4527   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4528   ;;
4529 esac
4531 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4532 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4533 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4535 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4536 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4537   XULRUNNER_STUB_NAME=$withval)
4539 if test -z "$XULRUNNER_STUB_NAME"; then
4540   case "$target_os" in
4541   darwin*)
4542     XULRUNNER_STUB_NAME=xulrunner
4543     ;;
4544   *)
4545     XULRUNNER_STUB_NAME=xulrunner-stub
4546   esac
4548 AC_SUBST(XULRUNNER_STUB_NAME)
4550 if test -z "$MOZ_BUILD_APP"; then
4551   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4552 else
4553   # We have a valid application only if it has a build.mk file in its top
4554   # directory.
4555   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4556     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4557   fi
4560 # Allow the application to influence configure with a confvars.sh script.
4562 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4563 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4564   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4565   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4566 else
4567   AC_MSG_RESULT([no])
4570 # Now is a good time to test for logic errors, define mismatches, etc.
4571 case "$MOZ_BUILD_APP" in
4572 xulrunner)
4573   if test "$LIBXUL_SDK"; then
4574     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4575   fi
4576   ;;
4578   # Fix this case for folks who forget. Warn them.
4579   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4580     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4581     MOZ_XUL_APP=1
4582   fi
4583   ;;
4584 esac
4586 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4587 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4588 # MOZ_BUILD_APP.
4589 case "$MOZ_BUILD_APP" in
4590 suite)
4591   AC_DEFINE(MOZ_SUITE)
4592   ;;
4594 browser)
4595   AC_DEFINE(MOZ_PHOENIX)
4596   ;;
4598 mail)
4599   AC_DEFINE(MOZ_THUNDERBIRD)
4600   ;;
4602 composer)
4603   AC_DEFINE(MOZ_STANDALONE_COMPOSER)
4604   ;;
4606 calendar)
4607   AC_DEFINE(MOZ_SUNBIRD)
4608   ;;
4610 xulrunner)
4611   AC_DEFINE(MOZ_XULRUNNER)
4612   ;;
4614 camino) 
4615   AC_DEFINE(MOZ_MACBROWSER)
4616   ;;
4618 content/xslt)
4619   AC_DEFINE(TX_EXE)
4620   ;;
4622 standalone) 
4623   MOZ_APP_NAME=mozilla
4624   MOZ_APP_DISPLAYNAME=Mozilla
4625   MOZ_APP_VERSION=$MOZILLA_VERSION
4626   ;;
4628 esac
4630 AC_SUBST(MOZ_BUILD_APP)
4631 AC_SUBST(MOZ_XUL_APP)
4632 AC_SUBST(MOZ_SUITE)
4633 AC_SUBST(MOZ_PHOENIX)
4634 AC_SUBST(MOZ_THUNDERBIRD)
4635 AC_SUBST(MOZ_STANDALONE_COMPOSER)
4636 AC_SUBST(MOZ_SUNBIRD)
4637 AC_SUBST(MOZ_XULRUNNER)
4639 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4641 if test "$MOZ_XUL_APP"; then
4642   MOZ_PROFILESHARING=
4643   AC_DEFINE(MOZ_XUL_APP)
4646 dnl ========================================================
4647 dnl = 
4648 dnl = Toolkit Options
4649 dnl = 
4650 dnl ========================================================
4651 MOZ_ARG_HEADER(Toolkit Options)
4653     dnl ========================================================
4654     dnl = Select the default toolkit
4655     dnl ========================================================
4656         MOZ_ARG_ENABLE_STRING(default-toolkit,
4657         [  --enable-default-toolkit=TK
4658                           Select default toolkit
4659                           Platform specific defaults:
4660                             BeOS - cairo-beos
4661                             Mac OS X - cairo-cocoa
4662                             Neutrino/QNX - photon
4663                             OS/2 - cairo-os2
4664                             Win32 - cairo-windows
4665                             WinCE - windows
4666                             * - cairo-gtk2],
4667     [ _DEFAULT_TOOLKIT=$enableval ],
4668     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4670     if test "$_DEFAULT_TOOLKIT" = "photon" \
4671         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4672         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4673         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4674         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4675         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4676         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4677     then
4678         dnl nglayout only supports building with one toolkit,
4679         dnl so ignore everything after the first comma (",").
4680         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4681     else
4682         if test "$no_x" != "yes"; then
4683             AC_MSG_ERROR([Toolkit must be cairo-gtk2.])
4684         else
4685             AC_MSG_ERROR([Toolkit must be $_PLATFORM_DEFAULT_TOOLKIT (if supported).])
4686         fi
4687     fi
4689 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4691 dnl ========================================================
4692 dnl = Enable the toolkit as needed                         =
4693 dnl ========================================================
4695 case "$MOZ_WIDGET_TOOLKIT" in
4696 photon)
4697         MOZ_ENABLE_PHOTON=1
4698         AC_DEFINE(MOZ_WIDGET_PHOTON)
4699     ;;
4701 cairo-windows)
4702     MOZ_WIDGET_TOOLKIT=windows
4703     MOZ_GFX_TOOLKIT=cairo
4704     ;;
4706 cairo-gtk2)
4707     MOZ_WIDGET_TOOLKIT=gtk2
4708     MOZ_GFX_TOOLKIT=cairo
4709     MOZ_ENABLE_GTK2=1
4710     MOZ_ENABLE_XREMOTE=1
4711     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4712     TK_LIBS='$(MOZ_GTK2_LIBS)'
4713     AC_DEFINE(MOZ_WIDGET_GTK2)
4714     ;;
4715 cairo-beos)
4716     MOZ_WIDGET_TOOLKIT=beos
4717     MOZ_GFX_TOOLKIT=cairo
4718     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4719     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4720     ;;
4722 cairo-os2)
4723     MOZ_WIDGET_TOOLKIT=os2
4724     MOZ_GFX_TOOLKIT=cairo
4725     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4726     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4727     ;;
4729 cairo-mac|cairo-cocoa)
4730     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4731         MOZ_WIDGET_TOOLKIT=cocoa
4732         AC_DEFINE(MOZ_WIDGET_COCOA)
4733         MOZ_ENABLE_COCOA=1
4734     else
4735         MOZ_WIDGET_TOOLKIT=mac
4736     fi
4737     MOZ_GFX_TOOLKIT=cairo
4738     MOZ_USER_DIR="Mozilla"
4739     AC_DEFINE(XP_MACOSX)
4740     AC_DEFINE(TARGET_CARBON)
4741     AC_DEFINE(TARGET_API_MAC_CARBON)
4742     TK_LIBS='-framework Carbon'
4743     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4744     CFLAGS="$CFLAGS $TK_CFLAGS"
4745     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4746     ;;
4747 esac
4749 if test "$MOZ_ENABLE_XREMOTE"; then
4750     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4753 if test "$COMPILE_ENVIRONMENT"; then
4754 if test "$MOZ_ENABLE_GTK2"
4755 then
4756     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 gdk-x11-2.0 glib-2.0 gobject-2.0)
4758 fi # COMPILE_ENVIRONMENT
4760 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4762 dnl ========================================================
4763 dnl = startup-notification support module
4764 dnl ========================================================
4766 if test "$MOZ_ENABLE_GTK2"
4767 then
4768     MOZ_ENABLE_STARTUP_NOTIFICATION=
4770     MOZ_ARG_ENABLE_BOOL(startup-notification,
4771     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4772         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4773         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4774     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4775     then
4776         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4777                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4778         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4779             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4780             then
4781                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4782             fi
4783             MOZ_ENABLE_STARTUP_NOTIFICATION=
4784         ])
4785     fi
4787     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4788         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4789     fi
4791     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4793 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4794 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4795 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4797 AC_SUBST(GTK_CONFIG)
4798 AC_SUBST(TK_CFLAGS)
4799 AC_SUBST(TK_LIBS)
4801 AC_SUBST(MOZ_ENABLE_GTK2)
4802 AC_SUBST(MOZ_ENABLE_PHOTON)
4803 AC_SUBST(MOZ_ENABLE_COCOA)
4804 AC_SUBST(MOZ_ENABLE_GLITZ)
4805 AC_SUBST(MOZ_ENABLE_XREMOTE)
4806 AC_SUBST(MOZ_GTK2_CFLAGS)
4807 AC_SUBST(MOZ_GTK2_LIBS)
4809 AC_SUBST(MOC)
4811 if test "$MOZ_ENABLE_GTK2"
4812 then
4813     AC_DEFINE(MOZ_X11)
4814     MOZ_X11=1
4816 AC_SUBST(MOZ_X11)
4818 dnl ========================================================
4819 dnl =
4820 dnl = Components & Features
4821 dnl = 
4822 dnl ========================================================
4823 MOZ_ARG_HEADER(Components and Features)
4825 dnl ========================================================
4826 dnl = Localization
4827 dnl ========================================================
4828 MOZ_ARG_ENABLE_STRING(ui-locale,
4829 [  --enable-ui-locale=ab-CD
4830                           Select the user interface locale (default: en-US)],
4831     MOZ_UI_LOCALE=$enableval )
4832 AC_SUBST(MOZ_UI_LOCALE)
4834 dnl =========================================================
4835 dnl = Calendar client
4836 dnl =========================================================
4837 MOZ_ARG_ENABLE_BOOL(calendar,,
4838     MOZ_OLD_CALENDAR=1,
4839     MOZ_OLD_CALENDAR= )
4841 if test "$MOZ_OLD_CALENDAR"; then
4842     AC_MSG_WARN([Building with the calendar extension is no longer supported.])
4843     if test "$MOZ_THUNDERBIRD"; then
4844         AC_MSG_WARN([Since you're trying to build mail, you could try adding])
4845         AC_MSG_WARN(['--enable-extensions=default,lightning' to your mozconfig])
4846         AC_MSG_WARN([and building WITH A FRESH TREE.])
4847     fi
4848     AC_MSG_WARN([For more information, please visit:])
4849     AC_MSG_ERROR([http://www.mozilla.org/projects/calendar/])
4852 AC_SUBST(MOZ_CALENDAR)
4854 dnl =========================================================
4855 dnl = Mail & News
4856 dnl =========================================================
4857 MOZ_ARG_DISABLE_BOOL(mailnews,
4858 [  --disable-mailnews      Disable building of mail & news components],
4859     MOZ_MAIL_NEWS=,
4860     MOZ_MAIL_NEWS=1 )
4861 AC_SUBST(MOZ_MAIL_NEWS)
4863 dnl =========================================================
4864 dnl = LDAP
4865 dnl =========================================================
4866 MOZ_ARG_DISABLE_BOOL(ldap,
4867 [  --disable-ldap          Disable LDAP support],
4868     MOZ_LDAP_XPCOM=,
4869     MOZ_LDAP_XPCOM=1)
4871 dnl ========================================================
4872 dnl = Trademarked Branding 
4873 dnl ========================================================
4874 MOZ_ARG_ENABLE_BOOL(official-branding,
4875 [  --enable-official-branding Enable Official mozilla.org Branding
4876                           Do not distribute builds with
4877                           --enable-official-branding unless you have
4878                           permission to use trademarks per
4879                           http://www.mozilla.org/foundation/trademarks/ .],
4880 [case "$MOZ_BUILD_APP" in
4881 browser)
4882     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4883     MOZ_APP_DISPLAYNAME=Firefox
4884     ;;
4886 calendar)
4887     MOZ_BRANDING_DIRECTORY=other-licenses/branding/sunbird
4888     MOZ_APP_DISPLAYNAME=Sunbird
4889     ;;
4891 mail)
4892     MOZ_BRANDING_DIRECTORY=other-licenses/branding/thunderbird
4893     ;;
4896     AC_MSG_ERROR([Official branding is only available for Firefox Sunbird and Thunderbird.])
4897 esac
4900 MOZ_ARG_WITH_STRING(branding,
4901 [  --with-branding=dir    Use branding from the specified directory.],
4902     MOZ_BRANDING_DIRECTORY=$withval)
4904 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4905 if test -z "$REAL_BRANDING_DIRECTORY"; then
4906   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4909 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4910   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4913 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4915 dnl ========================================================
4916 dnl = Distribution ID
4917 dnl ========================================================
4918 MOZ_ARG_WITH_STRING(distribution-id,
4919 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4920 [ val=`echo $withval`
4921     MOZ_DISTRIBUTION_ID="$val"])
4923 if test -z "$MOZ_DISTRIBUTION_ID"; then
4924    MOZ_DISTRIBUTION_ID="org.mozilla"
4927 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4928 AC_SUBST(MOZ_DISTRIBUTION_ID)
4930 dnl ========================================================
4931 dnl = Xft and Pango
4932 dnl ========================================================
4933 if test "$MOZ_ENABLE_GTK2"
4934 then
4935     PKG_CHECK_MODULES(MOZ_XFT, xft)
4936     AC_SUBST(MOZ_XFT_CFLAGS)
4937     AC_SUBST(MOZ_XFT_LIBS)
4939     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4940     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4941     AC_SUBST(MOZ_PANGO_CFLAGS)
4942     AC_SUBST(MOZ_PANGO_LIBS)
4945 dnl ========================================================
4946 dnl = PostScript print module
4947 dnl ========================================================
4948 MOZ_ARG_DISABLE_BOOL(postscript,
4949 [  --disable-postscript    Disable PostScript printing support ],
4950     MOZ_ENABLE_POSTSCRIPT=,
4951     MOZ_ENABLE_POSTSCRIPT=1 )
4953 dnl ========================================================
4954 dnl = GnomeVFS support module
4955 dnl ========================================================
4957 if test "$MOZ_X11"
4958 then
4959     dnl build the gnomevfs extension by default only when the
4960     dnl GTK2 toolkit is in use.
4961     if test "$MOZ_ENABLE_GTK2"
4962     then
4963         MOZ_ENABLE_GNOMEVFS=1
4964         MOZ_ENABLE_GCONF=1
4965         MOZ_ENABLE_LIBGNOME=1
4966     fi
4968     MOZ_ARG_DISABLE_BOOL(gnomevfs,
4969     [  --disable-gnomevfs      Disable GnomeVFS support ],
4970         MOZ_ENABLE_GNOMEVFS=,
4971         MOZ_ENABLE_GNOMEVFS=force)
4973     if test "$MOZ_ENABLE_GNOMEVFS"
4974     then
4975         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4976             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4977             MOZ_ENABLE_GNOMEVFS=1
4978         ],[
4979             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4980             then
4981                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4982             fi
4983             MOZ_ENABLE_GNOMEVFS=
4984         ])
4985     fi
4987     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4988     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4990     if test "$MOZ_ENABLE_GCONF"
4991     then
4992         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
4993             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
4994             MOZ_ENABLE_GCONF=1
4995         ],[
4996             MOZ_ENABLE_GCONF=
4997         ])
4998     fi
5000     if test "$MOZ_ENABLE_GCONF"; then
5001         AC_DEFINE(MOZ_ENABLE_GCONF)
5002     fi
5004     AC_SUBST(MOZ_ENABLE_GCONF)
5005     AC_SUBST(MOZ_GCONF_CFLAGS)
5006     AC_SUBST(MOZ_GCONF_LIBS)
5008     if test "$MOZ_ENABLE_LIBGNOME"
5009     then
5010         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5011             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5012             MOZ_ENABLE_LIBGNOME=1
5013         ],[
5014             MOZ_ENABLE_LIBGNOME=
5015         ])
5016     fi
5018     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5019     AC_SUBST(MOZ_LIBGNOME_LIBS)
5021     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5022     # are all available.
5024     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5025             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5026       MOZ_ENABLE_GNOME_COMPONENT=1
5027     else
5028       MOZ_ENABLE_GNOME_COMPONENT=
5029     fi
5031     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5034 dnl ========================================================
5035 dnl = libgnomeui support module
5036 dnl ========================================================
5038 if test "$MOZ_ENABLE_GTK2"
5039 then
5040     MOZ_ENABLE_GNOMEUI=1
5042     MOZ_ARG_DISABLE_BOOL(gnomeui,
5043     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5044         MOZ_ENABLE_GNOMEUI=,
5045         MOZ_ENABLE_GNOMEUI=force)
5047     if test "$MOZ_ENABLE_GNOMEUI"
5048     then
5049         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5050         [
5051             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5052             MOZ_ENABLE_GNOMEUI=1
5053         ],[
5054             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5055             then
5056                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5057             fi
5058             MOZ_ENABLE_GNOMEUI=
5059         ])
5060     fi
5062     if test "$MOZ_ENABLE_GNOMEUI"; then
5063         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5064     fi
5066 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5067 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5068 AC_SUBST(MOZ_GNOMEUI_LIBS)
5070 dnl ========================================================
5071 dnl = dbus support
5072 dnl ========================================================
5074 if test "$MOZ_ENABLE_GTK2"
5075 then
5076     MOZ_ENABLE_DBUS=1
5078     MOZ_ARG_DISABLE_BOOL(dbus,
5079     [  --disable-dbus       Disable dbus support ],
5080         MOZ_ENABLE_DBUS=,
5081         MOZ_ENABLE_DBUS=1)
5083     if test "$MOZ_ENABLE_DBUS"
5084     then
5085         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5086         AC_DEFINE(MOZ_ENABLE_DBUS)
5087     fi
5089 AC_SUBST(MOZ_ENABLE_DBUS)
5090 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5091 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5093 dnl ========================================================
5094 dnl = Build Personal Security Manager
5095 dnl ========================================================
5096 MOZ_ARG_DISABLE_BOOL(crypto,
5097 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5098     MOZ_PSM=,
5099     MOZ_PSM=1 )
5101 dnl ========================================================
5102 dnl = JS Debugger XPCOM component (js/jsd)
5103 dnl ========================================================
5104 MOZ_ARG_DISABLE_BOOL(jsd,
5105 [  --disable-jsd           Disable JavaScript debug library],
5106     MOZ_JSDEBUGGER=,
5107     MOZ_JSDEBUGGER=1)
5110 dnl ========================================================
5111 dnl = Disable plugin support
5112 dnl ========================================================
5113 MOZ_ARG_DISABLE_BOOL(plugins,
5114 [  --disable-plugins       Disable plugins support],
5115     MOZ_PLUGINS=,
5116     MOZ_PLUGINS=1)
5118 dnl ========================================================
5119 dnl = Open JVM Interface (OJI) support
5120 dnl ========================================================
5121 MOZ_ARG_ENABLE_BOOL(oji,
5122 [  --enable-oji           Enable Open JVM Integration support],
5123     MOZ_OJI=1,
5124     MOZ_OJI=)
5125 if test -n "$MOZ_OJI"; then
5126     AC_DEFINE(OJI)
5129 dnl bi-directional support always on
5130 IBMBIDI=1
5131 AC_DEFINE(IBMBIDI)
5133 dnl ========================================================
5134 dnl complex text support off by default
5135 dnl ========================================================
5136 MOZ_ARG_ENABLE_BOOL(ctl,
5137 [  --enable-ctl            Enable Thai Complex Script support],
5138     SUNCTL=1,
5139     SUNCTL= )
5141 dnl ========================================================
5142 dnl view source support on by default
5143 dnl ========================================================
5144 MOZ_ARG_DISABLE_BOOL(view-source,
5145 [  --disable-view-source     Disable view source support],
5146     MOZ_VIEW_SOURCE=,
5147     MOZ_VIEW_SOURCE=1 )
5148 if test "$MOZ_VIEW_SOURCE"; then
5149     AC_DEFINE(MOZ_VIEW_SOURCE)
5153 dnl ========================================================
5154 dnl accessibility support on by default on all platforms 
5155 dnl except OS X.
5156 dnl ========================================================
5157 MOZ_ARG_DISABLE_BOOL(accessibility,
5158 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5159     ACCESSIBILITY=,
5160     ACCESSIBILITY=1 )
5161 if test "$ACCESSIBILITY"; then
5162     AC_DEFINE(ACCESSIBILITY)
5165 if test -n "$ACCESSIBILITY"; then
5166 case "$target" in
5167 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5168     if test "$ac_cv_header_atlbase_h" = "no"; then
5169         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.])
5170     fi
5171     if test "$ac_cv_header_oleacc_idl" = "no"; then
5172         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.])
5173     fi
5174     ;;
5175 esac
5178 dnl ========================================================
5179 dnl xpfe/components on by default
5180 dnl ========================================================
5181 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5182 [  --disable-xpfe-components
5183                           Disable xpfe components],
5184     MOZ_XPFE_COMPONENTS=,
5185     MOZ_XPFE_COMPONENTS=1 )
5187 dnl ========================================================
5188 dnl xpinstall support on by default
5189 dnl ========================================================
5190 MOZ_ARG_DISABLE_BOOL(xpinstall,
5191 [  --disable-xpinstall     Disable xpinstall support],
5192     MOZ_XPINSTALL=,
5193     MOZ_XPINSTALL=1 )
5194 if test "$MOZ_XPINSTALL"; then
5195     AC_DEFINE(MOZ_XPINSTALL)
5198 dnl ========================================================
5199 dnl xpcom js loader support on by default
5200 dnl ========================================================
5201 MOZ_ARG_DISABLE_BOOL(jsloader,
5202 [  --disable-jsloader      Disable xpcom js loader support],
5203     MOZ_JSLOADER=,
5204     MOZ_JSLOADER=1 )
5205 if test "$MOZ_JSLOADER"; then
5206     AC_DEFINE(MOZ_JSLOADER)
5209 dnl ========================================================
5210 dnl Disable printing
5211 dnl ========================================================
5212 MOZ_ARG_DISABLE_BOOL(printing,
5213 [  --disable-printing  Disable printing support],
5214     NS_PRINTING=,
5215     NS_PRINTING=1 )
5217 if test "$NS_PRINTING"; then
5218     AC_DEFINE(NS_PRINTING)
5219     AC_DEFINE(NS_PRINT_PREVIEW)
5222 dnl ========================================================
5223 dnl use native unicode converters
5224 dnl ========================================================
5225 MOZ_ARG_ENABLE_BOOL(native-uconv,
5226 [  --enable-native-uconv   Enable iconv support],
5227     MOZ_USE_NATIVE_UCONV=1,
5228     MOZ_USE_NATIVE_UCONV= )
5229 if test "$MOZ_USE_NATIVE_UCONV"; then
5230     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5232 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5233     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5237 dnl ========================================================
5238 dnl Libeditor can be build as plaintext-only,
5239 dnl or as a full html and text editing component.
5240 dnl We build both by default.
5241 dnl ========================================================
5242 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5243 [  --enable-plaintext-editor-only
5244                           Allow only plaintext editing],
5245     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5246     MOZ_PLAINTEXT_EDITOR_ONLY= )
5247 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5248 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5250 dnl ========================================================
5251 dnl Composer is on by default.
5252 dnl ========================================================
5253 MOZ_ARG_DISABLE_BOOL(composer,
5254 [  --disable-composer      Disable building of Composer],
5255     MOZ_COMPOSER=,
5256     MOZ_COMPOSER=1 )
5257 AC_SUBST(MOZ_COMPOSER)
5260 dnl ========================================================
5261 dnl = Drop XPCOM Obsolete library
5262 dnl ========================================================
5263 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5264 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5265     MOZ_NO_XPCOM_OBSOLETE=1,
5266     MOZ_NO_XPCOM_OBSOLETE=)
5268 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5269     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5272 dnl ========================================================
5273 dnl = Disable Fast Load
5274 dnl ========================================================
5275 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5276 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5277     MOZ_NO_FAST_LOAD=1,
5278     MOZ_NO_FAST_LOAD=)
5280 AC_SUBST(MOZ_NO_FAST_LOAD)
5282 if test -n "$MOZ_NO_FAST_LOAD"; then
5283     AC_DEFINE(MOZ_NO_FAST_LOAD)
5286 dnl ========================================================
5287 dnl Permissions System
5288 dnl ========================================================
5289 MOZ_ARG_DISABLE_BOOL(permissions,
5290 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5291     MOZ_PERMISSIONS=,
5292     MOZ_PERMISSIONS=1
5295 dnl ========================================================
5296 dnl NegotiateAuth
5297 dnl ========================================================
5298 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5299 [  --disable-negotiateauth Disable GSS-API negotiation ],
5300     MOZ_AUTH_EXTENSION=,
5301     MOZ_AUTH_EXTENSION=1 )
5303 dnl ========================================================
5304 dnl XTF
5305 dnl ========================================================
5306 MOZ_ARG_DISABLE_BOOL(xtf,
5307 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5308     MOZ_XTF=,
5309     MOZ_XTF=1 )
5310 if test "$MOZ_XTF"; then
5311   AC_DEFINE(MOZ_XTF)
5314 dnl ========================================================
5315 dnl Inspector APIs
5316 dnl ========================================================
5317 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5318 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5319     MOZ_NO_INSPECTOR_APIS=1,
5320     MOZ_NO_INSPECTOR_APIS= )
5322 dnl ========================================================
5323 dnl Pref extensions (autoconfig and system-pref)
5324 dnl ========================================================
5325 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5326 [  --disable-pref-extensions
5327                           Disable pref extensions such as autoconfig and
5328                           system-pref],
5329   MOZ_PREF_EXTENSIONS=,
5330   MOZ_PREF_EXTENSIONS=1 )
5332 dnl ========================================================
5333 dnl = Universalchardet
5334 dnl ========================================================
5335 MOZ_ARG_DISABLE_BOOL(universalchardet,
5336 [  --disable-universalchardet
5337                           Disable universal encoding detection],
5338   MOZ_UNIVERSALCHARDET=,
5339   MOZ_UNIVERSALCHARDET=1 )
5341 dnl ========================================================
5342 dnl JavaXPCOM
5343 dnl ========================================================
5344 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5345 [  --enable-javaxpcom
5346                           Enable Java-XPCOM bridge],
5347     MOZ_JAVAXPCOM=1,
5348     MOZ_JAVAXPCOM= )
5350 if test -n "${MOZ_JAVAXPCOM}"; then
5351   case "$host_os" in
5352     cygwin*|msvc*|mks*)
5353       if test -n "$JAVA_HOME"; then
5354         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5355       fi
5356       ;;
5357     *mingw*)
5358       if test -n "$JAVA_HOME"; then
5359         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5360       fi
5361       ;;
5362   esac
5364   if test -n "${JAVA_INCLUDE_PATH}"; then
5365     dnl Make sure jni.h exists in the given include path.
5366     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5367       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5368     fi
5369   else
5370     case "$target_os" in
5371       darwin*)
5372         dnl Default to java system location
5373         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5374         ;;
5375       *)
5376         dnl Try $JAVA_HOME
5377         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5378         ;;
5379     esac
5380     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5381       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.])
5382     fi
5383   fi
5385   if test -n "${JAVA_BIN_PATH}"; then
5386     dnl Look for javac and jar in the specified path.
5387     JAVA_PATH="$JAVA_BIN_PATH"
5388   else
5389     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5390     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5391   fi
5393   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5394   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5395   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5396   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5397     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.])
5398   fi
5401 dnl ========================================================
5402 dnl = Breakpad crash reporting (on by default on supported platforms)
5403 dnl ========================================================
5405 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5406     || test "$OS_ARCH" = "Darwin" \
5407     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5408     || test "$OS_ARCH" = "SunOS") \
5409    && test -z "$HAVE_64BIT_OS"; then
5410    MOZ_CRASHREPORTER=1
5413 MOZ_ARG_DISABLE_BOOL(crashreporter,
5414 [  --disable-crashreporter          Disable breakpad crash reporting],
5415     MOZ_CRASHREPORTER=,
5416     MOZ_CRASHREPORTER=1)
5418 if test -n "$MOZ_CRASHREPORTER"; then
5419    AC_DEFINE(MOZ_CRASHREPORTER)
5421   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5422     test -z "$SKIP_LIBRARY_CHECKS"; then
5423     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5424     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5425     AC_SUBST(MOZ_GTHREAD_LIBS)
5427     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.])])
5428   fi
5431 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5432 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5433 [ val=`echo $withval | sed 's/[^0-9]//g'`
5434     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5436 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5437    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5439 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5442 dnl ========================================================
5443 dnl = Build mochitest JS/DOM tests (on by default)
5444 dnl ========================================================
5445 MOZ_ARG_DISABLE_BOOL(mochitest,
5446 [  --disable-mochitest        Disable mochitest harness],
5447     MOZ_MOCHITEST=,
5448     MOZ_MOCHITEST=1 )
5450 dnl ========================================================
5451 dnl = Enable compilation of specific extension modules
5452 dnl ========================================================
5454 MOZ_ARG_ENABLE_STRING(extensions,
5455 [  --enable-extensions     Enable extensions],
5456 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5457     if test "$option" = "yes" || test "$option" = "all"; then
5458         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5459     elif test "$option" = "no" || test "$option" = "none"; then
5460         MOZ_EXTENSIONS=""
5461     elif test "$option" = "default"; then
5462         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5463     elif test `echo "$option" | grep -c \^-` != 0; then
5464         option=`echo $option | sed 's/^-//'`
5465         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5466     else
5467         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5468     fi
5469 done],
5470     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5472 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5473     # Suppress warning on non-X11 platforms
5474     if test -n "$MOZ_X11"; then
5475         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5476     fi
5477     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5480 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5481     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5482     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5485 dnl This might be temporary: build tridentprofile only on Windows
5486 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5487     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5488     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5491 dnl cookie must be built before tridentprofile. put it at list's end.
5492 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5493   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5494   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5497 dnl xforms requires xtf and schema-validation
5498 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5499     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5500     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5502 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5503     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5504     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5507 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5508     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5509     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5512 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5513     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5514     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5517 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5518     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5519     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5522 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5523     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5524     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5527 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5528     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5529     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5532 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5533     AC_MSG_WARN([spellcheck is no longer an extension.])
5534     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5537 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5538     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5539     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5542 dnl Remove dupes
5543 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5545 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5546 dnl when trying to build a non-existent extension.
5547 for extension in $MOZ_EXTENSIONS; do
5548     if test ! -d "${srcdir}/extensions/${extension}"; then
5549         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5550     fi
5551 done
5554 dnl ========================================================
5555 dnl Image decoders
5556 dnl ========================================================
5557 case "$MOZ_WIDGET_TOOLKIT" in
5558 beos|windows|os2|mac|cocoa)
5559     ;;
5561     if test -z "$MOZ_ENABLE_GTK2"; then
5562        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
5563     fi
5564     ;;
5565 esac
5567 MOZ_ARG_ENABLE_STRING(image-decoders,
5568 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5569                           Enable specific image decoders],
5570 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5571     if test "$option" = "yes" || test "$option" = "all"; then
5572         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5573     elif test "$option" = "no" || test "$option" = "none"; then
5574         MOZ_IMG_DECODERS=""
5575     elif test "$option" = "default"; then
5576         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5577     elif test `echo "$option" | grep -c \^-` != 0; then
5578         option=`echo $option | sed 's/^-//'`
5579         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5580     else
5581         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5582     fi
5583 done],
5584     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5586 dnl Dupes are removed in the encoder section because it will also add decoders
5588 dnl ========================================================
5589 dnl Image encoders
5590 dnl ========================================================
5591 MOZ_ARG_ENABLE_STRING(image-encoders,
5592 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5593                           Enable specific image encoders],
5594 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5595     if test "$option" = "yes" || test "$option" = "all"; then
5596         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5597     elif test "$option" = "no" || test "$option" = "none"; then
5598         MOZ_IMG_ENCODERS=""
5599         addencoder=""
5600     elif test "$option" = "default"; then
5601         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5602     elif test `echo "$option" | grep -c \^-` != 0; then
5603         option=`echo $option | sed 's/^-//'`
5604         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5605     else
5606         addencoder="$option"
5607     fi
5608     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5609 done],
5610     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5612 dnl Remove dupes
5613 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5614 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5616 dnl ========================================================
5617 dnl experimental ldap features
5618 dnl ========================================================
5619 MOZ_ARG_ENABLE_BOOL(ldap-experimental,
5620 [  --enable-ldap-experimental
5621                           Enable LDAP experimental features],
5622     MOZ_LDAP_XPCOM_EXPERIMENTAL=1,
5623     MOZ_LDAP_XPCOM_EXPERIMENTAL=)
5625 dnl ========================================================
5626 dnl MathML on by default
5627 dnl ========================================================
5628 MOZ_ARG_DISABLE_BOOL(mathml,
5629 [  --disable-mathml        Disable MathML support],
5630     MOZ_MATHML=,
5631     MOZ_MATHML=1 )
5632 if test "$MOZ_MATHML"; then
5633   AC_DEFINE(MOZ_MATHML)
5636 dnl ========================================================
5637 dnl Canvas
5638 dnl ========================================================
5639 MOZ_ARG_DISABLE_BOOL(canvas,
5640 [  --disable-canvas          Disable html:canvas feature],
5641     MOZ_ENABLE_CANVAS=,
5642     MOZ_ENABLE_CANVAS=1 )
5643 if test -n "$MOZ_ENABLE_CANVAS"; then
5644     AC_DEFINE(MOZ_ENABLE_CANVAS)
5646 AC_SUBST(MOZ_ENABLE_CANVAS)
5648 dnl ========================================================
5649 dnl SVG
5650 dnl ========================================================
5651 MOZ_ARG_DISABLE_BOOL(svg,
5652 [  --disable-svg            Disable SVG support],
5653     MOZ_SVG=,
5654     MOZ_SVG=1 )
5655 if test -n "$MOZ_SVG"; then
5656   AC_DEFINE(MOZ_SVG)
5659 MOZ_SVG_FOREIGNOBJECT=1
5660 dnl ========================================================
5661 dnl SVG <foreignObject>
5662 dnl ========================================================
5663 MOZ_ARG_DISABLE_BOOL(svg-foreignobject,
5664    [  --disable-svg-foreignobject
5665                         Disable SVG <foreignObject> support],
5666    MOZ_SVG_FOREIGNOBJECT=,
5667    MOZ_SVG_FOREIGNOBJECT=1 )
5668 if test "$MOZ_SVG_FOREIGNOBJECT"; then
5669   if test "$MOZ_SVG"; then
5670     AC_DEFINE(MOZ_SVG_FOREIGNOBJECT)
5671   else
5672     MOZ_SVG_FOREIGNOBEJCT=
5673   fi
5676 dnl ========================================================
5677 dnl Installer
5678 dnl ========================================================
5679 case "$target_os" in
5680     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5681         MOZ_INSTALLER=1
5682         ;;
5683 esac
5685 MOZ_ARG_DISABLE_BOOL(installer,
5686 [  --disable-installer     Disable building of installer],
5687     MOZ_INSTALLER=,
5688     MOZ_INSTALLER=1 )
5689 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5690     # Disable installer for Windows builds that use the new toolkit if NSIS
5691     # isn't in the path.
5692     AC_PATH_PROGS(MAKENSIS, makensis)
5693     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5694         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5695     fi
5696     # The Windows build for NSIS requires the iconv command line utility to
5697     # convert the charset of the locale files.
5698     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5699     if test -z "$HOST_ICONV"; then
5700         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5701     fi
5704 # Automatically disable installer if xpinstall isn't built
5705 if test -z "$MOZ_XPINSTALL"; then
5706     MOZ_INSTALLER=
5708 AC_SUBST(MOZ_INSTALLER)
5710 AC_MSG_CHECKING([for tar archiver])
5711 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5712 if test -z "$TAR"; then
5713     AC_MSG_ERROR([no tar archiver found in \$PATH])
5715 AC_MSG_RESULT([$TAR])
5716 AC_SUBST(TAR)
5718 dnl ========================================================
5719 dnl Updater
5720 dnl ========================================================
5722 MOZ_ARG_DISABLE_BOOL(updater,
5723 [  --disable-updater       Disable building of updater],
5724     MOZ_UPDATER=,
5725     MOZ_UPDATER=1 )
5726 # The Windows build requires the iconv command line utility
5727 # in order to build the updater.
5728 case "$target_os" in
5729     msvc*|mks*|cygwin*|mingw*|wince*)
5730         if test -n "$MOZ_UPDATER"; then
5731             AC_MSG_CHECKING([for iconv])
5732             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5733             if test -z "$HOST_ICONV"; then
5734                 AC_MSG_ERROR([iconv not found in \$PATH])
5735             fi
5736         fi
5737         ;;
5738 esac
5739 AC_SUBST(MOZ_UPDATER)
5741 # app update channel is 'default' when not supplied.
5742 MOZ_ARG_ENABLE_STRING([update-channel],
5743 [  --enable-update-channel=CHANNEL
5744                            Select application update channel (default=default)],
5745     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5747 if test -z "$MOZ_UPDATE_CHANNEL"; then
5748     MOZ_UPDATE_CHANNEL=default
5750 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5752 # tools/update-packaging is not checked out by default.
5753 MOZ_ARG_ENABLE_BOOL(update-packaging,
5754 [  --enable-update-packaging
5755                            Enable tools/update-packaging],
5756     MOZ_UPDATE_PACKAGING=1,
5757     MOZ_UPDATE_PACKAGING= )
5758 AC_SUBST(MOZ_UPDATE_PACKAGING)
5760 dnl ========================================================
5761 dnl ActiveX
5762 dnl ========================================================
5764 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5765 [  --disable-xpconnect-idispatch
5766                           Disable building of xpconnect support for IDispatch
5767                           (win32 only)],
5768     XPC_IDISPATCH_SUPPORT=,
5769     XPC_IDISPATCH_SUPPORT=1)
5770 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5772 MOZ_ARG_DISABLE_BOOL(activex,
5773 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5774     MOZ_NO_ACTIVEX_SUPPORT=1,
5775     MOZ_NO_ACTIVEX_SUPPORT= )
5776 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5778 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5779 [  --disable-activex-scripting
5780                           Disable building of ActiveX scripting support (win32)],
5781     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5782     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5783 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5785 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5786 then
5787     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5790 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5791 case "$target" in
5792 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5793     if test "$ac_cv_header_atlbase_h" = "no"; then
5794         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.])
5795     fi
5796     ;;
5797 esac
5800 dnl ========================================================
5801 dnl leaky
5802 dnl ========================================================
5803 MOZ_ARG_ENABLE_BOOL(leaky,
5804 [  --enable-leaky          Build leaky memory tool],
5805     MOZ_LEAKY=1,
5806     MOZ_LEAKY=)
5809 dnl ========================================================
5810 dnl xpctools
5811 dnl ========================================================
5812 MOZ_ARG_ENABLE_BOOL(xpctools,
5813 [  --enable-xpctools       Build JS profiling tool],
5814     MOZ_XPCTOOLS=1,
5815     MOZ_XPCTOOLS= )
5818 dnl ========================================================
5819 dnl build the tests by default
5820 dnl ========================================================
5821 MOZ_ARG_DISABLE_BOOL(tests,
5822 [  --disable-tests         Do not build test libraries & programs],
5823     ENABLE_TESTS=,
5824     ENABLE_TESTS=1 )
5826 dnl ========================================================
5827 dnl parental controls (for Windows Vista)
5828 dnl ========================================================
5829 MOZ_ARG_DISABLE_BOOL(parental-controls,
5830 [  --disable-parental-controls
5831                            Do not build parental controls],
5832    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5833    MOZ_DISABLE_PARENTAL_CONTROLS=)
5834 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5835     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5838 dnl ========================================================
5839 dnl Vista SDK specific api
5840 dnl ========================================================
5841 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5842 [  --disable-vista-sdk-requirements
5843                            Do not build Vista SDK specific code],
5844    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5845    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5846 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5847     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5848     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5849     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5850         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5851     fi
5852     MOZ_DISABLE_PARENTAL_CONTROLS=1
5853 else
5854 case "$target" in
5855 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5856     if test "$ac_cv_header_wpcapi_h" = "no"; then
5857         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.])
5858     fi
5859     ;;
5860 esac
5862 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5863 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5865 dnl ========================================================
5866 dnl =
5867 dnl = Module specific options
5868 dnl =
5869 dnl ========================================================
5870 MOZ_ARG_HEADER(Individual module options)
5872 dnl ========================================================
5873 dnl = Enable Lea malloc in xpcom. OFF by default.
5874 dnl ========================================================
5875 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5876 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5877     XPCOM_USE_LEA=1,
5878     XPCOM_USE_LEA= )
5879 if test -n "$XPCOM_USE_LEA"; then
5880     AC_DEFINE(XPCOM_USE_LEA)
5883 dnl ========================================================
5884 dnl = Enable places (new history/bookmarks)
5885 dnl ========================================================
5886 MOZ_ARG_ENABLE_BOOL(places,
5887 [  --enable-places        Enable 'places' bookmark/history implementation],
5888     MOZ_PLACES=1,
5889     MOZ_PLACES= )
5890 if test -n "$MOZ_PLACES"; then
5891     AC_DEFINE(MOZ_PLACES)
5892     if test -z "$MOZ_MAIL_NEWS"; then
5893       MOZ_MORK=
5894     fi
5895     MOZ_MORKREADER=1
5896 else
5897   if test "$MOZ_BUILD_APP" = "browser"; then
5898     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5899   fi
5902 dnl ========================================================
5903 dnl = Disable feed handling components
5904 dnl ========================================================
5905 MOZ_ARG_DISABLE_BOOL(feeds,
5906 [  --disable-feeds        Disable feed handling and processing components],
5907     MOZ_FEEDS=,
5908     MOZ_FEEDS=1 )
5909 if test -n "$MOZ_FEEDS"; then
5910     AC_DEFINE(MOZ_FEEDS)
5911 else
5912     if test "$MOZ_BUILD_APP" = "browser"; then
5913         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5914     fi
5917 dnl ========================================================
5918 dnl = Enable mozStorage
5919 dnl ========================================================
5920 dnl Implicitly enabled by default if building calendar or places
5921 MOZ_ARG_ENABLE_BOOL(storage,
5922 [  --enable-storage        Enable mozStorage module and related components],
5923     MOZ_STORAGE=1,
5924     MOZ_STORAGE= )
5925 if test -n "$MOZ_STORAGE"; then
5926     AC_DEFINE(MOZ_STORAGE)
5929 dnl ========================================================
5930 dnl Check for sqlite
5931 dnl ========================================================
5933 MOZ_NATIVE_SQLITE=
5934 MOZ_ARG_ENABLE_BOOL(system-sqlite,
5935 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
5936 MOZ_NATIVE_SQLITE=1,
5937 MOZ_NATIVE_SQLITE= )
5939 if test -z "$MOZ_NATIVE_SQLITE"
5940 then
5941     SQLITE_CFLAGS=
5942     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
5943 else
5944     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
5947 AC_SUBST(MOZ_NATIVE_SQLITE)
5949 dnl = Enable help viewer (off by default)
5950 dnl ========================================================
5951 MOZ_ARG_ENABLE_BOOL(help-viewer,
5952 [  --enable-help-viewer        Enable help viewer],
5953     MOZ_HELP_VIEWER=1,
5954     MOZ_HELP_VIEWER= )
5955 if test -n "$MOZ_HELP_VIEWER"; then
5956      AC_DEFINE(MOZ_HELP_VIEWER)
5958 AC_SUBST(MOZ_HELP_VIEWER)
5960 dnl ========================================================
5961 dnl = Enable safe browsing (anti-phishing)
5962 dnl ========================================================
5963 MOZ_ARG_ENABLE_BOOL(safe-browsing,
5964 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
5965     MOZ_SAFE_BROWSING=1,
5966     MOZ_SAFE_BROWSING= )
5967 if test -n "$MOZ_SAFE_BROWSING"; then
5968     AC_DEFINE(MOZ_SAFE_BROWSING)
5970 AC_SUBST(MOZ_SAFE_BROWSING)
5972 dnl ========================================================
5973 dnl = Enable url-classifier
5974 dnl ========================================================
5975 dnl Implicitly enabled by default if building with safe-browsing
5976 if test -n "$MOZ_SAFE_BROWSING"; then
5977     MOZ_URL_CLASSIFIER=1
5979 MOZ_ARG_ENABLE_BOOL(url-classifier,
5980 [  --enable-url-classifier        Enable url classifier module],
5981     MOZ_URL_CLASSIFIER=1,
5982     MOZ_URL_CLASSIFIER= )
5983 if test -n "$MOZ_URL_CLASSIFIER"; then
5984     AC_DEFINE(MOZ_URL_CLASSIFIER)
5986 AC_SUBST(MOZ_URL_CLASSIFIER)
5988 dnl ========================================================
5989 dnl = Disable zipwriter
5990 dnl ========================================================
5991 MOZ_ARG_DISABLE_BOOL(zipwriter,
5992 [  --disable-zipwriter             Disable zipwriter component],
5993     MOZ_ZIPWRITER=,
5994     MOZ_ZIPWRITER=1 )
5995 AC_SUBST(MOZ_ZIPWRITER)
5997 dnl ========================================================
5998 dnl = Enable Ultrasparc specific optimizations for JS
5999 dnl ========================================================
6000 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6001 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6002     JS_ULTRASPARC_OPTS=1,
6003     JS_ULTRASPARC_OPTS= )
6005 dnl only enable option for ultrasparcs
6006 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6007     "$OS_TEST" != "sun4u"; then
6008     JS_ULTRASPARC_OPTS=
6010 AC_SUBST(JS_ULTRASPARC_OPTS)
6012 dnl ========================================================
6013 dnl =
6014 dnl = Feature options that require extra sources to be pulled
6015 dnl =
6016 dnl ========================================================
6017 dnl MOZ_ARG_HEADER(Features that require extra sources)
6019 dnl ========================================================
6020 dnl =
6021 dnl = Debugging Options
6022 dnl = 
6023 dnl ========================================================
6024 MOZ_ARG_HEADER(Debugging and Optimizations)
6026 dnl ========================================================
6027 dnl = Disable building with debug info.
6028 dnl = Debugging is OFF by default
6029 dnl ========================================================
6030 if test -z "$MOZ_DEBUG_FLAGS"
6031 then
6032     case "$target" in
6033     *-irix*)
6034         if test "$GNU_CC"; then
6035             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6036             case "$GCC_VERSION" in
6037             2.95.*)
6038                 MOZ_DEBUG_FLAGS=""
6039                 ;;
6040             *)
6041                 MOZ_DEBUG_FLAGS="-g"
6042                 ;;
6043             esac
6044         else
6045             MOZ_DEBUG_FLAGS="-g"
6046         fi
6047         ;;
6048     *)
6049         MOZ_DEBUG_FLAGS="-g"
6050         ;;
6051     esac
6054 MOZ_ARG_ENABLE_STRING(debug,
6055 [  --enable-debug[=DBG]    Enable building with developer debug info
6056                           (Using compiler flags DBG)],
6057 [ if test "$enableval" != "no"; then
6058     MOZ_DEBUG=1
6059     if test -n "$enableval" && test "$enableval" != "yes"; then
6060         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6061     fi
6062   else
6063     MOZ_DEBUG=
6064   fi ],
6065   MOZ_DEBUG=)
6067 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6068  case "${target_os}" in
6069     beos*)
6070         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6071         ;;
6072     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6073         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6074         ;;
6075     *) 
6076         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6077         ;;
6078   esac
6079 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6081 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6083 if test -n "$MOZ_DEBUG"; then
6084     AC_MSG_CHECKING([for valid debug flags])
6085     _SAVE_CFLAGS=$CFLAGS
6086     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6087     AC_TRY_COMPILE([#include <stdio.h>], 
6088         [printf("Hello World\n");],
6089         _results=yes,
6090         _results=no)
6091     AC_MSG_RESULT([$_results])
6092     if test "$_results" = "no"; then
6093         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6094     fi
6095     CFLAGS=$_SAVE_CFLAGS
6098 dnl ========================================================
6099 dnl = Enable code optimization. ON by default.
6100 dnl ========================================================
6101 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6102         MOZ_OPTIMIZE_FLAGS="-O"
6105 MOZ_ARG_ENABLE_STRING(optimize,
6106 [  --disable-optimize      Disable compiler optimization
6107   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6108 [ if test "$enableval" != "no"; then
6109     MOZ_OPTIMIZE=1
6110     if test -n "$enableval" && test "$enableval" != "yes"; then
6111         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6112         MOZ_OPTIMIZE=2
6113     fi
6114 else
6115     MOZ_OPTIMIZE=
6116 fi ], MOZ_OPTIMIZE=1)
6118 if test "$COMPILE_ENVIRONMENT"; then
6119 if test -n "$MOZ_OPTIMIZE"; then
6120     AC_MSG_CHECKING([for valid optimization flags])
6121     _SAVE_CFLAGS=$CFLAGS
6122     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6123     AC_TRY_COMPILE([#include <stdio.h>], 
6124         [printf("Hello World\n");],
6125         _results=yes,
6126         _results=no)
6127     AC_MSG_RESULT([$_results])
6128     if test "$_results" = "no"; then
6129         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6130     fi
6131     CFLAGS=$_SAVE_CFLAGS
6133 fi # COMPILE_ENVIRONMENT
6135 AC_SUBST(MOZ_OPTIMIZE)
6136 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6137 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6138 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6140 dnl ========================================================
6141 dnl = Enable/disable debug for specific modules only
6142 dnl =   module names beginning with ^ will be disabled 
6143 dnl ========================================================
6144 MOZ_ARG_ENABLE_STRING(debug-modules,
6145 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6146 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6148 dnl ========================================================
6149 dnl = Enable/disable generation of debugger info for specific modules only
6150 dnl =    the special module name ALL_MODULES can be used to denote all modules
6151 dnl =    module names beginning with ^ will be disabled
6152 dnl ========================================================
6153 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6154 [  --enable-debugger-info-modules
6155                           Enable/disable debugger info for specific modules],
6156 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6157       dnl note that the list of module names is reversed as it is copied
6158       dnl this is important, as it will allow config.mk to interpret stuff like
6159       dnl "^ALL_MODULES xpcom" properly
6160       if test "$i" = "no"; then
6161         i="^ALL_MODULES"
6162       fi
6163       if test "$i" = "yes"; then
6164         i="ALL_MODULES"
6165       fi
6166       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6167     done ])
6169 dnl ========================================================
6170 dnl Enable garbage collector
6171 dnl ========================================================
6172 MOZ_ARG_ENABLE_BOOL(boehm,
6173 [  --enable-boehm          Enable the Boehm Garbage Collector],
6174     GC_LEAK_DETECTOR=1,
6175     GC_LEAK_DETECTOR= )
6176 if test -n "$GC_LEAK_DETECTOR"; then
6177     AC_DEFINE(GC_LEAK_DETECTOR)
6180 dnl ========================================================
6181 dnl Disable runtime logging checks
6182 dnl ========================================================
6183 MOZ_ARG_DISABLE_BOOL(logging,
6184 [  --disable-logging       Disable logging facilities],
6185     NS_DISABLE_LOGGING=1,
6186     NS_DISABLE_LOGGING= )
6187 if test "$NS_DISABLE_LOGGING"; then
6188     AC_DEFINE(NS_DISABLE_LOGGING)
6189 else
6190     AC_DEFINE(MOZ_LOGGING)
6193 dnl ========================================================
6194 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6195 dnl ========================================================
6196 _ENABLE_LOGREFCNT=42
6197 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6198 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6199     _ENABLE_LOGREFCNT=1,
6200     _ENABLE_LOGREFCNT= )
6201 if test "$_ENABLE_LOGREFCNT" = "1"; then
6202     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6203 elif test -z "$_ENABLE_LOGREFCNT"; then
6204     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6207 dnl ========================================================
6208 dnl = Enable trace malloc
6209 dnl ========================================================
6210 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6211 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6212 [  --enable-trace-malloc   Enable malloc tracing],
6213     NS_TRACE_MALLOC=1,
6214     NS_TRACE_MALLOC= )
6215 if test "$NS_TRACE_MALLOC"; then
6216   # Please, Mr. Linker Man, don't take away our symbol names
6217   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6218   USE_ELF_DYNSTR_GC=
6219   AC_DEFINE(NS_TRACE_MALLOC)
6221 AC_SUBST(NS_TRACE_MALLOC)
6223 dnl ========================================================
6224 dnl = Enable jemalloc
6225 dnl ========================================================
6226 MOZ_ARG_ENABLE_BOOL(jemalloc,
6227 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6228     MOZ_MEMORY=1,
6229     MOZ_MEMORY=)
6231 if test "$NS_TRACE_MALLOC"; then
6232     MOZ_MEMORY=
6235 if test "$MOZ_MEMORY"; then
6237   dnl Don't try to run compiler tests on Windows  
6238   if test "$OS_ARCH" = "WINNT"; then
6239     if test -z "$HAVE_64BIT_OS"; then
6240       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6241     else
6242       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6243     fi
6244   else
6245     AC_CHECK_SIZEOF([int *], [4])
6246     case "${ac_cv_sizeof_int_p}" in
6247     4)
6248       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6249       ;;
6250     8)
6251       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6252       ;;
6253     *)
6254       AC_MSG_ERROR([Unexpected pointer size])
6255       ;;
6256     esac
6257   fi
6259   AC_DEFINE(MOZ_MEMORY)
6260   if test "x$MOZ_DEBUG" = "x1"; then
6261     AC_DEFINE(MOZ_MEMORY_DEBUG)
6262   fi
6263   dnl The generic feature tests that determine how to compute ncpus are long and
6264   dnl complicated.  Therefore, simply define special cpp variables for the
6265   dnl platforms we have special knowledge of.
6266   case "${target_os}" in
6267   darwin*)
6268     AC_DEFINE(MOZ_MEMORY_DARWIN)
6269     ;;
6270   *-freebsd*)
6271     AC_DEFINE(MOZ_MEMORY_BSD)
6272     ;;
6273   *linux*)
6274     AC_DEFINE(MOZ_MEMORY_LINUX)
6275     ;;
6276   netbsd*)
6277     AC_DEFINE(MOZ_MEMORY_BSD)
6278     ;;
6279   solaris*)
6280     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6281     ;;
6282   msvc*|mks*|cygwin*|mingw*)
6283     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6284     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6285     dnl will fail miserably
6286     if test "$_CC_SUITE" -lt "8"; then
6287         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6288     fi
6289     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6290       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6291         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.])
6292       else
6293         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6294       fi
6295     fi
6296     if test -z "$WIN32_CRT_SRC_DIR"; then
6297       # pre-built dll
6298       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6299       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6300     else
6301       # CRT source directory
6302       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6303       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6304       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6305     fi
6306     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6307     dnl are to avoid m4
6308     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6309     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6310     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6311     dnl This needs to be unix style.
6312     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6313     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6314     AC_DEFINE(_STATIC_CPPLIB)
6315     dnl Don't generate a manifest, since we're linking to a custom CRT.
6316     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6317     dnl Also pass this to NSPR/NSS
6318     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6319     export DLLFLAGS
6320     ;;
6321   *)
6322     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6323     ;;
6324   esac
6326   AC_ARG_WITH([valgrind],
6327     [  --with-valgrind         Enable valgrind integration hooks],
6328     [enable_valgrind="yes"], [enable_valgrind="no"])
6329   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6330   if test "x$enable_valgrind" = "xyes" ; then
6331     AC_DEFINE(MOZ_VALGRIND)
6332   fi
6334 AC_SUBST(MOZ_MEMORY)
6335 AC_SUBST(WIN32_CRT_SRC_DIR)
6336 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6337 AC_SUBST(MOZ_LIB)
6338 AC_SUBST(MOZ_PATH)
6339 dnl Need to set this for make because NSS doesn't have configure
6340 AC_SUBST(DLLFLAGS)
6342 dnl ========================================================
6343 dnl = Use malloc wrapper lib
6344 dnl ========================================================
6345 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6346 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6347     _WRAP_MALLOC=1,
6348     _WRAP_MALLOC= )
6350 if test -n "$_WRAP_MALLOC"; then
6351     if test "$GNU_CC"; then
6352     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"
6353     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6354     fi
6357 dnl ========================================================
6358 dnl = Location of malloc wrapper lib
6359 dnl ========================================================
6360 MOZ_ARG_WITH_STRING(wrap-malloc,
6361 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6362     WRAP_MALLOC_LIB=$withval)
6364 dnl ========================================================
6365 dnl = Use Electric Fence
6366 dnl ========================================================
6367 MOZ_ARG_ENABLE_BOOL(efence,
6368 [  --enable-efence         Link with Electric Fence],
6369     _ENABLE_EFENCE=1,
6370     _ENABLE_EFENCE= )
6371 if test -n "$_ENABLE_EFENCE"; then
6372     AC_CHECK_LIB(efence,malloc)
6375 dnl ========================================================
6376 dnl jprof
6377 dnl ========================================================
6378 MOZ_ARG_ENABLE_BOOL(jprof,
6379 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6380     MOZ_JPROF=1,
6381     MOZ_JPROF= )
6382 if test -n "$MOZ_JPROF"; then
6383     AC_DEFINE(MOZ_JPROF)
6386 dnl ========================================================
6387 dnl shark
6388 dnl ========================================================
6389 MOZ_ARG_ENABLE_BOOL(shark,
6390 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6391     MOZ_SHARK=1,
6392     MOZ_SHARK= )
6393 if test -n "$MOZ_SHARK"; then
6394     AC_DEFINE(MOZ_SHARK)
6397 dnl ========================================================
6398 dnl = Enable static checking using gcc-dehydra
6399 dnl ========================================================
6401 MOZ_ARG_WITH_STRING(static-checking,
6402 [  --with-static-checking=path/to/gcc_dehydra.so
6403                             Enable static checking of code using GCC-dehydra],
6404     DEHYDRA_PATH=$withval,
6405     DEHYDRA_PATH= )
6407 if test -n "$DEHYDRA_PATH"; then
6408     if ! test -f "$DEHYDRA_PATH"; then
6409         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6410     fi
6411     AC_DEFINE(NS_STATIC_CHECKING)
6413 AC_SUBST(DEHYDRA_PATH)
6415 dnl ========================================================
6416 dnl = Enable stripping of libs & executables
6417 dnl ========================================================
6418 MOZ_ARG_ENABLE_BOOL(strip,
6419 [  --enable-strip          Enable stripping of libs & executables ],
6420     ENABLE_STRIP=1,
6421     ENABLE_STRIP= )
6423 dnl ========================================================
6424 dnl = Enable stripping of libs & executables when packaging
6425 dnl ========================================================
6426 MOZ_ARG_ENABLE_BOOL(install-strip,
6427 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6428     PKG_SKIP_STRIP= ,
6429     PKG_SKIP_STRIP=1)
6431 dnl ========================================================
6432 dnl = --enable-elf-dynstr-gc
6433 dnl ========================================================
6434 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6435 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6436     USE_ELF_DYNSTR_GC=1,
6437     USE_ELF_DYNSTR_GC= )
6439 dnl ========================================================
6440 dnl = --enable-old-abi-compat-wrappers
6441 dnl ========================================================
6442 dnl on x86 linux, the current builds of some popular plugins (notably
6443 dnl flashplayer and real) expect a few builtin symbols from libgcc
6444 dnl which were available in some older versions of gcc.  However,
6445 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6446 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6447 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6448 dnl to true on x86 linux, and false everywhere else.
6451 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6452 [  --enable-old-abi-compat-wrappers
6453                           Support old GCC ABI symbols to ease the pain 
6454                           of the linux compiler change],
6455     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6456     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6457 if test "$COMPILE_ENVIRONMENT"; then
6458 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6459     AC_LANG_SAVE
6460     AC_LANG_CPLUSPLUS
6461     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6462     AC_LANG_RESTORE
6463     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6465 fi # COMPILE_ENVIRONMENT
6467 dnl ========================================================
6468 dnl = --enable-prebinding
6469 dnl ========================================================
6470 MOZ_ARG_ENABLE_BOOL(prebinding,
6471 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6472     USE_PREBINDING=1,
6473     USE_PREBINDING= )
6475 dnl ========================================================
6476 dnl = 
6477 dnl = Profiling and Instrumenting
6478 dnl = 
6479 dnl ========================================================
6480 MOZ_ARG_HEADER(Profiling and Instrumenting)
6482 dnl ========================================================
6483 dnl = Enable timeline service, which provides lightweight
6484 dnl = instrumentation of mozilla for performance measurement.
6485 dnl = Timeline is off by default.
6486 dnl ========================================================
6487 MOZ_ARG_ENABLE_BOOL(timeline,
6488 [  --enable-timeline       Enable timeline services ],
6489     MOZ_TIMELINE=1,
6490     MOZ_TIMELINE= )
6491 if test -n "$MOZ_TIMELINE"; then
6492     AC_DEFINE(MOZ_TIMELINE)
6495 dnl ========================================================
6496 dnl Turn on reflow counting
6497 dnl ========================================================
6498 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6499 [  --enable-reflow-perf    Enable reflow performance tracing],
6500     MOZ_REFLOW_PERF=1,
6501     MOZ_REFLOW_PERF= )
6502 if test -n "$MOZ_REFLOW_PREF"; then
6503     AC_DEFINE(MOZ_REFLOW_PREF)
6505 AC_SUBST(MOZ_REFLOW_PERF)
6507 dnl ========================================================
6508 dnl Enable performance metrics.
6509 dnl ========================================================
6510 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6511 [  --enable-perf-metrics   Enable performance metrics],
6512     MOZ_PERF_METRICS=1,
6513     MOZ_PERF_METRICS= )
6514 if test -n "$MOZ_PERF_METRICS"; then
6515     AC_DEFINE(MOZ_PERF_METRICS)
6518 dnl ========================================================
6519 dnl Enable code size metrics.
6520 dnl ========================================================
6521 MOZ_ARG_ENABLE_BOOL(codesighs,
6522 [  --enable-codesighs      Enable code size analysis tools],
6523     _ENABLE_CODESIGHS=1,
6524     _ENABLE_CODESIGHS= )
6525 if test -n "$_ENABLE_CODESIGHS"; then
6526     if test -d $srcdir/tools/codesighs; then 
6527         MOZ_MAPINFO=1
6528     else
6529         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6530     fi
6533 dnl ========================================================
6534 dnl = Add support for Eazel profiler
6535 dnl ========================================================
6536 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6537 [  --enable-eazel-profiler-support
6538                           Enable Corel/Eazel profiler support],
6539     ENABLE_EAZEL_PROFILER=1,
6540     ENABLE_EAZEL_PROFILER= )
6541 if test -n "$ENABLE_EAZEL_PROFILER"; then
6542     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6543     USE_ELF_DYNSTR_GC=
6544     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6545     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6546     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6549 MOZ_ARG_ENABLE_STRING(profile-modules,
6550 [  --enable-profile-modules
6551                           Enable/disable profiling for specific modules],
6552 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6554 MOZ_ARG_ENABLE_BOOL(insure,
6555 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6556     _ENABLE_INSURE=1,
6557     _ENABLE_INSURE= )
6558 if test -n "$_ENABLE_INSURE"; then
6559     MOZ_INSURE="insure"
6560     MOZ_INSURIFYING=1
6561     MOZ_INSURE_DIRS="."
6562     MOZ_INSURE_EXCLUDE_DIRS="config"
6565 MOZ_ARG_WITH_STRING(insure-dirs,
6566 [  --with-insure-dirs=DIRS
6567                           Dirs to instrument with insure ],
6568     MOZ_INSURE_DIRS=$withval )
6570 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6571 [  --with-insure-exclude-dirs=DIRS
6572                           Dirs to not instrument with insure ],
6573     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6575 dnl ========================================================
6576 dnl = Support for Quantify (Windows)
6577 dnl ========================================================
6578 MOZ_ARG_ENABLE_BOOL(quantify,
6579 [  --enable-quantify      Enable Quantify support (Windows only) ],
6580     MOZ_QUANTIFY=1,
6581     MOZ_QUANTIFY= )
6583 dnl ========================================================
6584 dnl = Support for demangling undefined symbols
6585 dnl ========================================================
6586 if test -z "$SKIP_LIBRARY_CHECKS"; then
6587     AC_LANG_SAVE
6588     AC_LANG_CPLUSPLUS
6589     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6590     AC_LANG_RESTORE
6593 # Demangle only for debug or trace-malloc builds
6594 MOZ_DEMANGLE_SYMBOLS=
6595 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6596     MOZ_DEMANGLE_SYMBOLS=1
6597     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6599 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6601 dnl ========================================================
6602 dnl = Support for gcc stack unwinding (from gcc 3.3)
6603 dnl ========================================================
6604 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6605     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6608 dnl ========================================================
6609 dnl =
6610 dnl = Misc. Options
6611 dnl = 
6612 dnl ========================================================
6613 MOZ_ARG_HEADER(Misc. Options)
6615 dnl ========================================================
6616 dnl update xterm title
6617 dnl ========================================================
6618 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6619 [  --enable-xterm-updates  Update XTERM titles with current command.],
6620     MOZ_UPDATE_XTERM=1,
6621     MOZ_UPDATE_XTERM= )
6623 dnl =========================================================
6624 dnl = Chrome format
6625 dnl =========================================================
6626 MOZ_ARG_ENABLE_STRING([chrome-format],
6627 [  --enable-chrome-format=jar|flat|both|symlink
6628                           Select FORMAT of chrome files (default=jar)],
6629     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6631 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6632     MOZ_CHROME_FILE_FORMAT=jar
6635 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6636     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6637     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6638     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6639     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6642 dnl ========================================================
6643 dnl = Define default location for MOZILLA_FIVE_HOME
6644 dnl ========================================================
6645 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6646 [  --with-default-mozilla-five-home
6647                           Set the default value for MOZILLA_FIVE_HOME],
6648 [ val=`echo $withval`
6649   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6651 dnl ========================================================
6652 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6653 dnl ========================================================
6654 MOZ_ARG_WITH_STRING(user-appdir,
6655 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6656 [ val=`echo $withval`
6657 if echo "$val" | grep "\/" >/dev/null; then
6658     AC_MSG_ERROR("Homedir must be single relative path.")
6659 else 
6660     MOZ_USER_DIR="$val"
6661 fi])
6663 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6665 dnl ========================================================
6666 dnl = Doxygen configuration
6667 dnl ========================================================
6668 dnl Use commas to specify multiple dirs to this arg
6669 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6670 MOZ_ARG_WITH_STRING(doc-input-dirs,
6671 [  --with-doc-input-dirs=DIRS
6672                           Header/idl dirs to create docs from],
6673 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6674 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6676 dnl Use commas to specify multiple dirs to this arg
6677 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6678 MOZ_ARG_WITH_STRING(doc-include-dirs,
6679 [  --with-doc-include-dirs=DIRS  
6680                           Include dirs to preprocess doc headers],
6681 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6682 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6684 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6685 MOZ_ARG_WITH_STRING(doc-output-dir,
6686 [  --with-doc-output-dir=DIR
6687                           Dir to generate docs into],
6688 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6689 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6691 if test -z "$SKIP_COMPILER_CHECKS"; then
6692 dnl ========================================================
6693 dnl =
6694 dnl = Compiler Options
6695 dnl = 
6696 dnl ========================================================
6697 MOZ_ARG_HEADER(Compiler Options)
6699 dnl ========================================================
6700 dnl Check for gcc -pipe support
6701 dnl ========================================================
6702 AC_MSG_CHECKING([for gcc -pipe support])
6703 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6704     echo '#include <stdio.h>' > dummy-hello.c
6705     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6706     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6707     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6708     if test $? = 0; then
6709         _res_as_stdin="yes"
6710     else
6711         _res_as_stdin="no"
6712     fi
6713     if test "$_res_as_stdin" = "yes"; then
6714         _SAVE_CFLAGS=$CFLAGS
6715         CFLAGS="$CFLAGS -pipe"
6716         AC_TRY_COMPILE( [ #include <stdio.h> ],
6717             [printf("Hello World\n");],
6718             [_res_gcc_pipe="yes"],
6719             [_res_gcc_pipe="no"] )
6720         CFLAGS=$_SAVE_CFLAGS
6721     fi
6722     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6723         _res="yes";
6724         CFLAGS="$CFLAGS -pipe"
6725         CXXFLAGS="$CXXFLAGS -pipe"
6726     else
6727         _res="no"
6728     fi
6729     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6730     AC_MSG_RESULT([$_res])
6731 else
6732     AC_MSG_RESULT([no])
6735 dnl pass -Wno-long-long to the compiler
6736 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6737 [  --enable-long-long-warning 
6738                           Warn about use of non-ANSI long long type],
6739     _IGNORE_LONG_LONG_WARNINGS=,
6740     _IGNORE_LONG_LONG_WARNINGS=1)
6742 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6743      _SAVE_CFLAGS="$CFLAGS"
6744      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6745      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6746      AC_TRY_COMPILE([], [return(0);], 
6747         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6748           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6749           result="yes" ], result="no")
6750      AC_MSG_RESULT([$result])
6751      CFLAGS="$_SAVE_CFLAGS"
6754 dnl ========================================================
6755 dnl Profile guided optimization
6756 dnl ========================================================
6757 dnl Test for profiling options
6758 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6759 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6761 dnl Provide a switch to disable PGO even when called via profiledbuild.
6762 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6763 [  --disable-profile-guided-optimization
6764                            Don't build with PGO even if called via make profiledbuild],
6765 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6766 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6768 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6770 _SAVE_CFLAGS="$CFLAGS"
6771 CFLAGS="$CFLAGS -fprofile-generate"
6773 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6774 AC_TRY_COMPILE([], [return 0;],
6775                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6776                  result="yes" ], result="no")
6777 AC_MSG_RESULT([$result])
6779 if test $result = "yes"; then
6780   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6781   PROFILE_USE_CFLAGS="-fprofile-use"
6782   PROFILE_USE_LDFLAGS="-fprofile-use"
6783 else
6784   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6785   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6786   AC_TRY_COMPILE([], [return 0;],
6787                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6788                    result="yes" ], result="no")
6789   AC_MSG_RESULT([$result])
6790   if test $result = "yes"; then
6791     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6792   fi
6793   # don't really care, this is an old GCC
6794   PROFILE_GEN_LDFLAGS=
6795   PROFILE_USE_LDFLAGS=
6798 CFLAGS="$_SAVE_CFLAGS"
6800 if test -n "$INTEL_CC"; then
6801   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6802   PROFILE_GEN_LDFLAGS=
6803   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6804   PROFILE_USE_LDFLAGS=
6807 dnl Sun Studio on Solaris
6808 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6809   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6810   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6811   if test "$CPU_ARCH" != "sparc"; then
6812     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6813     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6814   else
6815     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6816     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6817   fi
6820 AC_SUBST(PROFILE_GEN_CFLAGS)
6821 AC_SUBST(PROFILE_GEN_LDFLAGS)
6822 AC_SUBST(PROFILE_USE_CFLAGS)
6823 AC_SUBST(PROFILE_USE_LDFLAGS)
6825 AC_LANG_CPLUSPLUS
6827 dnl ========================================================
6828 dnl Test for -pedantic bustage
6829 dnl ========================================================
6830 MOZ_ARG_DISABLE_BOOL(pedantic,
6831 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6832 _PEDANTIC= )
6833 if test "$_PEDANTIC"; then
6834     _SAVE_CXXFLAGS=$CXXFLAGS
6835     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6836     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6837     AC_TRY_COMPILE([$configure_static_assert_macros],
6838                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6839                    result="no", result="yes" )
6840     AC_MSG_RESULT([$result])
6841     CXXFLAGS="$_SAVE_CXXFLAGS"
6843     case "$result" in
6844     no)
6845         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6846         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6847         ;;
6848     yes)
6849         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6850         ;;
6851     esac
6854 dnl ========================================================
6855 dnl Test for correct temporary object destruction order
6856 dnl ========================================================
6857 dnl We want to make sure the compiler follows the C++ spec here as 
6858 dnl xpcom and the string classes depend on it (bug 235381).
6859 AC_MSG_CHECKING([for correct temporary object destruction order])
6860 AC_TRY_RUN([ class A {
6861              public:  A(int& x) : mValue(x) {}
6862                       ~A() { mValue--; }
6863                       operator char**() { return 0; }
6864              private:  int& mValue;
6865              };
6866              void func(char **arg) {}
6867              int m=2;
6868              void test() {
6869                   func(A(m));
6870                   if (m==1) m = 0;
6871              }
6872              int main() {
6873                  test();
6874                  return(m);
6875              }
6876              ],
6877      result="yes", result="no", result="maybe")
6878 AC_MSG_RESULT([$result])
6880 if test "$result" = "no"; then
6881     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
6884 dnl ========================================================
6885 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
6886 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
6887 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
6888 dnl ========================================================
6889 _SAVE_CXXFLAGS=$CXXFLAGS
6890 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
6891 AC_CACHE_CHECK(for correct overload resolution with const and templates,
6892     ac_nscap_nonconst_opeq_bug,
6893     [AC_TRY_COMPILE([
6894                       template <class T>
6895                       class Pointer
6896                         {
6897                         public:
6898                           T* myPtr;
6899                         };
6900                       
6901                       template <class T, class U>
6902                       int operator==(const Pointer<T>& rhs, U* lhs)
6903                         {
6904                           return rhs.myPtr == lhs;
6905                         }
6906                       
6907                       template <class T, class U>
6908                       int operator==(const Pointer<T>& rhs, const U* lhs)
6909                         {
6910                           return rhs.myPtr == lhs;
6911                         }
6912                     ],
6913                     [
6914                       Pointer<int> foo;
6915                       const int* bar;
6916                       return foo == bar;
6917                     ],
6918                     ac_nscap_nonconst_opeq_bug="no",
6919                     ac_nscap_nonconst_opeq_bug="yes")])
6920 CXXFLAGS="$_SAVE_CXXFLAGS"
6922 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
6923     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
6925 fi # SKIP_COMPILER_CHECKS
6927 dnl ========================================================
6928 dnl C++ rtti
6929 dnl Should be smarter and check that the compiler does indeed have rtti
6930 dnl ========================================================
6931 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
6932 [  --enable-cpp-rtti       Enable C++ RTTI ],
6933 [ _MOZ_USE_RTTI=1 ],
6934 [ _MOZ_USE_RTTI= ])
6936 if test "$_MOZ_USE_RTTI"; then
6937    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
6938 else
6939    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
6942 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
6944 dnl ========================================================
6945 dnl C++ exceptions (g++/egcs only - for now)
6946 dnl Should be smarter and check that the compiler does indeed have exceptions
6947 dnl ========================================================
6948 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
6949 [  --enable-cpp-exceptions Enable C++ exceptions ],
6950 [ _MOZ_CPP_EXCEPTIONS=1 ],
6951 [ _MOZ_CPP_EXCEPTIONS= ])
6953 if test "$_MOZ_CPP_EXCEPTIONS"; then
6954     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
6955 else
6956     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
6959 # Irix & OSF native compilers do not like exception declarations 
6960 # when exceptions are disabled
6961 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
6962     AC_DEFINE(CPP_THROW_NEW, [])
6963 else
6964     AC_DEFINE(CPP_THROW_NEW, [throw()])
6966 AC_LANG_C
6968 dnl ========================================================
6969 dnl =
6970 dnl = Build depencency options
6971 dnl =
6972 dnl ========================================================
6973 MOZ_ARG_HEADER(Build dependencies)
6975 dnl ========================================================
6976 dnl = Do not auto generate dependency info
6977 dnl ========================================================
6978 MOZ_AUTO_DEPS=1
6979 MOZ_ARG_DISABLE_BOOL(auto-deps,
6980 [  --disable-auto-deps     Do not automatically generate dependency info],
6981     MOZ_AUTO_DEPS=,
6982     MOZ_AUTO_DEPS=1)
6984 if test -n "$MOZ_AUTO_DEPS"; then
6985 dnl ========================================================
6986 dnl = Use mkdepend instead of $CC -MD for dependency generation
6987 dnl ========================================================
6988 _cpp_md_flag=
6989 MOZ_ARG_DISABLE_BOOL(md,
6990 [  --disable-md            Do not use compiler-based dependencies ],
6991   [_cpp_md_flag=],
6992   [_cpp_md_flag=1],
6993   [dnl Default is to turn on -MD if using GNU-compatible compilers
6994    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
6995      _cpp_md_flag=1
6996    fi
6997   dnl Default is to use -xM if using Sun Studio on Solaris
6998    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6999      _cpp_md_flag=1
7000    fi])
7001 if test "$_cpp_md_flag"; then
7002   COMPILER_DEPEND=1
7003   if test "$OS_ARCH" = "OpenVMS"; then
7004     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
7005   else
7006     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
7007   fi
7008   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7009   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7010     _DEPEND_CFLAGS=
7011   fi
7012 else
7013   COMPILER_DEPEND=
7014   _USE_CPP_INCLUDE_FLAG=
7015   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7016   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7018 fi # MOZ_AUTO_DEPS
7019 MDDEPDIR='.deps'
7020 AC_SUBST(MOZ_AUTO_DEPS)
7021 AC_SUBST(COMPILER_DEPEND)
7022 AC_SUBST(MDDEPDIR)
7025 dnl ========================================================
7026 dnl =
7027 dnl = Static Build Options
7028 dnl =
7029 dnl ========================================================
7030 MOZ_ARG_HEADER(Static build options)
7032 MOZ_ARG_ENABLE_BOOL(static,
7033 [  --enable-static         Enable building of internal static libs],
7034     BUILD_STATIC_LIBS=1,
7035     BUILD_STATIC_LIBS=)
7037 dnl Disable libxul in debug builds, but not for xulrunner.
7038 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7039    MOZ_ENABLE_LIBXUL=
7042 MOZ_ARG_ENABLE_BOOL(libxul,
7043 [  --enable-libxul         Enable building of libxul],
7044     MOZ_ENABLE_LIBXUL=1,
7045     MOZ_ENABLE_LIBXUL=)
7047 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7048         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7051 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7052         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7055 if test -n "$MOZ_ENABLE_LIBXUL"; then
7056     XPCOM_LIBS="$LIBXUL_LIBS"
7057     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7058 else
7059     if test -n "$BUILD_STATIC_LIBS"; then
7060         AC_DEFINE(MOZ_STATIC_BUILD)
7061     fi
7062     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7065 dnl ========================================================
7066 dnl = Force JS to be a static lib
7067 dnl ========================================================
7068 MOZ_ARG_ENABLE_BOOL(js-static-build,
7069 [  --enable-js-static-build  Force js to be a static lib],
7070     JS_STATIC_BUILD=1,
7071     JS_STATIC_BUILD= )
7073 AC_SUBST(JS_STATIC_BUILD)
7074         
7075 if test -n "$JS_STATIC_BUILD"; then
7076     AC_DEFINE(EXPORT_JS_API)
7078 if test -z "$BUILD_STATIC_LIBS"; then
7079     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7084 dnl Disable static mail in debug builds, but not with libxul sdk.
7085 if test -n "$MOZ_DEBUG" -a -z "$LIBXUL_SDK"; then
7086    MOZ_STATIC_MAIL_BUILD=
7088 MOZ_ARG_ENABLE_BOOL(static-mail,
7089 [  --enable-static-mail Enable static mail build support],
7090     MOZ_STATIC_MAIL_BUILD=1,
7091     MOZ_STATIC_MAIL_BUILD= )
7093 if test "$MOZ_STATIC_MAIL_BUILD"; then
7094     AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
7097 AC_SUBST(MOZ_STATIC_MAIL_BUILD)
7099 dnl ========================================================
7100 dnl =
7101 dnl = Standalone module options
7102 dnl = 
7103 dnl ========================================================
7104 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7106 dnl Check for GLib and libIDL.
7107 dnl ========================================================
7108 case "$target_os" in
7109 msvc*|mks*|cygwin*|mingw*|wince*)
7110     SKIP_IDL_CHECK="yes"
7111     ;;
7113     SKIP_IDL_CHECK="no"
7114     ;;
7115 esac
7117 if test -z "$COMPILE_ENVIRONMENT"; then
7118     SKIP_IDL_CHECK="yes"
7121 dnl = Allow users to disable libIDL checking for standalone modules
7122 MOZ_ARG_WITHOUT_BOOL(libIDL,
7123 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7124         SKIP_IDL_CHECK="yes")
7126 if test "$SKIP_IDL_CHECK" = "no"
7127 then
7128     _LIBIDL_FOUND=
7129     if test "$MACOS_SDK_DIR"; then 
7130       dnl xpidl, and therefore libIDL, is only needed on the build host.
7131       dnl Don't build it against the SDK, as that causes problems.
7132       _MACSAVE_CFLAGS="$CFLAGS"
7133       _MACSAVE_LIBS="$LIBS"
7134       _MACSAVE_LDFLAGS="$LDFLAGS"
7135       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7136       changequote(,)
7137       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"`
7138       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7139       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7140       changequote([,])
7141       unset NEXT_ROOT
7142     fi
7144     if test "$MOZ_ENABLE_GTK2"; then
7145         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7146     fi
7147     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7148     dnl to either libIDL1 or libIDL2.
7149     if test -z "$_LIBIDL_FOUND"; then
7150         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7151         if test -z "$_LIBIDL_FOUND"; then
7152             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7153         fi
7154     fi
7155     dnl
7156     dnl If we don't have a libIDL config program & not cross-compiling, 
7157     dnl     look for orbit-config instead.
7158     dnl
7159     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7160         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7161         if test -n "$ORBIT_CONFIG"; then
7162             AC_MSG_CHECKING([for ORBit libIDL usability])
7163                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7164             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7165             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7166             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7167             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7168             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7169             LIBIDL_CONFIG=
7170             _SAVE_CFLAGS="$CFLAGS"
7171             _SAVE_LIBS="$LIBS"
7172             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7173             LIBS="$LIBIDL_LIBS $LIBS"
7174             AC_TRY_RUN([
7175 #include <stdlib.h>
7176 #include <libIDL/IDL.h>
7177 int main() {
7178   char *s;
7179   s=strdup(IDL_get_libver_string());
7180   if(s==NULL) {
7181     exit(1);
7182   }
7183   exit(0);
7185             ], [_LIBIDL_FOUND=1
7186                 result="yes"],
7187                [LIBIDL_CFLAGS=
7188                 LIBIDL_LIBS=
7189                 result="no"],
7190                [_LIBIDL_FOUND=1
7191                 result="maybe"] )
7192             AC_MSG_RESULT($result)
7193             CFLAGS="$_SAVE_CFLAGS"
7194             LIBS="$_SAVE_LIBS"
7195         fi
7196     fi
7197     if test -z "$_LIBIDL_FOUND"; then
7198         AC_MSG_ERROR([libIDL not found.
7199         libIDL $LIBIDL_VERSION or higher is required.])
7200     fi
7201     if test "$MACOS_SDK_DIR"; then
7202       CFLAGS="$_MACSAVE_CFLAGS"
7203       LIBS="$_MACSAVE_LIBS"
7204       LDFLAGS="$_MACSAVE_LDFLAGS"
7205       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7206         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7207       fi
7208     fi
7211 if test -n "$CROSS_COMPILE"; then
7212      if test -z "$HOST_LIBIDL_CONFIG"; then
7213         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7214     fi
7215     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7216         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7217         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7218     else
7219         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7220         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7221     fi
7224 if test -z "$SKIP_PATH_CHECKS"; then
7225 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7226     if test "$MOZ_ENABLE_GTK2"; then
7227         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7228     else
7229         AM_PATH_GLIB(${GLIB_VERSION})
7230     fi
7234 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7235     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7238 AC_SUBST(LIBIDL_CFLAGS)
7239 AC_SUBST(LIBIDL_LIBS)
7240 AC_SUBST(STATIC_LIBIDL)
7241 AC_SUBST(GLIB_CFLAGS)
7242 AC_SUBST(GLIB_LIBS)
7243 AC_SUBST(GLIB_GMODULE_LIBS)
7244 AC_SUBST(HOST_LIBIDL_CONFIG)
7245 AC_SUBST(HOST_LIBIDL_CFLAGS)
7246 AC_SUBST(HOST_LIBIDL_LIBS)
7248 dnl ========================================================
7249 dnl Check for libart
7250 dnl ========================================================
7251 if test "$MOZ_SVG_RENDERER_LIBART"; then
7252   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7253     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7254 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7255   fi
7257   dnl libart's configure hasn't been run yet, but we know what the
7258   dnl answer should be anyway
7259   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7260   case "$target_os" in
7261   msvc*|mks*|cygwin*|mingw*|wince*)
7262       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7263       ;;
7264   os2*)
7265       MOZ_LIBART_LIBS='-lmoz_art -lm'
7266       ;;
7267   beos*)
7268       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7269       ;;
7270   *)
7271       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7272       ;;
7273   esac
7274   AC_FUNC_ALLOCA
7277 AC_SUBST(MOZ_LIBART_CFLAGS)
7278 AC_SUBST(MOZ_LIBART_LIBS)
7280 dnl ========================================================
7281 dnl Check for cairo
7282 dnl ========================================================
7283 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7285 MOZ_TREE_CAIRO=1
7286 MOZ_ARG_ENABLE_BOOL(system-cairo,
7287 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7288 MOZ_TREE_CAIRO=,
7289 MOZ_TREE_CAIRO=1 )
7291 # Check for headers defining standard int types.
7292 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7294 if test "$MOZ_TREE_CAIRO"; then
7295     AC_DEFINE(MOZ_TREE_CAIRO)
7297     # For now we assume that we will have a uint64_t available through
7298     # one of the above headers or mozstdint.h.
7299     AC_DEFINE(HAVE_UINT64_T)
7301     # Define macros for cairo-features.h
7302     if test "$MOZ_X11"; then
7303         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7304         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7305         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7306         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7307         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7308         MOZ_ENABLE_CAIRO_FT=1
7309         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7310     fi
7311     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7312         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7313         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7314         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7315     fi
7316     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7317         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7318         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7319         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7320     fi
7321     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7322         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7323         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7324         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7325         MOZ_ENABLE_CAIRO_FT=1
7326         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7327         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7328     fi
7329     if test "$MOZ_ENABLE_GLITZ"; then
7330         GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
7331     fi
7332     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7333         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7334         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7335         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7336         MOZ_ENABLE_CAIRO_FT=1
7337     fi
7338     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7339     AC_SUBST(CAIRO_FT_CFLAGS)
7341     if test "$MOZ_DEBUG"; then
7342       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7343     else
7344       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7345     fi
7347     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7349     AC_SUBST(PS_SURFACE_FEATURE)
7350     AC_SUBST(PDF_SURFACE_FEATURE)
7351     AC_SUBST(SVG_SURFACE_FEATURE)
7352     AC_SUBST(XLIB_SURFACE_FEATURE)
7353     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7354     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7355     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7356     AC_SUBST(XCB_SURFACE_FEATURE)
7357     AC_SUBST(WIN32_SURFACE_FEATURE)
7358     AC_SUBST(OS2_SURFACE_FEATURE)
7359     AC_SUBST(BEOS_SURFACE_FEATURE)
7360     AC_SUBST(GLITZ_SURFACE_FEATURE)
7361     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7362     AC_SUBST(FT_FONT_FEATURE)
7363     AC_SUBST(WIN32_FONT_FEATURE)
7364     AC_SUBST(QUARTZ_FONT_FEATURE)
7365     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7367     if test "$_WIN32_MSVC"; then
7368         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7369         if test "$MOZ_ENABLE_GLITZ"; then
7370             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
7371         fi
7372     else
7373         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"
7375         if test "$MOZ_X11"; then
7376             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7377         fi
7379         if test "$MOZ_ENABLE_GLITZ"; then
7380             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
7381             if test "$MOZ_X11"; then
7382                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
7383             fi
7384             if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7385                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
7386             fi
7387         fi
7388     fi
7389 else
7390    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7391    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7392    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7393    if test "$MOZ_X11"; then
7394         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7395         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7396         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7397    fi
7400 AC_SUBST(MOZ_TREE_CAIRO)
7401 AC_SUBST(MOZ_CAIRO_CFLAGS)
7402 AC_SUBST(MOZ_CAIRO_LIBS)
7404 dnl ========================================================
7405 dnl Check for lcms
7406 dnl ========================================================
7408 MOZ_NATIVE_LCMS=
7409 MOZ_ARG_ENABLE_BOOL(system-lcms,
7410 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7411 MOZ_NATIVE_LCMS=1,
7412 MOZ_NATIVE_LCMS= )
7414 if test -z "$MOZ_NATIVE_LCMS"
7415 then
7416     LCMS_CFLAGS=
7417     if test "$_WIN32_MSVC"; then
7418         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7419             LCMS_CFLAGS=-DLCMS_DLL
7420         fi
7421         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7422     else
7423         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7424     fi
7425 else
7426     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7429 AC_SUBST(MOZ_NATIVE_LCMS)
7430 AC_SUBST(LCMS_CFLAGS)
7431 AC_SUBST(LCMS_LIBS)
7433 dnl ========================================================
7434 dnl disable xul
7435 dnl ========================================================
7436 MOZ_ARG_DISABLE_BOOL(xul,
7437 [  --disable-xul           Disable XUL],
7438     MOZ_XUL= )
7439 if test "$MOZ_XUL"; then
7440   AC_DEFINE(MOZ_XUL)
7441 else
7442   dnl remove extensions that require XUL
7443   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7446 AC_SUBST(MOZ_XUL)
7448 dnl ========================================================
7449 dnl Two ways to enable Python support:
7450 dnl   --enable-extensions=python # select all available.
7451 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7452 dnl or:
7453 dnl   --enable-extensions=python/xpcom,... # select individual ones
7455 dnl If either is used, we locate the Python to use.
7456 dnl ========================================================
7458 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7459 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7460     dnl Allow PYTHON to point to the Python interpreter to use
7461     dnl (note that it must be the python executable - which we
7462     dnl run to locate the relevant paths etc)
7463     dnl If not set, we use whatever Python we can find.
7464     MOZ_PYTHON=$PYTHON
7465     dnl Ask Python what its version number is
7466     changequote(,)
7467     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7468     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7469     changequote([,])
7470     dnl Ask for the Python "prefix" (ie, home/source dir)
7471     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7472     dnl Setup the include and library directories.
7473     if test "$OS_ARCH" = "WINNT"; then
7474         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7475         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7476         dnl Binary trees have "include" for .h, and "libs" for .lib
7477         dnl We add 'em both - along with quotes, to handle spaces.
7478         MOZ_PYTHON_DLL_SUFFIX=.pyd
7479         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7480         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7481     else
7482         dnl Non-Windows include and libs
7483         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7484         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7485         dnl Check for dynamic Python lib
7486         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7487         dnl - core, xpcom loader, pydom etc) all need to share Python.
7488         dnl - Python 2.3's std --enable-shared configure option will
7489         dnl   create a libpython2.3.so.1.0. We should first try this
7490         dnl   dotted versioned .so file because this is the one that
7491         dnl   the PyXPCOM build mechanics tries to link to.
7492         dnl   XXX Should find a better way than hardcoding "1.0".
7493         dnl - Python developement tree dir layouts are NOT allowed here
7494         dnl   because the PyXPCOM build just dies on it later anyway.
7495         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7496         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7497             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7498         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7499             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7500         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7501             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7502         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7503             dnl Don't Python development tree directory layout.
7504             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7505             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.])
7506         elif test "$OS_ARCH" = "Darwin"; then
7507             dnl We do Darwin last, so if a custom non-framework build of
7508             dnl python is used on OSX, then it will be picked up first by
7509             dnl the logic above.
7510             MOZ_PYTHON_LIBS="-framework Python"
7511         else
7512             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7513         fi
7514         if test "$OS_ARCH" = "Linux"; then
7515             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7516         fi
7517     fi
7518     dnl Handle "_d" on Windows
7519     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7520         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7521     else
7522         MOZ_PYTHON_DEBUG_SUFFIX=
7523     fi
7524     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7527 dnl If the user asks for the 'python' extension, then we add
7528 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7529 dnl Note the careful regex - it must match 'python' followed by anything
7530 dnl other than a '/', including the end-of-string.
7531 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7532     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7533         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7534     done
7536 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7537 dnl command-line, but not yet
7538 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7539 AC_SUBST(MOZ_PYTHON)
7540 AC_SUBST(MOZ_PYTHON_PREFIX)
7541 AC_SUBST(MOZ_PYTHON_INCLUDES)
7542 AC_SUBST(MOZ_PYTHON_LIBS)
7543 AC_SUBST(MOZ_PYTHON_VER)
7544 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7545 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7546 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7548 dnl ========================================================
7549 dnl disable profile sharing
7550 dnl ========================================================
7551 MOZ_ARG_DISABLE_BOOL(profilesharing,
7552 [  --disable-profilesharing           Disable profile sharing],
7553     MOZ_PROFILESHARING=,
7554     MOZ_PROFILESHARING=1 )
7555 if test "$MOZ_PROFILESHARING"; then
7556   MOZ_IPCD=1
7557   AC_DEFINE(MOZ_PROFILESHARING)
7560 dnl ========================================================
7561 dnl enable ipc/ipcd
7562 dnl ========================================================
7563 MOZ_ARG_ENABLE_BOOL(ipcd,
7564 [  --enable-ipcd                      Enable IPC daemon],
7565     MOZ_IPCD=1,
7566     MOZ_IPCD= )
7568 dnl ========================================================
7569 dnl disable profile locking
7570 dnl   do no use this in applications that can have more than
7571 dnl   one process accessing the profile directory.
7572 dnl ========================================================
7573 MOZ_ARG_DISABLE_BOOL(profilelocking,
7574 [  --disable-profilelocking           Disable profile locking],
7575     MOZ_PROFILELOCKING=,
7576     MOZ_PROFILELOCKING=1 )
7577 if test "$MOZ_PROFILELOCKING"; then
7578   AC_DEFINE(MOZ_PROFILELOCKING)
7581 dnl ========================================================
7582 dnl disable rdf services
7583 dnl ========================================================
7584 MOZ_ARG_DISABLE_BOOL(rdf,
7585 [  --disable-rdf           Disable RDF],
7586     MOZ_RDF= )
7587 if test "$MOZ_RDF"; then
7588   AC_DEFINE(MOZ_RDF)
7591 AC_SUBST(MOZ_RDF)
7593 dnl ========================================================
7594 dnl necko configuration options
7595 dnl ========================================================
7598 dnl option to disable various necko protocols
7600 MOZ_ARG_ENABLE_STRING(necko-protocols,
7601 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7602                           Enable/disable specific protocol handlers],
7603 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7604     if test "$option" = "yes" || test "$option" = "all"; then
7605         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7606     elif test "$option" = "no" || test "$option" = "none"; then
7607         NECKO_PROTOCOLS=""
7608     elif test "$option" = "default"; then
7609         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7610     elif test `echo "$option" | grep -c \^-` != 0; then
7611         option=`echo $option | sed 's/^-//'`
7612         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7613     else
7614         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7615     fi
7616 done],
7617     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7618 dnl Remove dupes
7619 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7620 AC_SUBST(NECKO_PROTOCOLS)
7621 for p in $NECKO_PROTOCOLS; do
7622     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7623 done
7626 dnl option to disable necko's disk cache
7628 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7629 [  --disable-necko-disk-cache
7630                           Disable necko disk cache],
7631     NECKO_DISK_CACHE=,
7632     NECKO_DISK_CACHE=1)
7633 AC_SUBST(NECKO_DISK_CACHE)
7634 if test "$NECKO_DISK_CACHE"; then
7635     AC_DEFINE(NECKO_DISK_CACHE)
7639 dnl option to minimize size of necko's i/o buffers
7641 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7642 [  --enable-necko-small-buffers
7643                           Minimize size of necko's i/o buffers],
7644     NECKO_SMALL_BUFFERS=1,
7645     NECKO_SMALL_BUFFERS=)
7646 AC_SUBST(NECKO_SMALL_BUFFERS)
7647 if test "$NECKO_SMALL_BUFFERS"; then
7648     AC_DEFINE(NECKO_SMALL_BUFFERS)
7649 fi 
7652 dnl option to disable cookies
7654 MOZ_ARG_DISABLE_BOOL(cookies,
7655 [  --disable-cookies       Disable cookie support],
7656     NECKO_COOKIES=,
7657     NECKO_COOKIES=1)
7658 AC_SUBST(NECKO_COOKIES)
7659 if test "$NECKO_COOKIES"; then
7660     AC_DEFINE(NECKO_COOKIES)
7663 dnl NECKO_ configuration options are not global
7664 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7666 dnl ========================================================
7667 dnl string api compatibility
7668 dnl ========================================================
7669 MOZ_ARG_DISABLE_BOOL(v1-string-abi,
7670 [  --disable-v1-string-abi   Disable binary compatibility layer for strings],
7671     MOZ_V1_STRING_ABI=,
7672     MOZ_V1_STRING_ABI=1)
7673 AC_SUBST(MOZ_V1_STRING_ABI)
7674 if test "$MOZ_V1_STRING_ABI"; then
7675     AC_DEFINE(MOZ_V1_STRING_ABI)
7678 dnl Only build Mork if it's required
7679 AC_SUBST(MOZ_MORK)
7680 if test "$MOZ_MORK"; then
7681   AC_DEFINE(MOZ_MORK)
7684 dnl Build the lightweight Mork reader if required
7685 AC_SUBST(MOZ_MORKREADER)
7686 if test "$MOZ_MORKREADER"; then
7687   AC_DEFINE(MOZ_MORKREADER)
7690 dnl ========================================================
7691 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7692     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7695 if test "$MOZ_LDAP_XPCOM"; then
7696     LDAP_CFLAGS='-I${DIST}/public/ldap'
7697     if test "$OS_ARCH" = "WINNT"; then
7698         if test -n "$GNU_CC"; then
7699             LDAP_LIBS='-L$(DIST)/lib -lnsldap32v60 -lnsldappr32v60 -lnsldif32v60'
7700         else
7701             LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)nsldap32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldappr32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldif32v60.${IMPORT_LIB_SUFFIX}'
7702         fi
7703     elif test "$OS_ARCH" = "OS2"; then
7704             LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)ldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)prldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)ldif60.${IMPORT_LIB_SUFFIX}'
7705     else
7706         LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
7707     fi
7710 if test "$COMPILE_ENVIRONMENT"; then
7711 if test "$SUNCTL"; then
7712     dnl older versions of glib do not seem to have gmodule which ctl needs
7713     _SAVE_CFLAGS=$CFLAGS
7714     CFLAGS="$CFLAGS $GLIB_CFLAGS"
7715     AC_LANG_SAVE
7716     AC_LANG_C
7717     AC_TRY_COMPILE([#include <gmodule.h>],
7718         [ int x = 1; x++; ],,
7719         [AC_MSG_ERROR([Cannot build ctl without gmodule support in glib.])])
7720     AC_LANG_RESTORE
7721     CFLAGS=$_SAVE_CFLAGS
7722     AC_DEFINE(SUNCTL)
7724 fi # COMPILE_ENVIRONMENT
7726 dnl ========================================================
7727 dnl =
7728 dnl = Maintainer debug option (no --enable equivalent)
7729 dnl =
7730 dnl ========================================================
7732 AC_SUBST(AR)
7733 AC_SUBST(AR_FLAGS)
7734 AC_SUBST(AR_LIST)
7735 AC_SUBST(AR_EXTRACT)
7736 AC_SUBST(AR_DELETE)
7737 AC_SUBST(AS)
7738 AC_SUBST(ASFLAGS)
7739 AC_SUBST(AS_DASH_C_FLAG)
7740 AC_SUBST(LD)
7741 AC_SUBST(RC)
7742 AC_SUBST(RCFLAGS)
7743 AC_SUBST(WINDRES)
7744 AC_SUBST(USE_SHORT_LIBNAME)
7745 AC_SUBST(IMPLIB)
7746 AC_SUBST(FILTER)
7747 AC_SUBST(BIN_FLAGS)
7748 AC_SUBST(NS_USE_NATIVE)
7749 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7750 AC_SUBST(MOZ_GFX_TOOLKIT)
7751 AC_SUBST(MOZ_UPDATE_XTERM)
7752 AC_SUBST(MINIMO)
7753 AC_SUBST(MOZ_AUTH_EXTENSION)
7754 AC_SUBST(MOZ_MATHML)
7755 AC_SUBST(MOZ_PERMISSIONS)
7756 AC_SUBST(MOZ_XTF)
7757 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7758 AC_SUBST(MOZ_PREF_EXTENSIONS)
7759 AC_SUBST(MOZ_SVG)
7760 AC_SUBST(MOZ_SVG_FOREIGNOBJECT)
7761 AC_SUBST(MOZ_XSLT_STANDALONE)
7762 AC_SUBST(MOZ_JS_LIBS)
7763 AC_SUBST(MOZ_PSM)
7764 AC_SUBST(MOZ_DEBUG)
7765 AC_SUBST(MOZ_DEBUG_MODULES)
7766 AC_SUBST(MOZ_PROFILE_MODULES)
7767 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7768 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7769 AC_SUBST(MOZ_DEBUG_FLAGS)
7770 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7771 AC_SUBST(WARNINGS_AS_ERRORS)
7772 AC_SUBST(MOZ_DBGRINFO_MODULES)
7773 AC_SUBST(MOZ_EXTENSIONS)
7774 AC_SUBST(MOZ_IMG_DECODERS)
7775 AC_SUBST(MOZ_IMG_ENCODERS)
7776 AC_SUBST(MOZ_JSDEBUGGER)
7777 AC_SUBST(MOZ_OJI)
7778 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7779 AC_SUBST(MOZ_PLUGINS)
7780 AC_SUBST(ENABLE_EAZEL_PROFILER)
7781 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7782 AC_SUBST(EAZEL_PROFILER_LIBS)
7783 AC_SUBST(MOZ_PERF_METRICS)
7784 AC_SUBST(GC_LEAK_DETECTOR)
7785 AC_SUBST(MOZ_LOG_REFCNT)
7786 AC_SUBST(MOZ_LEAKY)
7787 AC_SUBST(MOZ_JPROF)
7788 AC_SUBST(MOZ_SHARK)
7789 AC_SUBST(MOZ_XPCTOOLS)
7790 AC_SUBST(MOZ_JSLOADER)
7791 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7792 AC_SUBST(MOZ_INSURE)
7793 AC_SUBST(MOZ_INSURE_DIRS)
7794 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7795 AC_SUBST(MOZ_QUANTIFY)
7796 AC_SUBST(MOZ_INSURIFYING)
7797 AC_SUBST(MOZ_LDAP_XPCOM)
7798 AC_SUBST(MOZ_LDAP_XPCOM_EXPERIMENTAL)
7799 AC_SUBST(LDAP_CFLAGS)
7800 AC_SUBST(LDAP_LIBS)
7801 AC_SUBST(LIBICONV)
7802 AC_SUBST(MOZ_PLACES)
7803 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7804 AC_SUBST(MOZ_STORAGE)
7805 AC_SUBST(MOZ_FEEDS)
7806 AC_SUBST(NS_PRINTING)
7808 AC_SUBST(MOZ_JAVAXPCOM)
7809 AC_SUBST(JAVA_INCLUDE_PATH)
7810 AC_SUBST(JAVA)
7811 AC_SUBST(JAVAC)
7812 AC_SUBST(JAR)
7814 AC_SUBST(MOZ_PROFILESHARING)
7815 AC_SUBST(MOZ_PROFILELOCKING)
7817 AC_SUBST(MOZ_IPCD)
7819 AC_SUBST(HAVE_XIE)
7820 AC_SUBST(MOZ_XIE_LIBS)
7821 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7823 AC_SUBST(XPCOM_USE_LEA)
7824 AC_SUBST(BUILD_STATIC_LIBS)
7825 AC_SUBST(MOZ_ENABLE_LIBXUL)
7826 AC_SUBST(ENABLE_TESTS)
7827 AC_SUBST(IBMBIDI)
7828 AC_SUBST(SUNCTL)
7829 AC_SUBST(MOZ_UNIVERSALCHARDET)
7830 AC_SUBST(ACCESSIBILITY)
7831 AC_SUBST(MOZ_XPINSTALL)
7832 AC_SUBST(MOZ_VIEW_SOURCE)
7833 AC_SUBST(MOZ_SPELLCHECK)
7834 AC_SUBST(MOZ_XPFE_COMPONENTS)
7835 AC_SUBST(MOZ_USER_DIR)
7836 AC_SUBST(MOZ_CRASHREPORTER)
7837 AC_SUBST(MOZ_MOCHITEST)
7839 AC_SUBST(ENABLE_STRIP)
7840 AC_SUBST(PKG_SKIP_STRIP)
7841 AC_SUBST(USE_ELF_DYNSTR_GC)
7842 AC_SUBST(USE_PREBINDING)
7843 AC_SUBST(INCREMENTAL_LINKER)
7844 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7845 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7846 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7848 AC_SUBST(MOZ_FIX_LINK_PATHS)
7849 AC_SUBST(XPCOM_LIBS)
7850 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7851 AC_SUBST(XPCOM_GLUE_LDOPTS)
7852 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7854 AC_SUBST(USE_DEPENDENT_LIBS)
7856 AC_SUBST(MOZ_BUILD_ROOT)
7857 AC_SUBST(MOZ_OS2_TOOLS)
7858 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7860 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7861 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7862 AC_SUBST(MOZ_TIMELINE)
7863 AC_SUBST(WINCE)
7864 AC_SUBST(TARGET_DEVICE)
7866 AC_SUBST(MOZ_APP_NAME)
7867 AC_SUBST(MOZ_APP_DISPLAYNAME)
7868 AC_SUBST(MOZ_APP_VERSION)
7869 AC_SUBST(FIREFOX_VERSION)
7870 AC_SUBST(THUNDERBIRD_VERSION)
7871 AC_SUBST(SUNBIRD_VERSION)
7872 AC_SUBST(SEAMONKEY_VERSION)
7874 AC_SUBST(MOZ_PKG_SPECIAL)
7876 AC_SUBST(MOZILLA_OFFICIAL)
7877 AC_SUBST(BUILD_OFFICIAL)
7878 AC_SUBST(MOZ_MILESTONE_RELEASE)
7880 dnl win32 options
7881 AC_SUBST(MOZ_PROFILE)
7882 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7883 AC_SUBST(MOZ_MAPINFO)
7884 AC_SUBST(MOZ_BROWSE_INFO)
7885 AC_SUBST(MOZ_TOOLS_DIR)
7886 AC_SUBST(CYGWIN_WRAPPER)
7887 AC_SUBST(AS_PERL)
7888 AC_SUBST(WIN32_REDIST_DIR)
7889 AC_SUBST(PYTHON)
7891 dnl Echo the CFLAGS to remove extra whitespace.
7892 CFLAGS=`echo \
7893         $_WARNINGS_CFLAGS \
7894         $CFLAGS`
7896 CXXFLAGS=`echo \
7897         $_MOZ_RTTI_FLAGS \
7898         $_MOZ_EXCEPTIONS_FLAGS \
7899         $_WARNINGS_CXXFLAGS \
7900         $CXXFLAGS`
7902 COMPILE_CFLAGS=`echo \
7903     $_DEFINES_CFLAGS \
7904         $_DEPEND_CFLAGS \
7905     $COMPILE_CFLAGS`
7907 COMPILE_CXXFLAGS=`echo \
7908     $_DEFINES_CXXFLAGS \
7909         $_DEPEND_CFLAGS \
7910     $COMPILE_CXXFLAGS`
7912 AC_SUBST(SYSTEM_MAKEDEPEND)
7913 AC_SUBST(SYSTEM_JPEG)
7914 AC_SUBST(SYSTEM_PNG)
7915 AC_SUBST(SYSTEM_ZLIB)
7916 AC_SUBST(SYSTEM_BZ2)
7918 AC_SUBST(JPEG_CFLAGS)
7919 AC_SUBST(JPEG_LIBS)
7920 AC_SUBST(ZLIB_CFLAGS)
7921 AC_SUBST(ZLIB_LIBS)
7922 AC_SUBST(BZ2_CFLAGS)
7923 AC_SUBST(BZ2_LIBS)
7924 AC_SUBST(PNG_CFLAGS)
7925 AC_SUBST(PNG_LIBS)
7927 AC_SUBST(MOZ_JPEG_CFLAGS)
7928 AC_SUBST(MOZ_JPEG_LIBS)
7929 AC_SUBST(MOZ_ZLIB_CFLAGS)
7930 AC_SUBST(MOZ_ZLIB_LIBS)
7931 AC_SUBST(MOZ_BZ2_CFLAGS)
7932 AC_SUBST(MOZ_BZ2_LIBS)
7933 AC_SUBST(MOZ_PNG_CFLAGS)
7934 AC_SUBST(MOZ_PNG_LIBS)
7936 AC_SUBST(NSPR_CFLAGS)
7937 AC_SUBST(NSPR_LIBS)
7938 AC_SUBST(MOZ_NATIVE_NSPR)
7940 AC_SUBST(NSS_CFLAGS)
7941 AC_SUBST(NSS_LIBS)
7942 AC_SUBST(NSS_DEP_LIBS)
7943 AC_SUBST(MOZ_NATIVE_NSS)
7945 AC_SUBST(CFLAGS)
7946 AC_SUBST(CXXFLAGS)
7947 AC_SUBST(CPPFLAGS)
7948 AC_SUBST(COMPILE_CFLAGS)
7949 AC_SUBST(COMPILE_CXXFLAGS)
7950 AC_SUBST(LDFLAGS)
7951 AC_SUBST(LIBS)
7952 AC_SUBST(CROSS_COMPILE)
7954 AC_SUBST(HOST_CC)
7955 AC_SUBST(HOST_CXX)
7956 AC_SUBST(HOST_CFLAGS)
7957 AC_SUBST(HOST_CXXFLAGS)
7958 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7959 AC_SUBST(HOST_AR)
7960 AC_SUBST(HOST_AR_FLAGS)
7961 AC_SUBST(HOST_LD)
7962 AC_SUBST(HOST_RANLIB)
7963 AC_SUBST(HOST_NSPR_MDCPUCFG)
7964 AC_SUBST(HOST_BIN_SUFFIX)
7965 AC_SUBST(HOST_OS_ARCH)
7967 AC_SUBST(TARGET_CPU)
7968 AC_SUBST(TARGET_VENDOR)
7969 AC_SUBST(TARGET_OS)
7970 AC_SUBST(TARGET_NSPR_MDCPUCFG)
7971 AC_SUBST(TARGET_MD_ARCH)
7972 AC_SUBST(TARGET_XPCOM_ABI)
7973 AC_SUBST(OS_TARGET)
7974 AC_SUBST(OS_ARCH)
7975 AC_SUBST(OS_RELEASE)
7976 AC_SUBST(OS_TEST)
7978 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
7979 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
7981 AC_SUBST(WRAP_MALLOC_CFLAGS)
7982 AC_SUBST(WRAP_MALLOC_LIB)
7983 AC_SUBST(MKSHLIB)
7984 AC_SUBST(MKCSHLIB)
7985 AC_SUBST(MKSHLIB_FORCE_ALL)
7986 AC_SUBST(MKSHLIB_UNFORCE_ALL)
7987 AC_SUBST(DSO_CFLAGS)
7988 AC_SUBST(DSO_PIC_CFLAGS)
7989 AC_SUBST(DSO_LDOPTS)
7990 AC_SUBST(LIB_PREFIX)
7991 AC_SUBST(DLL_PREFIX)
7992 AC_SUBST(DLL_SUFFIX)
7993 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
7994 AC_SUBST(LIB_SUFFIX)
7995 AC_SUBST(OBJ_SUFFIX)
7996 AC_SUBST(BIN_SUFFIX)
7997 AC_SUBST(ASM_SUFFIX)
7998 AC_SUBST(IMPORT_LIB_SUFFIX)
7999 AC_SUBST(USE_N32)
8000 AC_SUBST(CC_VERSION)
8001 AC_SUBST(CXX_VERSION)
8002 AC_SUBST(MSMANIFEST_TOOL)
8004 if test "$USING_HCC"; then
8005    CC='${topsrcdir}/build/hcc'
8006    CC="$CC '$_OLDCC'"
8007    CXX='${topsrcdir}/build/hcpp'
8008    CXX="$CXX '$_OLDCXX'"
8009    AC_SUBST(CC)
8010    AC_SUBST(CXX)
8013 dnl Check for missing components
8014 if test "$COMPILE_ENVIRONMENT"; then
8015 if test "$MOZ_X11"; then
8016     dnl ====================================================
8017     dnl = Check if X headers exist
8018     dnl ====================================================
8019     _SAVE_CFLAGS=$CFLAGS
8020     CFLAGS="$CFLAGS $XCFLAGS"
8021     AC_TRY_COMPILE([
8022         #include <stdio.h>
8023         #include <stdlib.h>
8024         #include <X11/Xlib.h>
8025         #include <X11/Intrinsic.h>
8026     ],
8027     [
8028         Display *dpy = 0;
8029         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8030             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8031             exit(1);
8032         }
8033     ], [], 
8034     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8035     CFLAGS="$_SAVE_CFLAGS"
8037     if test ! -z "$MISSING_X"; then
8038         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8039     fi
8041 fi # MOZ_X11
8042 fi # COMPILE_ENVIRONMENT
8044 dnl Set various defines and substitutions
8045 dnl ========================================================
8047 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
8048       LIBS='so32dll.lib tcp32dll.lib'
8049 elif test "$OS_ARCH" = "BeOS"; then
8050   AC_DEFINE(XP_BEOS)
8051   MOZ_MOVEMAIL=1
8052 elif test "$OS_ARCH" = "Darwin"; then
8053   AC_DEFINE(XP_UNIX)
8054   AC_DEFINE(UNIX_ASYNC_DNS)
8055   MOZ_MOVEMAIL=1
8056 elif test "$OS_ARCH" = "OpenVMS"; then
8057   AC_DEFINE(XP_UNIX)
8058 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8059   AC_DEFINE(XP_UNIX)
8060   AC_DEFINE(UNIX_ASYNC_DNS)
8061   MOZ_MOVEMAIL=1
8063 AC_SUBST(MOZ_MOVEMAIL)
8065 AC_DEFINE(JS_THREADSAFE)
8067 if test "$MOZ_DEBUG"; then
8068     AC_DEFINE(MOZ_REFLOW_PERF)
8069     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8072 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8073     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8074     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8075     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8076     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8077     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8078     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8079     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8080     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8083 # Used for LD_LIBRARY_PATH of run_viewer target
8084 LIBS_PATH=
8085 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8086   case $lib_arg in
8087     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8088       * ) ;;
8089   esac
8090 done
8091 AC_SUBST(LIBS_PATH)
8093 dnl ========================================================
8094 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8095 dnl ========================================================
8096 case "$host_os" in
8097 mingw*)
8098     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8099     ;;
8100 cygwin*|msvc*|mks*)
8101     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8102     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8103     CC="\$(CYGWIN_WRAPPER) $CC"
8104     CXX="\$(CYGWIN_WRAPPER) $CXX"
8105     CPP="\$(CYGWIN_WRAPPER) $CPP"
8106     LD="\$(CYGWIN_WRAPPER) $LD"
8107     AS="\$(CYGWIN_WRAPPER) $AS"
8108     RC="\$(CYGWIN_WRAPPER) $RC"
8109     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8110     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8111     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8112     ;;
8113 esac
8115 AC_SUBST(CYGDRIVE_MOUNT)
8116 AC_SUBST(WIN_TOP_SRC)
8118 AC_SUBST(MOZILLA_VERSION)
8120 . ${srcdir}/config/chrome-versions.sh
8121 AC_DEFINE_UNQUOTED(MOZILLA_LOCALE_VERSION,"$MOZILLA_LOCALE_VERSION")
8122 AC_DEFINE_UNQUOTED(MOZILLA_REGION_VERSION,"$MOZILLA_REGION_VERSION")
8123 AC_DEFINE_UNQUOTED(MOZILLA_SKIN_VERSION,"$MOZILLA_SKIN_VERSION")
8125 AC_SUBST(ac_configure_args)
8127 dnl Spit out some output
8128 dnl ========================================================
8130 dnl The following defines are used by xpcom
8131 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8132 CPP_THROW_NEW
8133 HAVE_CPP_2BYTE_WCHAR_T
8134 HAVE_CPP_ACCESS_CHANGING_USING
8135 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8136 HAVE_CPP_BOOL
8137 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8138 HAVE_CPP_EXPLICIT
8139 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8140 HAVE_CPP_NAMESPACE_STD
8141 HAVE_CPP_NEW_CASTS
8142 HAVE_CPP_PARTIAL_SPECIALIZATION
8143 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8144 HAVE_CPP_TYPENAME
8145 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8146 HAVE_STATVFS
8147 NEED_CPP_UNUSED_IMPLEMENTATIONS
8148 NEW_H
8149 HAVE_GETPAGESIZE
8150 HAVE_ICONV
8151 HAVE_ICONV_WITH_CONST_INPUT
8152 HAVE_MBRTOWC
8153 HAVE_SYS_MOUNT_H
8154 HAVE_SYS_VFS_H
8155 HAVE_WCRTOMB
8156 MOZ_V1_STRING_ABI
8159 AC_CONFIG_HEADER(
8160 netwerk/necko-config.h
8161 xpcom/xpcom-config.h
8162 xpcom/xpcom-private.h
8165 # Save the defines header file before autoconf removes it.
8166 # (Do not add AC_DEFINE calls after this line.)
8167   _CONFIG_TMP=confdefs-tmp.h
8168   _CONFIG_DEFS_H=mozilla-config.h
8170   cat > $_CONFIG_TMP <<\EOF
8171 /* List of defines generated by configure. Included with preprocessor flag,
8172  * -include, to avoid long list of -D defines on the compile command-line.
8173  * Do not edit.
8174  */
8176 #ifndef _MOZILLA_CONFIG_H_
8177 #define _MOZILLA_CONFIG_H_
8180 _EGREP_PATTERN='^#define ('
8181 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8182     for f in $_NON_GLOBAL_ACDEFINES; do
8183         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8184     done
8186 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8188   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8190   cat >> $_CONFIG_TMP <<\EOF
8192 #endif /* _MOZILLA_CONFIG_H_ */
8196   # Only write mozilla-config.h when something changes (or it doesn't exist)
8197   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8198     rm $_CONFIG_TMP
8199   else
8200     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8201     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8203     echo ==== $_CONFIG_DEFS_H =================================
8204     cat $_CONFIG_DEFS_H
8205   fi
8207 dnl Probably shouldn't call this manually but we always want the output of DEFS
8208 rm -f confdefs.h.save
8209 mv confdefs.h confdefs.h.save
8210 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8211 AC_OUTPUT_MAKE_DEFS()
8212 MOZ_DEFINES=$DEFS
8213 AC_SUBST(MOZ_DEFINES)
8214 rm -f confdefs.h
8215 mv confdefs.h.save confdefs.h
8217 dnl Load the list of Makefiles to generate.
8218 dnl   To add new Makefiles, edit allmakefiles.sh.
8219 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8220 . ${srcdir}/allmakefiles.sh
8221 dnl 
8222 dnl Run a perl script to quickly create the makefiles.
8223 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8224 dnl   for the files it cannot handle correctly. This way, config.status
8225 dnl   will handle these files.
8226 dnl If it fails, nothing is set and config.status will run as usual.
8228 dnl This does not change the $MAKEFILES variable.
8230 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8232 if test -z "${AS_PERL}"; then
8233 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8234 else
8235 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8237 . ./conftest.sh
8238 rm conftest.sh
8240 echo $MAKEFILES > unallmakefiles
8242 AC_OUTPUT($MAKEFILES)
8244 dnl ========================================================
8245 dnl = Setup a nice relatively clean build environment for
8246 dnl = sub-configures.
8247 dnl ========================================================
8248 CC="$_SUBDIR_CC" 
8249 CXX="$_SUBDIR_CXX" 
8250 CFLAGS="$_SUBDIR_CFLAGS" 
8251 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8252 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8253 LDFLAGS="$_SUBDIR_LDFLAGS"
8254 HOST_CC="$_SUBDIR_HOST_CC" 
8255 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8256 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8259 unset MAKEFILES
8260 unset CONFIG_FILES
8262 if test "$COMPILE_ENVIRONMENT"; then
8263 if test -z "$MOZ_NATIVE_NSPR" || test "$MOZ_LDAP_XPCOM"; then
8264     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8265     if test -z "$MOZ_DEBUG"; then
8266         ac_configure_args="$ac_configure_args --disable-debug"
8267     fi
8268     if test "$MOZ_OPTIMIZE" = "1"; then
8269         ac_configure_args="$ac_configure_args --enable-optimize"
8270     fi
8271     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8272        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8273     fi
8274     if test -n "$HAVE_64BIT_OS"; then
8275         ac_configure_args="$ac_configure_args --enable-64bit"
8276     fi
8277     if test -n "$USE_ARM_KUSER"; then
8278         ac_configure_args="$ac_configure_args --with-arm-kuser"
8279     fi
8280     AC_OUTPUT_SUBDIRS(nsprpub)
8281     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8284 if test -z "$MOZ_NATIVE_NSPR"; then
8285     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8286     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8287     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8288        _libs=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --libdir=$\(LIBXUL_DIST\)/lib --libs`
8289        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $_libs'" config/autoconf.mk
8290     fi
8291     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
8292        _cflags=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --includedir=$\(LIBXUL_DIST\)/include/nspr --cflags`
8293        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $_cflags'" config/autoconf.mk
8294     fi
8295     rm -f config/autoconf.mk.bak
8298 # if we're building the LDAP XPCOM component, we need to build 
8299 # the c-sdk first.  
8301 if test "$MOZ_LDAP_XPCOM"; then
8303     # these subdirs may not yet have been created in the build tree.
8304     # don't use the "-p" switch to mkdir, since not all platforms have it
8305     #
8306     if test ! -d "directory"; then
8307         mkdir "directory"
8308     fi
8309     if test ! -d "directory/c-sdk"; then
8310         mkdir "directory/c-sdk"    
8311     fi
8312     if test ! -d "directory/c-sdk/ldap"; then
8313         mkdir "directory/c-sdk/ldap"    
8314     fi
8316     ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
8317     if test -z "$MOZ_DEBUG"; then
8318         ac_configure_args="$ac_configure_args --disable-debug"
8319     fi
8320     if test "$MOZ_OPTIMIZE" = "1"; then
8321         ac_configure_args="$ac_configure_args --enable-optimize"
8322     fi
8323     if test -n "$HAVE_64BIT_OS"; then
8324         ac_configure_args="$ac_configure_args --enable-64bit"
8325     fi
8326     AC_OUTPUT_SUBDIRS(directory/c-sdk)
8327     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8329 fi # COMPILE_ENVIRONMENT