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