Bug 443880. Comment-only change to IDL. r=me, b=443880
[wine-gecko.git] / configure.in
blob6ec2a3fd2f2e87ed055af36d4f2a66a5aa3e369a
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-l10n-base=DIR     path to l10n repositories],
212     L10NBASEDIR=$withval)
213 if test ! -z "$L10NBASEDIR"; then
214     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
215         AC_MSG_ERROR([--with-l10n-base must specify a path])
216     elif test -d "$L10NBASEDIR"; then
217         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
218     else
219         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
220     fi
222 AC_SUBST(L10NBASEDIR)
224 dnl ========================================================
225 dnl Checks for compilers.
226 dnl ========================================================
227 dnl Set CROSS_COMPILE in the environment when running configure
228 dnl to use the cross-compile setup for now
229 dnl ========================================================
231 if test "$COMPILE_ENVIRONMENT"; then
233 dnl Do some special WinCE toolchain stuff
234 case "$target" in
235 *wince)
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     # -Wshadow - removed because it generates more noise than help --pete
1317     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1318     if test -z "$INTEL_CC"; then
1319        # Don't use -Wcast-align with ICC
1320        case "$CPU_ARCH" in
1321            # And don't use it on hppa, ia64, sparc, since it's noisy there
1322            hppa | ia64 | sparc)
1323            ;;
1324            *)
1325         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1326            ;;
1327        esac
1328     fi
1330     dnl Turn pedantic on but disable the warnings for long long
1331     _PEDANTIC=1
1333     if test -z "$INTEL_CC"; then
1334       _IGNORE_LONG_LONG_WARNINGS=1
1335       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1336     else
1337       _IGNORE_LONG_LONG_WARNINGS=
1338     fi
1341     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1342     _USE_CPP_INCLUDE_FLAG=1
1343 else
1344     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1345     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1347     DSO_LDOPTS='-shared'
1348     if test "$GNU_LD"; then
1349         # Don't allow undefined symbols in libraries
1350         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1351     fi
1353     DSO_CFLAGS=''
1354     DSO_PIC_CFLAGS='-KPIC'
1355     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1358 if test "$GNU_CXX"; then
1359     # FIXME: Let us build with strict aliasing. bug 414641.
1360     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1361     # Turn on GNU specific features
1362     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1363     if test -z "$INTEL_CC"; then
1364        # Don't use -Wcast-align with ICC
1365        case "$CPU_ARCH" in
1366            # And don't use it on hppa, ia64, sparc, since it's noisy there
1367            hppa | ia64 | sparc)
1368            ;;
1369            *)
1370         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1371            ;;
1372        esac
1373     fi
1375     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1376     _USE_CPP_INCLUDE_FLAG=1
1378     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1379                    ac_has_wno_invalid_offsetof,
1380         [
1381             AC_LANG_SAVE
1382             AC_LANG_CPLUSPLUS
1383             _SAVE_CXXFLAGS="$CXXFLAGS"
1384             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1385             AC_TRY_COMPILE([],
1386                            [return(0);],
1387                            ac_has_wno_invalid_offsetof="yes",
1388                            ac_has_wno_invalid_offsetof="no")
1389             CXXFLAGS="$_SAVE_CXXFLAGS"
1390             AC_LANG_RESTORE
1391         ])
1392     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1393         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1394     fi
1395 else
1396     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1399 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1400 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1401 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1402 dnl normal behavior.
1403 dnl ========================================================
1404 MKSHLIB_FORCE_ALL=
1405 MKSHLIB_UNFORCE_ALL=
1407 if test "$COMPILE_ENVIRONMENT"; then
1408 if test "$GNU_CC"; then
1409   AC_MSG_CHECKING(whether ld has archive extraction flags)
1410   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1411    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1412     ac_cv_mkshlib_force_and_unforce="no"
1413     exec 3<&0 <<LOOP_INPUT
1414         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1415         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1416         force="-Wl,-all";              unforce="-Wl,-none"
1417 LOOP_INPUT
1418     while read line
1419     do
1420       eval $line
1421       LDFLAGS=$force
1422       LIBS=$unforce
1423       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1424     done
1425     exec 0<&3 3<&-
1426     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1427    ])
1428   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1429     AC_MSG_RESULT(no)
1430   else
1431     AC_MSG_RESULT(yes)
1432     eval $ac_cv_mkshlib_force_and_unforce
1433     MKSHLIB_FORCE_ALL=$force
1434     MKSHLIB_UNFORCE_ALL=$unforce
1435   fi
1436 fi # GNU_CC
1437 fi # COMPILE_ENVIRONMENT
1439 dnl =================================================================
1440 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1441 dnl which is bad when cross compiling.
1442 dnl =================================================================
1443 if test "$COMPILE_ENVIRONMENT"; then
1444 configure_static_assert_macros='
1445 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1446 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1447 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1450 dnl test that the macros actually work:
1451 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1452 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1453  [AC_LANG_SAVE
1454   AC_LANG_C
1455   ac_cv_static_assertion_macros_work="yes"
1456   AC_TRY_COMPILE([$configure_static_assert_macros],
1457                  [CONFIGURE_STATIC_ASSERT(1)],
1458                  ,
1459                  ac_cv_static_assertion_macros_work="no")
1460   AC_TRY_COMPILE([$configure_static_assert_macros],
1461                  [CONFIGURE_STATIC_ASSERT(0)],
1462                  ac_cv_static_assertion_macros_work="no",
1463                  )
1464   AC_LANG_CPLUSPLUS
1465   AC_TRY_COMPILE([$configure_static_assert_macros],
1466                  [CONFIGURE_STATIC_ASSERT(1)],
1467                  ,
1468                  ac_cv_static_assertion_macros_work="no")
1469   AC_TRY_COMPILE([$configure_static_assert_macros],
1470                  [CONFIGURE_STATIC_ASSERT(0)],
1471                  ac_cv_static_assertion_macros_work="no",
1472                  )
1473   AC_LANG_RESTORE
1474  ])
1475 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1476 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1477     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1479 fi # COMPILE_ENVIRONMENT
1481 dnl ========================================================
1482 dnl Checking for 64-bit OS
1483 dnl ========================================================
1484 if test "$COMPILE_ENVIRONMENT"; then
1485 AC_LANG_SAVE
1486 AC_LANG_C
1487 AC_MSG_CHECKING(for 64-bit OS)
1488 AC_TRY_COMPILE([$configure_static_assert_macros],
1489                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1490                result="yes", result="no")
1491 AC_MSG_RESULT("$result")
1492 if test "$result" = "yes"; then
1493     AC_DEFINE(HAVE_64BIT_OS)
1494     HAVE_64BIT_OS=1
1496 AC_SUBST(HAVE_64BIT_OS)
1497 AC_LANG_RESTORE
1498 fi # COMPILE_ENVIRONMENT
1500 dnl ========================================================
1501 dnl Enable high-memory support on OS/2 by default.
1502 dnl ========================================================
1503 MOZ_OS2_HIGH_MEMORY=1
1504 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1505 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1506     MOZ_OS2_HIGH_MEMORY=,
1507     MOZ_OS2_HIGH_MEMORY=1 )
1508 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1510 dnl ========================================================
1511 dnl System overrides of the defaults for host
1512 dnl ========================================================
1513 case "$host" in
1514 *-beos*)
1515     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1516     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1517     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1518     ;;
1520 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1521     if test -n "$_WIN32_MSVC"; then
1522         HOST_AR=lib
1523         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1524         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1525         HOST_RANLIB='echo ranlib'
1526     else
1527         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1528     fi
1529     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1530     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1531     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1532     HOST_BIN_SUFFIX=.exe
1533     case "$host" in
1534     *mingw*)
1535     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1536         ;;
1537     *)
1538         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1539         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1540             _pwd=`pwd`
1541             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1542         fi
1543         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1544             AS_PERL=1
1545             PERL="${CYGWIN_WRAPPER} $PERL"
1546         fi
1548         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1549             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1550         fi
1551         ;;
1552     esac
1553     ;;
1555 *-darwin*)
1556     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1557     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1558     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1559     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1560     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1561     ;;
1563 *-linux*|*-kfreebsd*-gnu)
1564     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1565     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1566     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1567     ;;
1569 *os2*)
1570     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1571     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1572     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1573     HOST_BIN_SUFFIX=.exe
1574     MOZ_FIX_LINK_PATHS=
1575     ;;
1577 *-osf*)
1578     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1579     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1580     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1581     ;;
1584     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1585     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1586     ;;
1587 esac
1589 dnl Get mozilla version from central milestone file
1590 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1592 dnl Get version of various core apps from the version files.
1593 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1595 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1596 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1598 dnl ========================================================
1599 dnl System overrides of the defaults for target
1600 dnl ========================================================
1602 case "$target" in
1603 *-aix*)
1604     AC_DEFINE(AIX)
1605     if test ! "$GNU_CC"; then
1606         if test ! "$HAVE_64BIT_OS"; then
1607             # Compiling with Visual Age C++ object model compat is the
1608             # default. To compile with object model ibm, add 
1609             # AIX_OBJMODEL=ibm to .mozconfig.
1610             if test "$AIX_OBJMODEL" = "ibm"; then
1611                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1612             else
1613                 AIX_OBJMODEL=compat
1614             fi
1615         else
1616             AIX_OBJMODEL=compat
1617         fi
1618         AC_SUBST(AIX_OBJMODEL)
1619         DSO_LDOPTS='-qmkshrobj=1'
1620         DSO_CFLAGS='-qflag=w:w'
1621         DSO_PIC_CFLAGS=
1622         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1623         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1624         MOZ_FIX_LINK_PATHS=
1625         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1626         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1627         if test "$COMPILE_ENVIRONMENT"; then
1628             AC_LANG_SAVE
1629             AC_LANG_CPLUSPLUS
1630             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
1631             AC_TRY_COMPILE([],
1632                 [#if (__IBMCPP__ < 502)
1633                  #error "Bad compiler"
1634                  #endif],
1635                 _BAD_COMPILER=,_BAD_COMPILER=1)
1636             if test -n "$_BAD_COMPILER"; then
1637                 AC_MSG_RESULT([no])    
1638                 AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
1639             else
1640                 AC_MSG_RESULT([yes])    
1641             fi
1642             AC_LANG_RESTORE
1643             TARGET_COMPILER_ABI="ibmc"
1644             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1645             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1646         fi
1647     fi
1648     case "${target_os}" in
1649     aix4.1*)
1650         DLL_SUFFIX='_shr.a'
1651         ;;
1652     esac
1653     if test "$COMPILE_ENVIRONMENT"; then
1654         AC_CHECK_HEADERS(sys/inttypes.h)
1655     fi
1656     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1657     ;;
1659 *-beos*)
1660     no_x=yes
1661     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1662     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1663     DSO_LDOPTS='-nostart'
1664     TK_LIBS='-lbe -lroot'
1665     LIBS="$LIBS -lbe"
1666     if test "$COMPILE_ENVIRONMENT"; then
1667         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1668         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1669     fi
1670     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1671     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1672     _MOZ_USE_RTTI=1
1673     USE_DEPENDENT_LIBS=
1674     MOZ_USER_DIR="Mozilla"
1675     ;;
1677 *-bsdi*)
1678     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1679     _PEDANTIC=
1680     _IGNORE_LONG_LONG_WARNINGS=
1681     case $OS_RELEASE in
1682         4.*|5.*)
1683             STRIP="$STRIP -d"
1684             ;;
1685         *)
1686             DSO_CFLAGS=''
1687             DSO_LDOPTS='-r'
1688             _WARNINGS_CFLAGS="-Wall"
1689             _WARNINGS_CXXFLAGS="-Wall"
1690             # The test above doesn't work properly, at least on 3.1.
1691             MKSHLIB_FORCE_ALL=''
1692             MKSHLIB_UNFORCE_ALL=''
1693         ;;
1694     esac
1695     ;;
1697 *-darwin*) 
1698     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1699     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1700     MOZ_OPTIMIZE_FLAGS="-O2"
1701     _PEDANTIC=
1702     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1703     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1704     DLL_SUFFIX=".dylib"
1705     DSO_LDOPTS=''
1706     STRIP="$STRIP -x -S"
1707     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1708     MOZ_ENABLE_POSTSCRIPT=
1709     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1710     LDFLAGS="$LDFLAGS -framework Cocoa"
1711     # The ExceptionHandling framework is needed for Objective-C exception
1712     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1713     # builds.
1714     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1715     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1716     MACOSX=1
1718     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1719     dnl ===================================================================
1720     if test "x$enable_dtrace" = "xyes"; then
1721         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1722     else
1723         dnl check for the presence of the -dead_strip linker flag
1724         AC_MSG_CHECKING([for -dead_strip option to ld])
1725         _SAVE_LDFLAGS=$LDFLAGS
1726         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1727         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1728         if test -n "$_HAVE_DEAD_STRIP" ; then
1729             AC_MSG_RESULT([yes])
1730             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1731         else
1732             AC_MSG_RESULT([no])
1733         fi
1734         
1735         LDFLAGS=$_SAVE_LDFLAGS
1736     fi
1737     ;;
1739 *-freebsd*)
1740     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1741         DLL_SUFFIX=".so.1.0"
1742         DSO_LDOPTS="-shared"
1743     fi
1744     if test ! "$GNU_CC"; then
1745         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1746     fi
1747 # Can't have force w/o an unforce.
1748 #    # Hack for FreeBSD 2.2
1749 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1750 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1751 #       MKSHLIB_UNFORCE_ALL=''
1752 #    fi
1753     ;; 
1755 *-hpux*)
1756     DLL_SUFFIX=".sl"
1757     if test ! "$GNU_CC"; then
1758         DSO_LDOPTS='-b -Wl,+s'
1759         DSO_CFLAGS=""
1760         DSO_PIC_CFLAGS="+Z"
1761         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1762         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1763         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1764     else
1765         DSO_LDOPTS='-b -E +s'
1766         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1767         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1768     fi
1769     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1770     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1771     ;;
1773 *-irix5*)
1774     AC_DEFINE(IRIX)
1775     DSO_LDOPTS='-elf -shared'
1777     if test "$GNU_CC"; then
1778        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1779        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1780        MKSHLIB_FORCE_ALL='-Wl,-all'
1781        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1782        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1783     else
1784        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1785        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1786        MKSHLIB_FORCE_ALL='-all'
1787        MKSHLIB_UNFORCE_ALL='-none'
1788     fi
1789     ;;
1791 *-irix6*)
1792     AC_DEFINE(IRIX)
1793     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1794     dnl compile and link using -n32
1795     USE_N32=1
1796     TARGET_COMPILER_ABI=n32
1797     DSO_LDOPTS='-elf -shared'
1798     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1799     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1800     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1801     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1802     if test "$GNU_CC"; then
1803        MKSHLIB_FORCE_ALL='-Wl,-all'
1804        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1805        _WARNINGS_CFLAGS="-Wall"
1806        _WARNINGS_CXXFLAGS="-Wall"
1807        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1808     else
1809        MKSHLIB_FORCE_ALL='-all'
1810        MKSHLIB_UNFORCE_ALL='-none'
1811            AR_LIST="$AR t"
1812            AR_EXTRACT="$AR x"
1813            AR_DELETE="$AR d"
1814            AR='$(CXX) -ar'
1815            AR_FLAGS='-o $@'
1816        CFLAGS="$CFLAGS -woff 3262 -G 4"
1817        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1818        if test -n "$USE_N32"; then
1819            ASFLAGS="$ASFLAGS -n32"
1820            CFLAGS="$CFLAGS -n32"
1821            CXXFLAGS="$CXXFLAGS -n32"
1822            LDFLAGS="$LDFLAGS -n32"
1823        fi
1824        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1825        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1826        MOZ_FIX_LINK_PATHS=
1827     fi
1828     if test -z "$GNU_CXX"; then
1829       MIPSPRO_CXX=1
1830     fi
1831     ;;
1833 *-*linux*)
1834     if test "$GNU_CC"; then
1835         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1836         case $GCC_VERSION in
1837         4.1.*|4.2.*)
1838             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1839             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1840         esac
1841     fi
1843     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1844     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1845     MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1846                                       # and that combo is not yet good at
1847                                       # debugging inlined functions (even
1848                                       # when using DWARF2 as the debugging
1849                                       # format)    
1851     MOZ_MEMORY=1
1853     case "${target_cpu}" in
1854     alpha*)
1855         CFLAGS="$CFLAGS -mieee"
1856         CXXFLAGS="$CXXFLAGS -mieee"
1857     ;;
1858     i*86)
1859         USE_ELF_DYNSTR_GC=1
1860         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1861     ;;
1862     mips*)
1863         CFLAGS="$CFLAGS -Wa,-xgot"
1864         CXXFLAGS="$CXXFLAGS -Wa,-xgot"
1865     ;;
1866     esac
1867     ;;
1869 *-wince*)
1871     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1872     AR_LIST="$AR -list"
1873     AR_EXTRACT="$AR -extract"
1874     AR_DELETE="$AR d"
1875     AR_FLAGS='-OUT:"$@"'
1877     DSO_CFLAGS=
1878     DSO_PIC_CFLAGS=
1879     DLL_SUFFIX=.dll
1880     BIN_SUFFIX='.exe'
1881     RC=rc.exe
1882     # certain versions of cygwin's makedepend barf on the 
1883     # #include <string> vs -I./dist/include/string issue so don't use it
1884     SYSTEM_MAKEDEPEND=
1886     HOST_CC=cl
1887     HOST_CXX=cl
1888     HOST_LD=link
1889     HOST_AR='lib -OUT:$@'
1890     HOST_RANLIB='echo ranlib'
1891     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1892         
1893         
1894     WARNINGS_AS_ERRORS='-WX'
1895         MOZ_OPTIMIZE_FLAGS='-O1'
1896     AR_FLAGS='-NOLOGO -OUT:"$@"'
1897     ASM_SUFFIX=asm
1898     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1899     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1900     DLL_PREFIX=
1901     DOXYGEN=:
1902     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1903     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1904     GARBAGE=
1905     IMPORT_LIB_SUFFIX=lib
1906     LIBS="$LIBS"
1907     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1908     LIB_PREFIX=
1909     LIB_SUFFIX=lib 
1910     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1911     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1912     MKSHLIB_FORCE_ALL=
1913     MKSHLIB_UNFORCE_ALL=
1914     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1915     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1916     MOZ_DEBUG_FLAGS='-Zi'
1917     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1918     MOZ_FIX_LINK_PATHS=
1919     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1920     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1921     OBJ_SUFFIX=obj
1922     RANLIB='echo not_ranlib'
1923     STRIP='echo not_strip'
1924     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1925     UNZIP=unzip
1926     XARGS=xargs
1927     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1928     ZIP=zip
1929     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1930     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1931     STATIC_LIBIDL=1
1933     AC_DEFINE(HAVE_SNPRINTF)
1934     AC_DEFINE(_WINDOWS)
1935     AC_DEFINE(_WIN32)
1936     AC_DEFINE(WIN32)
1937     AC_DEFINE(XP_WIN)
1938     AC_DEFINE(XP_WIN32)
1939     AC_DEFINE(HW_THREADS)
1940     AC_DEFINE(STDC_HEADERS)
1941     AC_DEFINE(NEW_H, <new>)
1942     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1944     TARGET_MD_ARCH=win32
1945     _PLATFORM_DEFAULT_TOOLKIT='windows'
1946     BIN_SUFFIX='.exe'
1947     USE_SHORT_LIBNAME=1
1948     MOZ_ENABLE_POSTSCRIPT=
1949     MOZ_USER_DIR="Mozilla"
1953 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1954     DSO_CFLAGS=
1955     DSO_PIC_CFLAGS=
1956     DLL_SUFFIX=.dll
1957     RC=rc.exe
1958     # certain versions of cygwin's makedepend barf on the 
1959     # #include <string> vs -I./dist/include/string issue so don't use it
1960     SYSTEM_MAKEDEPEND=
1961     if test -n "$GNU_CC"; then
1962         CC="$CC -mno-cygwin"
1963         CXX="$CXX -mno-cygwin"
1964         CPP="$CPP -mno-cygwin"
1965         CFLAGS="$CFLAGS -mms-bitfields"
1966         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1967         DSO_LDOPTS='-shared'
1968         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1969         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1970         RC='$(WINDRES)'
1971         # Use temp file for windres (bug 213281)
1972         RCFLAGS='-O coff --use-temp-file'
1973         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1974         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1975         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1976         MOZ_FIX_LINK_PATHS=
1977         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1978         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1979         DLL_PREFIX=
1980         IMPORT_LIB_SUFFIX=dll.a
1981     else
1982         TARGET_COMPILER_ABI=msvc
1983         HOST_CC='$(CC)'
1984         HOST_CXX='$(CXX)'
1985         HOST_LD='$(LD)'
1986         AR='lib -NOLOGO -OUT:"$@"'
1987         AR_FLAGS=
1988         RANLIB='echo not_ranlib'
1989         STRIP='echo not_strip'
1990         XARGS=xargs
1991         ZIP=zip
1992         UNZIP=unzip
1993         DOXYGEN=:
1994         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1995         OBJ_SUFFIX=obj
1996         LIB_SUFFIX=lib
1997         DLL_PREFIX=
1998         LIB_PREFIX=
1999         IMPORT_LIB_SUFFIX=lib
2000         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
2001         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
2002         MKSHLIB_FORCE_ALL=
2003         MKSHLIB_UNFORCE_ALL=
2004         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2005         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
2006         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
2007         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2008         MOZ_DEBUG_FLAGS='-Zi'
2009         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2010         WARNINGS_AS_ERRORS='-WX'
2011         MOZ_OPTIMIZE_FLAGS='-O1'
2012         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2013         MOZ_FIX_LINK_PATHS=
2014         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2015         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2016         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2017         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2018         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2019         if test $_MSC_VER -ge 1400; then
2020             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2021             dnl For profile-guided optimization
2022             PROFILE_GEN_CFLAGS="-GL"
2023             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2024             dnl XXX: PGO builds can fail with warnings treated as errors,
2025             dnl specifically "no profile data available" appears to be
2026             dnl treated as an error sometimes. This might be a consequence
2027             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2028             dnl with the linker doing most of the work in the whole-program
2029             dnl optimization/PGO case. I think it's probably a compiler bug,
2030             dnl but we work around it here.
2031             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2032             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2033             dnl Probably also a compiler bug, but what can you do?
2034             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2035             if test -n "$_USE_DYNAMICBASE"; then
2036                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2037             fi
2038         fi
2039     fi
2040     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2041     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2042     AC_DEFINE(HAVE_SNPRINTF)
2043     AC_DEFINE(_WINDOWS)
2044     AC_DEFINE(_WIN32)
2045     AC_DEFINE(WIN32)
2046     AC_DEFINE(XP_WIN)
2047     AC_DEFINE(XP_WIN32)
2048     AC_DEFINE(HW_THREADS)
2049     AC_DEFINE(STDC_HEADERS)
2050     AC_DEFINE(NEW_H, <new>)
2051     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2052     TARGET_MD_ARCH=win32
2053     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2054     BIN_SUFFIX='.exe'
2055     USE_SHORT_LIBNAME=1
2056     MOZ_ENABLE_POSTSCRIPT=
2057     MOZ_USER_DIR="Mozilla"
2059     dnl Hardcode to win95 for now - cls
2060     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2062     dnl set NO_X11 defines here as the general check is skipped on win32
2063     no_x=yes
2064     AC_DEFINE(NO_X11)
2066     dnl MinGW/MSYS doesn't provide or need cygpath
2067     case "$host" in
2068     *-mingw*)
2069         CYGPATH_W=echo
2070         CYGPATH_S=cat
2071         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2072         ;;
2073     *-cygwin*|*-msvc*|*-mks*)
2074         CYGPATH_W="cygpath -a -w"
2075         CYGPATH_S="sed -e s|\\\\|/|g"
2076         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2077         ;;
2078     esac
2079     case "$host" in
2080     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2082     if test -z "$MOZ_TOOLS"; then
2083         AC_MSG_ERROR([MOZ_TOOLS is not set])
2084     fi
2086     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2087     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2088         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2089     fi
2090     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2091         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2092     fi
2093     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2095     if test -n "$GLIB_PREFIX"; then
2096         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2097         if test "$?" = "0"; then
2098             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2099                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2100             fi
2101             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2102         else
2103             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2104         fi
2105     else
2106         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2107     fi
2108     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2109         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2110     fi
2111     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2112     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2113         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2114     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2115         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2116     else
2117         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2118     fi
2120     if test -n "$LIBIDL_PREFIX"; then
2121         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2122         if test "$?" = "0"; then
2123             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2124                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2125             fi
2126             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2127         else
2128             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2129         fi
2130     else
2131         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2132     fi        
2133     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2134         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2135     fi
2136     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2137     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2138         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2139         STATIC_LIBIDL=1
2140     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2141         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2142     else
2143         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2144     fi
2145     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2146     ;;
2148     *) # else cross-compiling
2149         if test -n "$GLIB_PREFIX"; then
2150             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2151             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2152                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2153             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2154                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2155             else
2156                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2157             fi
2158         fi
2159         if test -n "$LIBIDL_PREFIX"; then
2160             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2161             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2162                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2163                 STATIC_LIBIDL=1
2164             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2165                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2166             else
2167                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2168             fi
2169         fi
2170         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2171         ;;
2172     esac 
2175     case "$host_os" in
2176     cygwin*|msvc*|mks*)
2177         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])
2178         ;;
2180     *)
2181         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2183         AC_LANG_SAVE
2184         AC_LANG_CPLUSPLUS
2185         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2186         AC_LANG_RESTORE
2187         ;;
2188     esac
2190     case "$target" in
2191     i*86-*)
2192         AC_DEFINE(_X86_)
2193         ;;
2194     alpha-*)
2195         AC_DEFINE(_ALPHA_)
2196         ;;
2197     mips-*)
2198         AC_DEFINE(_MIPS_)
2199         ;;
2200     *)
2201         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2202         ;;
2203     esac
2204     ;;
2206 *-netbsd*)
2207     DSO_CFLAGS=''
2208     CFLAGS="$CFLAGS -Dunix"
2209     CXXFLAGS="$CXXFLAGS -Dunix"
2210     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2211         DLL_SUFFIX=".so"
2212         DSO_PIC_CFLAGS='-fPIC -DPIC'
2213         DSO_LDOPTS='-shared'
2214         BIN_FLAGS='-Wl,--export-dynamic'
2215     else
2216         DSO_PIC_CFLAGS='-fPIC -DPIC'
2217         DLL_SUFFIX=".so.1.0"
2218         DSO_LDOPTS='-shared'
2219     fi
2220     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2221     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2222     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2223     if test "$LIBRUNPATH"; then
2224         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2225     fi
2226     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2227     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2228     ;;
2230 *-nto*) 
2231         AC_DEFINE(NTO)  
2232         AC_DEFINE(_QNX_SOURCE)
2233         AC_DEFINE(_i386)
2234         OS_TARGET=NTO
2235         WARNINGS_AS_ERRORS=''
2236         MOZ_OPTIMIZE_FLAGS="-O"
2237         MOZ_DEBUG_FLAGS="-gstabs"
2238         USE_PTHREADS=1
2239         _PEDANTIC=
2240         LIBS="$LIBS -lsocket -lstdc++"
2241         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2242         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2243         if test "$with_x" != "yes"
2244         then
2245                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2246             TK_CFLAGS='-I/usr/include/photon'
2247                 TK_LIBS='-lph'
2248         fi
2249         case "${target_cpu}" in
2250         ppc*)
2251         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2252         ;;
2253         esac
2254         case "${host_cpu}" in
2255         i*86)
2256         USE_ELF_DYNSTR_GC=1
2257         ;;
2258         esac
2259         ;;
2261 *-openbsd*)
2262     DLL_SUFFIX=".so.1.0"
2263     DSO_CFLAGS=''
2264     DSO_PIC_CFLAGS='-fPIC'
2265     DSO_LDOPTS='-shared -fPIC'
2266     if test "$LIBRUNPATH"; then
2267         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2268     fi
2269     ;;
2271 *-openvms*) 
2272     AC_DEFINE(NO_PW_GECOS)
2273     AC_DEFINE(NO_UDSOCK)
2274     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2275     USE_PTHREADS=1
2276     MKSHLIB_FORCE_ALL='-all'
2277     MKSHLIB_UNFORCE_ALL='-none'
2278     AS='as'
2279     AS_DASH_C_FLAG='-Wc/names=as_is'
2280     AR_FLAGS='c $@'
2281     DSO_LDOPTS='-shared -auto_symvec'
2282     DSO_PIC_CFLAGS=
2283     MOZ_DEBUG_LDFLAGS='-g'
2284     COMPAQ_CXX=1
2285     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2286     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2287     ;;
2290 *-os2*)
2291     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2292     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2293     AC_DEFINE(XP_OS2)
2294     USE_SHORT_LIBNAME=1
2295     DLL_PREFIX=
2296     LIB_PREFIX=
2297     LIB_SUFFIX=lib
2298     BIN_SUFFIX=".exe"
2299     DLL_SUFFIX=".dll"
2300     IMPORT_LIB_SUFFIX=lib
2301     DSO_PIC_CFLAGS=
2302     TARGET_MD_ARCH=os2
2303     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2304     MOZ_ENABLE_POSTSCRIPT=
2305     RC=rc.exe
2306     RCFLAGS='-n'
2307     MOZ_USER_DIR="Mozilla"
2309     if test "$MOZTOOLS"; then
2310         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2311     else
2312         AC_MSG_ERROR([MOZTOOLS is not set])
2313     fi
2315     # EMX/GCC build
2316     if test -n "$GNU_CC"; then
2317         AC_DEFINE(OS2)
2318         AC_DEFINE(XP_OS2_EMX)
2319         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2320         AC_DEFINE(TCPV40HDRS)
2321         AR=emxomfar
2322         AR_FLAGS='r $@'
2323         CFLAGS="$CFLAGS -Zomf"
2324         CXXFLAGS="$CXXFLAGS -Zomf"
2325         DSO_LDOPTS='-Zdll'
2326         BIN_FLAGS='-Zlinker /ST:0x100000'
2327         IMPLIB='emximp -o'
2328         FILTER='emxexp -o'
2329         LDFLAGS='-Zmap'
2330         WARNINGS_AS_ERRORS='-Werror'
2331         MOZ_DEBUG_FLAGS="-g -fno-inline"
2332         MOZ_OPTIMIZE_FLAGS="-O2"
2333         MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2334         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2335         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2336         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2337         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2338           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2339           LDFLAGS="$LDFLAGS -Zhigh-mem"
2340           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2341           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2342         fi
2344         # GCC for OS/2 currently predefines these, but we don't want them
2345         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2346         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2348         AC_CACHE_CHECK(for __declspec(dllexport),
2349            ac_os2_declspec,
2350            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2351                            [return 0;],
2352                            ac_os2_declspec="yes",
2353                            ac_os2_declspec="no")])
2354         if test "$ac_os2_declspec" = "yes"; then
2355            FILTER='true'
2356            MOZ_OS2_USE_DECLSPEC='1'
2357         fi
2358         
2359     # Visual Age C++ build
2360     elif test "$VACPP" = "yes"; then
2361         MOZ_BUILD_ROOT=`pwd -D`
2362         OBJ_SUFFIX=obj
2363         AR=-ilib
2364         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2365         AR_LIST='/L'
2366         AR_EXTRACT='-*'
2367         AR_DELETE='-'
2368         AS=alp
2369         ASFLAGS='-Mb'
2370         AS_DASH_C_FLAG=''
2371         ASM_SUFFIX=asm
2372         LD='-ilink'
2373         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2374         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2375         MOZ_DEBUG_FLAGS="/Ti+"
2376         WARNINGS_AS_ERRORS='-WX'
2377         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2378         LDFLAGS="/NOL /M"
2379         MOZ_DEBUG_LDFLAGS="/DE"
2380         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2381         DSO_LDOPTS=''
2382         DSO_PIC_CFLAGS=
2383         IMPLIB='implib /NOL /NOI'
2384         FILTER='cppfilt -q -B -P'
2385         AC_DEFINE(NO_ANSI_KEYWORDS)
2386         AC_DEFINE(OS2,4)
2387         AC_DEFINE(_X86_)
2388         AC_DEFINE(XP_OS2_VACPP)
2389         AC_DEFINE(TCPV40HDRS)
2390         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2391         AC_DEFINE(STDC_HEADERS)
2392         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2393         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2394         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2395         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2396         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2397         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2398         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2399     fi
2400     ;;
2402 alpha*-*-osf*)
2403     if test "$GNU_CC"; then
2404       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2405       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2407     else
2408         MOZ_DEBUG_FLAGS='-g'
2409         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2410         CFLAGS="$CFLAGS -ieee"
2411         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2412         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2413         DSO_CFLAGS=
2414         DSO_PIC_CFLAGS=
2415         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2416         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2417         MKSHLIB_FORCE_ALL='-all'
2418         MKSHLIB_UNFORCE_ALL='-none'
2419         dnl Might fix the libxpcom.so breakage on this platform as well....
2420         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2421         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2422     fi
2423     if test -z "$GNU_CXX"; then
2424       COMPAQ_CXX=1
2425     fi
2426     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2427     ;;
2429 *-qnx*) 
2430     DIRENT_INO=d_stat.st_ino
2431     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2432     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2433     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2434     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2435     AC_DEFINE(STDC_HEADERS)
2436     if test "$no_x" = "yes"; then
2437             _PLATFORM_DEFAULT_TOOLKIT='photon'
2438             TK_CFLAGS='-I/usr/nto/include/photon'
2439             TK_LIBS='-lphoton -lphrender'
2440     fi
2441     ;;
2443 *-sco*) 
2444     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2445     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2446     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2447     if test ! "$GNU_CC"; then
2448        DSO_LDOPTS='-G'
2449     fi
2450     ;;
2452 dnl the qsort routine under solaris is faulty
2453 *-solaris*) 
2454     AC_DEFINE(SOLARIS)
2455     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2456     SYSTEM_MAKEDEPEND=
2457     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2458     # libraries one level up (e.g. libnspr4.so)
2459     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2460     MOZ_MEMORY=1
2461     if test -z "$GNU_CC"; then
2462        NS_USE_NATIVE=1
2463        MOZ_FIX_LINK_PATHS='-R $(LIBXUL_DIST)/bin'
2464        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2466        if test "$CPU_ARCH" != "sparc"; then
2467           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2468           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2469        else
2470           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2471           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2472           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2473        fi
2475        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2476        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2477            _SAVE_LDFLAGS=$LDFLAGS
2478            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2479            AC_TRY_LINK([#include <stdio.h>],
2480                        [printf("Hello World\n");],
2481                        ,
2482                        [LDFLAGS=$_SAVE_LDFLAGS])
2483        fi
2484        WARNINGS_AS_ERRORS='-Werror'
2485        MOZ_OPTIMIZE_FLAGS="-xO4"
2486        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2487        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2488        MKSHLIB_FORCE_ALL='-z allextract'
2489        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2490        DSO_LDOPTS='-G -z muldefs'
2491        AR_LIST="$AR t"
2492        AR_EXTRACT="$AR x"
2493        AR_DELETE="$AR d"
2494        AR='$(CXX) -xar'
2495        AR_FLAGS='-o $@'
2496        AS='/usr/ccs/bin/as'
2497        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2498        AS_DASH_C_FLAG=''
2499        TARGET_COMPILER_ABI="sunc"
2500         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2501         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2502        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2503        AC_LANG_SAVE
2504        AC_LANG_CPLUSPLUS
2505        AC_TRY_COMPILE([],
2506            [#if (__SUNPRO_CC < 0x530)
2507            #error "Denied"
2508            #endif],
2509            _BAD_COMPILER=,_BAD_COMPILER=1)
2510         if test -n "$_BAD_COMPILER"; then
2511             _res="no"
2512             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2513         else
2514             _res="yes"
2515         fi
2516         AC_MSG_RESULT([$_res])
2517         AC_LANG_RESTORE
2518     else
2519        ASFLAGS="$ASFLAGS -fPIC"
2520        DSO_LDOPTS='-G'
2521        _WARNINGS_CFLAGS=''
2522        _WARNINGS_CXXFLAGS=''
2523        if test "$OS_RELEASE" = "5.3"; then
2524           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2525        fi
2526     fi
2527     if test "$OS_RELEASE" = "5.5.1"; then
2528        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2529     fi
2530     ;;
2532 *-sunos*) 
2533     DSO_LDOPTS='-Bdynamic'
2534     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2535     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2536     AC_DEFINE(SUNOS4)
2537     AC_DEFINE(SPRINTF_RETURNS_STRING)
2538     case "$(target_os)" in
2539     sunos4.1*)
2540         DLL_SUFFIX='.so.1.0'
2541         ;;
2542     esac
2543     ;;
2545 *-sysv4.2uw7*) 
2546         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2547     ;;
2549 *-os2*)
2550     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2551     ;;
2553 esac
2555 dnl Only one oddball right now (QNX), but this gives us flexibility
2556 dnl if any other platforms need to override this in the future.
2557 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2559 dnl ========================================================
2560 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2561 dnl by now will not have any way to link most binaries (tests
2562 dnl as well as viewer, apprunner, etc.), because some symbols
2563 dnl will be left out of the "composite" .so's by ld as unneeded.
2564 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2565 dnl they can link in the static libs that provide the missing
2566 dnl symbols.
2567 dnl ========================================================
2568 NO_LD_ARCHIVE_FLAGS=
2569 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2570     NO_LD_ARCHIVE_FLAGS=1
2572 case "$target" in
2573 *-os2*)
2574     NO_LD_ARCHIVE_FLAGS=
2575     ;;
2576 *-aix4.3*|*-aix5*)
2577     NO_LD_ARCHIVE_FLAGS=
2578     ;;
2579 *-openvms*)
2580     NO_LD_ARCHIVE_FLAGS=
2581     ;;
2582 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2583     if test -z "$GNU_CC"; then
2584         NO_LD_ARCHIVE_FLAGS=
2585     fi
2586     ;;
2587 esac
2588 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2591 dnl Indicate that platform requires special thread safe 
2592 dnl locking when starting up the OJI JVM 
2593 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2594 dnl ========================================================
2595 case "$target" in
2596     *-hpux*)      
2597         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2598         ;;
2599 esac
2601 dnl ========================================================
2602 dnl = Flags to strip unused symbols from .so components
2603 dnl ========================================================
2604 case "$target" in
2605     *-linux*|*-kfreebsd*-gnu)
2606         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2607         ;;
2608     *-solaris*)
2609         if test -z "$GNU_CC"; then
2610          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2611         else
2612          if test -z "$GCC_USE_GNU_LD"; then
2613           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2614          else
2615           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2616          fi
2617         fi
2618         ;;
2619     *-nto*) 
2620         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2621         ;;
2622     *-darwin*)
2623         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2624         ;;
2625     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2626         if test -n "$GNU_CC"; then
2627            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2628         fi
2629         ;;
2630 esac
2632 if test -z "$COMPILE_ENVIRONMENT"; then
2633     SKIP_COMPILER_CHECKS=1
2634     SKIP_LIBRARY_CHECKS=1
2637 if test -z "$SKIP_COMPILER_CHECKS"; then
2638 dnl Checks for typedefs, structures, and compiler characteristics.
2639 dnl ========================================================
2640 AC_LANG_C
2641 AC_HEADER_STDC
2642 AC_C_CONST
2643 AC_TYPE_MODE_T
2644 AC_TYPE_OFF_T
2645 AC_TYPE_PID_T
2646 AC_TYPE_SIZE_T
2647 AC_STRUCT_ST_BLKSIZE
2648 AC_MSG_CHECKING(for siginfo_t)
2649 AC_CACHE_VAL(ac_cv_siginfo_t,
2650  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2651                   #include <signal.h>],
2652                  [siginfo_t* info;],
2653                  [ac_cv_siginfo_t=true],
2654                  [ac_cv_siginfo_t=false])])
2655 if test "$ac_cv_siginfo_t" = true ; then
2656   AC_DEFINE(HAVE_SIGINFO_T)
2657   AC_MSG_RESULT(yes)
2658 else
2659   AC_MSG_RESULT(no)
2662 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2663 dnl  header files.  These defines make Visual Age use the mozilla
2664 dnl  defines types.
2665 if test "$VACPP" = "yes"; then
2666    AC_DEFINE(__size_t)
2667    AC_DEFINE(__off_t)
2670 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2671 dnl ========================================================
2672 AC_MSG_CHECKING(for int16_t)
2673 AC_CACHE_VAL(ac_cv_int16_t,
2674  [AC_TRY_COMPILE([#include <stdio.h>
2675                   #include <sys/types.h>],
2676                  [int16_t foo = 0;],
2677                  [ac_cv_int16_t=true],
2678                  [ac_cv_int16_t=false])])
2679 if test "$ac_cv_int16_t" = true ; then
2680   AC_DEFINE(HAVE_INT16_T)
2681   AC_MSG_RESULT(yes)
2682 else
2683   AC_MSG_RESULT(no)
2685 AC_MSG_CHECKING(for int32_t)
2686 AC_CACHE_VAL(ac_cv_int32_t,
2687  [AC_TRY_COMPILE([#include <stdio.h>
2688                   #include <sys/types.h>],
2689                  [int32_t foo = 0;],
2690                  [ac_cv_int32_t=true],
2691                  [ac_cv_int32_t=false])])
2692 if test "$ac_cv_int32_t" = true ; then
2693   AC_DEFINE(HAVE_INT32_T)
2694   AC_MSG_RESULT(yes)
2695 else
2696   AC_MSG_RESULT(no)
2698 AC_MSG_CHECKING(for int64_t)
2699 AC_CACHE_VAL(ac_cv_int64_t,
2700  [AC_TRY_COMPILE([#include <stdio.h>
2701                   #include <sys/types.h>],
2702                  [int64_t foo = 0;],
2703                  [ac_cv_int64_t=true],
2704                  [ac_cv_int64_t=false])])
2705 if test "$ac_cv_int64_t" = true ; then
2706   AC_DEFINE(HAVE_INT64_T)
2707   AC_MSG_RESULT(yes)
2708 else
2709   AC_MSG_RESULT(no)
2711 AC_MSG_CHECKING(for int64)
2712 AC_CACHE_VAL(ac_cv_int64,
2713  [AC_TRY_COMPILE([#include <stdio.h>
2714                   #include <sys/types.h>],
2715                  [int64 foo = 0;],
2716                  [ac_cv_int64=true],
2717                  [ac_cv_int64=false])])
2718 if test "$ac_cv_int64" = true ; then
2719   AC_DEFINE(HAVE_INT64)
2720   AC_MSG_RESULT(yes)
2721 else
2722   AC_MSG_RESULT(no)
2724 AC_MSG_CHECKING(for uint)
2725 AC_CACHE_VAL(ac_cv_uint,
2726  [AC_TRY_COMPILE([#include <stdio.h>
2727                   #include <sys/types.h>],
2728                  [uint foo = 0;],
2729                  [ac_cv_uint=true],
2730                  [ac_cv_uint=false])])
2731 if test "$ac_cv_uint" = true ; then
2732   AC_DEFINE(HAVE_UINT)
2733   AC_MSG_RESULT(yes)
2734 else
2735   AC_MSG_RESULT(no)
2737 AC_MSG_CHECKING(for uint_t)
2738 AC_CACHE_VAL(ac_cv_uint_t,
2739  [AC_TRY_COMPILE([#include <stdio.h>
2740                   #include <sys/types.h>],
2741                  [uint_t foo = 0;],
2742                  [ac_cv_uint_t=true],
2743                  [ac_cv_uint_t=false])])
2744 if test "$ac_cv_uint_t" = true ; then
2745   AC_DEFINE(HAVE_UINT_T)
2746   AC_MSG_RESULT(yes)
2747 else
2748   AC_MSG_RESULT(no)
2750 AC_MSG_CHECKING(for uint16_t)
2751 AC_CACHE_VAL(ac_cv_uint16_t,
2752  [AC_TRY_COMPILE([#include <stdio.h>
2753                   #include <sys/types.h>],
2754                  [uint16_t foo = 0;],
2755                  [ac_cv_uint16_t=true],
2756                  [ac_cv_uint16_t=false])])
2757 if test "$ac_cv_uint16_t" = true ; then
2758   AC_DEFINE(HAVE_UINT16_T)
2759   AC_MSG_RESULT(yes)
2760 else
2761   AC_MSG_RESULT(no)
2764 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2765 dnl are defined when compiling C++ but not C.  Since the result of this
2766 dnl test is used only in C++, do it in C++.
2767 AC_LANG_CPLUSPLUS
2769 AC_MSG_CHECKING(for uname.domainname)
2770 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2771     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2772         [ struct utsname *res; char *domain; 
2773             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2774         [ac_cv_have_uname_domainname_field=true],
2775         [ac_cv_have_uname_domainname_field=false])])
2777 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2778     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2779     AC_MSG_RESULT(yes)
2780 else
2781     AC_MSG_RESULT(no)
2784 AC_MSG_CHECKING(for uname.__domainname)
2785 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2786     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2787         [ struct utsname *res; char *domain; 
2788             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2789         [ac_cv_have_uname_us_domainname_field=true],
2790         [ac_cv_have_uname_us_domainname_field=false])])
2792 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2793     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2794     AC_MSG_RESULT(yes)
2795 else
2796     AC_MSG_RESULT(no)
2799 AC_LANG_C
2801 dnl Check for usable wchar_t (2 bytes, unsigned)
2802 dnl (we really don't need the unsignedness check anymore)
2803 dnl ========================================================
2805 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2806     ac_cv_have_usable_wchar_v2,
2807     [AC_TRY_COMPILE([#include <stddef.h>
2808                      $configure_static_assert_macros],
2809                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2810                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2811                     ac_cv_have_usable_wchar_v2="yes",
2812                     ac_cv_have_usable_wchar_v2="no")])
2813 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2814     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2815     HAVE_CPP_2BYTE_WCHAR_T=1
2816 else
2817 dnl This is really gcc-only
2818 dnl Do this test using CXX only since some versions of gcc
2819 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2820 dnl only have short-wchar support for c++.
2821 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2823     AC_LANG_SAVE
2824     AC_LANG_CPLUSPLUS
2825     _SAVE_CXXFLAGS=$CXXFLAGS
2826     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2828     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2829         ac_cv_have_usable_wchar_option_v2,
2830         [AC_TRY_LINK([#include <stddef.h>
2831                       $configure_static_assert_macros],
2832                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2833                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2834                      ac_cv_have_usable_wchar_option_v2="yes",
2835                      ac_cv_have_usable_wchar_option_v2="no")])
2837     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2838         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2839         HAVE_CPP_2BYTE_WCHAR_T=1
2840     else    
2841         CXXFLAGS=$_SAVE_CXXFLAGS
2842     fi
2843     AC_LANG_RESTORE
2846 dnl Check for .hidden assembler directive and visibility attribute.
2847 dnl Borrowed from glibc configure.in
2848 dnl ===============================================================
2849 if test "$GNU_CC"; then
2850   AC_CACHE_CHECK(for visibility(hidden) attribute,
2851                  ac_cv_visibility_hidden,
2852                  [cat > conftest.c <<EOF
2853                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2855                   ac_cv_visibility_hidden=no
2856                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2857                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2858                       ac_cv_visibility_hidden=yes
2859                     fi
2860                   fi
2861                   rm -f conftest.[cs]
2862                  ])
2863   if test "$ac_cv_visibility_hidden" = "yes"; then
2864     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2866     AC_CACHE_CHECK(for visibility(default) attribute,
2867                    ac_cv_visibility_default,
2868                    [cat > conftest.c <<EOF
2869                     int foo __attribute__ ((visibility ("default"))) = 1;
2871                     ac_cv_visibility_default=no
2872                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2873                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2874                         ac_cv_visibility_default=yes
2875                       fi
2876                     fi
2877                     rm -f conftest.[cs]
2878                    ])
2879     if test "$ac_cv_visibility_default" = "yes"; then
2880       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2882       AC_CACHE_CHECK(for visibility pragma support,
2883                      ac_cv_visibility_pragma,
2884                      [cat > conftest.c <<EOF
2885 #pragma GCC visibility push(hidden)
2886                       int foo_hidden = 1;
2887 #pragma GCC visibility push(default)
2888                       int foo_default = 1;
2890                       ac_cv_visibility_pragma=no
2891                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2892                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2893                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2894                             ac_cv_visibility_pragma=yes
2895                           fi
2896                         fi
2897                       fi
2898                       rm -f conftest.[cs]
2899                     ])
2900       if test "$ac_cv_visibility_pragma" = "yes"; then
2901         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2902                        ac_cv_have_visibility_class_bug,
2903                        [cat > conftest.c <<EOF
2904 #pragma GCC visibility push(hidden)
2905 struct __attribute__ ((visibility ("default"))) TestStruct {
2906   static void Init();
2908 __attribute__ ((visibility ("default"))) void TestFunc() {
2909   TestStruct::Init();
2912                        ac_cv_have_visibility_class_bug=no
2913                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2914                          ac_cv_have_visibility_class_bug=yes
2915                        else
2916                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2917                            ac_cv_have_visibility_class_bug=yes
2918                          fi
2919                        fi
2920                        rm -rf conftest.{c,S}
2921                        ])
2923         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2924                        ac_cv_have_visibility_builtin_bug,
2925                        [cat > conftest.c <<EOF
2926 #pragma GCC visibility push(hidden)
2927 #pragma GCC visibility push(default)
2928 #include <string.h>
2929 #pragma GCC visibility pop
2931 __attribute__ ((visibility ("default"))) void Func() {
2932   char c[[100]];
2933   memset(c, 0, sizeof(c));
2936                        ac_cv_have_visibility_builtin_bug=no
2937                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2938                          ac_cv_have_visibility_builtin_bug=yes
2939                        else
2940                          if test `grep -c "@PLT" conftest.S` = 0; then
2941                            ac_cv_visibility_builtin_bug=yes
2942                          fi
2943                        fi
2944                        rm -f conftest.{c,S}
2945                        ])
2946         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2947                 "$ac_cv_have_visibility_class_bug" = "no"; then
2948           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2949           WRAP_SYSTEM_INCLUDES=1
2950         else
2951           VISIBILITY_FLAGS='-fvisibility=hidden'
2952         fi # have visibility pragma bug
2953       fi   # have visibility pragma
2954     fi     # have visibility(default) attribute
2955   fi       # have visibility(hidden) attribute
2956 fi         # GNU_CC
2958 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2959 AC_SUBST(VISIBILITY_FLAGS)
2961 dnl Checks for header files.
2962 dnl ========================================================
2963 AC_HEADER_DIRENT
2964 case "$target_os" in
2965 freebsd*)
2966 # for stuff like -lXshm
2967     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2968     ;;
2969 esac
2970 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2971 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2972 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2973 AC_CHECK_HEADERS(malloc.h)
2974 AC_CHECK_HEADERS(X11/XKBlib.h)
2976 dnl These are all the places some variant of statfs can be hiding.
2977 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2979 dnl Try for MMX support
2980 dnl NB - later gcc versions require -mmmx for this header to be successfully
2981 dnl included (or another option which implies it, such as -march=pentium-mmx)
2982 AC_CHECK_HEADERS(mmintrin.h)
2984 dnl Check whether the compiler supports the new-style C++ standard
2985 dnl library headers (i.e. <new>) or needs the old "new.h"
2986 AC_LANG_CPLUSPLUS
2987 NEW_H=new.h
2988 AC_CHECK_HEADER(new, [NEW_H=new])
2989 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2990 AC_LANG_C
2992 AC_ARG_ENABLE(dtrace,
2993               [  --enable-dtrace         build with dtrace support if available (default=no)],
2994               [enable_dtrace="yes"],)
2995 if test "x$enable_dtrace" = "xyes"; then
2996   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2997   if test -n "$HAVE_DTRACE"; then
2998       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2999   else
3000       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3001   fi
3003 AC_SUBST(HAVE_DTRACE)
3005 case $target in
3006 *-aix4.3*|*-aix5*)
3007         ;;
3009         AC_CHECK_HEADERS(sys/cdefs.h)
3010         ;;
3011 esac
3013 dnl Checks for libraries.
3014 dnl ========================================================
3015 case $target in
3016 *-hpux11.*)
3017         ;;
3019         AC_CHECK_LIB(c_r, gethostbyname_r)
3020         ;;
3021 esac
3023 dnl We don't want to link with libdl even if it's present on OS X, since
3024 dnl it's not used and not part of the default installation.
3025 dnl The same goes for BeOS.
3026 dnl We don't want to link against libm or libpthread on Darwin since
3027 dnl they both are just symlinks to libSystem and explicitly linking
3028 dnl against libSystem causes issues when debugging (see bug 299601).
3029 case $target in
3030 *-darwin*)
3031     ;;
3032 *-beos*)
3033     ;;
3035     AC_CHECK_LIB(m, atan)
3036     AC_CHECK_LIB(dl, dlopen,
3037     AC_CHECK_HEADER(dlfcn.h, 
3038         LIBS="-ldl $LIBS"
3039         AC_DEFINE(HAVE_LIBDL)))
3040     ;;
3041 esac
3043 _SAVE_CFLAGS="$CFLAGS"
3044 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3045 AC_CHECK_FUNCS(dladdr)
3046 CFLAGS="$_SAVE_CFLAGS"
3048 if test ! "$GNU_CXX"; then
3050     case $target in
3051     *-aix*)
3052         AC_CHECK_LIB(C_r, demangle)
3053         ;;
3054      *)
3055         AC_CHECK_LIB(C, demangle)
3056         ;;
3057      esac
3059 AC_CHECK_LIB(socket, socket)
3061 XLDFLAGS="$X_LIBS"
3062 XLIBS="$X_EXTRA_LIBS"
3064 dnl ========================================================
3065 dnl Checks for X libraries.
3066 dnl Ordering is important.
3067 dnl Xt is dependent upon SM as of X11R6
3068 dnl ========================================================
3069 if test "$no_x" = "yes"; then
3070     AC_DEFINE(NO_X11)
3071 else
3072     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3073         XLIBS="-lX11 $XLIBS"
3074         _SAVE_LDFLAGS="$LDFLAGS"
3075         LDFLAGS="$XLDFLAGS $LDFLAGS"
3076         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3077                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3078         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3079                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3080    
3081      
3082         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3083         unset ac_cv_lib_Xt_XtFree
3084             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3085             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3086         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3087                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3088         ])
3090     # AIX needs the motif library linked before libXt to prevent
3091     # crashes in plugins linked against Motif - Bug #98892
3092     case "${target_os}" in
3093     aix*)
3094         XT_LIBS="-lXm $XT_LIBS"
3095         ;;
3096     esac
3098     dnl ========================================================
3099     dnl = Check for XShm
3100     dnl ========================================================
3101     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3102         $XLIBS $XEXT_LIBS)
3103     AC_CHECK_HEADER(X11/extensions/XShm.h)
3104     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3105         test -n "$_HAVE_XSHM_XEXT"; then
3106         AC_DEFINE(HAVE_XSHM)
3107     fi
3109     dnl ========================================================
3110     dnl = Check for XIE
3111     dnl ========================================================
3112     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3113         $XLIBS $XEXT_LIBS)
3114     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3116     if test "$MOZ_XIE_LIBS"; then
3117         dnl ====================================================
3118         dnl = If XIE is present and is desired, turn it on
3119         dnl ====================================================
3120         case $target in
3121             *-hpux*)
3122                 ;;
3123             *)
3124                 HAVE_XIE=1
3125                 ;;
3126         esac
3127     fi
3129         LDFLAGS="$_SAVE_LDFLAGS"
3131     dnl ========================================================
3132     dnl = Check for freetype2 and its functionality
3133     dnl ========================================================
3134     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3136     if test "$_HAVE_FREETYPE2"; then
3137         _SAVE_LIBS="$LIBS"
3138         _SAVE_CFLAGS="$CFLAGS"
3139         LIBS="$LIBS $FT2_LIBS"
3140         CFLAGS="$CFLAGS $FT2_CFLAGS"
3142         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3143             ac_cv_member_FT_Bitmap_Size_y_ppem,
3144             [AC_TRY_COMPILE([#include <ft2build.h>
3145                              #include FT_FREETYPE_H],
3146                             [FT_Bitmap_Size s;
3147                              if (sizeof s.y_ppem) return 0;
3148                              return 1],
3149                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3150                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3151         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3152             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3153         else
3154             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3155         fi
3156         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3157                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3158                            [FT_Bitmap_Size structure includes y_ppem field])
3160         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3162         LIBS="$_SAVE_LIBS"
3163         CFLAGS="$_SAVE_CFLAGS"
3164     fi
3166 fi # $no_x
3168 AC_SUBST(XCFLAGS)
3169 AC_SUBST(XLDFLAGS)
3170 AC_SUBST(XLIBS)
3171 AC_SUBST(XT_LIBS)
3173 dnl ========================================================
3174 dnl = pthread support
3175 dnl = Start by checking whether the system support pthreads
3176 dnl ========================================================
3177 case "$target_os" in
3178 darwin*)
3179     USE_PTHREADS=1
3180     ;;
3182     MOZ_CHECK_PTHREADS(pthreads,
3183         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3184         MOZ_CHECK_PTHREADS(pthread,
3185             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3186             MOZ_CHECK_PTHREADS(c_r,
3187                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3188                 MOZ_CHECK_PTHREADS(c,
3189                     USE_PTHREADS=1
3190                 )
3191             )
3192         )
3193     )
3194     ;;
3195 esac
3197 dnl ========================================================
3198 dnl Check the command line for --with-pthreads 
3199 dnl ========================================================
3200 MOZ_ARG_WITH_BOOL(pthreads,
3201 [  --with-pthreads         Force use of system pthread library with NSPR ],
3202 [ if test "$USE_PTHREADS"x = x; then
3203     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3204 fi],
3205     USE_PTHREADS=
3206     _PTHREAD_LDFLAGS=
3209 dnl ========================================================
3210 dnl Do the platform specific pthread hackery
3211 dnl ========================================================
3212 if test "$USE_PTHREADS"x != x
3213 then
3214         dnl
3215         dnl See if -pthread is supported.
3216         dnl
3217         rm -f conftest*
3218         ac_cv_have_dash_pthread=no
3219         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3220         echo 'int main() { return 0; }' | cat > conftest.c
3221         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3222         if test $? -eq 0; then
3223                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3224                         ac_cv_have_dash_pthread=yes
3225                 case "$target_os" in
3226                 freebsd*)
3227 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3228                 ;;
3229                 *)
3230                             CFLAGS="$CFLAGS -pthread"
3231                             CXXFLAGS="$CXXFLAGS -pthread"
3232                 ;;
3233                 esac
3234                 fi
3235         fi
3236         rm -f conftest*
3237     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3239         dnl
3240         dnl See if -pthreads is supported.
3241         dnl
3242     ac_cv_have_dash_pthreads=no
3243     if test "$ac_cv_have_dash_pthread" = "no"; then
3244             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3245         echo 'int main() { return 0; }' | cat > conftest.c
3246             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3247         if test $? -eq 0; then
3248                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3249                             ac_cv_have_dash_pthreads=yes
3250                             CFLAGS="$CFLAGS -pthreads"
3251                             CXXFLAGS="$CXXFLAGS -pthreads"
3252                     fi
3253             fi
3254             rm -f conftest*
3255         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3256     fi
3258         case "$target" in
3259             *-*-freebsd*)
3260                         AC_DEFINE(_REENTRANT)
3261                         AC_DEFINE(_THREAD_SAFE)
3262                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3263                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3264                                 _PTHREAD_LDFLAGS="-pthread"
3265                         else
3266                                 _PTHREAD_LDFLAGS="-lc_r"
3267                         fi
3268                         ;;
3270             *-*-openbsd*|*-*-bsdi*)
3271                         AC_DEFINE(_REENTRANT)
3272                         AC_DEFINE(_THREAD_SAFE)
3273                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3274                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3275                 _PTHREAD_LDFLAGS="-pthread"
3276                         fi
3277                         ;;
3279             *-*-linux*|*-*-kfreebsd*-gnu)
3280                         AC_DEFINE(_REENTRANT) 
3281                         ;;
3283             *-*-nto*) 
3284                         AC_DEFINE(_REENTRANT) 
3285                         ;;
3287             *-aix4.3*|*-aix5*)
3288                         AC_DEFINE(_REENTRANT) 
3289                         ;;
3291             *-hpux11.*)
3292                         AC_DEFINE(_REENTRANT) 
3293                         ;;
3295             alpha*-*-osf*)
3296                         AC_DEFINE(_REENTRANT)
3297                         ;;
3299             *-*-solaris*) 
3300                         AC_DEFINE(_REENTRANT) 
3301                         if test ! "$GNU_CC"; then
3302                                 CFLAGS="$CFLAGS -mt" 
3303                                 CXXFLAGS="$CXXFLAGS -mt" 
3304                         fi
3305                         ;;
3306         esac
3307     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3310 dnl ========================================================
3311 dnl See if mmap sees writes
3312 dnl For cross compiling, just define it as no, which is a safe default
3313 dnl ========================================================
3314 AC_MSG_CHECKING(whether mmap() sees write()s)
3316 changequote(,)
3317 mmap_test_prog='
3318     #include <stdlib.h>
3319     #include <unistd.h>
3320     #include <sys/mman.h>
3321     #include <sys/types.h>
3322     #include <sys/stat.h>
3323     #include <fcntl.h>
3325     char fname[] = "conftest.file";
3326     char zbuff[1024]; /* Fractional page is probably worst case */
3328     int main() {
3329         char *map;
3330         int fd;
3331         int i;
3332         unlink(fname);
3333         fd = open(fname, O_RDWR | O_CREAT, 0660);
3334         if(fd<0) return 1;
3335         unlink(fname);
3336         write(fd, zbuff, sizeof(zbuff));
3337         lseek(fd, 0, SEEK_SET);
3338         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3339         if(map==(char*)-1) return 2;
3340         for(i=0; fname[i]; i++) {
3341             int rc = write(fd, &fname[i], 1);
3342             if(map[i]!=fname[i]) return 4;
3343         }
3344         return 0;
3345     }
3347 changequote([,])
3349 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3351 AC_MSG_RESULT("$result")
3353 if test "$result" = "no"; then
3354     AC_DEFINE(MMAP_MISSES_WRITES)
3358 dnl Checks for library functions.
3359 dnl ========================================================
3360 AC_PROG_GCC_TRADITIONAL
3361 AC_FUNC_MEMCMP
3362 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3363 AC_CHECK_FUNCS(flockfile getpagesize)
3365 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3366 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3367   AC_CHECK_FUNCS(localtime_r strtok_r)
3370 dnl check for wcrtomb/mbrtowc
3371 dnl =======================================================================
3372 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3373 AC_LANG_SAVE
3374 AC_LANG_CPLUSPLUS
3375 AC_CACHE_CHECK(for wcrtomb,
3376     ac_cv_have_wcrtomb,
3377     [AC_TRY_LINK([#include <wchar.h>],
3378                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3379                  ac_cv_have_wcrtomb="yes",
3380                  ac_cv_have_wcrtomb="no")])
3381 if test "$ac_cv_have_wcrtomb" = "yes"; then
3382     AC_DEFINE(HAVE_WCRTOMB)
3384 AC_CACHE_CHECK(for mbrtowc,
3385     ac_cv_have_mbrtowc,
3386     [AC_TRY_LINK([#include <wchar.h>],
3387                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3388                  ac_cv_have_mbrtowc="yes",
3389                  ac_cv_have_mbrtowc="no")])
3390 if test "$ac_cv_have_mbrtowc" = "yes"; then
3391     AC_DEFINE(HAVE_MBRTOWC)
3393 AC_LANG_RESTORE
3396 AC_CACHE_CHECK(
3397     [for res_ninit()],
3398     ac_cv_func_res_ninit,
3399     [AC_TRY_LINK([
3400         #ifdef linux
3401         #define _BSD_SOURCE 1
3402         #endif
3403         #include <resolv.h>
3404         ],
3405         [int foo = res_ninit(&_res);],
3406         [ac_cv_func_res_ninit=yes],
3407         [ac_cv_func_res_ninit=no])
3408     ])
3410 if test "$ac_cv_func_res_ninit" = "yes"; then
3411     AC_DEFINE(HAVE_RES_NINIT)
3412 dnl must add the link line we do something as foolish as this... dougt
3413 dnl else
3414 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3415 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3418 AC_LANG_CPLUSPLUS
3419 AC_CACHE_CHECK(
3420     [for gnu_get_libc_version()],
3421     ac_cv_func_gnu_get_libc_version,
3422     [AC_TRY_LINK([
3423         #ifdef HAVE_GNU_LIBC_VERSION_H
3424         #include <gnu/libc-version.h>
3425         #endif
3426         ],
3427         [const char *glibc_version = gnu_get_libc_version();],
3428         [ac_cv_func_gnu_get_libc_version=yes],
3429         [ac_cv_func_gnu_get_libc_version=no] 
3430         )]
3431     )
3433 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3434     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3437 case $target_os in
3438     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3439         ;;
3440     *)
3441     
3442 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3443     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3444         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3445 _SAVE_LIBS=$LIBS
3446 LIBS="$LIBS $_ICONV_LIBS"
3447 AC_CACHE_CHECK(
3448     [for iconv()],
3449     ac_cv_func_iconv,
3450     [AC_TRY_LINK([
3451         #include <stdlib.h>
3452         #include <iconv.h>
3453         ],
3454         [
3455             iconv_t h = iconv_open("", "");
3456             iconv(h, NULL, NULL, NULL, NULL);
3457             iconv_close(h);
3458         ],
3459         [ac_cv_func_iconv=yes],
3460         [ac_cv_func_iconv=no] 
3461         )]
3462     )
3463 if test "$ac_cv_func_iconv" = "yes"; then
3464     AC_DEFINE(HAVE_ICONV)
3465     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3466     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3467     LIBICONV="$_ICONV_LIBS"
3468     AC_CACHE_CHECK(
3469         [for iconv() with const input],
3470         ac_cv_func_const_iconv,
3471         [AC_TRY_COMPILE([
3472             #include <stdlib.h>
3473             #include <iconv.h>
3474             ],
3475             [
3476                 const char *input = "testing";
3477                 iconv_t h = iconv_open("", "");
3478                 iconv(h, &input, NULL, NULL, NULL);
3479                 iconv_close(h);
3480             ],
3481             [ac_cv_func_const_iconv=yes],
3482             [ac_cv_func_const_iconv=no] 
3483             )]
3484         )
3485     if test "$ac_cv_func_const_iconv" = "yes"; then
3486         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3487     fi
3489 LIBS=$_SAVE_LIBS
3491     ;;
3492 esac
3494 AM_LANGINFO_CODESET
3496 AC_LANG_C
3498 dnl **********************
3499 dnl *** va_copy checks ***
3500 dnl **********************
3501 dnl we currently check for all three va_copy possibilities, so we get
3502 dnl all results in config.log for bug reports.
3503 AC_MSG_CHECKING(for an implementation of va_copy())
3504 AC_CACHE_VAL(ac_cv_va_copy,[
3505     AC_TRY_RUN([
3506         #include <stdarg.h>
3507         void f (int i, ...) {
3508             va_list args1, args2;
3509             va_start (args1, i);
3510             va_copy (args2, args1);
3511             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3512                 exit (1);
3513             va_end (args1); va_end (args2);
3514         }
3515         int main() { f (0, 42); return 0; }],
3516         ac_cv_va_copy=yes,
3517         ac_cv_va_copy=no,
3518         ac_cv_va_copy=no
3519     )
3521 AC_MSG_RESULT($ac_cv_va_copy)
3522 AC_MSG_CHECKING(for an implementation of __va_copy())
3523 AC_CACHE_VAL(ac_cv___va_copy,[
3524     AC_TRY_RUN([
3525         #include <stdarg.h>
3526         void f (int i, ...) {
3527             va_list args1, args2;
3528             va_start (args1, i);
3529             __va_copy (args2, args1);
3530             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3531                 exit (1);
3532             va_end (args1); va_end (args2);
3533         }
3534         int main() { f (0, 42); return 0; }],
3535         ac_cv___va_copy=yes,
3536         ac_cv___va_copy=no,
3537         ac_cv___va_copy=no
3538     )
3540 AC_MSG_RESULT($ac_cv___va_copy)
3541 AC_MSG_CHECKING(whether va_lists can be copied by value)
3542 AC_CACHE_VAL(ac_cv_va_val_copy,[
3543     AC_TRY_RUN([
3544         #include <stdarg.h>
3545         void f (int i, ...) {
3546             va_list args1, args2;
3547             va_start (args1, i);
3548             args2 = args1;
3549             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3550                 exit (1);
3551             va_end (args1); va_end (args2);
3552         }
3553         int main() { f (0, 42); return 0; }],
3554         ac_cv_va_val_copy=yes,
3555         ac_cv_va_val_copy=no,
3556         ac_cv_va_val_copy=yes
3557     )
3559 if test "x$ac_cv_va_copy" = "xyes"; then
3560     AC_DEFINE(VA_COPY, va_copy)
3561     AC_DEFINE(HAVE_VA_COPY)
3562 elif test "x$ac_cv___va_copy" = "xyes"; then
3563     AC_DEFINE(VA_COPY, __va_copy)
3564     AC_DEFINE(HAVE_VA_COPY)
3567 if test "x$ac_cv_va_val_copy" = "xno"; then
3568    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3570 AC_MSG_RESULT($ac_cv_va_val_copy)
3572 dnl Check for dll-challenged libc's.
3573 dnl This check is apparently only needed for Linux.
3574 case "$target" in
3575         *-linux*)
3576             dnl ===================================================================
3577             _curdir=`pwd`
3578             export _curdir
3579             rm -rf conftest* _conftest
3580             mkdir _conftest
3581             cat >> conftest.C <<\EOF
3582 #include <stdio.h>
3583 #include <link.h>
3584 #include <dlfcn.h>
3585 #ifdef _dl_loaded
3586 void __dump_link_map(void) {
3587   struct link_map *map = _dl_loaded;
3588   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3590 int main() {
3591   dlopen("./conftest1.so",RTLD_LAZY);
3592   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3593   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3594   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3595   __dump_link_map();
3597 #else
3598 /* _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).*/
3599 int main() { printf("./conftest1.so\n"); }
3600 #endif
3603             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3605             cat >> conftest1.C <<\EOF
3606 #include <stdio.h>
3607 void foo(void) {printf("foo in dll called\n");}
3609             ${CXX-g++} -fPIC -c -g conftest1.C
3610             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3611             ${CXX-g++} -g conftest.C -o conftest -ldl
3612             cp -f conftest1.so conftest _conftest
3613             cd _conftest
3614             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3615             then
3616                 echo
3617                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3618                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3619                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3620                 echo "*** will be excessive memory usage at runtime."
3621                 echo
3622             fi
3623             cd ${_curdir}
3624             rm -rf conftest* _conftest
3625             dnl ===================================================================
3626             ;;
3627 esac
3629 dnl ===================================================================
3630 dnl ========================================================
3631 dnl By default, turn rtti and exceptions off on g++/egcs
3632 dnl ========================================================
3633 if test "$GNU_CXX"; then
3635   AC_MSG_CHECKING(for C++ exceptions flag)
3637   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3638   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3639   [echo "int main() { return 0; }" | cat > conftest.C
3641   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3643   if egrep "warning.*renamed" conftest.out >/dev/null; then
3644     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3645   else
3646     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3647   fi
3649   rm -f conftest*])
3651   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3652   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3653   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3656 dnl ========================================================
3657 dnl Put your C++ language/feature checks below
3658 dnl ========================================================
3659 AC_LANG_CPLUSPLUS
3661 HAVE_GCC3_ABI=
3662 if test "$GNU_CC"; then
3663   AC_CACHE_CHECK(for gcc 3.0 ABI,
3664       ac_cv_gcc_three_abi,
3665       [AC_TRY_COMPILE([],
3666                       [
3667 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3668   return 0;
3669 #else
3670 #error Not gcc3.
3671 #endif
3672                       ],
3673                       ac_cv_gcc_three_abi="yes",
3674                       ac_cv_gcc_three_abi="no")])
3675   if test "$ac_cv_gcc_three_abi" = "yes"; then
3676       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3677       HAVE_GCC3_ABI=1
3678   else
3679       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3680   fi
3682 AC_SUBST(HAVE_GCC3_ABI)
3685 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3686                ac_cv_cpp_explicit,
3687                [AC_TRY_COMPILE(class X {
3688                                public: explicit X(int i) : i_(i) {}
3689                                private: int i_;
3690                                };,
3691                                X x(3);,
3692                                ac_cv_cpp_explicit=yes,
3693                                ac_cv_cpp_explicit=no)])
3694 if test "$ac_cv_cpp_explicit" = yes ; then
3695    AC_DEFINE(HAVE_CPP_EXPLICIT)
3698 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3699                ac_cv_cpp_typename,
3700                [AC_TRY_COMPILE(class param {
3701                                public:
3702                                    typedef unsigned long num_type;
3703                                };
3705                                template <class T> class tplt {
3706                                public:
3707                                    typedef typename T::num_type t_num_type;
3708                                    t_num_type foo(typename T::num_type num) {
3709                                        return num;
3710                                    }
3711                                };,
3712                                tplt<param> A;
3713                                A.foo(0);,
3714                                ac_cv_cpp_typename=yes,
3715                                ac_cv_cpp_typename=no)])
3716 if test "$ac_cv_cpp_typename" = yes ; then
3717    AC_DEFINE(HAVE_CPP_TYPENAME)
3720 dnl Check for support of modern template specialization syntax
3721 dnl Test code and requirement from scc@netscape.com.
3722 dnl Autoconf cut-and-paste job by waterson@netscape.com
3723 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3724                ac_cv_cpp_modern_specialize_template_syntax,
3725                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3726                                class Y {};
3727                                template <> struct X<Y> { double a; };,
3728                                X<int> int_x;
3729                                X<Y> y_x;,
3730                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3731                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3732 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3733   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3737 dnl Some compilers support only full specialization, and some don't.
3738 AC_CACHE_CHECK(whether partial template specialization works,
3739                ac_cv_cpp_partial_specialization,
3740                [AC_TRY_COMPILE(template <class T> class Foo {};
3741                                template <class T> class Foo<T*> {};,
3742                                return 0;,
3743                                ac_cv_cpp_partial_specialization=yes,
3744                                ac_cv_cpp_partial_specialization=no)])
3745 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3746   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3749 dnl Some compilers have limited support for operators with templates;
3750 dnl specifically, it is necessary to define derived operators when a base
3751 dnl class's operator declaration should suffice.
3752 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3753                ac_cv_need_derived_template_operators,
3754                [AC_TRY_COMPILE([template <class T> class Base { };
3755                                 template <class T>
3756                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3757                                 template <class T> class Derived : public Base<T> { };],
3758                                [Derived<char> a, b;
3759                                 Base<char> c = a + b;
3760                                 return 0;],
3761                                ac_cv_need_derived_template_operators=no,
3762                                ac_cv_need_derived_template_operators=yes)])
3763 if test "$ac_cv_need_derived_template_operators" = yes ; then
3764   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3768 dnl Some compilers have trouble detecting that a template class
3769 dnl that derives from another template is actually an instance
3770 dnl of the base class. This test checks for that.
3771 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3772                ac_cv_need_cpp_template_cast_to_base,
3773                [AC_TRY_COMPILE([template <class T> class Base { };
3774                                 template <class T> class Derived : public Base<T> { };
3775                                 template <class T> int foo(const Base<T>&) { return 0; }],
3776                                [Derived<char> bar; return foo(bar);],
3777                                ac_cv_need_cpp_template_cast_to_base=no,
3778                                ac_cv_need_cpp_template_cast_to_base=yes)])
3779 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3780   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3783 dnl Some compilers have trouble resolving the ambiguity between two
3784 dnl functions whose arguments differ only by cv-qualifications.
3785 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3786                ac_cv_can_resolve_const_ambiguity,
3787                [AC_TRY_COMPILE([
3788                                 template <class T> class ptrClass {
3789                                   public: T* ptr;
3790                                 };
3792                                 template <class T> T* a(ptrClass<T> *arg) {
3793                                   return arg->ptr;
3794                                 }
3796                                 template <class T>
3797                                 const T* a(const ptrClass<T> *arg) {
3798                                   return arg->ptr;
3799                                 }
3800                                ],
3801                                [ ptrClass<int> i;
3802                                  a(&i); ],
3803                                ac_cv_can_resolve_const_ambiguity=yes,
3804                                ac_cv_can_resolve_const_ambiguity=no)])
3805 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3806   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3810 dnl We don't do exceptions on unix.  The only reason this used to be here
3811 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3812 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3813 dnl So im commenting this out until someone writes some artificial 
3814 dnl intelligence to detect not only if the compiler has exceptions, but if 
3815 dnl they are enabled as well.
3816 dnl 
3817 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3818 dnl                ac_cv_cpp_exceptions,
3819 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3820 dnl                                static void F() { throw X(); },
3821 dnl                                try { F(); } catch(X & e) { },
3822 dnl                                ac_cv_cpp_exceptions=yes,
3823 dnl                                ac_cv_cpp_exceptions=no)])
3824 dnl if test $ac_cv_cpp_exceptions = yes ; then
3825 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3826 dnl fi
3828 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3829 dnl supports it well enough to allow us to use it to change access, but not
3830 dnl to resolve ambiguity. The next two tests determine how well the |using|
3831 dnl keyword is supported.
3833 dnl Check to see if we can change access with |using|.  Test both a
3834 dnl legal and an illegal example.
3835 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3836                ac_cv_cpp_access_changing_using2,
3837                [AC_TRY_COMPILE(
3838                    class A { protected: int foo() { return 0; } };
3839                    class B : public A { public: using A::foo; };,
3840                    B b; return b.foo();,
3841                    [AC_TRY_COMPILE(
3842                        class A { public: int foo() { return 1; } };
3843                        class B : public A { private: using A::foo; };,
3844                        B b; return b.foo();,
3845                        ac_cv_cpp_access_changing_using2=no,
3846                        ac_cv_cpp_access_changing_using2=yes)],
3847                    ac_cv_cpp_access_changing_using2=no)])
3848 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3849    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3852 dnl Check to see if we can resolve ambiguity with |using|.
3853 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3854                ac_cv_cpp_ambiguity_resolving_using,
3855                [AC_TRY_COMPILE(class X { 
3856                                  public: int go(const X&) {return 3;}
3857                                          int jo(const X&) {return 3;}
3858                                };
3859                                class Y : public X {
3860                                  public:  int go(int) {return 2;}
3861                                           int jo(int) {return 2;}
3862                                           using X::jo;
3863                                  private: using X::go;
3864                                };,
3865                                X x; Y y; y.jo(x);,
3866                                ac_cv_cpp_ambiguity_resolving_using=yes,
3867                                ac_cv_cpp_ambiguity_resolving_using=no)])
3868 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3869    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3872 dnl Check to see if the |std| namespace is supported. If so, we'll want
3873 dnl to qualify any standard library calls with "std::" to ensure that
3874 dnl those functions can be resolved.
3875 AC_CACHE_CHECK(for \"std::\" namespace,
3876                ac_cv_cpp_namespace_std,
3877                [AC_TRY_COMPILE([#include <algorithm>],
3878                                [return std::min(0, 1);],
3879                                ac_cv_cpp_namespace_std=yes,
3880                                ac_cv_cpp_namespace_std=no)])
3881 if test "$ac_cv_cpp_namespace_std" = yes ; then
3882    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3885 dnl Older compilers are overly ambitious with respect to using the standard
3886 dnl template library's |operator!=()| when |operator==()| is defined. In
3887 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3888 dnl ambiguity at compile-time. This test checks for that case.
3889 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3890                ac_cv_cpp_unambiguous_std_notequal,
3891                [AC_TRY_COMPILE([#include <algorithm>
3892                                 struct T1 {};
3893                                 int operator==(const T1&, const T1&) { return 0; }
3894                                 int operator!=(const T1&, const T1&) { return 0; }],
3895                                [T1 a,b; return a != b;],
3896                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3897                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3898 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3899   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3903 AC_CACHE_CHECK(for C++ reinterpret_cast,
3904                ac_cv_cpp_reinterpret_cast,
3905                [AC_TRY_COMPILE(struct X { int i; };
3906                                struct Y { int i; };,
3907                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3908                                ac_cv_cpp_reinterpret_cast=yes,
3909                                ac_cv_cpp_reinterpret_cast=no)])
3910 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3911    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3914 dnl See if a dynamic_cast to void* gives the most derived object.
3915 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3916                ac_cv_cpp_dynamic_cast_void_ptr,
3917                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3918                             class Y { int j; public: virtual ~Y() { } };
3919                             class Z : public X, public Y { int k; };
3921                             int main() {
3922                                  Z mdo;
3923                                  X *subx = (X*)&mdo;
3924                                  Y *suby = (Y*)&mdo;
3925                                  return !((((void*)&mdo != (void*)subx) &&
3926                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3927                                           (((void*)&mdo != (void*)suby) &&
3928                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3929                             }],
3930                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3931                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3932                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3933 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3934    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3938 dnl note that this one is reversed - if the test fails, then
3939 dnl we require implementations of unused virtual methods. Which
3940 dnl really blows because it means we'll have useless vtable
3941 dnl bloat.
3942 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3943                ac_cv_cpp_unused_required,
3944                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3945                                X x;,
3946                                ac_cv_cpp_unused_required=no,
3947                                ac_cv_cpp_unused_required=yes)])
3948 if test "$ac_cv_cpp_unused_required" = yes ; then
3949    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3953 dnl Some compilers have trouble comparing a constant reference to a templatized
3954 dnl class to zero, and require an explicit operator==() to be defined that takes
3955 dnl an int. This test separates the strong from the weak.
3957 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3958                ac_cv_trouble_comparing_to_zero,
3959                [AC_TRY_COMPILE([#include <algorithm>
3960                                 template <class T> class Foo {};
3961                                 class T2;
3962                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3963                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3964                                [Foo<int> f; return (0 != f);],
3965                                ac_cv_trouble_comparing_to_zero=no,
3966                                ac_cv_trouble_comparing_to_zero=yes)])
3967 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3968   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3973 dnl End of C++ language/feature checks
3974 AC_LANG_C
3976 dnl ========================================================
3977 dnl =  Internationalization checks
3978 dnl ========================================================
3980 dnl Internationalization and Locale support is different
3981 dnl on various UNIX platforms.  Checks for specific i18n
3982 dnl features go here.
3984 dnl check for LC_MESSAGES
3985 AC_CACHE_CHECK(for LC_MESSAGES,
3986                 ac_cv_i18n_lc_messages,
3987                 [AC_TRY_COMPILE([#include <locale.h>],
3988                                 [int category = LC_MESSAGES;],
3989                                 ac_cv_i18n_lc_messages=yes,
3990                                 ac_cv_i18n_lc_messages=no)])
3991 if test "$ac_cv_i18n_lc_messages" = yes; then
3992    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3993 fi      
3995 fi # SKIP_COMPILER_CHECKS
3997 TARGET_XPCOM_ABI=
3998 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3999     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4002 dnl Mozilla specific options
4003 dnl ========================================================
4004 dnl The macros used for command line options
4005 dnl are defined in build/autoconf/altoptions.m4.
4008 dnl ========================================================
4009 dnl =
4010 dnl = Check for external package dependencies
4011 dnl =
4012 dnl ========================================================
4013 MOZ_ARG_HEADER(External Packages)
4015 MOZ_ENABLE_LIBXUL=
4017 MOZ_ARG_WITH_STRING(libxul-sdk,
4018 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4019   LIBXUL_SDK_DIR=$withval)
4021 if test "$LIBXUL_SDK_DIR" = "yes"; then
4022     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4023 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4024     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4026     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
4027         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
4028     fi
4030     MOZ_ENABLE_LIBXUL=1
4032 AC_SUBST(LIBXUL_SDK)
4034 dnl ========================================================
4035 dnl = If NSPR was not detected in the system, 
4036 dnl = use the one in the source tree (mozilla/nsprpub)
4037 dnl ========================================================
4038 MOZ_ARG_WITH_BOOL(system-nspr,
4039 [  --with-system-nspr      Use system installed NSPR],
4040     _USE_SYSTEM_NSPR=1 )
4042 if test -n "$_USE_SYSTEM_NSPR"; then
4043     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4046 if test -n "$MOZ_NATIVE_NSPR"; then
4047     _SAVE_CFLAGS=$CFLAGS
4048     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4049     AC_TRY_COMPILE([#include "prlog.h"],
4050                 [#ifndef PR_STATIC_ASSERT
4051                  #error PR_STATIC_ASSERT not defined
4052                  #endif],
4053                 [MOZ_NATIVE_NSPR=1],
4054                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4055     CFLAGS=$_SAVE_CFLAGS
4056 else
4057     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --includedir=$(LIBXUL_DIST)/include/nspr --cflags`'
4058     # explicitly set libs for Visual Age C++ for OS/2
4059     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
4060         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''
4061     elif test "$OS_ARCH" = "WINCE"; then
4062         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4063         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4064     elif test "$OS_ARCH" = "WINNT"; then
4065         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4066         if test -n "$GNU_CC"; then
4067             NSPR_LIBS="-L\$(LIBXUL_DIST)/lib -lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
4068         else
4069             NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4070         fi
4071     else
4072         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --libdir=$(LIBXUL_DIST)/lib --libs`'
4073     fi
4076 dnl ========================================================
4077 dnl = If NSS was not detected in the system, 
4078 dnl = use the one in the source tree (mozilla/security/nss)
4079 dnl ========================================================
4081 MOZ_ARG_WITH_BOOL(system-nss,
4082 [  --with-system-nss      Use system installed NSS],
4083     _USE_SYSTEM_NSS=1 )
4085 if test -n "$_USE_SYSTEM_NSS"; then
4086     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4089 if test -n "$MOZ_NATIVE_NSS"; then
4090    NSS_LIBS="$NSS_LIBS -lcrmf"
4091 else
4092    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4093    NSS_DEP_LIBS="\
4094         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4095         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4096         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4097         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4098         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4099         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4101    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4102        NSS_LIBS="\
4103         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4104         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4105         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4106         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4107         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4108         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4109    else
4110        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4111    fi
4114 if test -z "$SKIP_LIBRARY_CHECKS"; then
4115 dnl system JPEG support
4116 dnl ========================================================
4117 MOZ_ARG_WITH_STRING(system-jpeg,
4118 [  --with-system-jpeg[=PFX]
4119                           Use system libjpeg [installed at prefix PFX]],
4120     JPEG_DIR=$withval)
4122 _SAVE_CFLAGS=$CFLAGS
4123 _SAVE_LDFLAGS=$LDFLAGS
4124 _SAVE_LIBS=$LIBS
4125 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4126     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4127     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4129 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4130     SYSTEM_JPEG=
4131 else
4132     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4135 if test "$SYSTEM_JPEG" = 1; then
4136     LIBS="$JPEG_LIBS $LIBS"
4137     AC_TRY_COMPILE([ #include <stdio.h>
4138                      #include <sys/types.h>
4139                      #include <jpeglib.h> ],
4140                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4141                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4142                      #endif ],
4143                    SYSTEM_JPEG=1,
4144                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4145 fi 
4146 CFLAGS=$_SAVE_CFLAGS
4147 LDFLAGS=$_SAVE_LDFLAGS
4148 LIBS=$_SAVE_LIBS
4150 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4151     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4152     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4155 dnl system ZLIB support
4156 dnl ========================================================
4157 MOZ_ARG_WITH_STRING(system-zlib,
4158 [  --with-system-zlib[=PFX]
4159                           Use system libz [installed at prefix PFX]],
4160     ZLIB_DIR=$withval)
4162 _SAVE_CFLAGS=$CFLAGS
4163 _SAVE_LDFLAGS=$LDFLAGS
4164 _SAVE_LIBS=$LIBS
4165 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4166     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4167     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4169 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4170     SYSTEM_ZLIB=
4171 else
4172     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4173         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4175 if test "$SYSTEM_ZLIB" = 1; then
4176     LIBS="$ZLIB_LIBS $LIBS"
4177     AC_TRY_COMPILE([ #include <stdio.h>
4178                      #include <string.h>
4179                      #include <zlib.h> ],
4180                    [ #if ZLIB_VERNUM < $MOZZLIB 
4181                      #error "Insufficient zlib version ($MOZZLIB required)."
4182                      #endif ],
4183                    SYSTEM_ZLIB=1,
4184                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4186 CFLAGS=$_SAVE_CFLAGS
4187 LDFLAGS=$_SAVE_LDFLAGS
4188 LIBS=$_SAVE_LIBS
4190 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4191     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4192     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4195 dnl system BZIP2 Support
4196 dnl ========================================================
4197 MOZ_ARG_WITH_STRING(system-bz2,
4198 [  --with-system-bz2[=PFX]
4199                           Use system libbz2 [installed at prefix PFX]],
4200     BZ2_DIR=$withval)
4202 _SAVE_CFLAGS=$CFLAGS
4203 _SAVE_LDFLAGS=$LDFLAGS
4204 _SAVE_LIBS=$LIBS
4205 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4206     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4207     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4209 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4210     SYSTEM_BZ2=
4211 else
4212     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4213         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4215 CFLAGS=$_SAVE_CFLAGS
4216 LDFLAGS=$_SAVE_LDFLAGS
4217 LIBS=$_SAVE_LIBS
4219 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4220     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4221     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4224 dnl system PNG Support
4225 dnl ========================================================
4226 MOZ_ARG_WITH_STRING(system-png, 
4227 [  --with-system-png[=PFX]
4228                           Use system libpng [installed at prefix PFX]],
4229     PNG_DIR=$withval)
4231 _SAVE_CFLAGS=$CFLAGS
4232 _SAVE_LDFLAGS=$LDFLAGS
4233 _SAVE_LIBS=$LIBS
4234 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4235 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4236 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4237     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4238     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4240 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4241     SYSTEM_PNG=
4242 else
4243     _SAVE_PNG_LIBS=$PNG_LIBS
4244     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4245                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4246                  $PNG_LIBS)
4247     AC_CHECK_LIB(png, png_get_acTL, ,
4248                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4249                  $_SAVE_PNG_LIBS)
4251 if test "$SYSTEM_PNG" = 1; then
4252     LIBS="$PNG_LIBS $LIBS"
4253     AC_TRY_COMPILE([ #include <stdio.h>
4254                      #include <sys/types.h>
4255                      #include <png.h> ],
4256                    [ #if PNG_LIBPNG_VER < $MOZPNG
4257                      #error "Insufficient libpng version ($MOZPNG required)."
4258                      #endif
4259                      #ifndef PNG_UINT_31_MAX
4260                      #error "Insufficient libpng version."
4261                      #endif ],
4262                    SYSTEM_PNG=1,
4263                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4265 CFLAGS=$_SAVE_CFLAGS
4266 LDFLAGS=$_SAVE_LDFLAGS
4267 LIBS=$_SAVE_LIBS
4269 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4270     PNG_CFLAGS="-I${PNG_DIR}/include"
4271     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4274 fi # SKIP_LIBRARY_CHECKS
4276 dnl system HunSpell Support
4277 dnl ========================================================
4278 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4279 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4280     SYSTEM_HUNSPELL=1 )
4282 if test -n "$SYSTEM_HUNSPELL"; then
4283     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4286 AC_SUBST(SYSTEM_HUNSPELL)
4288 dnl check whether to enable glitz
4289 dnl ========================================================
4290 MOZ_ARG_ENABLE_BOOL(glitz,
4291 [  --enable-glitz          Enable Glitz for use with Cairo],
4292     MOZ_ENABLE_GLITZ=1,
4293     MOZ_ENABLE_GLITZ= )
4294 if test "$MOZ_ENABLE_GLITZ"; then
4295     AC_DEFINE(MOZ_ENABLE_GLITZ)
4298 dnl ========================================================
4299 dnl Java SDK support
4300 dnl ========================================================
4301 JAVA_INCLUDE_PATH=
4302 MOZ_ARG_WITH_STRING(java-include-path,
4303 [  --with-java-include-path=dir   Location of Java SDK headers],
4304     JAVA_INCLUDE_PATH=$withval)
4306 JAVA_BIN_PATH=
4307 MOZ_ARG_WITH_STRING(java-bin-path,
4308 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4309     JAVA_BIN_PATH=$withval)
4311 dnl ========================================================
4312 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4313 dnl their usage and use them in spidermonkey.
4314 dnl ========================================================
4315 MOZ_ARG_WITH_BOOL(arm-kuser,
4316 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4317     USE_ARM_KUSER=1,
4318     USE_ARM_KUSER=)
4319 if test -n "$USE_ARM_KUSER"; then
4320    AC_DEFINE(USE_ARM_KUSER)
4323 dnl ========================================================
4324 dnl =
4325 dnl = Application
4326 dnl =
4327 dnl ========================================================
4329 MOZ_ARG_HEADER(Application)
4331 BUILD_STATIC_LIBS=
4332 ENABLE_TESTS=1
4333 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4334 MOZ_BRANDING_DIRECTORY=
4335 MOZ_DBGRINFO_MODULES=
4336 MOZ_ENABLE_CANVAS=1
4337 MOZ_EXTENSIONS_ALL=" wallet p3p venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4338 MOZ_FEEDS=1
4339 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4340 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4341 MOZ_IPCD=
4342 MOZ_JAVAXPCOM=
4343 MOZ_JSDEBUGGER=1
4344 MOZ_JSLOADER=1
4345 MOZ_LIBART_CFLAGS=
4346 MOZ_LIBART_LIBS=
4347 MOZ_MATHML=1
4348 MOZ_MOCHITEST=1
4349 MOZ_MORK=1
4350 MOZ_MORKREADER=
4351 MOZ_AUTH_EXTENSION=1
4352 MOZ_NO_ACTIVEX_SUPPORT=1
4353 MOZ_NO_INSPECTOR_APIS=
4354 MOZ_NO_XPCOM_OBSOLETE=
4355 MOZ_NO_FAST_LOAD=
4356 MOZ_OGG=1
4357 MOZ_MEDIA=
4358 MOZ_OJI=1
4359 MOZ_PERMISSIONS=1
4360 MOZ_PLACES=
4361 MOZ_PLAINTEXT_EDITOR_ONLY=
4362 MOZ_PLUGINS=1
4363 MOZ_PREF_EXTENSIONS=1
4364 MOZ_PROFILELOCKING=1
4365 MOZ_PROFILESHARING=1
4366 MOZ_PSM=1
4367 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4368 MOZ_PYTHON=
4369 MOZ_PYTHON_DEBUG_SUFFIX=
4370 MOZ_PYTHON_DLL_SUFFIX=
4371 MOZ_PYTHON_INCLUDES=
4372 MOZ_PYTHON_LIBS=
4373 MOZ_PYTHON_PREFIX=
4374 MOZ_PYTHON_VER=
4375 MOZ_PYTHON_VER_DOTTED=
4376 MOZ_RDF=1
4377 MOZ_REFLOW_PERF=
4378 MOZ_SAFE_BROWSING=
4379 MOZ_HELP_VIEWER=
4380 MOZ_SPELLCHECK=1
4381 MOZ_STATIC_MAIL_BUILD=
4382 MOZ_STORAGE=1
4383 MOZ_SVG=1
4384 MOZ_TIMELINE=
4385 MOZ_UI_LOCALE=en-US
4386 MOZ_UNIVERSALCHARDET=1
4387 MOZ_URL_CLASSIFIER=
4388 MOZ_USE_NATIVE_UCONV=
4389 MOZ_V1_STRING_ABI=
4390 MOZ_VIEW_SOURCE=1
4391 MOZ_XPFE_COMPONENTS=1
4392 MOZ_XPINSTALL=1
4393 MOZ_XSLT_STANDALONE=
4394 MOZ_XTF=1
4395 MOZ_XUL=1
4396 MOZ_XUL_APP=1
4397 MOZ_ZIPWRITER=1
4398 NS_PRINTING=1
4399 NECKO_COOKIES=1
4400 NECKO_DISK_CACHE=1
4401 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4402 NECKO_SMALL_BUFFERS=
4403 JS_STATIC_BUILD=
4404 XPC_IDISPATCH_SUPPORT=
4407 case "$target_os" in
4408 darwin*)
4409     ACCESSIBILITY=
4410     ;;
4412     ACCESSIBILITY=1
4413     ;;
4414 esac
4416 case "$target_os" in
4417     msvc*|mks*|cygwin*|mingw*)
4418         if test -z "$GNU_CC"; then 
4419             XPC_IDISPATCH_SUPPORT=1
4420             MOZ_NO_ACTIVEX_SUPPORT=
4421             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4422         fi
4423         ;;
4424 esac
4426 MOZ_ARG_ENABLE_STRING(application,
4427 [  --enable-application=APP
4428                           Options include:
4429                             browser (Firefox)
4430                             xulrunner
4431                             content/xslt (Standalone Transformiix XSLT)
4432                             netwerk (Standalone Necko)
4433                             tools/update-packaging (AUS-related packaging tools)
4434                             standalone (use this for standalone
4435                               xpcom/xpconnect or to manually drive a build)],
4436 [ MOZ_BUILD_APP=$enableval ] )
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_MATHML=
4472   MOZ_AUTH_EXTENSION=
4473   MOZ_NO_ACTIVEX_SUPPORT=1
4474   MOZ_NO_INSPECTOR_APIS=1
4475   MOZ_NO_XPCOM_OBSOLETE=1
4476   MOZ_NO_FAST_LOAD=1
4477   MOZ_OJI=
4478   MOZ_PLAINTEXT_EDITOR_ONLY=1
4479 #  MOZ_PLUGINS=
4480   MOZ_PREF_EXTENSIONS=
4481   MOZ_PROFILELOCKING=
4482   MOZ_PROFILESHARING=
4483   MOZ_SPELLCHECK=
4484   MOZ_SVG=
4485   MOZ_UNIVERSALCHARDET=
4486   MOZ_UPDATER=
4487   MOZ_USE_NATIVE_UCONV=
4488   MOZ_VIEW_SOURCE=
4489   MOZ_XPFE_COMPONENTS=
4490   MOZ_XPINSTALL=
4491   MOZ_XTF=
4492   MOZ_ZIPWRITER=
4493   NECKO_DISK_CACHE=
4494   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4495   NECKO_SMALL_BUFFERS=1
4496   NS_DISABLE_LOGGING=1
4497   NS_PRINTING=
4498   JS_STATIC_BUILD=1
4499   ;;
4501 minimal)
4502   MOZ_EMBEDDING_LEVEL_DEFAULT=
4503   MOZ_EMBEDDING_LEVEL_BASIC=
4504   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4505   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4506   ENABLE_TESTS=
4507   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4508   MOZ_COMPOSER=
4509   MOZ_ENABLE_CANVAS=
4510   MOZ_ENABLE_POSTSCRIPT=
4511   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4512   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4513   MOZ_IMG_ENCODERS_DEFAULT=
4514   MOZ_IMG_ENCODERS=
4515   MOZ_INSTALLER=
4516   MOZ_JSDEBUGGER=
4517   MOZ_MATHML=
4518   MOZ_AUTH_EXTENSION=
4519   MOZ_NO_ACTIVEX_SUPPORT=1
4520   MOZ_NO_INSPECTOR_APIS=1
4521   MOZ_NO_XPCOM_OBSOLETE=1
4522   MOZ_NO_FAST_LOAD=1
4523   MOZ_OJI=
4524   MOZ_PLAINTEXT_EDITOR_ONLY=1
4525   MOZ_PLUGINS=
4526   MOZ_PREF_EXTENSIONS=
4527   MOZ_PROFILELOCKING=
4528   MOZ_PROFILESHARING=
4529   MOZ_SPELLCHECK=
4530   MOZ_STORAGE=1
4531   MOZ_PLACES=
4532   MOZ_SVG=
4533   MOZ_UNIVERSALCHARDET=
4534   MOZ_UPDATER=
4535   MOZ_USE_NATIVE_UCONV=1
4536   MOZ_VIEW_SOURCE=
4537   MOZ_XPFE_COMPONENTS=
4538   MOZ_XPINSTALL=
4539   MOZ_XTF=
4540   MOZ_XUL=
4541   MOZ_ZIPWRITER=
4542   MOZ_RDF=
4543   NECKO_DISK_CACHE=
4544   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4545   NECKO_SMALL_BUFFERS=1
4546   NS_DISABLE_LOGGING=1
4547   NS_PRINTING=
4548   JS_STATIC_BUILD=1
4549   ;;
4552   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4553   ;;
4554 esac
4556 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4557 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4558 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4560 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4561 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4562   XULRUNNER_STUB_NAME=$withval)
4564 if test -z "$XULRUNNER_STUB_NAME"; then
4565   case "$target_os" in
4566   darwin*)
4567     XULRUNNER_STUB_NAME=xulrunner
4568     ;;
4569   *)
4570     XULRUNNER_STUB_NAME=xulrunner-stub
4571   esac
4573 AC_SUBST(XULRUNNER_STUB_NAME)
4575 if test -z "$MOZ_BUILD_APP"; then
4576   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4577 else
4578   # We have a valid application only if it has a build.mk file in its top
4579   # directory.
4580   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4581     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4582   fi
4585 # Allow the application to influence configure with a confvars.sh script.
4587 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4588 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4589   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4590   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4591 else
4592   AC_MSG_RESULT([no])
4595 # Now is a good time to test for logic errors, define mismatches, etc.
4596 case "$MOZ_BUILD_APP" in
4597 xulrunner)
4598   if test "$LIBXUL_SDK"; then
4599     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4600   fi
4601   ;;
4603   # Fix this case for folks who forget. Warn them.
4604   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4605     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4606     MOZ_XUL_APP=1
4607   fi
4608   ;;
4609 esac
4611 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4612 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4613 # MOZ_BUILD_APP.
4614 case "$MOZ_BUILD_APP" in
4615 browser)
4616   AC_DEFINE(MOZ_PHOENIX)
4617   ;;
4619 xulrunner)
4620   AC_DEFINE(MOZ_XULRUNNER)
4621   ;;
4623 content/xslt)
4624   AC_DEFINE(TX_EXE)
4625   ;;
4627 standalone) 
4628   MOZ_APP_NAME=mozilla
4629   MOZ_APP_DISPLAYNAME=Mozilla
4630   MOZ_APP_VERSION=$MOZILLA_VERSION
4631   ;;
4633 esac
4635 if test -z "$MOZ_XUL_APP"; then
4636         AC_MSG_ERROR([builds with unsetting MOZ_XUL_APP in confvars.sh are not supported.])
4639 AC_SUBST(MOZ_BUILD_APP)
4640 AC_SUBST(MOZ_XUL_APP)
4641 AC_SUBST(MOZ_PHOENIX)
4642 AC_SUBST(MOZ_XULRUNNER)
4644 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4646 if test "$MOZ_XUL_APP"; then
4647   MOZ_PROFILESHARING=
4648   AC_DEFINE(MOZ_XUL_APP)
4651 dnl ========================================================
4652 dnl = 
4653 dnl = Toolkit Options
4654 dnl = 
4655 dnl ========================================================
4656 MOZ_ARG_HEADER(Toolkit Options)
4658     dnl ========================================================
4659     dnl = Select the default toolkit
4660     dnl ========================================================
4661         MOZ_ARG_ENABLE_STRING(default-toolkit,
4662         [  --enable-default-toolkit=TK
4663                           Select default toolkit
4664                           Platform specific defaults:
4665                             BeOS - cairo-beos
4666                             Mac OS X - cairo-cocoa
4667                             Neutrino/QNX - photon
4668                             OS/2 - cairo-os2
4669                             Win32 - cairo-windows
4670                             WinCE - windows
4671                             Gtk2 with DirectFB - cairo-gtk2-dfb
4672                             * - cairo-gtk2
4673                             * - cairo-qt],
4674     [ _DEFAULT_TOOLKIT=$enableval ],
4675     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4677     if test "$_DEFAULT_TOOLKIT" = "photon" \
4678         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4679         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4680         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4681         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4682         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4683         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4684         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4685         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4686         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4687     then
4688         dnl nglayout only supports building with one toolkit,
4689         dnl so ignore everything after the first comma (",").
4690         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4691     else
4692         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4693     fi
4695 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4697 dnl ========================================================
4698 dnl = Enable the toolkit as needed                         =
4699 dnl ========================================================
4701 case "$MOZ_WIDGET_TOOLKIT" in
4702 photon)
4703         MOZ_ENABLE_PHOTON=1
4704         AC_DEFINE(MOZ_WIDGET_PHOTON)
4705     ;;
4707 cairo-windows)
4708     MOZ_WIDGET_TOOLKIT=windows
4709     MOZ_GFX_TOOLKIT=cairo
4710     ;;
4712 cairo-gtk2|cairo-gtk2-x11)
4713     MOZ_WIDGET_TOOLKIT=gtk2
4714     MOZ_GFX_TOOLKIT=cairo
4715     MOZ_ENABLE_GTK2=1
4716     MOZ_ENABLE_XREMOTE=1
4718     AC_DEFINE(MOZ_X11)
4719     MOZ_X11=1
4721     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4722     TK_LIBS='$(MOZ_GTK2_LIBS)'
4723     AC_DEFINE(MOZ_WIDGET_GTK2)
4724     ;;
4726 cairo-gtk2-dfb)
4727     MOZ_WIDGET_TOOLKIT=gtk2
4728     MOZ_GFX_TOOLKIT=cairo
4729     MOZ_ENABLE_GTK2=1
4731     AC_DEFINE(MOZ_DFB)
4732     MOZ_DFB=1
4734     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4735     TK_LIBS='$(MOZ_GTK2_LIBS)'
4736     AC_DEFINE(MOZ_WIDGET_GTK2)
4737     if test "$no_x" != "yes"; then
4738         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4739         no_x=yes
4740     fi
4741     ;;
4743 cairo-qt)
4744     MOZ_WIDGET_TOOLKIT=qt
4745     MOZ_GFX_TOOLKIT=cairo
4746     MOZ_ENABLE_QT=1
4747     MOZ_ENABLE_XREMOTE=1
4749     AC_DEFINE(MOZ_X11)
4750     MOZ_X11=1
4752     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4753     TK_LIBS='$(MOZ_QT_LIBS)'
4754     AC_DEFINE(MOZ_WIDGET_QT)
4755     ;;
4757 cairo-beos)
4758     MOZ_WIDGET_TOOLKIT=beos
4759     MOZ_GFX_TOOLKIT=cairo
4760     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4761     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4762     ;;
4764 cairo-os2)
4765     MOZ_WIDGET_TOOLKIT=os2
4766     MOZ_GFX_TOOLKIT=cairo
4767     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4768     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4769     ;;
4771 cairo-mac|cairo-cocoa)
4772     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4773         MOZ_WIDGET_TOOLKIT=cocoa
4774         AC_DEFINE(MOZ_WIDGET_COCOA)
4775         MOZ_ENABLE_COCOA=1
4776     else
4777         MOZ_WIDGET_TOOLKIT=mac
4778     fi
4779     MOZ_GFX_TOOLKIT=cairo
4780     MOZ_USER_DIR="Mozilla"
4781     AC_DEFINE(XP_MACOSX)
4782     AC_DEFINE(TARGET_CARBON)
4783     AC_DEFINE(TARGET_API_MAC_CARBON)
4784     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4785     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4786     CFLAGS="$CFLAGS $TK_CFLAGS"
4787     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4788     ;;
4789 esac
4791 if test "$MOZ_ENABLE_XREMOTE"; then
4792     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4795 if test "$COMPILE_ENVIRONMENT"; then
4796   if test "$MOZ_ENABLE_GTK2"; then
4797     if test "$MOZ_X11"; then
4798       GDK_PACKAGES=gdk-x11-2.0
4799     elif test "$MOZ_DFB"; then
4800       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4801       GDK_PACKAGES=directfb
4802     fi
4804     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4805   fi
4807 fi # COMPILE_ENVIRONMENT
4809 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4811 dnl ========================================================
4812 dnl = startup-notification support module
4813 dnl ========================================================
4815 if test "$MOZ_ENABLE_GTK2"
4816 then
4817     MOZ_ENABLE_STARTUP_NOTIFICATION=
4819     MOZ_ARG_ENABLE_BOOL(startup-notification,
4820     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4821         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4822         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4823     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4824     then
4825         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4826                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4827         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4828             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4829             then
4830                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4831             fi
4832             MOZ_ENABLE_STARTUP_NOTIFICATION=
4833         ])
4834     fi
4836     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4837         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4838     fi
4840     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4842 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4843 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4844 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4846 dnl ========================================================
4847 dnl = QT support
4848 dnl ========================================================
4849 if test "$MOZ_ENABLE_QT"
4850 then
4851     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4852     AC_SUBST(MOZ_QT_CFLAGS)
4853     AC_SUBST(MOZ_QT_LIBS)
4855     MOZ_ARG_WITH_STRING(qtdir,
4856     [  --with-qtdir=\$dir       Specify Qt directory ],
4857     [ QTDIR=$withval])
4859     if test -z "$QTDIR"; then
4860       QTDIR="/usr"
4861     fi
4862     QTINCDIR="/include/qt"
4863     if test ! -d "$QTDIR$QTINCDIR"; then
4864        QTINCDIR="/include/X11/qt"
4865     fi
4866     if test ! -d "$QTDIR$QTINCDIR"; then
4867        QTINCDIR="/include"
4868     fi
4870     if test -x "$QTDIR/bin/moc-qt4"; then
4871       HOST_MOC="$QTDIR/bin/moc-qt4"
4872     else
4873       if test -x "$QTDIR/bin/moc"; then
4874         HOST_MOC="$QTDIR/bin/moc"
4875       else
4876         AC_CHECK_PROGS(HOST_MOC, moc, "")
4877       fi
4878     fi
4879     if test -z "$HOST_MOC"; then
4880       AC_MSG_ERROR([no acceptable moc preprocessor found])
4881     fi
4882     MOC=$HOST_MOC
4885 AC_SUBST(GTK_CONFIG)
4886 AC_SUBST(TK_CFLAGS)
4887 AC_SUBST(TK_LIBS)
4889 AC_SUBST(MOZ_ENABLE_GTK2)
4890 AC_SUBST(MOZ_ENABLE_PHOTON)
4891 AC_SUBST(MOZ_ENABLE_COCOA)
4892 AC_SUBST(MOZ_ENABLE_GLITZ)
4893 AC_SUBST(MOZ_ENABLE_QT)
4894 AC_SUBST(MOZ_ENABLE_XREMOTE)
4895 AC_SUBST(MOZ_GTK2_CFLAGS)
4896 AC_SUBST(MOZ_GTK2_LIBS)
4897 AC_SUBST(MOZ_QT_CFLAGS)
4898 AC_SUBST(MOZ_QT_LIBS)
4900 AC_SUBST(MOC)
4902 AC_SUBST(MOZ_DFB)
4903 AC_SUBST(MOZ_X11)
4905 dnl ========================================================
4906 dnl =
4907 dnl = Components & Features
4908 dnl = 
4909 dnl ========================================================
4910 MOZ_ARG_HEADER(Components and Features)
4912 dnl ========================================================
4913 dnl = Localization
4914 dnl ========================================================
4915 MOZ_ARG_ENABLE_STRING(ui-locale,
4916 [  --enable-ui-locale=ab-CD
4917                           Select the user interface locale (default: en-US)],
4918     MOZ_UI_LOCALE=$enableval )
4919 AC_SUBST(MOZ_UI_LOCALE)
4921 dnl ========================================================
4922 dnl = Trademarked Branding 
4923 dnl ========================================================
4924 MOZ_ARG_ENABLE_BOOL(official-branding,
4925 [  --enable-official-branding Enable Official mozilla.org Branding
4926                           Do not distribute builds with
4927                           --enable-official-branding unless you have
4928                           permission to use trademarks per
4929                           http://www.mozilla.org/foundation/trademarks/ .],
4930 [case "$MOZ_BUILD_APP" in
4931 browser)
4932     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4933     MOZ_APP_DISPLAYNAME=Firefox
4934     ;;
4937     AC_MSG_ERROR([Official branding is only available for Firefox.])
4938 esac
4941 MOZ_ARG_WITH_STRING(branding,
4942 [  --with-branding=dir    Use branding from the specified directory.],
4943     MOZ_BRANDING_DIRECTORY=$withval)
4945 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4946 if test -z "$REAL_BRANDING_DIRECTORY"; then
4947   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4950 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4951   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4954 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4956 dnl ========================================================
4957 dnl = Distribution ID
4958 dnl ========================================================
4959 MOZ_ARG_WITH_STRING(distribution-id,
4960 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4961 [ val=`echo $withval`
4962     MOZ_DISTRIBUTION_ID="$val"])
4964 if test -z "$MOZ_DISTRIBUTION_ID"; then
4965    MOZ_DISTRIBUTION_ID="org.mozilla"
4968 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4969 AC_SUBST(MOZ_DISTRIBUTION_ID)
4972 dnl ========================================================
4973 dnl complex text support off by default
4974 dnl ========================================================
4975 MOZ_PANGO=1
4976 MOZ_ARG_DISABLE_BOOL(pango,
4977 [  --disable-pango Disable usage of Pango ],
4978     MOZ_PANGO=,
4979     MOZ_PANGO=1)
4982 dnl ========================================================
4983 dnl = Xft and Pango
4984 dnl ========================================================
4985 if test "$MOZ_ENABLE_GTK2"
4986 then
4987     if test "$MOZ_X11"; then
4988         PKG_CHECK_MODULES(MOZ_XFT, xft)
4989         AC_SUBST(MOZ_XFT_CFLAGS)
4990         AC_SUBST(MOZ_XFT_LIBS)
4991     fi
4993     AC_SUBST(MOZ_PANGO)
4995     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4997     if test "$MOZ_PANGO"
4998     then
4999         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5000         AC_SUBST(MOZ_PANGO_CFLAGS)
5001         AC_SUBST(MOZ_PANGO_LIBS)
5002         AC_DEFINE(MOZ_PANGO)
5003     else
5004         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5005         AC_SUBST(MOZ_PANGO_CFLAGS)
5006         AC_SUBST(MOZ_PANGO_LIBS)
5008         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5009         AC_SUBST(FT2_CFLAGS)
5010         AC_SUBST(FT2_LIBS)
5011     fi
5014 dnl ========================================================
5015 dnl = PostScript print module
5016 dnl ========================================================
5017 MOZ_ARG_DISABLE_BOOL(postscript,
5018 [  --disable-postscript    Disable PostScript printing support ],
5019     MOZ_ENABLE_POSTSCRIPT=,
5020     MOZ_ENABLE_POSTSCRIPT=1 )
5022 dnl ========================================================
5023 dnl = GnomeVFS support module
5024 dnl ========================================================
5026 if test "$MOZ_X11"
5027 then
5028     dnl build the gnomevfs extension by default only when the
5029     dnl GTK2 toolkit is in use.
5030     if test "$MOZ_ENABLE_GTK2"
5031     then
5032         MOZ_ENABLE_GNOMEVFS=1
5033         MOZ_ENABLE_GCONF=1
5034         MOZ_ENABLE_LIBGNOME=1
5035     fi
5037     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5038     [  --disable-gnomevfs      Disable GnomeVFS support ],
5039         MOZ_ENABLE_GNOMEVFS=,
5040         MOZ_ENABLE_GNOMEVFS=force)
5042     if test "$MOZ_ENABLE_GNOMEVFS"
5043     then
5044         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5045             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5046             MOZ_ENABLE_GNOMEVFS=1
5047         ],[
5048             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5049             then
5050                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5051             fi
5052             MOZ_ENABLE_GNOMEVFS=
5053         ])
5054     fi
5056     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5057     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5059     if test "$MOZ_ENABLE_GCONF"
5060     then
5061         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5062             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5063             MOZ_ENABLE_GCONF=1
5064         ],[
5065             MOZ_ENABLE_GCONF=
5066         ])
5067     fi
5069     if test "$MOZ_ENABLE_GCONF"; then
5070         AC_DEFINE(MOZ_ENABLE_GCONF)
5071     fi
5073     AC_SUBST(MOZ_ENABLE_GCONF)
5074     AC_SUBST(MOZ_GCONF_CFLAGS)
5075     AC_SUBST(MOZ_GCONF_LIBS)
5077     if test "$MOZ_ENABLE_LIBGNOME"
5078     then
5079         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5080             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5081             MOZ_ENABLE_LIBGNOME=1
5082         ],[
5083             MOZ_ENABLE_LIBGNOME=
5084         ])
5085     fi
5087     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5088     AC_SUBST(MOZ_LIBGNOME_LIBS)
5090     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5091     # are all available.
5093     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5094             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5095       MOZ_ENABLE_GNOME_COMPONENT=1
5096     else
5097       MOZ_ENABLE_GNOME_COMPONENT=
5098     fi
5100     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5103 dnl ========================================================
5104 dnl = libgnomeui support module
5105 dnl ========================================================
5107 if test "$MOZ_ENABLE_GTK2"
5108 then
5109     MOZ_ENABLE_GNOMEUI=1
5111     MOZ_ARG_DISABLE_BOOL(gnomeui,
5112     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5113         MOZ_ENABLE_GNOMEUI=,
5114         MOZ_ENABLE_GNOMEUI=force)
5116     if test "$MOZ_ENABLE_GNOMEUI"
5117     then
5118         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5119         [
5120             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5121             MOZ_ENABLE_GNOMEUI=1
5122         ],[
5123             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5124             then
5125                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5126             fi
5127             MOZ_ENABLE_GNOMEUI=
5128         ])
5129     fi
5131     if test "$MOZ_ENABLE_GNOMEUI"; then
5132         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5133     fi
5135 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5136 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5137 AC_SUBST(MOZ_GNOMEUI_LIBS)
5139 dnl ========================================================
5140 dnl = dbus support
5141 dnl ========================================================
5143 if test "$MOZ_ENABLE_GTK2"
5144 then
5145     MOZ_ENABLE_DBUS=1
5147     MOZ_ARG_DISABLE_BOOL(dbus,
5148     [  --disable-dbus       Disable dbus support ],
5149         MOZ_ENABLE_DBUS=,
5150         MOZ_ENABLE_DBUS=1)
5152     if test "$MOZ_ENABLE_DBUS"
5153     then
5154         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5155         AC_DEFINE(MOZ_ENABLE_DBUS)
5156     fi
5158 AC_SUBST(MOZ_ENABLE_DBUS)
5159 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5160 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5162 dnl ========================================================
5163 dnl = Build Personal Security Manager
5164 dnl ========================================================
5165 MOZ_ARG_DISABLE_BOOL(crypto,
5166 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5167     MOZ_PSM=,
5168     MOZ_PSM=1 )
5170 dnl ========================================================
5171 dnl = JS Debugger XPCOM component (js/jsd)
5172 dnl ========================================================
5173 MOZ_ARG_DISABLE_BOOL(jsd,
5174 [  --disable-jsd           Disable JavaScript debug library],
5175     MOZ_JSDEBUGGER=,
5176     MOZ_JSDEBUGGER=1)
5179 dnl ========================================================
5180 dnl = Disable plugin support
5181 dnl ========================================================
5182 MOZ_ARG_DISABLE_BOOL(plugins,
5183 [  --disable-plugins       Disable plugins support],
5184     MOZ_PLUGINS=,
5185     MOZ_PLUGINS=1)
5187 dnl ========================================================
5188 dnl = Open JVM Interface (OJI) support
5189 dnl ========================================================
5190 MOZ_ARG_DISABLE_BOOL(oji,
5191 [  --disable-oji           Disable Open JVM Integration support],
5192     MOZ_OJI=,
5193     MOZ_OJI=1)
5194 if test -n "$MOZ_OJI"; then
5195     AC_DEFINE(OJI)
5198 dnl bi-directional support always on
5199 IBMBIDI=1
5200 AC_DEFINE(IBMBIDI)
5202 dnl ========================================================
5203 dnl view source support on by default
5204 dnl ========================================================
5205 MOZ_ARG_DISABLE_BOOL(view-source,
5206 [  --disable-view-source     Disable view source support],
5207     MOZ_VIEW_SOURCE=,
5208     MOZ_VIEW_SOURCE=1 )
5209 if test "$MOZ_VIEW_SOURCE"; then
5210     AC_DEFINE(MOZ_VIEW_SOURCE)
5214 dnl ========================================================
5215 dnl accessibility support on by default on all platforms 
5216 dnl except OS X.
5217 dnl ========================================================
5218 MOZ_ARG_DISABLE_BOOL(accessibility,
5219 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5220     ACCESSIBILITY=,
5221     ACCESSIBILITY=1 )
5222 if test "$ACCESSIBILITY"; then
5223     AC_DEFINE(ACCESSIBILITY)
5226 if test -n "$ACCESSIBILITY"; then
5227 case "$target" in
5228 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5229     if test "$ac_cv_header_atlbase_h" = "no"; then
5230         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.])
5231     fi
5232     if test "$ac_cv_header_oleacc_idl" = "no"; then
5233         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.])
5234     fi
5235     ;;
5236 esac
5239 dnl ========================================================
5240 dnl xpfe/components on by default
5241 dnl ========================================================
5242 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5243 [  --disable-xpfe-components
5244                           Disable xpfe components],
5245     MOZ_XPFE_COMPONENTS=,
5246     MOZ_XPFE_COMPONENTS=1 )
5248 dnl ========================================================
5249 dnl xpinstall support on by default
5250 dnl ========================================================
5251 MOZ_ARG_DISABLE_BOOL(xpinstall,
5252 [  --disable-xpinstall     Disable xpinstall support],
5253     MOZ_XPINSTALL=,
5254     MOZ_XPINSTALL=1 )
5255 if test "$MOZ_XPINSTALL"; then
5256     AC_DEFINE(MOZ_XPINSTALL)
5259 dnl ========================================================
5260 dnl xpcom js loader support on by default
5261 dnl ========================================================
5262 MOZ_ARG_DISABLE_BOOL(jsloader,
5263 [  --disable-jsloader      Disable xpcom js loader support],
5264     MOZ_JSLOADER=,
5265     MOZ_JSLOADER=1 )
5266 if test "$MOZ_JSLOADER"; then
5267     AC_DEFINE(MOZ_JSLOADER)
5270 dnl ========================================================
5271 dnl Disable printing
5272 dnl ========================================================
5273 MOZ_ARG_DISABLE_BOOL(printing,
5274 [  --disable-printing  Disable printing support],
5275     NS_PRINTING=,
5276     NS_PRINTING=1 )
5278 if test "$NS_PRINTING"; then
5279     AC_DEFINE(NS_PRINTING)
5280     AC_DEFINE(NS_PRINT_PREVIEW)
5283 dnl ========================================================
5284 dnl use native unicode converters
5285 dnl ========================================================
5286 MOZ_ARG_ENABLE_BOOL(native-uconv,
5287 [  --enable-native-uconv   Enable iconv support],
5288     MOZ_USE_NATIVE_UCONV=1,
5289     MOZ_USE_NATIVE_UCONV= )
5290 if test "$MOZ_USE_NATIVE_UCONV"; then
5291     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5293 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5294     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5298 dnl ========================================================
5299 dnl Libeditor can be build as plaintext-only,
5300 dnl or as a full html and text editing component.
5301 dnl We build both by default.
5302 dnl ========================================================
5303 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5304 [  --enable-plaintext-editor-only
5305                           Allow only plaintext editing],
5306     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5307     MOZ_PLAINTEXT_EDITOR_ONLY= )
5308 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5309 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5311 dnl ========================================================
5312 dnl Composer is on by default.
5313 dnl ========================================================
5314 MOZ_ARG_DISABLE_BOOL(composer,
5315 [  --disable-composer      Disable building of Composer],
5316     MOZ_COMPOSER=,
5317     MOZ_COMPOSER=1 )
5318 AC_SUBST(MOZ_COMPOSER)
5321 dnl ========================================================
5322 dnl = Drop XPCOM Obsolete library
5323 dnl ========================================================
5324 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5325 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5326     MOZ_NO_XPCOM_OBSOLETE=1,
5327     MOZ_NO_XPCOM_OBSOLETE=)
5329 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5330     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5333 dnl ========================================================
5334 dnl = Disable Fast Load
5335 dnl ========================================================
5336 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5337 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5338     MOZ_NO_FAST_LOAD=1,
5339     MOZ_NO_FAST_LOAD=)
5341 AC_SUBST(MOZ_NO_FAST_LOAD)
5343 if test -n "$MOZ_NO_FAST_LOAD"; then
5344     AC_DEFINE(MOZ_NO_FAST_LOAD)
5347 dnl ========================================================
5348 dnl = Enable Ogg Codecs
5349 dnl ========================================================
5350 MOZ_ARG_DISABLE_BOOL(ogg,
5351 [  --disable-ogg           Disable Ogg Codec support],
5352     MOZ_OGG=,
5353     MOZ_OGG=1)
5355 AC_SUBST(MOZ_OGG)
5357 if test -n "$MOZ_OGG"; then
5358     AC_DEFINE(MOZ_OGG)
5359     MOZ_MEDIA=1
5362 AC_SUBST(MOZ_MEDIA)
5364 if test -n "$MOZ_MEDIA"; then
5365     AC_DEFINE(MOZ_MEDIA)
5368 dnl If using Ogg with Linux, ensure that the alsa library is available
5369 if test -n "$MOZ_OGG"; then
5370    case "$target_os" in
5371 linux*)
5372       AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5373       ;;
5374    esac
5377 dnl ========================================================
5378 dnl Permissions System
5379 dnl ========================================================
5380 MOZ_ARG_DISABLE_BOOL(permissions,
5381 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5382     MOZ_PERMISSIONS=,
5383     MOZ_PERMISSIONS=1
5386 dnl ========================================================
5387 dnl NegotiateAuth
5388 dnl ========================================================
5389 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5390 [  --disable-negotiateauth Disable GSS-API negotiation ],
5391     MOZ_AUTH_EXTENSION=,
5392     MOZ_AUTH_EXTENSION=1 )
5394 dnl ========================================================
5395 dnl XTF
5396 dnl ========================================================
5397 MOZ_ARG_DISABLE_BOOL(xtf,
5398 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5399     MOZ_XTF=,
5400     MOZ_XTF=1 )
5401 if test "$MOZ_XTF"; then
5402   AC_DEFINE(MOZ_XTF)
5405 dnl ========================================================
5406 dnl Inspector APIs
5407 dnl ========================================================
5408 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5409 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5410     MOZ_NO_INSPECTOR_APIS=1,
5411     MOZ_NO_INSPECTOR_APIS= )
5413 dnl ========================================================
5414 dnl Pref extensions (autoconfig and system-pref)
5415 dnl ========================================================
5416 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5417 [  --disable-pref-extensions
5418                           Disable pref extensions such as autoconfig and
5419                           system-pref],
5420   MOZ_PREF_EXTENSIONS=,
5421   MOZ_PREF_EXTENSIONS=1 )
5423 dnl ========================================================
5424 dnl = Universalchardet
5425 dnl ========================================================
5426 MOZ_ARG_DISABLE_BOOL(universalchardet,
5427 [  --disable-universalchardet
5428                           Disable universal encoding detection],
5429   MOZ_UNIVERSALCHARDET=,
5430   MOZ_UNIVERSALCHARDET=1 )
5432 dnl ========================================================
5433 dnl JavaXPCOM
5434 dnl ========================================================
5435 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5436 [  --enable-javaxpcom
5437                           Enable Java-XPCOM bridge],
5438     MOZ_JAVAXPCOM=1,
5439     MOZ_JAVAXPCOM= )
5441 if test -n "${MOZ_JAVAXPCOM}"; then
5442   case "$host_os" in
5443     cygwin*|msvc*|mks*)
5444       if test -n "$JAVA_HOME"; then
5445         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5446       fi
5447       ;;
5448     *mingw*)
5449       if test -n "$JAVA_HOME"; then
5450         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5451       fi
5452       ;;
5453   esac
5455   if test -n "${JAVA_INCLUDE_PATH}"; then
5456     dnl Make sure jni.h exists in the given include path.
5457     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5458       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5459     fi
5460   else
5461     case "$target_os" in
5462       darwin*)
5463         dnl Default to java system location
5464         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5465         ;;
5466       *)
5467         dnl Try $JAVA_HOME
5468         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5469         ;;
5470     esac
5471     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5472       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.])
5473     fi
5474   fi
5476   if test -n "${JAVA_BIN_PATH}"; then
5477     dnl Look for javac and jar in the specified path.
5478     JAVA_PATH="$JAVA_BIN_PATH"
5479   else
5480     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5481     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5482   fi
5484   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5485   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5486   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5487   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5488     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.])
5489   fi
5492 dnl ========================================================
5493 dnl = Breakpad crash reporting (on by default on supported platforms)
5494 dnl ========================================================
5496 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5497     || test "$OS_ARCH" = "Darwin" \
5498     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5499     || test "$OS_ARCH" = "SunOS") \
5500    && test -z "$HAVE_64BIT_OS"; then
5501    MOZ_CRASHREPORTER=1
5504 MOZ_ARG_DISABLE_BOOL(crashreporter,
5505 [  --disable-crashreporter          Disable breakpad crash reporting],
5506     MOZ_CRASHREPORTER=,
5507     MOZ_CRASHREPORTER=1)
5509 if test -n "$MOZ_CRASHREPORTER"; then
5510    AC_DEFINE(MOZ_CRASHREPORTER)
5512   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5513     test -z "$SKIP_LIBRARY_CHECKS"; then
5514     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5515     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5516     AC_SUBST(MOZ_GTHREAD_LIBS)
5518     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.])])
5519   fi
5522 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5523 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5524 [ val=`echo $withval | sed 's/[^0-9]//g'`
5525     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5527 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5528    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5530 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5533 dnl ========================================================
5534 dnl = Build mochitest JS/DOM tests (on by default)
5535 dnl ========================================================
5536 MOZ_ARG_DISABLE_BOOL(mochitest,
5537 [  --disable-mochitest        Disable mochitest harness],
5538     MOZ_MOCHITEST=,
5539     MOZ_MOCHITEST=1 )
5541 dnl ========================================================
5542 dnl = Enable compilation of specific extension modules
5543 dnl ========================================================
5545 MOZ_ARG_ENABLE_STRING(extensions,
5546 [  --enable-extensions     Enable extensions],
5547 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5548     if test "$option" = "yes" || test "$option" = "all"; then
5549         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5550     elif test "$option" = "no" || test "$option" = "none"; then
5551         MOZ_EXTENSIONS=""
5552     elif test "$option" = "default"; then
5553         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5554     elif test `echo "$option" | grep -c \^-` != 0; then
5555         option=`echo $option | sed 's/^-//'`
5556         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5557     else
5558         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5559     fi
5560 done],
5561     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5563 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5564     # Suppress warning on non-X11 platforms
5565     if test -n "$MOZ_X11"; then
5566         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5567     fi
5568     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5571 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5572     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5573     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5576 dnl This might be temporary: build tridentprofile only on Windows
5577 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5578     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5579     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5582 dnl cookie must be built before tridentprofile. put it at list's end.
5583 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5584   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5585   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5588 dnl xforms requires xtf and schema-validation
5589 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5590     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5591     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5593 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5594     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5595     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5598 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5599     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5600     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5603 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5604     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5605     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5608 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5609     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5610     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5613 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5614     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5615     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5618 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5619     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5620     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5623 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5624     AC_MSG_WARN([spellcheck is no longer an extension.])
5625     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5628 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5629     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5630     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5633 dnl Remove dupes
5634 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5636 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5637 dnl when trying to build a non-existent extension.
5638 for extension in $MOZ_EXTENSIONS; do
5639     if test ! -d "${srcdir}/extensions/${extension}"; then
5640         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5641     fi
5642 done
5645 dnl ========================================================
5646 dnl Image decoders
5647 dnl ========================================================
5648 case "$MOZ_WIDGET_TOOLKIT" in
5649 beos|windows|os2|mac|cocoa)
5650     ;;
5652     if test -z "$MOZ_ENABLE_GTK2"; then
5653        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
5654     fi
5655     ;;
5656 esac
5658 MOZ_ARG_ENABLE_STRING(image-decoders,
5659 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5660                           Enable specific image decoders],
5661 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5662     if test "$option" = "yes" || test "$option" = "all"; then
5663         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5664     elif test "$option" = "no" || test "$option" = "none"; then
5665         MOZ_IMG_DECODERS=""
5666     elif test "$option" = "default"; then
5667         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5668     elif test `echo "$option" | grep -c \^-` != 0; then
5669         option=`echo $option | sed 's/^-//'`
5670         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5671     else
5672         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5673     fi
5674 done],
5675     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5677 dnl Dupes are removed in the encoder section because it will also add decoders
5679 dnl ========================================================
5680 dnl Image encoders
5681 dnl ========================================================
5682 MOZ_ARG_ENABLE_STRING(image-encoders,
5683 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5684                           Enable specific image encoders],
5685 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5686     if test "$option" = "yes" || test "$option" = "all"; then
5687         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5688     elif test "$option" = "no" || test "$option" = "none"; then
5689         MOZ_IMG_ENCODERS=""
5690         addencoder=""
5691     elif test "$option" = "default"; then
5692         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5693     elif test `echo "$option" | grep -c \^-` != 0; then
5694         option=`echo $option | sed 's/^-//'`
5695         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5696     else
5697         addencoder="$option"
5698     fi
5699     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5700 done],
5701     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5703 dnl Remove dupes
5704 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5705 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5707 dnl ========================================================
5708 dnl MathML on by default
5709 dnl ========================================================
5710 MOZ_ARG_DISABLE_BOOL(mathml,
5711 [  --disable-mathml        Disable MathML support],
5712     MOZ_MATHML=,
5713     MOZ_MATHML=1 )
5714 if test "$MOZ_MATHML"; then
5715   AC_DEFINE(MOZ_MATHML)
5718 dnl ========================================================
5719 dnl Canvas
5720 dnl ========================================================
5721 MOZ_ARG_DISABLE_BOOL(canvas,
5722 [  --disable-canvas          Disable html:canvas feature],
5723     MOZ_ENABLE_CANVAS=,
5724     MOZ_ENABLE_CANVAS=1 )
5725 if test -n "$MOZ_ENABLE_CANVAS"; then
5726     AC_DEFINE(MOZ_ENABLE_CANVAS)
5728 AC_SUBST(MOZ_ENABLE_CANVAS)
5730 dnl ========================================================
5731 dnl SVG
5732 dnl ========================================================
5733 MOZ_ARG_DISABLE_BOOL(svg,
5734 [  --disable-svg            Disable SVG support],
5735     MOZ_SVG=,
5736     MOZ_SVG=1 )
5737 if test -n "$MOZ_SVG"; then
5738   AC_DEFINE(MOZ_SVG)
5741 dnl ========================================================
5742 dnl Installer
5743 dnl ========================================================
5744 case "$target_os" in
5745     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5746         MOZ_INSTALLER=1
5747         ;;
5748 esac
5750 MOZ_ARG_DISABLE_BOOL(installer,
5751 [  --disable-installer     Disable building of installer],
5752     MOZ_INSTALLER=,
5753     MOZ_INSTALLER=1 )
5754 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5755     # Disable installer for Windows builds that use the new toolkit if NSIS
5756     # isn't in the path.
5757     AC_PATH_PROGS(MAKENSIS, makensis)
5758     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5759         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5760     fi
5761     # The Windows build for NSIS requires the iconv command line utility to
5762     # convert the charset of the locale files.
5763     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5764     if test -z "$HOST_ICONV"; then
5765         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5766     fi
5769 # Automatically disable installer if xpinstall isn't built
5770 if test -z "$MOZ_XPINSTALL"; then
5771     MOZ_INSTALLER=
5773 AC_SUBST(MOZ_INSTALLER)
5775 AC_MSG_CHECKING([for tar archiver])
5776 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5777 if test -z "$TAR"; then
5778     AC_MSG_ERROR([no tar archiver found in \$PATH])
5780 AC_MSG_RESULT([$TAR])
5781 AC_SUBST(TAR)
5783 AC_MSG_CHECKING([for wget])
5784 AC_CHECK_PROGS(WGET, wget, "")
5785 AC_MSG_RESULT([$WGET])
5786 AC_SUBST(WGET)
5788 dnl ========================================================
5789 dnl Updater
5790 dnl ========================================================
5792 MOZ_ARG_DISABLE_BOOL(updater,
5793 [  --disable-updater       Disable building of updater],
5794     MOZ_UPDATER=,
5795     MOZ_UPDATER=1 )
5796 # The Windows build requires the iconv command line utility
5797 # in order to build the updater.
5798 case "$target_os" in
5799     msvc*|mks*|cygwin*|mingw*|wince*)
5800         if test -n "$MOZ_UPDATER"; then
5801             AC_MSG_CHECKING([for iconv])
5802             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5803             if test -z "$HOST_ICONV"; then
5804                 AC_MSG_ERROR([iconv not found in \$PATH])
5805             fi
5806         fi
5807         ;;
5808 esac
5809 AC_SUBST(MOZ_UPDATER)
5811 # app update channel is 'default' when not supplied.
5812 MOZ_ARG_ENABLE_STRING([update-channel],
5813 [  --enable-update-channel=CHANNEL
5814                            Select application update channel (default=default)],
5815     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5817 if test -z "$MOZ_UPDATE_CHANNEL"; then
5818     MOZ_UPDATE_CHANNEL=default
5820 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5822 # tools/update-packaging is not checked out by default.
5823 MOZ_ARG_ENABLE_BOOL(update-packaging,
5824 [  --enable-update-packaging
5825                            Enable tools/update-packaging],
5826     MOZ_UPDATE_PACKAGING=1,
5827     MOZ_UPDATE_PACKAGING= )
5828 AC_SUBST(MOZ_UPDATE_PACKAGING)
5830 dnl ========================================================
5831 dnl ActiveX
5832 dnl ========================================================
5834 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5835 [  --disable-xpconnect-idispatch
5836                           Disable building of xpconnect support for IDispatch
5837                           (win32 only)],
5838     XPC_IDISPATCH_SUPPORT=,
5839     XPC_IDISPATCH_SUPPORT=1)
5840 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5842 MOZ_ARG_DISABLE_BOOL(activex,
5843 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5844     MOZ_NO_ACTIVEX_SUPPORT=1,
5845     MOZ_NO_ACTIVEX_SUPPORT= )
5846 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5848 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5849 [  --disable-activex-scripting
5850                           Disable building of ActiveX scripting support (win32)],
5851     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5852     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5853 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5855 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5856 then
5857     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5860 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5861 case "$target" in
5862 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5863     if test "$ac_cv_header_atlbase_h" = "no"; then
5864         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.])
5865     fi
5866     ;;
5867 esac
5870 dnl ========================================================
5871 dnl leaky
5872 dnl ========================================================
5873 MOZ_ARG_ENABLE_BOOL(leaky,
5874 [  --enable-leaky          Build leaky memory tool],
5875     MOZ_LEAKY=1,
5876     MOZ_LEAKY=)
5879 dnl ========================================================
5880 dnl xpctools
5881 dnl ========================================================
5882 MOZ_ARG_ENABLE_BOOL(xpctools,
5883 [  --enable-xpctools       Build JS profiling tool],
5884     MOZ_XPCTOOLS=1,
5885     MOZ_XPCTOOLS= )
5888 dnl ========================================================
5889 dnl build the tests by default
5890 dnl ========================================================
5891 MOZ_ARG_DISABLE_BOOL(tests,
5892 [  --disable-tests         Do not build test libraries & programs],
5893     ENABLE_TESTS=,
5894     ENABLE_TESTS=1 )
5896 dnl ========================================================
5897 dnl parental controls (for Windows Vista)
5898 dnl ========================================================
5899 MOZ_ARG_DISABLE_BOOL(parental-controls,
5900 [  --disable-parental-controls
5901                            Do not build parental controls],
5902    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5903    MOZ_DISABLE_PARENTAL_CONTROLS=)
5904 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5905     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5908 dnl ========================================================
5909 dnl Vista SDK specific api
5910 dnl ========================================================
5911 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5912 [  --disable-vista-sdk-requirements
5913                            Do not build Vista SDK specific code],
5914    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5915    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5916 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5917     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5918     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5919     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5920         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5921     fi
5922     MOZ_DISABLE_PARENTAL_CONTROLS=1
5923 else
5924 case "$target" in
5925 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5926     if test "$ac_cv_header_wpcapi_h" = "no"; then
5927         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.])
5928     fi
5929     ;;
5930 esac
5932 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5933 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5935 dnl ========================================================
5936 dnl =
5937 dnl = Module specific options
5938 dnl =
5939 dnl ========================================================
5940 MOZ_ARG_HEADER(Individual module options)
5942 dnl ========================================================
5943 dnl = Enable Lea malloc in xpcom. OFF by default.
5944 dnl ========================================================
5945 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5946 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5947     XPCOM_USE_LEA=1,
5948     XPCOM_USE_LEA= )
5949 if test -n "$XPCOM_USE_LEA"; then
5950     AC_DEFINE(XPCOM_USE_LEA)
5953 dnl ========================================================
5954 dnl = Enable places (new history/bookmarks)
5955 dnl ========================================================
5956 MOZ_ARG_ENABLE_BOOL(places,
5957 [  --enable-places        Enable 'places' bookmark/history implementation],
5958     MOZ_PLACES=1,
5959     MOZ_PLACES= )
5960 if test -n "$MOZ_PLACES"; then
5961     AC_DEFINE(MOZ_PLACES)
5962     if test -z "$MOZ_MAIL_NEWS"; then
5963       MOZ_MORK=
5964     fi
5965     MOZ_MORKREADER=1
5966 else
5967   if test "$MOZ_BUILD_APP" = "browser"; then
5968     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5969   fi
5972 dnl ========================================================
5973 dnl = Disable feed handling components
5974 dnl ========================================================
5975 MOZ_ARG_DISABLE_BOOL(feeds,
5976 [  --disable-feeds        Disable feed handling and processing components],
5977     MOZ_FEEDS=,
5978     MOZ_FEEDS=1 )
5979 if test -n "$MOZ_FEEDS"; then
5980     AC_DEFINE(MOZ_FEEDS)
5981 else
5982     if test "$MOZ_BUILD_APP" = "browser"; then
5983         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5984     fi
5987 dnl ========================================================
5988 dnl = Enable mozStorage
5989 dnl ========================================================
5990 dnl Implicitly enabled by default if building calendar or places
5991 MOZ_ARG_ENABLE_BOOL(storage,
5992 [  --enable-storage        Enable mozStorage module and related components],
5993     MOZ_STORAGE=1,
5994     MOZ_STORAGE= )
5995 if test -n "$MOZ_STORAGE"; then
5996     AC_DEFINE(MOZ_STORAGE)
5999 dnl ========================================================
6000 dnl Check for sqlite
6001 dnl ========================================================
6003 MOZ_NATIVE_SQLITE=
6004 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6005 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6006 MOZ_NATIVE_SQLITE=1,
6007 MOZ_NATIVE_SQLITE= )
6009 if test -z "$MOZ_NATIVE_SQLITE"
6010 then
6011     SQLITE_CFLAGS=
6012     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6013 else
6014     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6017 AC_SUBST(MOZ_NATIVE_SQLITE)
6019 dnl ========================================================
6020 dnl = Enable help viewer (off by default)
6021 dnl ========================================================
6022 MOZ_ARG_ENABLE_BOOL(help-viewer,
6023 [  --enable-help-viewer        Enable help viewer],
6024     MOZ_HELP_VIEWER=1,
6025     MOZ_HELP_VIEWER= )
6026 if test -n "$MOZ_HELP_VIEWER"; then
6027      AC_DEFINE(MOZ_HELP_VIEWER)
6029 AC_SUBST(MOZ_HELP_VIEWER)
6030 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6031     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6034 dnl ========================================================
6035 dnl = Enable safe browsing (anti-phishing)
6036 dnl ========================================================
6037 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6038 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6039     MOZ_SAFE_BROWSING=1,
6040     MOZ_SAFE_BROWSING= )
6041 if test -n "$MOZ_SAFE_BROWSING"; then
6042     AC_DEFINE(MOZ_SAFE_BROWSING)
6044 AC_SUBST(MOZ_SAFE_BROWSING)
6046 dnl ========================================================
6047 dnl = Enable url-classifier
6048 dnl ========================================================
6049 dnl Implicitly enabled by default if building with safe-browsing
6050 if test -n "$MOZ_SAFE_BROWSING"; then
6051     MOZ_URL_CLASSIFIER=1
6053 MOZ_ARG_ENABLE_BOOL(url-classifier,
6054 [  --enable-url-classifier        Enable url classifier module],
6055     MOZ_URL_CLASSIFIER=1,
6056     MOZ_URL_CLASSIFIER= )
6057 if test -n "$MOZ_URL_CLASSIFIER"; then
6058     AC_DEFINE(MOZ_URL_CLASSIFIER)
6060 AC_SUBST(MOZ_URL_CLASSIFIER)
6062 dnl ========================================================
6063 dnl = Disable zipwriter
6064 dnl ========================================================
6065 MOZ_ARG_DISABLE_BOOL(zipwriter,
6066 [  --disable-zipwriter             Disable zipwriter component],
6067     MOZ_ZIPWRITER=,
6068     MOZ_ZIPWRITER=1 )
6069 AC_SUBST(MOZ_ZIPWRITER)
6071 dnl ========================================================
6072 dnl = Enable Ultrasparc specific optimizations for JS
6073 dnl ========================================================
6074 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6075 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6076     JS_ULTRASPARC_OPTS=1,
6077     JS_ULTRASPARC_OPTS= )
6079 dnl only enable option for ultrasparcs
6080 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6081     "$OS_TEST" != "sun4u"; then
6082     JS_ULTRASPARC_OPTS=
6084 AC_SUBST(JS_ULTRASPARC_OPTS)
6086 dnl ========================================================
6087 dnl = Hildon and OSSO checks
6088 dnl ========================================================
6089 PKG_CHECK_MODULES(LIBHILONMIME,libhildonmime,
6090                   NS_HILDON=1,
6091                   NS_HILDON=)
6092 if test $NS_HILDON; then
6093    AC_DEFINE(NS_HILDON)
6096 PKG_CHECK_MODULES(LIBOSSO,libosso,
6097                   NS_OSSO=1,
6098                   NS_OSSO=)
6100 if test $NS_OSSO; then
6101     if test -z "$MOZ_ENABLE_DBUS"; then
6102         AC_MSG_ERROR([DBus is required when building for OSSO])
6103     fi
6104     AC_DEFINE(NS_OSSO)     
6107 dnl ========================================================
6108 dnl =
6109 dnl = Feature options that require extra sources to be pulled
6110 dnl =
6111 dnl ========================================================
6112 dnl MOZ_ARG_HEADER(Features that require extra sources)
6114 dnl ========================================================
6115 dnl =
6116 dnl = Debugging Options
6117 dnl = 
6118 dnl ========================================================
6119 MOZ_ARG_HEADER(Debugging and Optimizations)
6121 dnl ========================================================
6122 dnl = Disable building with debug info.
6123 dnl = Debugging is OFF by default
6124 dnl ========================================================
6125 if test -z "$MOZ_DEBUG_FLAGS"
6126 then
6127     case "$target" in
6128     *-irix*)
6129         if test "$GNU_CC"; then
6130             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6131             case "$GCC_VERSION" in
6132             2.95.*)
6133                 MOZ_DEBUG_FLAGS=""
6134                 ;;
6135             *)
6136                 MOZ_DEBUG_FLAGS="-g"
6137                 ;;
6138             esac
6139         else
6140             MOZ_DEBUG_FLAGS="-g"
6141         fi
6142         ;;
6143     *)
6144         MOZ_DEBUG_FLAGS="-g"
6145         ;;
6146     esac
6149 MOZ_ARG_ENABLE_STRING(debug,
6150 [  --enable-debug[=DBG]    Enable building with developer debug info
6151                           (Using compiler flags DBG)],
6152 [ if test "$enableval" != "no"; then
6153     MOZ_DEBUG=1
6154     if test -n "$enableval" && test "$enableval" != "yes"; then
6155         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6156     fi
6157   else
6158     MOZ_DEBUG=
6159   fi ],
6160   MOZ_DEBUG=)
6162 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6163  case "${target_os}" in
6164     beos*)
6165         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6166         ;;
6167     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6168         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6169         ;;
6170     *) 
6171         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6172         ;;
6173   esac
6174 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6176 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6178 if test -n "$MOZ_DEBUG"; then
6179     AC_MSG_CHECKING([for valid debug flags])
6180     _SAVE_CFLAGS=$CFLAGS
6181     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6182     AC_TRY_COMPILE([#include <stdio.h>], 
6183         [printf("Hello World\n");],
6184         _results=yes,
6185         _results=no)
6186     AC_MSG_RESULT([$_results])
6187     if test "$_results" = "no"; then
6188         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6189     fi
6190     CFLAGS=$_SAVE_CFLAGS
6193 dnl ========================================================
6194 dnl = Enable code optimization. ON by default.
6195 dnl ========================================================
6196 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6197         MOZ_OPTIMIZE_FLAGS="-O"
6200 MOZ_ARG_ENABLE_STRING(optimize,
6201 [  --disable-optimize      Disable compiler optimization
6202   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6203 [ if test "$enableval" != "no"; then
6204     MOZ_OPTIMIZE=1
6205     if test -n "$enableval" && test "$enableval" != "yes"; then
6206         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6207         MOZ_OPTIMIZE=2
6208     fi
6209 else
6210     MOZ_OPTIMIZE=
6211 fi ], MOZ_OPTIMIZE=1)
6213 if test "$COMPILE_ENVIRONMENT"; then
6214 if test -n "$MOZ_OPTIMIZE"; then
6215     AC_MSG_CHECKING([for valid optimization flags])
6216     _SAVE_CFLAGS=$CFLAGS
6217     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6218     AC_TRY_COMPILE([#include <stdio.h>], 
6219         [printf("Hello World\n");],
6220         _results=yes,
6221         _results=no)
6222     AC_MSG_RESULT([$_results])
6223     if test "$_results" = "no"; then
6224         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6225     fi
6226     CFLAGS=$_SAVE_CFLAGS
6228 fi # COMPILE_ENVIRONMENT
6230 AC_SUBST(MOZ_OPTIMIZE)
6231 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6232 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6233 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6235 dnl ========================================================
6236 dnl = Enable/disable debug for specific modules only
6237 dnl =   module names beginning with ^ will be disabled 
6238 dnl ========================================================
6239 MOZ_ARG_ENABLE_STRING(debug-modules,
6240 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6241 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6243 dnl ========================================================
6244 dnl = Enable/disable generation of debugger info for specific modules only
6245 dnl =    the special module name ALL_MODULES can be used to denote all modules
6246 dnl =    module names beginning with ^ will be disabled
6247 dnl ========================================================
6248 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6249 [  --enable-debugger-info-modules
6250                           Enable/disable debugger info for specific modules],
6251 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6252       dnl note that the list of module names is reversed as it is copied
6253       dnl this is important, as it will allow config.mk to interpret stuff like
6254       dnl "^ALL_MODULES xpcom" properly
6255       if test "$i" = "no"; then
6256         i="^ALL_MODULES"
6257       fi
6258       if test "$i" = "yes"; then
6259         i="ALL_MODULES"
6260       fi
6261       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6262     done ])
6264 dnl ========================================================
6265 dnl Enable garbage collector
6266 dnl ========================================================
6267 MOZ_ARG_ENABLE_BOOL(boehm,
6268 [  --enable-boehm          Enable the Boehm Garbage Collector],
6269     GC_LEAK_DETECTOR=1,
6270     GC_LEAK_DETECTOR= )
6271 if test -n "$GC_LEAK_DETECTOR"; then
6272     AC_DEFINE(GC_LEAK_DETECTOR)
6275 dnl ========================================================
6276 dnl Disable runtime logging checks
6277 dnl ========================================================
6278 MOZ_ARG_DISABLE_BOOL(logging,
6279 [  --disable-logging       Disable logging facilities],
6280     NS_DISABLE_LOGGING=1,
6281     NS_DISABLE_LOGGING= )
6282 if test "$NS_DISABLE_LOGGING"; then
6283     AC_DEFINE(NS_DISABLE_LOGGING)
6284 else
6285     AC_DEFINE(MOZ_LOGGING)
6288 dnl ========================================================
6289 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6290 dnl ========================================================
6291 _ENABLE_LOGREFCNT=42
6292 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6293 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6294     _ENABLE_LOGREFCNT=1,
6295     _ENABLE_LOGREFCNT= )
6296 if test "$_ENABLE_LOGREFCNT" = "1"; then
6297     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6298 elif test -z "$_ENABLE_LOGREFCNT"; then
6299     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6302 dnl ========================================================
6303 dnl = Enable trace malloc
6304 dnl ========================================================
6305 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6306 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6307 [  --enable-trace-malloc   Enable malloc tracing],
6308     NS_TRACE_MALLOC=1,
6309     NS_TRACE_MALLOC= )
6310 if test "$NS_TRACE_MALLOC"; then
6311   # Please, Mr. Linker Man, don't take away our symbol names
6312   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6313   USE_ELF_DYNSTR_GC=
6314   AC_DEFINE(NS_TRACE_MALLOC)
6316 AC_SUBST(NS_TRACE_MALLOC)
6318 dnl ========================================================
6319 dnl = Enable jemalloc
6320 dnl ========================================================
6321 MOZ_ARG_ENABLE_BOOL(jemalloc,
6322 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6323     MOZ_MEMORY=1,
6324     MOZ_MEMORY=)
6326 if test "$NS_TRACE_MALLOC"; then
6327     MOZ_MEMORY=
6330 if test "$MOZ_MEMORY"; then
6332   dnl Don't try to run compiler tests on Windows  
6333   if test "$OS_ARCH" = "WINNT"; then
6334     if test -z "$HAVE_64BIT_OS"; then
6335       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6336     else
6337       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6338     fi
6339   else
6340     AC_CHECK_SIZEOF([int *], [4])
6341     case "${ac_cv_sizeof_int_p}" in
6342     4)
6343       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6344       ;;
6345     8)
6346       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6347       ;;
6348     *)
6349       AC_MSG_ERROR([Unexpected pointer size])
6350       ;;
6351     esac
6352   fi
6354   AC_DEFINE(MOZ_MEMORY)
6355   if test "x$MOZ_DEBUG" = "x1"; then
6356     AC_DEFINE(MOZ_MEMORY_DEBUG)
6357   fi
6358   dnl The generic feature tests that determine how to compute ncpus are long and
6359   dnl complicated.  Therefore, simply define special cpp variables for the
6360   dnl platforms we have special knowledge of.
6361   case "${target_os}" in
6362   darwin*)
6363     AC_DEFINE(MOZ_MEMORY_DARWIN)
6364     ;;
6365   *-freebsd*)
6366     AC_DEFINE(MOZ_MEMORY_BSD)
6367     ;;
6368   *linux*)
6369     AC_DEFINE(MOZ_MEMORY_LINUX)
6370     ;;
6371   netbsd*)
6372     AC_DEFINE(MOZ_MEMORY_BSD)
6373     ;;
6374   solaris*)
6375     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6376     ;;
6377   msvc*|mks*|cygwin*|mingw*)
6378     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6379     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6380     dnl will fail miserably
6381     if test "$_CC_SUITE" -lt "8"; then
6382         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6383     fi
6384     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6385       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6386         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.])
6387       else
6388         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6389       fi
6390     fi
6391     if test -z "$WIN32_CRT_SRC_DIR"; then
6392       # pre-built dll
6393       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6394       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6395     else
6396       # CRT source directory
6397       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6398       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6399       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6400     fi
6401     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6402     dnl are to avoid m4
6403     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6404     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6405     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6406     dnl This needs to be unix style.
6407     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6408     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6409     AC_DEFINE(_STATIC_CPPLIB)
6410     dnl Don't generate a manifest, since we're linking to a custom CRT.
6411     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6412     dnl Also pass this to NSPR/NSS
6413     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6414     export DLLFLAGS
6415     ;;
6416   *)
6417     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6418     ;;
6419   esac
6421   AC_ARG_WITH([valgrind],
6422     [  --with-valgrind         Enable valgrind integration hooks],
6423     [enable_valgrind="yes"], [enable_valgrind="no"])
6424   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6425   if test "x$enable_valgrind" = "xyes" ; then
6426     AC_DEFINE(MOZ_VALGRIND)
6427   fi
6429 AC_SUBST(MOZ_MEMORY)
6430 AC_SUBST(WIN32_CRT_SRC_DIR)
6431 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6432 AC_SUBST(MOZ_LIB)
6433 AC_SUBST(MOZ_PATH)
6434 dnl Need to set this for make because NSS doesn't have configure
6435 AC_SUBST(DLLFLAGS)
6437 dnl ========================================================
6438 dnl = Use malloc wrapper lib
6439 dnl ========================================================
6440 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6441 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6442     _WRAP_MALLOC=1,
6443     _WRAP_MALLOC= )
6445 if test -n "$_WRAP_MALLOC"; then
6446     if test "$GNU_CC"; then
6447     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"
6448     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6449     fi
6452 dnl ========================================================
6453 dnl = Location of malloc wrapper lib
6454 dnl ========================================================
6455 MOZ_ARG_WITH_STRING(wrap-malloc,
6456 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6457     WRAP_MALLOC_LIB=$withval)
6459 dnl ========================================================
6460 dnl = Use Electric Fence
6461 dnl ========================================================
6462 MOZ_ARG_ENABLE_BOOL(efence,
6463 [  --enable-efence         Link with Electric Fence],
6464     _ENABLE_EFENCE=1,
6465     _ENABLE_EFENCE= )
6466 if test -n "$_ENABLE_EFENCE"; then
6467     AC_CHECK_LIB(efence,malloc)
6470 dnl ========================================================
6471 dnl jprof
6472 dnl ========================================================
6473 MOZ_ARG_ENABLE_BOOL(jprof,
6474 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6475     MOZ_JPROF=1,
6476     MOZ_JPROF= )
6477 if test -n "$MOZ_JPROF"; then
6478     AC_DEFINE(MOZ_JPROF)
6481 dnl ========================================================
6482 dnl shark
6483 dnl ========================================================
6484 MOZ_ARG_ENABLE_BOOL(shark,
6485 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6486     MOZ_SHARK=1,
6487     MOZ_SHARK= )
6488 if test -n "$MOZ_SHARK"; then
6489     AC_DEFINE(MOZ_SHARK)
6492 dnl ========================================================
6493 dnl callgrind
6494 dnl ========================================================
6495 MOZ_ARG_ENABLE_BOOL(callgrind,
6496 [  --enable-callgrind      Enable callgrind profiling],
6497     MOZ_CALLGRIND=1,
6498     MOZ_CALLGRIND= )
6499 if test -n "$MOZ_CALLGRIND"; then
6500     AC_DEFINE(MOZ_CALLGRIND)
6503 dnl ========================================================
6504 dnl vtune
6505 dnl ========================================================
6506 MOZ_ARG_ENABLE_BOOL(vtune,
6507 [  --enable-vtune          Enable vtune profiling],
6508     MOZ_VTUNE=1,
6509     MOZ_VTUNE= )
6510 if test -n "$MOZ_VTUNE"; then
6511     AC_DEFINE(MOZ_VTUNE)
6514 dnl ========================================================
6515 dnl = Enable static checking using gcc-dehydra
6516 dnl ========================================================
6518 MOZ_ARG_WITH_STRING(static-checking,
6519 [  --with-static-checking=path/to/gcc_dehydra.so
6520                             Enable static checking of code using GCC-dehydra],
6521     DEHYDRA_PATH=$withval,
6522     DEHYDRA_PATH= )
6524 if test -n "$DEHYDRA_PATH"; then
6525     if ! test -f "$DEHYDRA_PATH"; then
6526         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6527     fi
6528     AC_DEFINE(NS_STATIC_CHECKING)
6530 AC_SUBST(DEHYDRA_PATH)
6532 dnl ========================================================
6533 dnl = Enable stripping of libs & executables
6534 dnl ========================================================
6535 MOZ_ARG_ENABLE_BOOL(strip,
6536 [  --enable-strip          Enable stripping of libs & executables ],
6537     ENABLE_STRIP=1,
6538     ENABLE_STRIP= )
6540 dnl ========================================================
6541 dnl = Enable stripping of libs & executables when packaging
6542 dnl ========================================================
6543 MOZ_ARG_ENABLE_BOOL(install-strip,
6544 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6545     PKG_SKIP_STRIP= ,
6546     PKG_SKIP_STRIP=1)
6548 dnl ========================================================
6549 dnl = --enable-elf-dynstr-gc
6550 dnl ========================================================
6551 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6552 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6553     USE_ELF_DYNSTR_GC=1,
6554     USE_ELF_DYNSTR_GC= )
6556 dnl ========================================================
6557 dnl = --enable-old-abi-compat-wrappers
6558 dnl ========================================================
6559 dnl on x86 linux, the current builds of some popular plugins (notably
6560 dnl flashplayer and real) expect a few builtin symbols from libgcc
6561 dnl which were available in some older versions of gcc.  However,
6562 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6563 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6564 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6565 dnl to true on x86 linux, and false everywhere else.
6568 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6569 [  --enable-old-abi-compat-wrappers
6570                           Support old GCC ABI symbols to ease the pain 
6571                           of the linux compiler change],
6572     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6573     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6574 if test "$COMPILE_ENVIRONMENT"; then
6575 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6576     AC_LANG_SAVE
6577     AC_LANG_CPLUSPLUS
6578     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6579     AC_LANG_RESTORE
6580     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6582 fi # COMPILE_ENVIRONMENT
6584 dnl ========================================================
6585 dnl = --enable-prebinding
6586 dnl ========================================================
6587 MOZ_ARG_ENABLE_BOOL(prebinding,
6588 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6589     USE_PREBINDING=1,
6590     USE_PREBINDING= )
6592 dnl ========================================================
6593 dnl = 
6594 dnl = Profiling and Instrumenting
6595 dnl = 
6596 dnl ========================================================
6597 MOZ_ARG_HEADER(Profiling and Instrumenting)
6599 dnl ========================================================
6600 dnl = Enable timeline service, which provides lightweight
6601 dnl = instrumentation of mozilla for performance measurement.
6602 dnl = Timeline is off by default.
6603 dnl ========================================================
6604 MOZ_ARG_ENABLE_BOOL(timeline,
6605 [  --enable-timeline       Enable timeline services ],
6606     MOZ_TIMELINE=1,
6607     MOZ_TIMELINE= )
6608 if test -n "$MOZ_TIMELINE"; then
6609     AC_DEFINE(MOZ_TIMELINE)
6612 dnl ========================================================
6613 dnl Turn on reflow counting
6614 dnl ========================================================
6615 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6616 [  --enable-reflow-perf    Enable reflow performance tracing],
6617     MOZ_REFLOW_PERF=1,
6618     MOZ_REFLOW_PERF= )
6619 if test -n "$MOZ_REFLOW_PREF"; then
6620     AC_DEFINE(MOZ_REFLOW_PREF)
6622 AC_SUBST(MOZ_REFLOW_PERF)
6624 dnl ========================================================
6625 dnl Enable performance metrics.
6626 dnl ========================================================
6627 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6628 [  --enable-perf-metrics   Enable performance metrics],
6629     MOZ_PERF_METRICS=1,
6630     MOZ_PERF_METRICS= )
6631 if test -n "$MOZ_PERF_METRICS"; then
6632     AC_DEFINE(MOZ_PERF_METRICS)
6635 dnl ========================================================
6636 dnl Enable code size metrics.
6637 dnl ========================================================
6638 MOZ_ARG_ENABLE_BOOL(codesighs,
6639 [  --enable-codesighs      Enable code size analysis tools],
6640     _ENABLE_CODESIGHS=1,
6641     _ENABLE_CODESIGHS= )
6642 if test -n "$_ENABLE_CODESIGHS"; then
6643     if test -d $srcdir/tools/codesighs; then 
6644         MOZ_MAPINFO=1
6645     else
6646         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6647     fi
6650 dnl ========================================================
6651 dnl = Add support for Eazel profiler
6652 dnl ========================================================
6653 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6654 [  --enable-eazel-profiler-support
6655                           Enable Corel/Eazel profiler support],
6656     ENABLE_EAZEL_PROFILER=1,
6657     ENABLE_EAZEL_PROFILER= )
6658 if test -n "$ENABLE_EAZEL_PROFILER"; then
6659     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6660     USE_ELF_DYNSTR_GC=
6661     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6662     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6663     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6666 MOZ_ARG_ENABLE_STRING(profile-modules,
6667 [  --enable-profile-modules
6668                           Enable/disable profiling for specific modules],
6669 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6671 MOZ_ARG_ENABLE_BOOL(insure,
6672 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6673     _ENABLE_INSURE=1,
6674     _ENABLE_INSURE= )
6675 if test -n "$_ENABLE_INSURE"; then
6676     MOZ_INSURE="insure"
6677     MOZ_INSURIFYING=1
6678     MOZ_INSURE_DIRS="."
6679     MOZ_INSURE_EXCLUDE_DIRS="config"
6682 MOZ_ARG_WITH_STRING(insure-dirs,
6683 [  --with-insure-dirs=DIRS
6684                           Dirs to instrument with insure ],
6685     MOZ_INSURE_DIRS=$withval )
6687 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6688 [  --with-insure-exclude-dirs=DIRS
6689                           Dirs to not instrument with insure ],
6690     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6692 dnl ========================================================
6693 dnl = Support for Quantify (Windows)
6694 dnl ========================================================
6695 MOZ_ARG_ENABLE_BOOL(quantify,
6696 [  --enable-quantify      Enable Quantify support (Windows only) ],
6697     MOZ_QUANTIFY=1,
6698     MOZ_QUANTIFY= )
6700 dnl ========================================================
6701 dnl = Support for demangling undefined symbols
6702 dnl ========================================================
6703 if test -z "$SKIP_LIBRARY_CHECKS"; then
6704     AC_LANG_SAVE
6705     AC_LANG_CPLUSPLUS
6706     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6707     AC_LANG_RESTORE
6710 # Demangle only for debug or trace-malloc builds
6711 MOZ_DEMANGLE_SYMBOLS=
6712 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6713     MOZ_DEMANGLE_SYMBOLS=1
6714     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6716 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6718 dnl ========================================================
6719 dnl = Support for gcc stack unwinding (from gcc 3.3)
6720 dnl ========================================================
6721 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6722     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6725 dnl ========================================================
6726 dnl =
6727 dnl = Misc. Options
6728 dnl = 
6729 dnl ========================================================
6730 MOZ_ARG_HEADER(Misc. Options)
6732 dnl ========================================================
6733 dnl update xterm title
6734 dnl ========================================================
6735 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6736 [  --enable-xterm-updates  Update XTERM titles with current command.],
6737     MOZ_UPDATE_XTERM=1,
6738     MOZ_UPDATE_XTERM= )
6740 dnl =========================================================
6741 dnl = Chrome format
6742 dnl =========================================================
6743 MOZ_ARG_ENABLE_STRING([chrome-format],
6744 [  --enable-chrome-format=jar|flat|both|symlink
6745                           Select FORMAT of chrome files (default=jar)],
6746     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6748 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6749     MOZ_CHROME_FILE_FORMAT=jar
6752 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6753     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6754     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6755     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6756     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6759 dnl ========================================================
6760 dnl = Define default location for MOZILLA_FIVE_HOME
6761 dnl ========================================================
6762 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6763 [  --with-default-mozilla-five-home
6764                           Set the default value for MOZILLA_FIVE_HOME],
6765 [ val=`echo $withval`
6766   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6768 dnl ========================================================
6769 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6770 dnl ========================================================
6771 MOZ_ARG_WITH_STRING(user-appdir,
6772 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6773 [ val=`echo $withval`
6774 if echo "$val" | grep "\/" >/dev/null; then
6775     AC_MSG_ERROR("Homedir must be single relative path.")
6776 else 
6777     MOZ_USER_DIR="$val"
6778 fi])
6780 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6782 dnl ========================================================
6783 dnl = Doxygen configuration
6784 dnl ========================================================
6785 dnl Use commas to specify multiple dirs to this arg
6786 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6787 MOZ_ARG_WITH_STRING(doc-input-dirs,
6788 [  --with-doc-input-dirs=DIRS
6789                           Header/idl dirs to create docs from],
6790 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6791 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6793 dnl Use commas to specify multiple dirs to this arg
6794 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6795 MOZ_ARG_WITH_STRING(doc-include-dirs,
6796 [  --with-doc-include-dirs=DIRS  
6797                           Include dirs to preprocess doc headers],
6798 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6799 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6801 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6802 MOZ_ARG_WITH_STRING(doc-output-dir,
6803 [  --with-doc-output-dir=DIR
6804                           Dir to generate docs into],
6805 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6806 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6808 if test -z "$SKIP_COMPILER_CHECKS"; then
6809 dnl ========================================================
6810 dnl =
6811 dnl = Compiler Options
6812 dnl = 
6813 dnl ========================================================
6814 MOZ_ARG_HEADER(Compiler Options)
6816 dnl ========================================================
6817 dnl Check for gcc -pipe support
6818 dnl ========================================================
6819 AC_MSG_CHECKING([for gcc -pipe support])
6820 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6821     echo '#include <stdio.h>' > dummy-hello.c
6822     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6823     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6824     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6825     if test $? = 0; then
6826         _res_as_stdin="yes"
6827     else
6828         _res_as_stdin="no"
6829     fi
6830     if test "$_res_as_stdin" = "yes"; then
6831         _SAVE_CFLAGS=$CFLAGS
6832         CFLAGS="$CFLAGS -pipe"
6833         AC_TRY_COMPILE( [ #include <stdio.h> ],
6834             [printf("Hello World\n");],
6835             [_res_gcc_pipe="yes"],
6836             [_res_gcc_pipe="no"] )
6837         CFLAGS=$_SAVE_CFLAGS
6838     fi
6839     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6840         _res="yes";
6841         CFLAGS="$CFLAGS -pipe"
6842         CXXFLAGS="$CXXFLAGS -pipe"
6843     else
6844         _res="no"
6845     fi
6846     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6847     AC_MSG_RESULT([$_res])
6848 else
6849     AC_MSG_RESULT([no])
6852 dnl pass -Wno-long-long to the compiler
6853 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6854 [  --enable-long-long-warning 
6855                           Warn about use of non-ANSI long long type],
6856     _IGNORE_LONG_LONG_WARNINGS=,
6857     _IGNORE_LONG_LONG_WARNINGS=1)
6859 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6860      _SAVE_CFLAGS="$CFLAGS"
6861      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6862      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6863      AC_TRY_COMPILE([], [return(0);], 
6864         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6865           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6866           result="yes" ], result="no")
6867      AC_MSG_RESULT([$result])
6868      CFLAGS="$_SAVE_CFLAGS"
6871 dnl ========================================================
6872 dnl Profile guided optimization
6873 dnl ========================================================
6874 dnl Test for profiling options
6875 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6876 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6878 dnl Provide a switch to disable PGO even when called via profiledbuild.
6879 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6880 [  --disable-profile-guided-optimization
6881                            Don't build with PGO even if called via make profiledbuild],
6882 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6883 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6885 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6887 _SAVE_CFLAGS="$CFLAGS"
6888 CFLAGS="$CFLAGS -fprofile-generate"
6890 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6891 AC_TRY_COMPILE([], [return 0;],
6892                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6893                  result="yes" ], result="no")
6894 AC_MSG_RESULT([$result])
6896 if test $result = "yes"; then
6897   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6898   PROFILE_USE_CFLAGS="-fprofile-use"
6899   PROFILE_USE_LDFLAGS="-fprofile-use"
6900 else
6901   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6902   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6903   AC_TRY_COMPILE([], [return 0;],
6904                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6905                    result="yes" ], result="no")
6906   AC_MSG_RESULT([$result])
6907   if test $result = "yes"; then
6908     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6909   fi
6910   # don't really care, this is an old GCC
6911   PROFILE_GEN_LDFLAGS=
6912   PROFILE_USE_LDFLAGS=
6915 CFLAGS="$_SAVE_CFLAGS"
6917 if test -n "$INTEL_CC"; then
6918   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6919   PROFILE_GEN_LDFLAGS=
6920   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6921   PROFILE_USE_LDFLAGS=
6924 dnl Sun Studio on Solaris
6925 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6926   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6927   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6928   if test "$CPU_ARCH" != "sparc"; then
6929     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6930     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6931   else
6932     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6933     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6934   fi
6937 AC_SUBST(PROFILE_GEN_CFLAGS)
6938 AC_SUBST(PROFILE_GEN_LDFLAGS)
6939 AC_SUBST(PROFILE_USE_CFLAGS)
6940 AC_SUBST(PROFILE_USE_LDFLAGS)
6942 AC_LANG_CPLUSPLUS
6944 dnl ========================================================
6945 dnl Test for -pedantic bustage
6946 dnl ========================================================
6947 MOZ_ARG_DISABLE_BOOL(pedantic,
6948 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6949 _PEDANTIC= )
6950 if test "$_PEDANTIC"; then
6951     _SAVE_CXXFLAGS=$CXXFLAGS
6952     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6953     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6954     AC_TRY_COMPILE([$configure_static_assert_macros],
6955                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6956                    result="no", result="yes" )
6957     AC_MSG_RESULT([$result])
6958     CXXFLAGS="$_SAVE_CXXFLAGS"
6960     case "$result" in
6961     no)
6962         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6963         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6964         ;;
6965     yes)
6966         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6967         ;;
6968     esac
6971 dnl ========================================================
6972 dnl Test for correct temporary object destruction order
6973 dnl ========================================================
6974 dnl We want to make sure the compiler follows the C++ spec here as 
6975 dnl xpcom and the string classes depend on it (bug 235381).
6976 AC_MSG_CHECKING([for correct temporary object destruction order])
6977 AC_TRY_RUN([ class A {
6978              public:  A(int& x) : mValue(x) {}
6979                       ~A() { mValue--; }
6980                       operator char**() { return 0; }
6981              private:  int& mValue;
6982              };
6983              void func(char **arg) {}
6984              int m=2;
6985              void test() {
6986                   func(A(m));
6987                   if (m==1) m = 0;
6988              }
6989              int main() {
6990                  test();
6991                  return(m);
6992              }
6993              ],
6994      result="yes", result="no", result="maybe")
6995 AC_MSG_RESULT([$result])
6997 if test "$result" = "no"; then
6998     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7001 dnl ========================================================
7002 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7003 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7004 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7005 dnl ========================================================
7006 _SAVE_CXXFLAGS=$CXXFLAGS
7007 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7008 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7009     ac_nscap_nonconst_opeq_bug,
7010     [AC_TRY_COMPILE([
7011                       template <class T>
7012                       class Pointer
7013                         {
7014                         public:
7015                           T* myPtr;
7016                         };
7017                       
7018                       template <class T, class U>
7019                       int operator==(const Pointer<T>& rhs, U* lhs)
7020                         {
7021                           return rhs.myPtr == lhs;
7022                         }
7023                       
7024                       template <class T, class U>
7025                       int operator==(const Pointer<T>& rhs, const U* lhs)
7026                         {
7027                           return rhs.myPtr == lhs;
7028                         }
7029                     ],
7030                     [
7031                       Pointer<int> foo;
7032                       const int* bar;
7033                       return foo == bar;
7034                     ],
7035                     ac_nscap_nonconst_opeq_bug="no",
7036                     ac_nscap_nonconst_opeq_bug="yes")])
7037 CXXFLAGS="$_SAVE_CXXFLAGS"
7039 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7040     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7042 fi # SKIP_COMPILER_CHECKS
7044 dnl ========================================================
7045 dnl C++ rtti
7046 dnl Should be smarter and check that the compiler does indeed have rtti
7047 dnl ========================================================
7048 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7049 [  --enable-cpp-rtti       Enable C++ RTTI ],
7050 [ _MOZ_USE_RTTI=1 ],
7051 [ _MOZ_USE_RTTI= ])
7053 if test "$_MOZ_USE_RTTI"; then
7054    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7055 else
7056    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7059 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7061 dnl ========================================================
7062 dnl C++ exceptions (g++/egcs only - for now)
7063 dnl Should be smarter and check that the compiler does indeed have exceptions
7064 dnl ========================================================
7065 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7066 [  --enable-cpp-exceptions Enable C++ exceptions ],
7067 [ _MOZ_CPP_EXCEPTIONS=1 ],
7068 [ _MOZ_CPP_EXCEPTIONS= ])
7070 if test "$_MOZ_CPP_EXCEPTIONS"; then
7071     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7072 else
7073     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7076 # Irix & OSF native compilers do not like exception declarations 
7077 # when exceptions are disabled
7078 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7079     AC_DEFINE(CPP_THROW_NEW, [])
7080 else
7081     AC_DEFINE(CPP_THROW_NEW, [throw()])
7083 AC_LANG_C
7085 dnl ========================================================
7086 dnl =
7087 dnl = Build depencency options
7088 dnl =
7089 dnl ========================================================
7090 MOZ_ARG_HEADER(Build dependencies)
7092 dnl ========================================================
7093 dnl = Do not auto generate dependency info
7094 dnl ========================================================
7095 MOZ_AUTO_DEPS=1
7096 MOZ_ARG_DISABLE_BOOL(auto-deps,
7097 [  --disable-auto-deps     Do not automatically generate dependency info],
7098     MOZ_AUTO_DEPS=,
7099     MOZ_AUTO_DEPS=1)
7101 if test -n "$MOZ_AUTO_DEPS"; then
7102 dnl ========================================================
7103 dnl = Use mkdepend instead of $CC -MD for dependency generation
7104 dnl ========================================================
7105 _cpp_md_flag=
7106 MOZ_ARG_DISABLE_BOOL(md,
7107 [  --disable-md            Do not use compiler-based dependencies ],
7108   [_cpp_md_flag=],
7109   [_cpp_md_flag=1],
7110   [dnl Default is to turn on -MD if using GNU-compatible compilers
7111    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7112      _cpp_md_flag=1
7113    fi
7114   dnl Default is to use -xM if using Sun Studio on Solaris
7115    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7116      _cpp_md_flag=1
7117    fi])
7118 if test "$_cpp_md_flag"; then
7119   COMPILER_DEPEND=1
7120   if test "$OS_ARCH" = "OpenVMS"; then
7121     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
7122   else
7123     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
7124   fi
7125   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7126   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7127     _DEPEND_CFLAGS=
7128   fi
7129 else
7130   COMPILER_DEPEND=
7131   _USE_CPP_INCLUDE_FLAG=
7132   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7133   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7135 fi # MOZ_AUTO_DEPS
7136 MDDEPDIR='.deps'
7137 AC_SUBST(MOZ_AUTO_DEPS)
7138 AC_SUBST(COMPILER_DEPEND)
7139 AC_SUBST(MDDEPDIR)
7142 dnl ========================================================
7143 dnl =
7144 dnl = Static Build Options
7145 dnl =
7146 dnl ========================================================
7147 MOZ_ARG_HEADER(Static build options)
7149 MOZ_ARG_ENABLE_BOOL(static,
7150 [  --enable-static         Enable building of internal static libs],
7151     BUILD_STATIC_LIBS=1,
7152     BUILD_STATIC_LIBS=)
7154 dnl Disable libxul in debug builds, but not for xulrunner.
7155 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7156    MOZ_ENABLE_LIBXUL=
7159 MOZ_ARG_ENABLE_BOOL(libxul,
7160 [  --enable-libxul         Enable building of libxul],
7161     MOZ_ENABLE_LIBXUL=1,
7162     MOZ_ENABLE_LIBXUL=)
7164 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7165         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7168 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7169         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7172 if test -n "$MOZ_ENABLE_LIBXUL"; then
7173     XPCOM_LIBS="$LIBXUL_LIBS"
7174     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7175 else
7176     if test -n "$BUILD_STATIC_LIBS"; then
7177         AC_DEFINE(MOZ_STATIC_BUILD)
7178     fi
7179     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7182 dnl ========================================================
7183 dnl = Force JS to be a static lib
7184 dnl ========================================================
7185 MOZ_ARG_ENABLE_BOOL(js-static-build,
7186 [  --enable-js-static-build  Force js to be a static lib],
7187     JS_STATIC_BUILD=1,
7188     JS_STATIC_BUILD= )
7190 AC_SUBST(JS_STATIC_BUILD)
7191         
7192 if test -n "$JS_STATIC_BUILD"; then
7193     AC_DEFINE(EXPORT_JS_API)
7195 if test -z "$BUILD_STATIC_LIBS"; then
7196     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7201 dnl ========================================================
7202 dnl =
7203 dnl = Standalone module options
7204 dnl = 
7205 dnl ========================================================
7206 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7208 dnl Check for GLib and libIDL.
7209 dnl ========================================================
7210 case "$target_os" in
7211 msvc*|mks*|cygwin*|mingw*|wince*)
7212     SKIP_IDL_CHECK="yes"
7213     ;;
7215     SKIP_IDL_CHECK="no"
7216     ;;
7217 esac
7219 if test -z "$COMPILE_ENVIRONMENT"; then
7220     SKIP_IDL_CHECK="yes"
7223 dnl = Allow users to disable libIDL checking for standalone modules
7224 MOZ_ARG_WITHOUT_BOOL(libIDL,
7225 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7226         SKIP_IDL_CHECK="yes")
7228 if test "$SKIP_IDL_CHECK" = "no"
7229 then
7230     _LIBIDL_FOUND=
7231     if test "$MACOS_SDK_DIR"; then 
7232       dnl xpidl, and therefore libIDL, is only needed on the build host.
7233       dnl Don't build it against the SDK, as that causes problems.
7234       _MACSAVE_CFLAGS="$CFLAGS"
7235       _MACSAVE_LIBS="$LIBS"
7236       _MACSAVE_LDFLAGS="$LDFLAGS"
7237       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7238       changequote(,)
7239       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"`
7240       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7241       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7242       changequote([,])
7243       unset NEXT_ROOT
7244     fi
7246     if test "$MOZ_ENABLE_GTK2"; then
7247         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7248     fi
7249     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7250     dnl to either libIDL1 or libIDL2.
7251     if test -z "$_LIBIDL_FOUND"; then
7252         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7253         if test -z "$_LIBIDL_FOUND"; then
7254             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7255         fi
7256     fi
7257     dnl
7258     dnl If we don't have a libIDL config program & not cross-compiling, 
7259     dnl     look for orbit-config instead.
7260     dnl
7261     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7262         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7263         if test -n "$ORBIT_CONFIG"; then
7264             AC_MSG_CHECKING([for ORBit libIDL usability])
7265                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7266             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7267             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7268             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7269             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7270             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7271             LIBIDL_CONFIG=
7272             _SAVE_CFLAGS="$CFLAGS"
7273             _SAVE_LIBS="$LIBS"
7274             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7275             LIBS="$LIBIDL_LIBS $LIBS"
7276             AC_TRY_RUN([
7277 #include <stdlib.h>
7278 #include <libIDL/IDL.h>
7279 int main() {
7280   char *s;
7281   s=strdup(IDL_get_libver_string());
7282   if(s==NULL) {
7283     exit(1);
7284   }
7285   exit(0);
7287             ], [_LIBIDL_FOUND=1
7288                 result="yes"],
7289                [LIBIDL_CFLAGS=
7290                 LIBIDL_LIBS=
7291                 result="no"],
7292                [_LIBIDL_FOUND=1
7293                 result="maybe"] )
7294             AC_MSG_RESULT($result)
7295             CFLAGS="$_SAVE_CFLAGS"
7296             LIBS="$_SAVE_LIBS"
7297         fi
7298     fi
7299     if test -z "$_LIBIDL_FOUND"; then
7300         AC_MSG_ERROR([libIDL not found.
7301         libIDL $LIBIDL_VERSION or higher is required.])
7302     fi
7303     if test "$MACOS_SDK_DIR"; then
7304       CFLAGS="$_MACSAVE_CFLAGS"
7305       LIBS="$_MACSAVE_LIBS"
7306       LDFLAGS="$_MACSAVE_LDFLAGS"
7307       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7308         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7309       fi
7310     fi
7313 if test -n "$CROSS_COMPILE"; then
7314      if test -z "$HOST_LIBIDL_CONFIG"; then
7315         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7316     fi
7317     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7318         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7319         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7320     else
7321         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7322         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7323     fi
7326 if test -z "$SKIP_PATH_CHECKS"; then
7327 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7328     if test "$MOZ_ENABLE_GTK2"; then
7329         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7330     else
7331         AM_PATH_GLIB(${GLIB_VERSION})
7332     fi
7336 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7337     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7340 AC_SUBST(LIBIDL_CFLAGS)
7341 AC_SUBST(LIBIDL_LIBS)
7342 AC_SUBST(STATIC_LIBIDL)
7343 AC_SUBST(GLIB_CFLAGS)
7344 AC_SUBST(GLIB_LIBS)
7345 AC_SUBST(GLIB_GMODULE_LIBS)
7346 AC_SUBST(HOST_LIBIDL_CONFIG)
7347 AC_SUBST(HOST_LIBIDL_CFLAGS)
7348 AC_SUBST(HOST_LIBIDL_LIBS)
7350 dnl ========================================================
7351 dnl Check for libart
7352 dnl ========================================================
7353 if test "$MOZ_SVG_RENDERER_LIBART"; then
7354   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7355     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7356 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7357   fi
7359   dnl libart's configure hasn't been run yet, but we know what the
7360   dnl answer should be anyway
7361   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7362   case "$target_os" in
7363   msvc*|mks*|cygwin*|mingw*|wince*)
7364       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7365       ;;
7366   os2*)
7367       MOZ_LIBART_LIBS='-lmoz_art -lm'
7368       ;;
7369   beos*)
7370       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7371       ;;
7372   *)
7373       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7374       ;;
7375   esac
7376   AC_FUNC_ALLOCA
7379 AC_SUBST(MOZ_LIBART_CFLAGS)
7380 AC_SUBST(MOZ_LIBART_LIBS)
7382 dnl ========================================================
7383 dnl Check for cairo
7384 dnl ========================================================
7385 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7387 MOZ_TREE_CAIRO=1
7388 MOZ_ARG_ENABLE_BOOL(system-cairo,
7389 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7390 MOZ_TREE_CAIRO=,
7391 MOZ_TREE_CAIRO=1 )
7393 # Check for headers defining standard int types.
7394 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7396 if test "$MOZ_TREE_CAIRO"; then
7397     AC_DEFINE(MOZ_TREE_CAIRO)
7399     # For now we assume that we will have a uint64_t available through
7400     # one of the above headers or mozstdint.h.
7401     AC_DEFINE(HAVE_UINT64_T)
7403     # Define macros for cairo-features.h
7404     if test "$MOZ_X11"; then
7405         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7406         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7407         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7408         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7409         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7410         MOZ_ENABLE_CAIRO_FT=1
7411         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7412     fi
7413     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7414         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7415     fi
7416     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7417         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7418         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7419         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7420     fi
7421     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7422         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7423         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7424         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7425     fi
7426     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7427         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7428         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7429         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7430         MOZ_ENABLE_CAIRO_FT=1
7431         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7432         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7433     fi
7434     if test "$MOZ_ENABLE_GLITZ"; then
7435         GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
7436     fi
7437     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7438         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7439         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7440         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7441         MOZ_ENABLE_CAIRO_FT=1
7442     fi
7443     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7444     AC_SUBST(CAIRO_FT_CFLAGS)
7446     if test "$MOZ_DEBUG"; then
7447       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7448     else
7449       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7450     fi
7452     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7454     AC_SUBST(PS_SURFACE_FEATURE)
7455     AC_SUBST(PDF_SURFACE_FEATURE)
7456     AC_SUBST(SVG_SURFACE_FEATURE)
7457     AC_SUBST(XLIB_SURFACE_FEATURE)
7458     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7459     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7460     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7461     AC_SUBST(XCB_SURFACE_FEATURE)
7462     AC_SUBST(WIN32_SURFACE_FEATURE)
7463     AC_SUBST(OS2_SURFACE_FEATURE)
7464     AC_SUBST(BEOS_SURFACE_FEATURE)
7465     AC_SUBST(GLITZ_SURFACE_FEATURE)
7466     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7467     AC_SUBST(FT_FONT_FEATURE)
7468     AC_SUBST(WIN32_FONT_FEATURE)
7469     AC_SUBST(QUARTZ_FONT_FEATURE)
7470     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7471     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7473     if test "$_WIN32_MSVC"; then
7474         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7475         if test "$MOZ_ENABLE_GLITZ"; then
7476             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
7477         fi
7478     else
7479         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"
7481         if test "$MOZ_X11"; then
7482             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7483         fi
7485         if test "$MOZ_ENABLE_GLITZ"; then
7486             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
7487             if test "$MOZ_X11"; then
7488                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
7489             fi
7490             if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7491                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
7492             fi
7493         fi
7494     fi
7496     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7497     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7499 else
7500    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7501    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7502    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7503    if test "$MOZ_X11"; then
7504         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7505         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7506         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7507    fi
7510 AC_SUBST(MOZ_TREE_CAIRO)
7511 AC_SUBST(MOZ_CAIRO_CFLAGS)
7512 AC_SUBST(MOZ_CAIRO_LIBS)
7514 dnl ========================================================
7515 dnl Check for lcms
7516 dnl ========================================================
7518 MOZ_NATIVE_LCMS=
7519 MOZ_ARG_ENABLE_BOOL(system-lcms,
7520 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7521 MOZ_NATIVE_LCMS=1,
7522 MOZ_NATIVE_LCMS= )
7524 if test -z "$MOZ_NATIVE_LCMS"
7525 then
7526     LCMS_CFLAGS=
7527     if test "$_WIN32_MSVC"; then
7528         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7529             LCMS_CFLAGS=-DLCMS_DLL
7530         fi
7531         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7532     else
7533         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7534     fi
7535 else
7536     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7539 AC_SUBST(MOZ_NATIVE_LCMS)
7540 AC_SUBST(LCMS_CFLAGS)
7541 AC_SUBST(LCMS_LIBS)
7543 dnl ========================================================
7544 dnl disable xul
7545 dnl ========================================================
7546 MOZ_ARG_DISABLE_BOOL(xul,
7547 [  --disable-xul           Disable XUL],
7548     MOZ_XUL= )
7549 if test "$MOZ_XUL"; then
7550   AC_DEFINE(MOZ_XUL)
7551 else
7552   dnl remove extensions that require XUL
7553   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7556 AC_SUBST(MOZ_XUL)
7558 dnl ========================================================
7559 dnl Two ways to enable Python support:
7560 dnl   --enable-extensions=python # select all available.
7561 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7562 dnl or:
7563 dnl   --enable-extensions=python/xpcom,... # select individual ones
7565 dnl If either is used, we locate the Python to use.
7566 dnl ========================================================
7568 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7569 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7570     dnl Allow PYTHON to point to the Python interpreter to use
7571     dnl (note that it must be the python executable - which we
7572     dnl run to locate the relevant paths etc)
7573     dnl If not set, we use whatever Python we can find.
7574     MOZ_PYTHON=$PYTHON
7575     dnl Ask Python what its version number is
7576     changequote(,)
7577     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7578     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7579     changequote([,])
7580     dnl Ask for the Python "prefix" (ie, home/source dir)
7581     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7582     dnl Setup the include and library directories.
7583     if test "$OS_ARCH" = "WINNT"; then
7584         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7585         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7586         dnl Binary trees have "include" for .h, and "libs" for .lib
7587         dnl We add 'em both - along with quotes, to handle spaces.
7588         MOZ_PYTHON_DLL_SUFFIX=.pyd
7589         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7590         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7591     else
7592         dnl Non-Windows include and libs
7593         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7594         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7595         dnl Check for dynamic Python lib
7596         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7597         dnl - core, xpcom loader, pydom etc) all need to share Python.
7598         dnl - Python 2.3's std --enable-shared configure option will
7599         dnl   create a libpython2.3.so.1.0. We should first try this
7600         dnl   dotted versioned .so file because this is the one that
7601         dnl   the PyXPCOM build mechanics tries to link to.
7602         dnl   XXX Should find a better way than hardcoding "1.0".
7603         dnl - Python developement tree dir layouts are NOT allowed here
7604         dnl   because the PyXPCOM build just dies on it later anyway.
7605         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7606         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7607             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7608         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7609             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7610         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7611             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7612         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7613             dnl Don't Python development tree directory layout.
7614             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7615             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.])
7616         elif test "$OS_ARCH" = "Darwin"; then
7617             dnl We do Darwin last, so if a custom non-framework build of
7618             dnl python is used on OSX, then it will be picked up first by
7619             dnl the logic above.
7620             MOZ_PYTHON_LIBS="-framework Python"
7621         else
7622             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7623         fi
7624         if test "$OS_ARCH" = "Linux"; then
7625             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7626         fi
7627     fi
7628     dnl Handle "_d" on Windows
7629     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7630         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7631     else
7632         MOZ_PYTHON_DEBUG_SUFFIX=
7633     fi
7634     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7637 dnl If the user asks for the 'python' extension, then we add
7638 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7639 dnl Note the careful regex - it must match 'python' followed by anything
7640 dnl other than a '/', including the end-of-string.
7641 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7642     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7643         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7644     done
7646 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7647 dnl command-line, but not yet
7648 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7649 AC_SUBST(MOZ_PYTHON)
7650 AC_SUBST(MOZ_PYTHON_PREFIX)
7651 AC_SUBST(MOZ_PYTHON_INCLUDES)
7652 AC_SUBST(MOZ_PYTHON_LIBS)
7653 AC_SUBST(MOZ_PYTHON_VER)
7654 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7655 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7656 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7658 dnl ========================================================
7659 dnl disable profile sharing
7660 dnl ========================================================
7661 MOZ_ARG_DISABLE_BOOL(profilesharing,
7662 [  --disable-profilesharing           Disable profile sharing],
7663     MOZ_PROFILESHARING=,
7664     MOZ_PROFILESHARING=1 )
7665 if test "$MOZ_PROFILESHARING"; then
7666   MOZ_IPCD=1
7667   AC_DEFINE(MOZ_PROFILESHARING)
7670 dnl ========================================================
7671 dnl enable ipc/ipcd
7672 dnl ========================================================
7673 MOZ_ARG_ENABLE_BOOL(ipcd,
7674 [  --enable-ipcd                      Enable IPC daemon],
7675     MOZ_IPCD=1,
7676     MOZ_IPCD= )
7678 dnl ========================================================
7679 dnl disable profile locking
7680 dnl   do no use this in applications that can have more than
7681 dnl   one process accessing the profile directory.
7682 dnl ========================================================
7683 MOZ_ARG_DISABLE_BOOL(profilelocking,
7684 [  --disable-profilelocking           Disable profile locking],
7685     MOZ_PROFILELOCKING=,
7686     MOZ_PROFILELOCKING=1 )
7687 if test "$MOZ_PROFILELOCKING"; then
7688   AC_DEFINE(MOZ_PROFILELOCKING)
7691 dnl ========================================================
7692 dnl disable rdf services
7693 dnl ========================================================
7694 MOZ_ARG_DISABLE_BOOL(rdf,
7695 [  --disable-rdf           Disable RDF],
7696     MOZ_RDF= )
7697 if test "$MOZ_RDF"; then
7698   AC_DEFINE(MOZ_RDF)
7701 AC_SUBST(MOZ_RDF)
7703 dnl ========================================================
7704 dnl necko configuration options
7705 dnl ========================================================
7708 dnl option to disable various necko protocols
7710 MOZ_ARG_ENABLE_STRING(necko-protocols,
7711 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7712                           Enable/disable specific protocol handlers],
7713 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7714     if test "$option" = "yes" || test "$option" = "all"; then
7715         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7716     elif test "$option" = "no" || test "$option" = "none"; then
7717         NECKO_PROTOCOLS=""
7718     elif test "$option" = "default"; then
7719         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7720     elif test `echo "$option" | grep -c \^-` != 0; then
7721         option=`echo $option | sed 's/^-//'`
7722         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7723     else
7724         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7725     fi
7726 done],
7727     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7728 dnl Remove dupes
7729 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7730 AC_SUBST(NECKO_PROTOCOLS)
7731 for p in $NECKO_PROTOCOLS; do
7732     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7733 done
7736 dnl option to disable necko's disk cache
7738 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7739 [  --disable-necko-disk-cache
7740                           Disable necko disk cache],
7741     NECKO_DISK_CACHE=,
7742     NECKO_DISK_CACHE=1)
7743 AC_SUBST(NECKO_DISK_CACHE)
7744 if test "$NECKO_DISK_CACHE"; then
7745     AC_DEFINE(NECKO_DISK_CACHE)
7749 dnl option to minimize size of necko's i/o buffers
7751 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7752 [  --enable-necko-small-buffers
7753                           Minimize size of necko's i/o buffers],
7754     NECKO_SMALL_BUFFERS=1,
7755     NECKO_SMALL_BUFFERS=)
7756 AC_SUBST(NECKO_SMALL_BUFFERS)
7757 if test "$NECKO_SMALL_BUFFERS"; then
7758     AC_DEFINE(NECKO_SMALL_BUFFERS)
7759 fi 
7762 dnl option to disable cookies
7764 MOZ_ARG_DISABLE_BOOL(cookies,
7765 [  --disable-cookies       Disable cookie support],
7766     NECKO_COOKIES=,
7767     NECKO_COOKIES=1)
7768 AC_SUBST(NECKO_COOKIES)
7769 if test "$NECKO_COOKIES"; then
7770     AC_DEFINE(NECKO_COOKIES)
7773 dnl NECKO_ configuration options are not global
7774 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7776 dnl ========================================================
7777 dnl string api compatibility
7778 dnl ========================================================
7779 MOZ_ARG_DISABLE_BOOL(v1-string-abi,
7780 [  --disable-v1-string-abi   Disable binary compatibility layer for strings],
7781     MOZ_V1_STRING_ABI=,
7782     MOZ_V1_STRING_ABI=1)
7783 AC_SUBST(MOZ_V1_STRING_ABI)
7784 if test "$MOZ_V1_STRING_ABI"; then
7785     AC_DEFINE(MOZ_V1_STRING_ABI)
7788 dnl Only build Mork if it's required
7789 AC_SUBST(MOZ_MORK)
7790 if test "$MOZ_MORK"; then
7791   AC_DEFINE(MOZ_MORK)
7794 dnl Build the lightweight Mork reader if required
7795 AC_SUBST(MOZ_MORKREADER)
7796 if test "$MOZ_MORKREADER"; then
7797   AC_DEFINE(MOZ_MORKREADER)
7800 dnl ========================================================
7801 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7802     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7805 dnl ========================================================
7806 dnl =
7807 dnl = Maintainer debug option (no --enable equivalent)
7808 dnl =
7809 dnl ========================================================
7811 AC_SUBST(AR)
7812 AC_SUBST(AR_FLAGS)
7813 AC_SUBST(AR_LIST)
7814 AC_SUBST(AR_EXTRACT)
7815 AC_SUBST(AR_DELETE)
7816 AC_SUBST(AS)
7817 AC_SUBST(ASFLAGS)
7818 AC_SUBST(AS_DASH_C_FLAG)
7819 AC_SUBST(LD)
7820 AC_SUBST(RC)
7821 AC_SUBST(RCFLAGS)
7822 AC_SUBST(WINDRES)
7823 AC_SUBST(USE_SHORT_LIBNAME)
7824 AC_SUBST(IMPLIB)
7825 AC_SUBST(FILTER)
7826 AC_SUBST(BIN_FLAGS)
7827 AC_SUBST(NS_USE_NATIVE)
7828 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7829 AC_SUBST(MOZ_GFX_TOOLKIT)
7830 AC_SUBST(MOZ_UPDATE_XTERM)
7831 AC_SUBST(MINIMO)
7832 AC_SUBST(NS_HILDON)
7833 AC_SUBST(NS_OSSO)
7834 AC_SUBST(MOZ_AUTH_EXTENSION)
7835 AC_SUBST(MOZ_MATHML)
7836 AC_SUBST(MOZ_PERMISSIONS)
7837 AC_SUBST(MOZ_XTF)
7838 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7839 AC_SUBST(MOZ_PREF_EXTENSIONS)
7840 AC_SUBST(MOZ_SVG)
7841 AC_SUBST(MOZ_XSLT_STANDALONE)
7842 AC_SUBST(MOZ_JS_LIBS)
7843 AC_SUBST(MOZ_PSM)
7844 AC_SUBST(MOZ_DEBUG)
7845 AC_SUBST(MOZ_DEBUG_MODULES)
7846 AC_SUBST(MOZ_PROFILE_MODULES)
7847 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7848 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7849 AC_SUBST(MOZ_DEBUG_FLAGS)
7850 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7851 AC_SUBST(WARNINGS_AS_ERRORS)
7852 AC_SUBST(MOZ_DBGRINFO_MODULES)
7853 AC_SUBST(MOZ_EXTENSIONS)
7854 AC_SUBST(MOZ_IMG_DECODERS)
7855 AC_SUBST(MOZ_IMG_ENCODERS)
7856 AC_SUBST(MOZ_JSDEBUGGER)
7857 AC_SUBST(MOZ_OJI)
7858 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7859 AC_SUBST(MOZ_PLUGINS)
7860 AC_SUBST(ENABLE_EAZEL_PROFILER)
7861 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7862 AC_SUBST(EAZEL_PROFILER_LIBS)
7863 AC_SUBST(MOZ_PERF_METRICS)
7864 AC_SUBST(GC_LEAK_DETECTOR)
7865 AC_SUBST(MOZ_LOG_REFCNT)
7866 AC_SUBST(MOZ_LEAKY)
7867 AC_SUBST(MOZ_JPROF)
7868 AC_SUBST(MOZ_SHARK)
7869 AC_SUBST(MOZ_CALLGRIND)
7870 AC_SUBST(MOZ_VTUNE)
7871 AC_SUBST(MOZ_XPCTOOLS)
7872 AC_SUBST(MOZ_JSLOADER)
7873 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7874 AC_SUBST(MOZ_INSURE)
7875 AC_SUBST(MOZ_INSURE_DIRS)
7876 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7877 AC_SUBST(MOZ_QUANTIFY)
7878 AC_SUBST(MOZ_INSURIFYING)
7879 AC_SUBST(LIBICONV)
7880 AC_SUBST(MOZ_PLACES)
7881 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7882 AC_SUBST(MOZ_STORAGE)
7883 AC_SUBST(MOZ_FEEDS)
7884 AC_SUBST(NS_PRINTING)
7886 AC_SUBST(MOZ_JAVAXPCOM)
7887 AC_SUBST(JAVA_INCLUDE_PATH)
7888 AC_SUBST(JAVA)
7889 AC_SUBST(JAVAC)
7890 AC_SUBST(JAR)
7892 AC_SUBST(MOZ_PROFILESHARING)
7893 AC_SUBST(MOZ_PROFILELOCKING)
7895 AC_SUBST(MOZ_IPCD)
7897 AC_SUBST(HAVE_XIE)
7898 AC_SUBST(MOZ_XIE_LIBS)
7899 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7901 AC_SUBST(XPCOM_USE_LEA)
7902 AC_SUBST(BUILD_STATIC_LIBS)
7903 AC_SUBST(MOZ_ENABLE_LIBXUL)
7904 AC_SUBST(ENABLE_TESTS)
7905 AC_SUBST(IBMBIDI)
7906 AC_SUBST(MOZ_UNIVERSALCHARDET)
7907 AC_SUBST(ACCESSIBILITY)
7908 AC_SUBST(MOZ_XPINSTALL)
7909 AC_SUBST(MOZ_VIEW_SOURCE)
7910 AC_SUBST(MOZ_SPELLCHECK)
7911 AC_SUBST(MOZ_XPFE_COMPONENTS)
7912 AC_SUBST(MOZ_USER_DIR)
7913 AC_SUBST(MOZ_CRASHREPORTER)
7914 AC_SUBST(MOZ_MOCHITEST)
7916 AC_SUBST(ENABLE_STRIP)
7917 AC_SUBST(PKG_SKIP_STRIP)
7918 AC_SUBST(USE_ELF_DYNSTR_GC)
7919 AC_SUBST(USE_PREBINDING)
7920 AC_SUBST(INCREMENTAL_LINKER)
7921 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7922 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7923 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7925 AC_SUBST(MOZ_FIX_LINK_PATHS)
7926 AC_SUBST(XPCOM_LIBS)
7927 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7928 AC_SUBST(XPCOM_GLUE_LDOPTS)
7929 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7931 AC_SUBST(USE_DEPENDENT_LIBS)
7933 AC_SUBST(MOZ_BUILD_ROOT)
7934 AC_SUBST(MOZ_OS2_TOOLS)
7935 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7937 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7938 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7939 AC_SUBST(MOZ_TIMELINE)
7940 AC_SUBST(WINCE)
7941 AC_SUBST(TARGET_DEVICE)
7943 AC_SUBST(MOZ_APP_NAME)
7944 AC_SUBST(MOZ_APP_DISPLAYNAME)
7945 AC_SUBST(MOZ_APP_VERSION)
7946 AC_SUBST(FIREFOX_VERSION)
7948 AC_SUBST(MOZ_PKG_SPECIAL)
7950 AC_SUBST(MOZILLA_OFFICIAL)
7951 AC_SUBST(BUILD_OFFICIAL)
7952 AC_SUBST(MOZ_MILESTONE_RELEASE)
7954 dnl win32 options
7955 AC_SUBST(MOZ_PROFILE)
7956 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7957 AC_SUBST(MOZ_MAPINFO)
7958 AC_SUBST(MOZ_BROWSE_INFO)
7959 AC_SUBST(MOZ_TOOLS_DIR)
7960 AC_SUBST(CYGWIN_WRAPPER)
7961 AC_SUBST(AS_PERL)
7962 AC_SUBST(WIN32_REDIST_DIR)
7963 AC_SUBST(PYTHON)
7965 dnl Echo the CFLAGS to remove extra whitespace.
7966 CFLAGS=`echo \
7967         $_WARNINGS_CFLAGS \
7968         $CFLAGS`
7970 CXXFLAGS=`echo \
7971         $_MOZ_RTTI_FLAGS \
7972         $_MOZ_EXCEPTIONS_FLAGS \
7973         $_WARNINGS_CXXFLAGS \
7974         $CXXFLAGS`
7976 COMPILE_CFLAGS=`echo \
7977     $_DEFINES_CFLAGS \
7978         $_DEPEND_CFLAGS \
7979     $COMPILE_CFLAGS`
7981 COMPILE_CXXFLAGS=`echo \
7982     $_DEFINES_CXXFLAGS \
7983         $_DEPEND_CFLAGS \
7984     $COMPILE_CXXFLAGS`
7986 AC_SUBST(SYSTEM_MAKEDEPEND)
7987 AC_SUBST(SYSTEM_JPEG)
7988 AC_SUBST(SYSTEM_PNG)
7989 AC_SUBST(SYSTEM_ZLIB)
7990 AC_SUBST(SYSTEM_BZ2)
7992 AC_SUBST(JPEG_CFLAGS)
7993 AC_SUBST(JPEG_LIBS)
7994 AC_SUBST(ZLIB_CFLAGS)
7995 AC_SUBST(ZLIB_LIBS)
7996 AC_SUBST(BZ2_CFLAGS)
7997 AC_SUBST(BZ2_LIBS)
7998 AC_SUBST(PNG_CFLAGS)
7999 AC_SUBST(PNG_LIBS)
8001 AC_SUBST(MOZ_JPEG_CFLAGS)
8002 AC_SUBST(MOZ_JPEG_LIBS)
8003 AC_SUBST(MOZ_ZLIB_CFLAGS)
8004 AC_SUBST(MOZ_ZLIB_LIBS)
8005 AC_SUBST(MOZ_BZ2_CFLAGS)
8006 AC_SUBST(MOZ_BZ2_LIBS)
8007 AC_SUBST(MOZ_PNG_CFLAGS)
8008 AC_SUBST(MOZ_PNG_LIBS)
8010 AC_SUBST(NSPR_CFLAGS)
8011 AC_SUBST(NSPR_LIBS)
8012 AC_SUBST(MOZ_NATIVE_NSPR)
8014 AC_SUBST(NSS_CFLAGS)
8015 AC_SUBST(NSS_LIBS)
8016 AC_SUBST(NSS_DEP_LIBS)
8017 AC_SUBST(MOZ_NATIVE_NSS)
8019 AC_SUBST(CFLAGS)
8020 AC_SUBST(CXXFLAGS)
8021 AC_SUBST(CPPFLAGS)
8022 AC_SUBST(COMPILE_CFLAGS)
8023 AC_SUBST(COMPILE_CXXFLAGS)
8024 AC_SUBST(LDFLAGS)
8025 AC_SUBST(LIBS)
8026 AC_SUBST(CROSS_COMPILE)
8028 AC_SUBST(HOST_CC)
8029 AC_SUBST(HOST_CXX)
8030 AC_SUBST(HOST_CFLAGS)
8031 AC_SUBST(HOST_CXXFLAGS)
8032 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8033 AC_SUBST(HOST_AR)
8034 AC_SUBST(HOST_AR_FLAGS)
8035 AC_SUBST(HOST_LD)
8036 AC_SUBST(HOST_RANLIB)
8037 AC_SUBST(HOST_NSPR_MDCPUCFG)
8038 AC_SUBST(HOST_BIN_SUFFIX)
8039 AC_SUBST(HOST_OS_ARCH)
8041 AC_SUBST(TARGET_CPU)
8042 AC_SUBST(TARGET_VENDOR)
8043 AC_SUBST(TARGET_OS)
8044 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8045 AC_SUBST(TARGET_MD_ARCH)
8046 AC_SUBST(TARGET_XPCOM_ABI)
8047 AC_SUBST(OS_TARGET)
8048 AC_SUBST(OS_ARCH)
8049 AC_SUBST(OS_RELEASE)
8050 AC_SUBST(OS_TEST)
8052 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8053 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8055 AC_SUBST(WRAP_MALLOC_CFLAGS)
8056 AC_SUBST(WRAP_MALLOC_LIB)
8057 AC_SUBST(MKSHLIB)
8058 AC_SUBST(MKCSHLIB)
8059 AC_SUBST(MKSHLIB_FORCE_ALL)
8060 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8061 AC_SUBST(DSO_CFLAGS)
8062 AC_SUBST(DSO_PIC_CFLAGS)
8063 AC_SUBST(DSO_LDOPTS)
8064 AC_SUBST(LIB_PREFIX)
8065 AC_SUBST(DLL_PREFIX)
8066 AC_SUBST(DLL_SUFFIX)
8067 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8068 AC_SUBST(LIB_SUFFIX)
8069 AC_SUBST(OBJ_SUFFIX)
8070 AC_SUBST(BIN_SUFFIX)
8071 AC_SUBST(ASM_SUFFIX)
8072 AC_SUBST(IMPORT_LIB_SUFFIX)
8073 AC_SUBST(USE_N32)
8074 AC_SUBST(CC_VERSION)
8075 AC_SUBST(CXX_VERSION)
8076 AC_SUBST(MSMANIFEST_TOOL)
8078 if test "$USING_HCC"; then
8079    CC='${topsrcdir}/build/hcc'
8080    CC="$CC '$_OLDCC'"
8081    CXX='${topsrcdir}/build/hcpp'
8082    CXX="$CXX '$_OLDCXX'"
8083    AC_SUBST(CC)
8084    AC_SUBST(CXX)
8087 dnl Check for missing components
8088 if test "$COMPILE_ENVIRONMENT"; then
8089 if test "$MOZ_X11"; then
8090     dnl ====================================================
8091     dnl = Check if X headers exist
8092     dnl ====================================================
8093     _SAVE_CFLAGS=$CFLAGS
8094     CFLAGS="$CFLAGS $XCFLAGS"
8095     AC_TRY_COMPILE([
8096         #include <stdio.h>
8097         #include <stdlib.h>
8098         #include <X11/Xlib.h>
8099         #include <X11/Intrinsic.h>
8100     ],
8101     [
8102         Display *dpy = 0;
8103         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8104             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8105             exit(1);
8106         }
8107     ], [], 
8108     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8109     CFLAGS="$_SAVE_CFLAGS"
8111     if test ! -z "$MISSING_X"; then
8112         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8113     fi
8115 fi # MOZ_X11
8116 fi # COMPILE_ENVIRONMENT
8118 dnl Set various defines and substitutions
8119 dnl ========================================================
8121 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
8122       LIBS='so32dll.lib tcp32dll.lib'
8123 elif test "$OS_ARCH" = "BeOS"; then
8124   AC_DEFINE(XP_BEOS)
8125   MOZ_MOVEMAIL=1
8126 elif test "$OS_ARCH" = "Darwin"; then
8127   AC_DEFINE(XP_UNIX)
8128   AC_DEFINE(UNIX_ASYNC_DNS)
8129   MOZ_MOVEMAIL=1
8130 elif test "$OS_ARCH" = "OpenVMS"; then
8131   AC_DEFINE(XP_UNIX)
8132 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8133   AC_DEFINE(XP_UNIX)
8134   AC_DEFINE(UNIX_ASYNC_DNS)
8135   MOZ_MOVEMAIL=1
8137 AC_SUBST(MOZ_MOVEMAIL)
8139 AC_DEFINE(JS_THREADSAFE)
8141 if test "$MOZ_DEBUG"; then
8142     AC_DEFINE(MOZ_REFLOW_PERF)
8143     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8146 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8147     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8148     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8149     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8150     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8151     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8152     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8153     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8154     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8157 # Used for LD_LIBRARY_PATH of run_viewer target
8158 LIBS_PATH=
8159 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8160   case $lib_arg in
8161     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8162       * ) ;;
8163   esac
8164 done
8165 AC_SUBST(LIBS_PATH)
8167 dnl ========================================================
8168 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8169 dnl ========================================================
8170 case "$host_os" in
8171 mingw*)
8172     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8173     ;;
8174 cygwin*|msvc*|mks*)
8175     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8176     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8177     CC="\$(CYGWIN_WRAPPER) $CC"
8178     CXX="\$(CYGWIN_WRAPPER) $CXX"
8179     CPP="\$(CYGWIN_WRAPPER) $CPP"
8180     LD="\$(CYGWIN_WRAPPER) $LD"
8181     AS="\$(CYGWIN_WRAPPER) $AS"
8182     RC="\$(CYGWIN_WRAPPER) $RC"
8183     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8184     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8185     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8186     ;;
8187 esac
8189 AC_SUBST(CYGDRIVE_MOUNT)
8190 AC_SUBST(WIN_TOP_SRC)
8192 AC_SUBST(MOZILLA_VERSION)
8194 . ${srcdir}/config/chrome-versions.sh
8195 AC_DEFINE_UNQUOTED(MOZILLA_LOCALE_VERSION,"$MOZILLA_LOCALE_VERSION")
8196 AC_DEFINE_UNQUOTED(MOZILLA_REGION_VERSION,"$MOZILLA_REGION_VERSION")
8197 AC_DEFINE_UNQUOTED(MOZILLA_SKIN_VERSION,"$MOZILLA_SKIN_VERSION")
8199 AC_SUBST(ac_configure_args)
8201 dnl Spit out some output
8202 dnl ========================================================
8204 dnl The following defines are used by xpcom
8205 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8206 CPP_THROW_NEW
8207 HAVE_CPP_2BYTE_WCHAR_T
8208 HAVE_CPP_ACCESS_CHANGING_USING
8209 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8210 HAVE_CPP_BOOL
8211 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8212 HAVE_CPP_EXPLICIT
8213 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8214 HAVE_CPP_NAMESPACE_STD
8215 HAVE_CPP_NEW_CASTS
8216 HAVE_CPP_PARTIAL_SPECIALIZATION
8217 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8218 HAVE_CPP_TYPENAME
8219 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8220 HAVE_STATVFS
8221 NEED_CPP_UNUSED_IMPLEMENTATIONS
8222 NEW_H
8223 HAVE_GETPAGESIZE
8224 HAVE_ICONV
8225 HAVE_ICONV_WITH_CONST_INPUT
8226 HAVE_MBRTOWC
8227 HAVE_SYS_MOUNT_H
8228 HAVE_SYS_VFS_H
8229 HAVE_WCRTOMB
8230 MOZ_V1_STRING_ABI
8233 AC_CONFIG_HEADER(
8234 netwerk/necko-config.h
8235 xpcom/xpcom-config.h
8236 xpcom/xpcom-private.h
8239 # Save the defines header file before autoconf removes it.
8240 # (Do not add AC_DEFINE calls after this line.)
8241   _CONFIG_TMP=confdefs-tmp.h
8242   _CONFIG_DEFS_H=mozilla-config.h
8244   cat > $_CONFIG_TMP <<\EOF
8245 /* List of defines generated by configure. Included with preprocessor flag,
8246  * -include, to avoid long list of -D defines on the compile command-line.
8247  * Do not edit.
8248  */
8250 #ifndef _MOZILLA_CONFIG_H_
8251 #define _MOZILLA_CONFIG_H_
8254 _EGREP_PATTERN='^#define ('
8255 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8256     for f in $_NON_GLOBAL_ACDEFINES; do
8257         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8258     done
8260 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8262   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8264   cat >> $_CONFIG_TMP <<\EOF
8266 #endif /* _MOZILLA_CONFIG_H_ */
8270   # Only write mozilla-config.h when something changes (or it doesn't exist)
8271   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8272     rm $_CONFIG_TMP
8273   else
8274     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8275     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8277     echo ==== $_CONFIG_DEFS_H =================================
8278     cat $_CONFIG_DEFS_H
8279   fi
8281 dnl Probably shouldn't call this manually but we always want the output of DEFS
8282 rm -f confdefs.h.save
8283 mv confdefs.h confdefs.h.save
8284 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8285 AC_OUTPUT_MAKE_DEFS()
8286 MOZ_DEFINES=$DEFS
8287 AC_SUBST(MOZ_DEFINES)
8288 rm -f confdefs.h
8289 mv confdefs.h.save confdefs.h
8291 dnl Load the list of Makefiles to generate.
8292 dnl   To add new Makefiles, edit allmakefiles.sh.
8293 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8294 . ${srcdir}/allmakefiles.sh
8295 dnl 
8296 dnl Run a perl script to quickly create the makefiles.
8297 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8298 dnl   for the files it cannot handle correctly. This way, config.status
8299 dnl   will handle these files.
8300 dnl If it fails, nothing is set and config.status will run as usual.
8302 dnl This does not change the $MAKEFILES variable.
8304 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8306 if test -z "${AS_PERL}"; then
8307 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8308 else
8309 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8311 . ./conftest.sh
8312 rm conftest.sh
8314 echo $MAKEFILES > unallmakefiles
8316 AC_OUTPUT($MAKEFILES)
8318 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8319 if test "$CAIRO_FEATURES_H"; then
8320   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8321     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8322   else
8323     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8324   fi
8327 dnl ========================================================
8328 dnl = Setup a nice relatively clean build environment for
8329 dnl = sub-configures.
8330 dnl ========================================================
8331 CC="$_SUBDIR_CC" 
8332 CXX="$_SUBDIR_CXX" 
8333 CFLAGS="$_SUBDIR_CFLAGS" 
8334 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8335 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8336 LDFLAGS="$_SUBDIR_LDFLAGS"
8337 HOST_CC="$_SUBDIR_HOST_CC" 
8338 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8339 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8342 unset MAKEFILES
8343 unset CONFIG_FILES
8345 if test "$COMPILE_ENVIRONMENT"; then
8346 if test -z "$MOZ_NATIVE_NSPR"; then
8347     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8348     if test -z "$MOZ_DEBUG"; then
8349         ac_configure_args="$ac_configure_args --disable-debug"
8350     fi
8351     if test "$MOZ_OPTIMIZE" = "1"; then
8352         ac_configure_args="$ac_configure_args --enable-optimize"
8353     fi
8354     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8355        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8356     fi
8357     if test -n "$HAVE_64BIT_OS"; then
8358         ac_configure_args="$ac_configure_args --enable-64bit"
8359     fi
8360     if test -n "$USE_ARM_KUSER"; then
8361         ac_configure_args="$ac_configure_args --with-arm-kuser"
8362     fi
8363     AC_OUTPUT_SUBDIRS(nsprpub)
8364     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8367 if test -z "$MOZ_NATIVE_NSPR"; then
8368     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8369     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8370     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8371        _libs=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --libdir=$\(LIBXUL_DIST\)/lib --libs`
8372        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $_libs'" config/autoconf.mk
8373     fi
8374     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
8375        _cflags=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --includedir=$\(LIBXUL_DIST\)/include/nspr --cflags`
8376        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $_cflags'" config/autoconf.mk
8377     fi
8378     rm -f config/autoconf.mk.bak
8381 fi # COMPILE_ENVIRONMENT