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