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