Bug 448767 - Make -moz-system-metric(mac-graphite-theme) live, r+sr=roc
[mozilla-central.git] / configure.in
blobe4b5022ec3132e7548f8f65346989001a2176021
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     if test -z "$AS_BIN"; then
1878         AS="$AS_BIN"
1879     fi
1880     DSO_CFLAGS=
1881     DSO_PIC_CFLAGS=
1882     DLL_SUFFIX=.dll
1883     BIN_SUFFIX='.exe'
1884     if test -z "$RC"; then 
1885         RC=rc.exe  
1886     fi
1887     # certain versions of cygwin's makedepend barf on the 
1888     # #include <string> vs -I./dist/include/string issue so don't use it
1889     SYSTEM_MAKEDEPEND=
1891     HOST_CC=cl
1892     HOST_CXX=cl
1893     HOST_LD=link
1894     HOST_AR='lib -OUT:$@'
1895     HOST_RANLIB='echo ranlib'
1896     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1897         
1898         
1899     WARNINGS_AS_ERRORS='-WX'
1900         MOZ_OPTIMIZE_FLAGS='-O1'
1901     AR_FLAGS='-NOLOGO -OUT:"$@"'
1902     ASM_SUFFIX=asm
1903     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1904     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1905     DLL_PREFIX=
1906     DOXYGEN=:
1907     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1908     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1909     GARBAGE=
1910     IMPORT_LIB_SUFFIX=lib
1911     LIBS="$LIBS"
1912     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1913     LIB_PREFIX=
1914     LIB_SUFFIX=lib 
1915     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1916     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1917     MKSHLIB_FORCE_ALL=
1918     MKSHLIB_UNFORCE_ALL=
1919     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1920     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1921     MOZ_DEBUG_FLAGS='-Zi'
1922     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1923     MOZ_FIX_LINK_PATHS=
1924     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1925     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1926     OBJ_SUFFIX=obj
1927     RANLIB='echo not_ranlib'
1928     STRIP='echo not_strip'
1929     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1930     UNZIP=unzip
1931     XARGS=xargs
1932     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1933     ZIP=zip
1934     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1935     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1936     STATIC_LIBIDL=1
1938     AC_DEFINE(HAVE_SNPRINTF)
1939     AC_DEFINE(_WINDOWS)
1940     AC_DEFINE(_WIN32)
1941     AC_DEFINE(WIN32)
1942     AC_DEFINE(XP_WIN)
1943     AC_DEFINE(XP_WIN32)
1944     AC_DEFINE(HW_THREADS)
1945     AC_DEFINE(STDC_HEADERS)
1946     AC_DEFINE(NEW_H, <new>)
1947     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1949     TARGET_MD_ARCH=win32
1950     _PLATFORM_DEFAULT_TOOLKIT='windows'
1951     BIN_SUFFIX='.exe'
1952     USE_SHORT_LIBNAME=1
1953     MOZ_ENABLE_POSTSCRIPT=
1954     MOZ_USER_DIR="Mozilla"
1958 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1959     DSO_CFLAGS=
1960     DSO_PIC_CFLAGS=
1961     DLL_SUFFIX=.dll
1962     RC=rc.exe
1963     # certain versions of cygwin's makedepend barf on the 
1964     # #include <string> vs -I./dist/include/string issue so don't use it
1965     SYSTEM_MAKEDEPEND=
1966     if test -n "$GNU_CC"; then
1967         CC="$CC -mno-cygwin"
1968         CXX="$CXX -mno-cygwin"
1969         CPP="$CPP -mno-cygwin"
1970         CFLAGS="$CFLAGS -mms-bitfields"
1971         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1972         DSO_LDOPTS='-shared'
1973         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1974         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1975         RC='$(WINDRES)'
1976         # Use temp file for windres (bug 213281)
1977         RCFLAGS='-O coff --use-temp-file'
1978         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1979         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1980         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1981         MOZ_FIX_LINK_PATHS=
1982         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1983         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1984         DLL_PREFIX=
1985         IMPORT_LIB_SUFFIX=dll.a
1986     else
1987         TARGET_COMPILER_ABI=msvc
1988         HOST_CC='$(CC)'
1989         HOST_CXX='$(CXX)'
1990         HOST_LD='$(LD)'
1991         AR='lib -NOLOGO -OUT:"$@"'
1992         AR_FLAGS=
1993         RANLIB='echo not_ranlib'
1994         STRIP='echo not_strip'
1995         XARGS=xargs
1996         ZIP=zip
1997         UNZIP=unzip
1998         DOXYGEN=:
1999         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2000         OBJ_SUFFIX=obj
2001         LIB_SUFFIX=lib
2002         DLL_PREFIX=
2003         LIB_PREFIX=
2004         IMPORT_LIB_SUFFIX=lib
2005         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
2006         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
2007         MKSHLIB_FORCE_ALL=
2008         MKSHLIB_UNFORCE_ALL=
2009         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2010         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
2011         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
2012         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2013         MOZ_DEBUG_FLAGS='-Zi'
2014         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2015         WARNINGS_AS_ERRORS='-WX'
2016         MOZ_OPTIMIZE_FLAGS='-O1'
2017         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2018         MOZ_FIX_LINK_PATHS=
2019         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2020         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2021         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2022         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2023         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2024         if test $_MSC_VER -ge 1400; then
2025             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2026             dnl For profile-guided optimization
2027             PROFILE_GEN_CFLAGS="-GL"
2028             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2029             dnl XXX: PGO builds can fail with warnings treated as errors,
2030             dnl specifically "no profile data available" appears to be
2031             dnl treated as an error sometimes. This might be a consequence
2032             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2033             dnl with the linker doing most of the work in the whole-program
2034             dnl optimization/PGO case. I think it's probably a compiler bug,
2035             dnl but we work around it here.
2036             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2037             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2038             dnl Probably also a compiler bug, but what can you do?
2039             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2040             if test -n "$_USE_DYNAMICBASE"; then
2041                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2042             fi
2043         fi
2044     fi
2045     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2046     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2047     AC_DEFINE(HAVE_SNPRINTF)
2048     AC_DEFINE(_WINDOWS)
2049     AC_DEFINE(_WIN32)
2050     AC_DEFINE(WIN32)
2051     AC_DEFINE(XP_WIN)
2052     AC_DEFINE(XP_WIN32)
2053     AC_DEFINE(HW_THREADS)
2054     AC_DEFINE(STDC_HEADERS)
2055     AC_DEFINE(NEW_H, <new>)
2056     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2057     TARGET_MD_ARCH=win32
2058     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2059     BIN_SUFFIX='.exe'
2060     USE_SHORT_LIBNAME=1
2061     MOZ_ENABLE_POSTSCRIPT=
2062     MOZ_USER_DIR="Mozilla"
2064     dnl Hardcode to win95 for now - cls
2065     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2067     dnl set NO_X11 defines here as the general check is skipped on win32
2068     no_x=yes
2069     AC_DEFINE(NO_X11)
2071     dnl MinGW/MSYS doesn't provide or need cygpath
2072     case "$host" in
2073     *-mingw*)
2074         CYGPATH_W=echo
2075         CYGPATH_S=cat
2076         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2077         ;;
2078     *-cygwin*|*-msvc*|*-mks*)
2079         CYGPATH_W="cygpath -a -w"
2080         CYGPATH_S="sed -e s|\\\\|/|g"
2081         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2082         ;;
2083     esac
2084     case "$host" in
2085     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2087     if test -z "$MOZ_TOOLS"; then
2088         AC_MSG_ERROR([MOZ_TOOLS is not set])
2089     fi
2091     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2092     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2093         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2094     fi
2095     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2096         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2097     fi
2098     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2100     if test -n "$GLIB_PREFIX"; then
2101         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2102         if test "$?" = "0"; then
2103             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2104                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2105             fi
2106             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2107         else
2108             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2109         fi
2110     else
2111         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2112     fi
2113     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2114         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2115     fi
2116     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2117     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2118         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2119     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2120         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2121     else
2122         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2123     fi
2125     if test -n "$LIBIDL_PREFIX"; then
2126         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2127         if test "$?" = "0"; then
2128             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2129                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2130             fi
2131             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2132         else
2133             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2134         fi
2135     else
2136         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2137     fi        
2138     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2139         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2140     fi
2141     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2142     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2143         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2144         STATIC_LIBIDL=1
2145     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2146         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2147     else
2148         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2149     fi
2150     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2151     ;;
2153     *) # else cross-compiling
2154         if test -n "$GLIB_PREFIX"; then
2155             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2156             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2157                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2158             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2159                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2160             else
2161                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2162             fi
2163         fi
2164         if test -n "$LIBIDL_PREFIX"; then
2165             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2166             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2167                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2168                 STATIC_LIBIDL=1
2169             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2170                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2171             else
2172                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2173             fi
2174         fi
2175         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2176         ;;
2177     esac 
2180     case "$host_os" in
2181     cygwin*|msvc*|mks*)
2182         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])
2183         ;;
2185     *)
2186         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2188         AC_LANG_SAVE
2189         AC_LANG_CPLUSPLUS
2190         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2191         AC_LANG_RESTORE
2192         ;;
2193     esac
2195     case "$target" in
2196     i*86-*)
2197         AC_DEFINE(_X86_)
2198         ;;
2199     alpha-*)
2200         AC_DEFINE(_ALPHA_)
2201         ;;
2202     mips-*)
2203         AC_DEFINE(_MIPS_)
2204         ;;
2205     *)
2206         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2207         ;;
2208     esac
2209     ;;
2211 *-netbsd*)
2212     DSO_CFLAGS=''
2213     CFLAGS="$CFLAGS -Dunix"
2214     CXXFLAGS="$CXXFLAGS -Dunix"
2215     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2216         DLL_SUFFIX=".so"
2217         DSO_PIC_CFLAGS='-fPIC -DPIC'
2218         DSO_LDOPTS='-shared'
2219         BIN_FLAGS='-Wl,--export-dynamic'
2220     else
2221         DSO_PIC_CFLAGS='-fPIC -DPIC'
2222         DLL_SUFFIX=".so.1.0"
2223         DSO_LDOPTS='-shared'
2224     fi
2225     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2226     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2227     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2228     if test "$LIBRUNPATH"; then
2229         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2230     fi
2231     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2232     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2233     ;;
2235 *-nto*) 
2236         AC_DEFINE(NTO)  
2237         AC_DEFINE(_QNX_SOURCE)
2238         AC_DEFINE(_i386)
2239         OS_TARGET=NTO
2240         WARNINGS_AS_ERRORS=''
2241         MOZ_OPTIMIZE_FLAGS="-O"
2242         MOZ_DEBUG_FLAGS="-gstabs"
2243         USE_PTHREADS=1
2244         _PEDANTIC=
2245         LIBS="$LIBS -lsocket -lstdc++"
2246         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2247         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2248         if test "$with_x" != "yes"
2249         then
2250                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2251             TK_CFLAGS='-I/usr/include/photon'
2252                 TK_LIBS='-lph'
2253         fi
2254         case "${target_cpu}" in
2255         ppc*)
2256         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2257         ;;
2258         esac
2259         case "${host_cpu}" in
2260         i*86)
2261         USE_ELF_DYNSTR_GC=1
2262         ;;
2263         esac
2264         ;;
2266 *-openbsd*)
2267     DLL_SUFFIX=".so.1.0"
2268     DSO_CFLAGS=''
2269     DSO_PIC_CFLAGS='-fPIC'
2270     DSO_LDOPTS='-shared -fPIC'
2271     if test "$LIBRUNPATH"; then
2272         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2273     fi
2274     ;;
2276 *-openvms*) 
2277     AC_DEFINE(NO_PW_GECOS)
2278     AC_DEFINE(NO_UDSOCK)
2279     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2280     USE_PTHREADS=1
2281     MKSHLIB_FORCE_ALL='-all'
2282     MKSHLIB_UNFORCE_ALL='-none'
2283     AS='as'
2284     AS_DASH_C_FLAG='-Wc/names=as_is'
2285     AR_FLAGS='c $@'
2286     DSO_LDOPTS='-shared -auto_symvec'
2287     DSO_PIC_CFLAGS=
2288     MOZ_DEBUG_LDFLAGS='-g'
2289     COMPAQ_CXX=1
2290     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2291     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2292     ;;
2295 *-os2*)
2296     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2297     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2298     AC_DEFINE(XP_OS2)
2299     USE_SHORT_LIBNAME=1
2300     DLL_PREFIX=
2301     LIB_PREFIX=
2302     LIB_SUFFIX=lib
2303     BIN_SUFFIX=".exe"
2304     DLL_SUFFIX=".dll"
2305     IMPORT_LIB_SUFFIX=lib
2306     DSO_PIC_CFLAGS=
2307     TARGET_MD_ARCH=os2
2308     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2309     MOZ_ENABLE_POSTSCRIPT=
2310     RC=rc.exe
2311     RCFLAGS='-n'
2312     MOZ_USER_DIR="Mozilla"
2314     if test "$MOZTOOLS"; then
2315         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2316     else
2317         AC_MSG_ERROR([MOZTOOLS is not set])
2318     fi
2320     # EMX/GCC build
2321     if test -n "$GNU_CC"; then
2322         AC_DEFINE(OS2)
2323         AC_DEFINE(XP_OS2_EMX)
2324         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2325         AC_DEFINE(TCPV40HDRS)
2326         AR=emxomfar
2327         AR_FLAGS='r $@'
2328         CFLAGS="$CFLAGS -Zomf"
2329         CXXFLAGS="$CXXFLAGS -Zomf"
2330         DSO_LDOPTS='-Zdll'
2331         BIN_FLAGS='-Zlinker /ST:0x100000'
2332         IMPLIB='emximp -o'
2333         FILTER='emxexp -o'
2334         LDFLAGS='-Zmap'
2335         WARNINGS_AS_ERRORS='-Werror'
2336         MOZ_DEBUG_FLAGS="-g -fno-inline"
2337         MOZ_OPTIMIZE_FLAGS="-O2"
2338         MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2339         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2340         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2341         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2342         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2343           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2344           LDFLAGS="$LDFLAGS -Zhigh-mem"
2345           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2346           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2347         fi
2349         # GCC for OS/2 currently predefines these, but we don't want them
2350         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2351         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2353         AC_CACHE_CHECK(for __declspec(dllexport),
2354            ac_os2_declspec,
2355            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2356                            [return 0;],
2357                            ac_os2_declspec="yes",
2358                            ac_os2_declspec="no")])
2359         if test "$ac_os2_declspec" = "yes"; then
2360            FILTER='true'
2361            MOZ_OS2_USE_DECLSPEC='1'
2362         fi
2363         
2364     # Visual Age C++ build
2365     elif test "$VACPP" = "yes"; then
2366         MOZ_BUILD_ROOT=`pwd -D`
2367         OBJ_SUFFIX=obj
2368         AR=-ilib
2369         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2370         AR_LIST='/L'
2371         AR_EXTRACT='-*'
2372         AR_DELETE='-'
2373         AS=alp
2374         ASFLAGS='-Mb'
2375         AS_DASH_C_FLAG=''
2376         ASM_SUFFIX=asm
2377         LD='-ilink'
2378         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2379         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2380         MOZ_DEBUG_FLAGS="/Ti+"
2381         WARNINGS_AS_ERRORS='-WX'
2382         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2383         LDFLAGS="/NOL /M"
2384         MOZ_DEBUG_LDFLAGS="/DE"
2385         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2386         DSO_LDOPTS=''
2387         DSO_PIC_CFLAGS=
2388         IMPLIB='implib /NOL /NOI'
2389         FILTER='cppfilt -q -B -P'
2390         AC_DEFINE(NO_ANSI_KEYWORDS)
2391         AC_DEFINE(OS2,4)
2392         AC_DEFINE(_X86_)
2393         AC_DEFINE(XP_OS2_VACPP)
2394         AC_DEFINE(TCPV40HDRS)
2395         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2396         AC_DEFINE(STDC_HEADERS)
2397         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2398         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2399         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2400         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2401         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2402         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2403         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2404     fi
2405     ;;
2407 alpha*-*-osf*)
2408     if test "$GNU_CC"; then
2409       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2410       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2412     else
2413         MOZ_DEBUG_FLAGS='-g'
2414         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2415         CFLAGS="$CFLAGS -ieee"
2416         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2417         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2418         DSO_CFLAGS=
2419         DSO_PIC_CFLAGS=
2420         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2421         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2422         MKSHLIB_FORCE_ALL='-all'
2423         MKSHLIB_UNFORCE_ALL='-none'
2424         dnl Might fix the libxpcom.so breakage on this platform as well....
2425         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2426         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2427     fi
2428     if test -z "$GNU_CXX"; then
2429       COMPAQ_CXX=1
2430     fi
2431     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2432     ;;
2434 *-qnx*) 
2435     DIRENT_INO=d_stat.st_ino
2436     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2437     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2438     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2439     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2440     AC_DEFINE(STDC_HEADERS)
2441     if test "$no_x" = "yes"; then
2442             _PLATFORM_DEFAULT_TOOLKIT='photon'
2443             TK_CFLAGS='-I/usr/nto/include/photon'
2444             TK_LIBS='-lphoton -lphrender'
2445     fi
2446     ;;
2448 *-sco*) 
2449     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2450     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2451     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2452     if test ! "$GNU_CC"; then
2453        DSO_LDOPTS='-G'
2454     fi
2455     ;;
2457 dnl the qsort routine under solaris is faulty
2458 *-solaris*) 
2459     AC_DEFINE(SOLARIS)
2460     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2461     SYSTEM_MAKEDEPEND=
2462     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2463     # libraries one level up (e.g. libnspr4.so)
2464     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2465     MOZ_MEMORY=1
2466     if test -z "$GNU_CC"; then
2467        NS_USE_NATIVE=1
2468        MOZ_FIX_LINK_PATHS='-R $(LIBXUL_DIST)/bin'
2469        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2471        if test "$CPU_ARCH" != "sparc"; then
2472           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2473           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2474        else
2475           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2476           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2477           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2478        fi
2480        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2481        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2482            _SAVE_LDFLAGS=$LDFLAGS
2483            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2484            AC_TRY_LINK([#include <stdio.h>],
2485                        [printf("Hello World\n");],
2486                        ,
2487                        [LDFLAGS=$_SAVE_LDFLAGS])
2488        fi
2489        WARNINGS_AS_ERRORS='-Werror'
2490        MOZ_OPTIMIZE_FLAGS="-xO4"
2491        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2492        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2493        MKSHLIB_FORCE_ALL='-z allextract'
2494        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2495        DSO_LDOPTS='-G -z muldefs'
2496        AR_LIST="$AR t"
2497        AR_EXTRACT="$AR x"
2498        AR_DELETE="$AR d"
2499        AR='$(CXX) -xar'
2500        AR_FLAGS='-o $@'
2501        AS='/usr/ccs/bin/as'
2502        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2503        AS_DASH_C_FLAG=''
2504        TARGET_COMPILER_ABI="sunc"
2505         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2506         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2507        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2508        AC_LANG_SAVE
2509        AC_LANG_CPLUSPLUS
2510        AC_TRY_COMPILE([],
2511            [#if (__SUNPRO_CC < 0x530)
2512            #error "Denied"
2513            #endif],
2514            _BAD_COMPILER=,_BAD_COMPILER=1)
2515         if test -n "$_BAD_COMPILER"; then
2516             _res="no"
2517             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2518         else
2519             _res="yes"
2520         fi
2521         AC_MSG_RESULT([$_res])
2522         AC_LANG_RESTORE
2523     else
2524        ASFLAGS="$ASFLAGS -fPIC"
2525        DSO_LDOPTS='-G'
2526        _WARNINGS_CFLAGS=''
2527        _WARNINGS_CXXFLAGS=''
2528        if test "$OS_RELEASE" = "5.3"; then
2529           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2530        fi
2531     fi
2532     if test "$OS_RELEASE" = "5.5.1"; then
2533        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2534     fi
2535     ;;
2537 *-sunos*) 
2538     DSO_LDOPTS='-Bdynamic'
2539     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2540     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2541     AC_DEFINE(SUNOS4)
2542     AC_DEFINE(SPRINTF_RETURNS_STRING)
2543     case "$(target_os)" in
2544     sunos4.1*)
2545         DLL_SUFFIX='.so.1.0'
2546         ;;
2547     esac
2548     ;;
2550 *-sysv4.2uw7*) 
2551         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2552     ;;
2554 *-os2*)
2555     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2556     ;;
2558 esac
2560 dnl Only one oddball right now (QNX), but this gives us flexibility
2561 dnl if any other platforms need to override this in the future.
2562 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2564 dnl ========================================================
2565 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2566 dnl by now will not have any way to link most binaries (tests
2567 dnl as well as viewer, apprunner, etc.), because some symbols
2568 dnl will be left out of the "composite" .so's by ld as unneeded.
2569 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2570 dnl they can link in the static libs that provide the missing
2571 dnl symbols.
2572 dnl ========================================================
2573 NO_LD_ARCHIVE_FLAGS=
2574 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2575     NO_LD_ARCHIVE_FLAGS=1
2577 case "$target" in
2578 *-os2*)
2579     NO_LD_ARCHIVE_FLAGS=
2580     ;;
2581 *-aix4.3*|*-aix5*)
2582     NO_LD_ARCHIVE_FLAGS=
2583     ;;
2584 *-openvms*)
2585     NO_LD_ARCHIVE_FLAGS=
2586     ;;
2587 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2588     if test -z "$GNU_CC"; then
2589         NO_LD_ARCHIVE_FLAGS=
2590     fi
2591     ;;
2592 esac
2593 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2596 dnl Indicate that platform requires special thread safe 
2597 dnl locking when starting up the OJI JVM 
2598 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2599 dnl ========================================================
2600 case "$target" in
2601     *-hpux*)      
2602         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2603         ;;
2604 esac
2606 dnl ========================================================
2607 dnl = Flags to strip unused symbols from .so components
2608 dnl ========================================================
2609 case "$target" in
2610     *-linux*|*-kfreebsd*-gnu)
2611         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2612         ;;
2613     *-solaris*)
2614         if test -z "$GNU_CC"; then
2615          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2616         else
2617          if test -z "$GCC_USE_GNU_LD"; then
2618           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2619          else
2620           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2621          fi
2622         fi
2623         ;;
2624     *-nto*) 
2625         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2626         ;;
2627     *-darwin*)
2628         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2629         ;;
2630     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2631         if test -n "$GNU_CC"; then
2632            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2633         fi
2634         ;;
2635 esac
2637 if test -z "$COMPILE_ENVIRONMENT"; then
2638     SKIP_COMPILER_CHECKS=1
2639     SKIP_LIBRARY_CHECKS=1
2642 if test -z "$SKIP_COMPILER_CHECKS"; then
2643 dnl Checks for typedefs, structures, and compiler characteristics.
2644 dnl ========================================================
2645 AC_LANG_C
2646 AC_HEADER_STDC
2647 AC_C_CONST
2648 AC_TYPE_MODE_T
2649 AC_TYPE_OFF_T
2650 AC_TYPE_PID_T
2651 AC_TYPE_SIZE_T
2652 AC_STRUCT_ST_BLKSIZE
2653 AC_MSG_CHECKING(for siginfo_t)
2654 AC_CACHE_VAL(ac_cv_siginfo_t,
2655  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2656                   #include <signal.h>],
2657                  [siginfo_t* info;],
2658                  [ac_cv_siginfo_t=true],
2659                  [ac_cv_siginfo_t=false])])
2660 if test "$ac_cv_siginfo_t" = true ; then
2661   AC_DEFINE(HAVE_SIGINFO_T)
2662   AC_MSG_RESULT(yes)
2663 else
2664   AC_MSG_RESULT(no)
2667 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2668 dnl  header files.  These defines make Visual Age use the mozilla
2669 dnl  defines types.
2670 if test "$VACPP" = "yes"; then
2671    AC_DEFINE(__size_t)
2672    AC_DEFINE(__off_t)
2675 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2676 dnl ========================================================
2677 AC_MSG_CHECKING(for int16_t)
2678 AC_CACHE_VAL(ac_cv_int16_t,
2679  [AC_TRY_COMPILE([#include <stdio.h>
2680                   #include <sys/types.h>],
2681                  [int16_t foo = 0;],
2682                  [ac_cv_int16_t=true],
2683                  [ac_cv_int16_t=false])])
2684 if test "$ac_cv_int16_t" = true ; then
2685   AC_DEFINE(HAVE_INT16_T)
2686   AC_MSG_RESULT(yes)
2687 else
2688   AC_MSG_RESULT(no)
2690 AC_MSG_CHECKING(for int32_t)
2691 AC_CACHE_VAL(ac_cv_int32_t,
2692  [AC_TRY_COMPILE([#include <stdio.h>
2693                   #include <sys/types.h>],
2694                  [int32_t foo = 0;],
2695                  [ac_cv_int32_t=true],
2696                  [ac_cv_int32_t=false])])
2697 if test "$ac_cv_int32_t" = true ; then
2698   AC_DEFINE(HAVE_INT32_T)
2699   AC_MSG_RESULT(yes)
2700 else
2701   AC_MSG_RESULT(no)
2703 AC_MSG_CHECKING(for int64_t)
2704 AC_CACHE_VAL(ac_cv_int64_t,
2705  [AC_TRY_COMPILE([#include <stdio.h>
2706                   #include <sys/types.h>],
2707                  [int64_t foo = 0;],
2708                  [ac_cv_int64_t=true],
2709                  [ac_cv_int64_t=false])])
2710 if test "$ac_cv_int64_t" = true ; then
2711   AC_DEFINE(HAVE_INT64_T)
2712   AC_MSG_RESULT(yes)
2713 else
2714   AC_MSG_RESULT(no)
2716 AC_MSG_CHECKING(for int64)
2717 AC_CACHE_VAL(ac_cv_int64,
2718  [AC_TRY_COMPILE([#include <stdio.h>
2719                   #include <sys/types.h>],
2720                  [int64 foo = 0;],
2721                  [ac_cv_int64=true],
2722                  [ac_cv_int64=false])])
2723 if test "$ac_cv_int64" = true ; then
2724   AC_DEFINE(HAVE_INT64)
2725   AC_MSG_RESULT(yes)
2726 else
2727   AC_MSG_RESULT(no)
2729 AC_MSG_CHECKING(for uint)
2730 AC_CACHE_VAL(ac_cv_uint,
2731  [AC_TRY_COMPILE([#include <stdio.h>
2732                   #include <sys/types.h>],
2733                  [uint foo = 0;],
2734                  [ac_cv_uint=true],
2735                  [ac_cv_uint=false])])
2736 if test "$ac_cv_uint" = true ; then
2737   AC_DEFINE(HAVE_UINT)
2738   AC_MSG_RESULT(yes)
2739 else
2740   AC_MSG_RESULT(no)
2742 AC_MSG_CHECKING(for uint_t)
2743 AC_CACHE_VAL(ac_cv_uint_t,
2744  [AC_TRY_COMPILE([#include <stdio.h>
2745                   #include <sys/types.h>],
2746                  [uint_t foo = 0;],
2747                  [ac_cv_uint_t=true],
2748                  [ac_cv_uint_t=false])])
2749 if test "$ac_cv_uint_t" = true ; then
2750   AC_DEFINE(HAVE_UINT_T)
2751   AC_MSG_RESULT(yes)
2752 else
2753   AC_MSG_RESULT(no)
2755 AC_MSG_CHECKING(for uint16_t)
2756 AC_CACHE_VAL(ac_cv_uint16_t,
2757  [AC_TRY_COMPILE([#include <stdio.h>
2758                   #include <sys/types.h>],
2759                  [uint16_t foo = 0;],
2760                  [ac_cv_uint16_t=true],
2761                  [ac_cv_uint16_t=false])])
2762 if test "$ac_cv_uint16_t" = true ; then
2763   AC_DEFINE(HAVE_UINT16_T)
2764   AC_MSG_RESULT(yes)
2765 else
2766   AC_MSG_RESULT(no)
2769 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2770 dnl are defined when compiling C++ but not C.  Since the result of this
2771 dnl test is used only in C++, do it in C++.
2772 AC_LANG_CPLUSPLUS
2774 AC_MSG_CHECKING(for uname.domainname)
2775 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2776     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2777         [ struct utsname *res; char *domain; 
2778             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2779         [ac_cv_have_uname_domainname_field=true],
2780         [ac_cv_have_uname_domainname_field=false])])
2782 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2783     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2784     AC_MSG_RESULT(yes)
2785 else
2786     AC_MSG_RESULT(no)
2789 AC_MSG_CHECKING(for uname.__domainname)
2790 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2791     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2792         [ struct utsname *res; char *domain; 
2793             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2794         [ac_cv_have_uname_us_domainname_field=true],
2795         [ac_cv_have_uname_us_domainname_field=false])])
2797 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2798     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2799     AC_MSG_RESULT(yes)
2800 else
2801     AC_MSG_RESULT(no)
2804 AC_LANG_C
2806 dnl Check for usable wchar_t (2 bytes, unsigned)
2807 dnl (we really don't need the unsignedness check anymore)
2808 dnl ========================================================
2810 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2811     ac_cv_have_usable_wchar_v2,
2812     [AC_TRY_COMPILE([#include <stddef.h>
2813                      $configure_static_assert_macros],
2814                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2815                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2816                     ac_cv_have_usable_wchar_v2="yes",
2817                     ac_cv_have_usable_wchar_v2="no")])
2818 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2819     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2820     HAVE_CPP_2BYTE_WCHAR_T=1
2821 else
2822 dnl This is really gcc-only
2823 dnl Do this test using CXX only since some versions of gcc
2824 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2825 dnl only have short-wchar support for c++.
2826 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2828     AC_LANG_SAVE
2829     AC_LANG_CPLUSPLUS
2830     _SAVE_CXXFLAGS=$CXXFLAGS
2831     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2833     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2834         ac_cv_have_usable_wchar_option_v2,
2835         [AC_TRY_LINK([#include <stddef.h>
2836                       $configure_static_assert_macros],
2837                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2838                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2839                      ac_cv_have_usable_wchar_option_v2="yes",
2840                      ac_cv_have_usable_wchar_option_v2="no")])
2842     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2843         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2844         HAVE_CPP_2BYTE_WCHAR_T=1
2845     else    
2846         CXXFLAGS=$_SAVE_CXXFLAGS
2847     fi
2848     AC_LANG_RESTORE
2851 dnl Check for .hidden assembler directive and visibility attribute.
2852 dnl Borrowed from glibc configure.in
2853 dnl ===============================================================
2854 if test "$GNU_CC"; then
2855   AC_CACHE_CHECK(for visibility(hidden) attribute,
2856                  ac_cv_visibility_hidden,
2857                  [cat > conftest.c <<EOF
2858                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2860                   ac_cv_visibility_hidden=no
2861                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2862                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2863                       ac_cv_visibility_hidden=yes
2864                     fi
2865                   fi
2866                   rm -f conftest.[cs]
2867                  ])
2868   if test "$ac_cv_visibility_hidden" = "yes"; then
2869     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2871     AC_CACHE_CHECK(for visibility(default) attribute,
2872                    ac_cv_visibility_default,
2873                    [cat > conftest.c <<EOF
2874                     int foo __attribute__ ((visibility ("default"))) = 1;
2876                     ac_cv_visibility_default=no
2877                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2878                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2879                         ac_cv_visibility_default=yes
2880                       fi
2881                     fi
2882                     rm -f conftest.[cs]
2883                    ])
2884     if test "$ac_cv_visibility_default" = "yes"; then
2885       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2887       AC_CACHE_CHECK(for visibility pragma support,
2888                      ac_cv_visibility_pragma,
2889                      [cat > conftest.c <<EOF
2890 #pragma GCC visibility push(hidden)
2891                       int foo_hidden = 1;
2892 #pragma GCC visibility push(default)
2893                       int foo_default = 1;
2895                       ac_cv_visibility_pragma=no
2896                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2897                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2898                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2899                             ac_cv_visibility_pragma=yes
2900                           fi
2901                         fi
2902                       fi
2903                       rm -f conftest.[cs]
2904                     ])
2905       if test "$ac_cv_visibility_pragma" = "yes"; then
2906         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2907                        ac_cv_have_visibility_class_bug,
2908                        [cat > conftest.c <<EOF
2909 #pragma GCC visibility push(hidden)
2910 struct __attribute__ ((visibility ("default"))) TestStruct {
2911   static void Init();
2913 __attribute__ ((visibility ("default"))) void TestFunc() {
2914   TestStruct::Init();
2917                        ac_cv_have_visibility_class_bug=no
2918                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2919                          ac_cv_have_visibility_class_bug=yes
2920                        else
2921                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2922                            ac_cv_have_visibility_class_bug=yes
2923                          fi
2924                        fi
2925                        rm -rf conftest.{c,S}
2926                        ])
2928         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2929                        ac_cv_have_visibility_builtin_bug,
2930                        [cat > conftest.c <<EOF
2931 #pragma GCC visibility push(hidden)
2932 #pragma GCC visibility push(default)
2933 #include <string.h>
2934 #pragma GCC visibility pop
2936 __attribute__ ((visibility ("default"))) void Func() {
2937   char c[[100]];
2938   memset(c, 0, sizeof(c));
2941                        ac_cv_have_visibility_builtin_bug=no
2942                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2943                          ac_cv_have_visibility_builtin_bug=yes
2944                        else
2945                          if test `grep -c "@PLT" conftest.S` = 0; then
2946                            ac_cv_visibility_builtin_bug=yes
2947                          fi
2948                        fi
2949                        rm -f conftest.{c,S}
2950                        ])
2951         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2952                 "$ac_cv_have_visibility_class_bug" = "no"; then
2953           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2954           WRAP_SYSTEM_INCLUDES=1
2955         else
2956           VISIBILITY_FLAGS='-fvisibility=hidden'
2957         fi # have visibility pragma bug
2958       fi   # have visibility pragma
2959     fi     # have visibility(default) attribute
2960   fi       # have visibility(hidden) attribute
2961 fi         # GNU_CC
2963 # visibility hidden flag for Sun Studio on Solaris
2964 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
2965 VISIBILITY_FLAGS='-xldscope=hidden'
2966 fi         # Sun Studio on Solaris
2968 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2969 AC_SUBST(VISIBILITY_FLAGS)
2971 dnl Checks for header files.
2972 dnl ========================================================
2973 AC_HEADER_DIRENT
2974 case "$target_os" in
2975 freebsd*)
2976 # for stuff like -lXshm
2977     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2978     ;;
2979 esac
2980 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2981 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2982 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2983 AC_CHECK_HEADERS(malloc.h)
2984 AC_CHECK_HEADERS(X11/XKBlib.h)
2986 dnl These are all the places some variant of statfs can be hiding.
2987 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2989 dnl Try for MMX support
2990 dnl NB - later gcc versions require -mmmx for this header to be successfully
2991 dnl included (or another option which implies it, such as -march=pentium-mmx)
2992 AC_CHECK_HEADERS(mmintrin.h)
2994 dnl Check whether the compiler supports the new-style C++ standard
2995 dnl library headers (i.e. <new>) or needs the old "new.h"
2996 AC_LANG_CPLUSPLUS
2997 NEW_H=new.h
2998 AC_CHECK_HEADER(new, [NEW_H=new])
2999 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3000 AC_LANG_C
3002 AC_ARG_ENABLE(dtrace,
3003               [  --enable-dtrace         build with dtrace support if available (default=no)],
3004               [enable_dtrace="yes"],)
3005 if test "x$enable_dtrace" = "xyes"; then
3006   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3007   if test -n "$HAVE_DTRACE"; then
3008       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3009   else
3010       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3011   fi
3013 AC_SUBST(HAVE_DTRACE)
3015 case $target in
3016 *-aix4.3*|*-aix5*)
3017         ;;
3019         AC_CHECK_HEADERS(sys/cdefs.h)
3020         ;;
3021 esac
3023 dnl Checks for libraries.
3024 dnl ========================================================
3025 case $target in
3026 *-hpux11.*)
3027         ;;
3029         AC_CHECK_LIB(c_r, gethostbyname_r)
3030         ;;
3031 esac
3033 dnl We don't want to link with libdl even if it's present on OS X, since
3034 dnl it's not used and not part of the default installation.
3035 dnl The same goes for BeOS.
3036 dnl We don't want to link against libm or libpthread on Darwin since
3037 dnl they both are just symlinks to libSystem and explicitly linking
3038 dnl against libSystem causes issues when debugging (see bug 299601).
3039 case $target in
3040 *-darwin*)
3041     ;;
3042 *-beos*)
3043     ;;
3045     AC_CHECK_LIB(m, atan)
3046     AC_CHECK_LIB(dl, dlopen,
3047     AC_CHECK_HEADER(dlfcn.h, 
3048         LIBS="-ldl $LIBS"
3049         AC_DEFINE(HAVE_LIBDL)))
3050     ;;
3051 esac
3053 _SAVE_CFLAGS="$CFLAGS"
3054 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3055 AC_CHECK_FUNCS(dladdr)
3056 CFLAGS="$_SAVE_CFLAGS"
3058 if test ! "$GNU_CXX"; then
3060     case $target in
3061     *-aix*)
3062         AC_CHECK_LIB(C_r, demangle)
3063         ;;
3064      *)
3065         AC_CHECK_LIB(C, demangle)
3066         ;;
3067      esac
3069 AC_CHECK_LIB(socket, socket)
3071 XLDFLAGS="$X_LIBS"
3072 XLIBS="$X_EXTRA_LIBS"
3074 dnl ========================================================
3075 dnl Checks for X libraries.
3076 dnl Ordering is important.
3077 dnl Xt is dependent upon SM as of X11R6
3078 dnl ========================================================
3079 if test "$no_x" = "yes"; then
3080     AC_DEFINE(NO_X11)
3081 else
3082     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3083         XLIBS="-lX11 $XLIBS"
3084         _SAVE_LDFLAGS="$LDFLAGS"
3085         LDFLAGS="$XLDFLAGS $LDFLAGS"
3086         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3087                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3088         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3089                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3090    
3091      
3092         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3093         unset ac_cv_lib_Xt_XtFree
3094             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3095             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3096         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3097                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3098         ])
3100     # AIX needs the motif library linked before libXt to prevent
3101     # crashes in plugins linked against Motif - Bug #98892
3102     case "${target_os}" in
3103     aix*)
3104         XT_LIBS="-lXm $XT_LIBS"
3105         ;;
3106     esac
3108     dnl ========================================================
3109     dnl = Check for XShm
3110     dnl ========================================================
3111     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3112         $XLIBS $XEXT_LIBS)
3113     AC_CHECK_HEADER(X11/extensions/XShm.h)
3114     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3115         test -n "$_HAVE_XSHM_XEXT"; then
3116         AC_DEFINE(HAVE_XSHM)
3117     fi
3119     dnl ========================================================
3120     dnl = Check for XIE
3121     dnl ========================================================
3122     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3123         $XLIBS $XEXT_LIBS)
3124     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3126     if test "$MOZ_XIE_LIBS"; then
3127         dnl ====================================================
3128         dnl = If XIE is present and is desired, turn it on
3129         dnl ====================================================
3130         case $target in
3131             *-hpux*)
3132                 ;;
3133             *)
3134                 HAVE_XIE=1
3135                 ;;
3136         esac
3137     fi
3139         LDFLAGS="$_SAVE_LDFLAGS"
3141     dnl ========================================================
3142     dnl = Check for freetype2 and its functionality
3143     dnl ========================================================
3144     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3146     if test "$_HAVE_FREETYPE2"; then
3147         _SAVE_LIBS="$LIBS"
3148         _SAVE_CFLAGS="$CFLAGS"
3149         LIBS="$LIBS $FT2_LIBS"
3150         CFLAGS="$CFLAGS $FT2_CFLAGS"
3152         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3153             ac_cv_member_FT_Bitmap_Size_y_ppem,
3154             [AC_TRY_COMPILE([#include <ft2build.h>
3155                              #include FT_FREETYPE_H],
3156                             [FT_Bitmap_Size s;
3157                              if (sizeof s.y_ppem) return 0;
3158                              return 1],
3159                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3160                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3161         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3162             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3163         else
3164             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3165         fi
3166         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3167                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3168                            [FT_Bitmap_Size structure includes y_ppem field])
3170         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3172         LIBS="$_SAVE_LIBS"
3173         CFLAGS="$_SAVE_CFLAGS"
3174     fi
3176 fi # $no_x
3178 AC_SUBST(XCFLAGS)
3179 AC_SUBST(XLDFLAGS)
3180 AC_SUBST(XLIBS)
3181 AC_SUBST(XT_LIBS)
3183 dnl ========================================================
3184 dnl = pthread support
3185 dnl = Start by checking whether the system support pthreads
3186 dnl ========================================================
3187 case "$target_os" in
3188 darwin*)
3189     USE_PTHREADS=1
3190     ;;
3192     MOZ_CHECK_PTHREADS(pthreads,
3193         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3194         MOZ_CHECK_PTHREADS(pthread,
3195             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3196             MOZ_CHECK_PTHREADS(c_r,
3197                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3198                 MOZ_CHECK_PTHREADS(c,
3199                     USE_PTHREADS=1
3200                 )
3201             )
3202         )
3203     )
3204     ;;
3205 esac
3207 dnl ========================================================
3208 dnl Check the command line for --with-pthreads 
3209 dnl ========================================================
3210 MOZ_ARG_WITH_BOOL(pthreads,
3211 [  --with-pthreads         Force use of system pthread library with NSPR ],
3212 [ if test "$USE_PTHREADS"x = x; then
3213     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3214 fi],
3215     USE_PTHREADS=
3216     _PTHREAD_LDFLAGS=
3219 dnl ========================================================
3220 dnl Do the platform specific pthread hackery
3221 dnl ========================================================
3222 if test "$USE_PTHREADS"x != x
3223 then
3224         dnl
3225         dnl See if -pthread is supported.
3226         dnl
3227         rm -f conftest*
3228         ac_cv_have_dash_pthread=no
3229         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3230         echo 'int main() { return 0; }' | cat > conftest.c
3231         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3232         if test $? -eq 0; then
3233                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3234                         ac_cv_have_dash_pthread=yes
3235                 case "$target_os" in
3236                 freebsd*)
3237 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3238                 ;;
3239                 *)
3240                             CFLAGS="$CFLAGS -pthread"
3241                             CXXFLAGS="$CXXFLAGS -pthread"
3242                 ;;
3243                 esac
3244                 fi
3245         fi
3246         rm -f conftest*
3247     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3249         dnl
3250         dnl See if -pthreads is supported.
3251         dnl
3252     ac_cv_have_dash_pthreads=no
3253     if test "$ac_cv_have_dash_pthread" = "no"; then
3254             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3255         echo 'int main() { return 0; }' | cat > conftest.c
3256             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3257         if test $? -eq 0; then
3258                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3259                             ac_cv_have_dash_pthreads=yes
3260                             CFLAGS="$CFLAGS -pthreads"
3261                             CXXFLAGS="$CXXFLAGS -pthreads"
3262                     fi
3263             fi
3264             rm -f conftest*
3265         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3266     fi
3268         case "$target" in
3269             *-*-freebsd*)
3270                         AC_DEFINE(_REENTRANT)
3271                         AC_DEFINE(_THREAD_SAFE)
3272                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3273                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3274                                 _PTHREAD_LDFLAGS="-pthread"
3275                         else
3276                                 _PTHREAD_LDFLAGS="-lc_r"
3277                         fi
3278                         ;;
3280             *-*-openbsd*|*-*-bsdi*)
3281                         AC_DEFINE(_REENTRANT)
3282                         AC_DEFINE(_THREAD_SAFE)
3283                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3284                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3285                 _PTHREAD_LDFLAGS="-pthread"
3286                         fi
3287                         ;;
3289             *-*-linux*|*-*-kfreebsd*-gnu)
3290                         AC_DEFINE(_REENTRANT) 
3291                         ;;
3293             *-*-nto*) 
3294                         AC_DEFINE(_REENTRANT) 
3295                         ;;
3297             *-aix4.3*|*-aix5*)
3298                         AC_DEFINE(_REENTRANT) 
3299                         ;;
3301             *-hpux11.*)
3302                         AC_DEFINE(_REENTRANT) 
3303                         ;;
3305             alpha*-*-osf*)
3306                         AC_DEFINE(_REENTRANT)
3307                         ;;
3309             *-*-solaris*) 
3310                         AC_DEFINE(_REENTRANT) 
3311                         if test ! "$GNU_CC"; then
3312                                 CFLAGS="$CFLAGS -mt" 
3313                                 CXXFLAGS="$CXXFLAGS -mt" 
3314                         fi
3315                         ;;
3316         esac
3317     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3320 dnl ========================================================
3321 dnl See if mmap sees writes
3322 dnl For cross compiling, just define it as no, which is a safe default
3323 dnl ========================================================
3324 AC_MSG_CHECKING(whether mmap() sees write()s)
3326 changequote(,)
3327 mmap_test_prog='
3328     #include <stdlib.h>
3329     #include <unistd.h>
3330     #include <sys/mman.h>
3331     #include <sys/types.h>
3332     #include <sys/stat.h>
3333     #include <fcntl.h>
3335     char fname[] = "conftest.file";
3336     char zbuff[1024]; /* Fractional page is probably worst case */
3338     int main() {
3339         char *map;
3340         int fd;
3341         int i;
3342         unlink(fname);
3343         fd = open(fname, O_RDWR | O_CREAT, 0660);
3344         if(fd<0) return 1;
3345         unlink(fname);
3346         write(fd, zbuff, sizeof(zbuff));
3347         lseek(fd, 0, SEEK_SET);
3348         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3349         if(map==(char*)-1) return 2;
3350         for(i=0; fname[i]; i++) {
3351             int rc = write(fd, &fname[i], 1);
3352             if(map[i]!=fname[i]) return 4;
3353         }
3354         return 0;
3355     }
3357 changequote([,])
3359 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3361 AC_MSG_RESULT("$result")
3363 if test "$result" = "no"; then
3364     AC_DEFINE(MMAP_MISSES_WRITES)
3368 dnl Checks for library functions.
3369 dnl ========================================================
3370 AC_PROG_GCC_TRADITIONAL
3371 AC_FUNC_MEMCMP
3372 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3373 AC_CHECK_FUNCS(flockfile getpagesize)
3375 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3376 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3377   AC_CHECK_FUNCS(localtime_r strtok_r)
3380 dnl check for wcrtomb/mbrtowc
3381 dnl =======================================================================
3382 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3383 AC_LANG_SAVE
3384 AC_LANG_CPLUSPLUS
3385 AC_CACHE_CHECK(for wcrtomb,
3386     ac_cv_have_wcrtomb,
3387     [AC_TRY_LINK([#include <wchar.h>],
3388                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3389                  ac_cv_have_wcrtomb="yes",
3390                  ac_cv_have_wcrtomb="no")])
3391 if test "$ac_cv_have_wcrtomb" = "yes"; then
3392     AC_DEFINE(HAVE_WCRTOMB)
3394 AC_CACHE_CHECK(for mbrtowc,
3395     ac_cv_have_mbrtowc,
3396     [AC_TRY_LINK([#include <wchar.h>],
3397                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3398                  ac_cv_have_mbrtowc="yes",
3399                  ac_cv_have_mbrtowc="no")])
3400 if test "$ac_cv_have_mbrtowc" = "yes"; then
3401     AC_DEFINE(HAVE_MBRTOWC)
3403 AC_LANG_RESTORE
3406 AC_CACHE_CHECK(
3407     [for res_ninit()],
3408     ac_cv_func_res_ninit,
3409     [AC_TRY_LINK([
3410         #ifdef linux
3411         #define _BSD_SOURCE 1
3412         #endif
3413         #include <resolv.h>
3414         ],
3415         [int foo = res_ninit(&_res);],
3416         [ac_cv_func_res_ninit=yes],
3417         [ac_cv_func_res_ninit=no])
3418     ])
3420 if test "$ac_cv_func_res_ninit" = "yes"; then
3421     AC_DEFINE(HAVE_RES_NINIT)
3422 dnl must add the link line we do something as foolish as this... dougt
3423 dnl else
3424 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3425 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3428 AC_LANG_CPLUSPLUS
3429 AC_CACHE_CHECK(
3430     [for gnu_get_libc_version()],
3431     ac_cv_func_gnu_get_libc_version,
3432     [AC_TRY_LINK([
3433         #ifdef HAVE_GNU_LIBC_VERSION_H
3434         #include <gnu/libc-version.h>
3435         #endif
3436         ],
3437         [const char *glibc_version = gnu_get_libc_version();],
3438         [ac_cv_func_gnu_get_libc_version=yes],
3439         [ac_cv_func_gnu_get_libc_version=no] 
3440         )]
3441     )
3443 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3444     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3447 case $target_os in
3448     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3449         ;;
3450     *)
3451     
3452 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3453     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3454         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3455 _SAVE_LIBS=$LIBS
3456 LIBS="$LIBS $_ICONV_LIBS"
3457 AC_CACHE_CHECK(
3458     [for iconv()],
3459     ac_cv_func_iconv,
3460     [AC_TRY_LINK([
3461         #include <stdlib.h>
3462         #include <iconv.h>
3463         ],
3464         [
3465             iconv_t h = iconv_open("", "");
3466             iconv(h, NULL, NULL, NULL, NULL);
3467             iconv_close(h);
3468         ],
3469         [ac_cv_func_iconv=yes],
3470         [ac_cv_func_iconv=no] 
3471         )]
3472     )
3473 if test "$ac_cv_func_iconv" = "yes"; then
3474     AC_DEFINE(HAVE_ICONV)
3475     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3476     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3477     LIBICONV="$_ICONV_LIBS"
3478     AC_CACHE_CHECK(
3479         [for iconv() with const input],
3480         ac_cv_func_const_iconv,
3481         [AC_TRY_COMPILE([
3482             #include <stdlib.h>
3483             #include <iconv.h>
3484             ],
3485             [
3486                 const char *input = "testing";
3487                 iconv_t h = iconv_open("", "");
3488                 iconv(h, &input, NULL, NULL, NULL);
3489                 iconv_close(h);
3490             ],
3491             [ac_cv_func_const_iconv=yes],
3492             [ac_cv_func_const_iconv=no] 
3493             )]
3494         )
3495     if test "$ac_cv_func_const_iconv" = "yes"; then
3496         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3497     fi
3499 LIBS=$_SAVE_LIBS
3501     ;;
3502 esac
3504 AM_LANGINFO_CODESET
3506 AC_LANG_C
3508 dnl **********************
3509 dnl *** va_copy checks ***
3510 dnl **********************
3511 dnl we currently check for all three va_copy possibilities, so we get
3512 dnl all results in config.log for bug reports.
3513 AC_MSG_CHECKING(for an implementation of va_copy())
3514 AC_CACHE_VAL(ac_cv_va_copy,[
3515     AC_TRY_RUN([
3516         #include <stdarg.h>
3517         void f (int i, ...) {
3518             va_list args1, args2;
3519             va_start (args1, i);
3520             va_copy (args2, args1);
3521             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3522                 exit (1);
3523             va_end (args1); va_end (args2);
3524         }
3525         int main() { f (0, 42); return 0; }],
3526         ac_cv_va_copy=yes,
3527         ac_cv_va_copy=no,
3528         ac_cv_va_copy=no
3529     )
3531 AC_MSG_RESULT($ac_cv_va_copy)
3532 AC_MSG_CHECKING(for an implementation of __va_copy())
3533 AC_CACHE_VAL(ac_cv___va_copy,[
3534     AC_TRY_RUN([
3535         #include <stdarg.h>
3536         void f (int i, ...) {
3537             va_list args1, args2;
3538             va_start (args1, i);
3539             __va_copy (args2, args1);
3540             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3541                 exit (1);
3542             va_end (args1); va_end (args2);
3543         }
3544         int main() { f (0, 42); return 0; }],
3545         ac_cv___va_copy=yes,
3546         ac_cv___va_copy=no,
3547         ac_cv___va_copy=no
3548     )
3550 AC_MSG_RESULT($ac_cv___va_copy)
3551 AC_MSG_CHECKING(whether va_lists can be copied by value)
3552 AC_CACHE_VAL(ac_cv_va_val_copy,[
3553     AC_TRY_RUN([
3554         #include <stdarg.h>
3555         void f (int i, ...) {
3556             va_list args1, args2;
3557             va_start (args1, i);
3558             args2 = args1;
3559             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3560                 exit (1);
3561             va_end (args1); va_end (args2);
3562         }
3563         int main() { f (0, 42); return 0; }],
3564         ac_cv_va_val_copy=yes,
3565         ac_cv_va_val_copy=no,
3566         ac_cv_va_val_copy=yes
3567     )
3569 if test "x$ac_cv_va_copy" = "xyes"; then
3570     AC_DEFINE(VA_COPY, va_copy)
3571     AC_DEFINE(HAVE_VA_COPY)
3572 elif test "x$ac_cv___va_copy" = "xyes"; then
3573     AC_DEFINE(VA_COPY, __va_copy)
3574     AC_DEFINE(HAVE_VA_COPY)
3577 if test "x$ac_cv_va_val_copy" = "xno"; then
3578    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3580 AC_MSG_RESULT($ac_cv_va_val_copy)
3582 dnl Check for dll-challenged libc's.
3583 dnl This check is apparently only needed for Linux.
3584 case "$target" in
3585         *-linux*)
3586             dnl ===================================================================
3587             _curdir=`pwd`
3588             export _curdir
3589             rm -rf conftest* _conftest
3590             mkdir _conftest
3591             cat >> conftest.C <<\EOF
3592 #include <stdio.h>
3593 #include <link.h>
3594 #include <dlfcn.h>
3595 #ifdef _dl_loaded
3596 void __dump_link_map(void) {
3597   struct link_map *map = _dl_loaded;
3598   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3600 int main() {
3601   dlopen("./conftest1.so",RTLD_LAZY);
3602   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3603   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3604   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3605   __dump_link_map();
3607 #else
3608 /* _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).*/
3609 int main() { printf("./conftest1.so\n"); }
3610 #endif
3613             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3615             cat >> conftest1.C <<\EOF
3616 #include <stdio.h>
3617 void foo(void) {printf("foo in dll called\n");}
3619             ${CXX-g++} -fPIC -c -g conftest1.C
3620             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3621             ${CXX-g++} -g conftest.C -o conftest -ldl
3622             cp -f conftest1.so conftest _conftest
3623             cd _conftest
3624             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3625             then
3626                 echo
3627                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3628                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3629                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3630                 echo "*** will be excessive memory usage at runtime."
3631                 echo
3632             fi
3633             cd ${_curdir}
3634             rm -rf conftest* _conftest
3635             dnl ===================================================================
3636             ;;
3637 esac
3639 dnl ===================================================================
3640 dnl ========================================================
3641 dnl By default, turn rtti and exceptions off on g++/egcs
3642 dnl ========================================================
3643 if test "$GNU_CXX"; then
3645   AC_MSG_CHECKING(for C++ exceptions flag)
3647   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3648   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3649   [echo "int main() { return 0; }" | cat > conftest.C
3651   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3653   if egrep "warning.*renamed" conftest.out >/dev/null; then
3654     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3655   else
3656     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3657   fi
3659   rm -f conftest*])
3661   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3662   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3663   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3666 dnl ========================================================
3667 dnl Put your C++ language/feature checks below
3668 dnl ========================================================
3669 AC_LANG_CPLUSPLUS
3671 HAVE_GCC3_ABI=
3672 if test "$GNU_CC"; then
3673   AC_CACHE_CHECK(for gcc 3.0 ABI,
3674       ac_cv_gcc_three_abi,
3675       [AC_TRY_COMPILE([],
3676                       [
3677 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3678   return 0;
3679 #else
3680 #error Not gcc3.
3681 #endif
3682                       ],
3683                       ac_cv_gcc_three_abi="yes",
3684                       ac_cv_gcc_three_abi="no")])
3685   if test "$ac_cv_gcc_three_abi" = "yes"; then
3686       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3687       HAVE_GCC3_ABI=1
3688   else
3689       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3690   fi
3692 AC_SUBST(HAVE_GCC3_ABI)
3695 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3696                ac_cv_cpp_explicit,
3697                [AC_TRY_COMPILE(class X {
3698                                public: explicit X(int i) : i_(i) {}
3699                                private: int i_;
3700                                };,
3701                                X x(3);,
3702                                ac_cv_cpp_explicit=yes,
3703                                ac_cv_cpp_explicit=no)])
3704 if test "$ac_cv_cpp_explicit" = yes ; then
3705    AC_DEFINE(HAVE_CPP_EXPLICIT)
3708 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3709                ac_cv_cpp_typename,
3710                [AC_TRY_COMPILE(class param {
3711                                public:
3712                                    typedef unsigned long num_type;
3713                                };
3715                                template <class T> class tplt {
3716                                public:
3717                                    typedef typename T::num_type t_num_type;
3718                                    t_num_type foo(typename T::num_type num) {
3719                                        return num;
3720                                    }
3721                                };,
3722                                tplt<param> A;
3723                                A.foo(0);,
3724                                ac_cv_cpp_typename=yes,
3725                                ac_cv_cpp_typename=no)])
3726 if test "$ac_cv_cpp_typename" = yes ; then
3727    AC_DEFINE(HAVE_CPP_TYPENAME)
3730 dnl Check for support of modern template specialization syntax
3731 dnl Test code and requirement from scc@netscape.com.
3732 dnl Autoconf cut-and-paste job by waterson@netscape.com
3733 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3734                ac_cv_cpp_modern_specialize_template_syntax,
3735                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3736                                class Y {};
3737                                template <> struct X<Y> { double a; };,
3738                                X<int> int_x;
3739                                X<Y> y_x;,
3740                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3741                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3742 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3743   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3747 dnl Some compilers support only full specialization, and some don't.
3748 AC_CACHE_CHECK(whether partial template specialization works,
3749                ac_cv_cpp_partial_specialization,
3750                [AC_TRY_COMPILE(template <class T> class Foo {};
3751                                template <class T> class Foo<T*> {};,
3752                                return 0;,
3753                                ac_cv_cpp_partial_specialization=yes,
3754                                ac_cv_cpp_partial_specialization=no)])
3755 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3756   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3759 dnl Some compilers have limited support for operators with templates;
3760 dnl specifically, it is necessary to define derived operators when a base
3761 dnl class's operator declaration should suffice.
3762 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3763                ac_cv_need_derived_template_operators,
3764                [AC_TRY_COMPILE([template <class T> class Base { };
3765                                 template <class T>
3766                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3767                                 template <class T> class Derived : public Base<T> { };],
3768                                [Derived<char> a, b;
3769                                 Base<char> c = a + b;
3770                                 return 0;],
3771                                ac_cv_need_derived_template_operators=no,
3772                                ac_cv_need_derived_template_operators=yes)])
3773 if test "$ac_cv_need_derived_template_operators" = yes ; then
3774   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3778 dnl Some compilers have trouble detecting that a template class
3779 dnl that derives from another template is actually an instance
3780 dnl of the base class. This test checks for that.
3781 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3782                ac_cv_need_cpp_template_cast_to_base,
3783                [AC_TRY_COMPILE([template <class T> class Base { };
3784                                 template <class T> class Derived : public Base<T> { };
3785                                 template <class T> int foo(const Base<T>&) { return 0; }],
3786                                [Derived<char> bar; return foo(bar);],
3787                                ac_cv_need_cpp_template_cast_to_base=no,
3788                                ac_cv_need_cpp_template_cast_to_base=yes)])
3789 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3790   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3793 dnl Some compilers have trouble resolving the ambiguity between two
3794 dnl functions whose arguments differ only by cv-qualifications.
3795 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3796                ac_cv_can_resolve_const_ambiguity,
3797                [AC_TRY_COMPILE([
3798                                 template <class T> class ptrClass {
3799                                   public: T* ptr;
3800                                 };
3802                                 template <class T> T* a(ptrClass<T> *arg) {
3803                                   return arg->ptr;
3804                                 }
3806                                 template <class T>
3807                                 const T* a(const ptrClass<T> *arg) {
3808                                   return arg->ptr;
3809                                 }
3810                                ],
3811                                [ ptrClass<int> i;
3812                                  a(&i); ],
3813                                ac_cv_can_resolve_const_ambiguity=yes,
3814                                ac_cv_can_resolve_const_ambiguity=no)])
3815 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3816   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3820 dnl We don't do exceptions on unix.  The only reason this used to be here
3821 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3822 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3823 dnl So im commenting this out until someone writes some artificial 
3824 dnl intelligence to detect not only if the compiler has exceptions, but if 
3825 dnl they are enabled as well.
3826 dnl 
3827 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3828 dnl                ac_cv_cpp_exceptions,
3829 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3830 dnl                                static void F() { throw X(); },
3831 dnl                                try { F(); } catch(X & e) { },
3832 dnl                                ac_cv_cpp_exceptions=yes,
3833 dnl                                ac_cv_cpp_exceptions=no)])
3834 dnl if test $ac_cv_cpp_exceptions = yes ; then
3835 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3836 dnl fi
3838 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3839 dnl supports it well enough to allow us to use it to change access, but not
3840 dnl to resolve ambiguity. The next two tests determine how well the |using|
3841 dnl keyword is supported.
3843 dnl Check to see if we can change access with |using|.  Test both a
3844 dnl legal and an illegal example.
3845 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3846                ac_cv_cpp_access_changing_using2,
3847                [AC_TRY_COMPILE(
3848                    class A { protected: int foo() { return 0; } };
3849                    class B : public A { public: using A::foo; };,
3850                    B b; return b.foo();,
3851                    [AC_TRY_COMPILE(
3852                        class A { public: int foo() { return 1; } };
3853                        class B : public A { private: using A::foo; };,
3854                        B b; return b.foo();,
3855                        ac_cv_cpp_access_changing_using2=no,
3856                        ac_cv_cpp_access_changing_using2=yes)],
3857                    ac_cv_cpp_access_changing_using2=no)])
3858 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3859    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3862 dnl Check to see if we can resolve ambiguity with |using|.
3863 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3864                ac_cv_cpp_ambiguity_resolving_using,
3865                [AC_TRY_COMPILE(class X { 
3866                                  public: int go(const X&) {return 3;}
3867                                          int jo(const X&) {return 3;}
3868                                };
3869                                class Y : public X {
3870                                  public:  int go(int) {return 2;}
3871                                           int jo(int) {return 2;}
3872                                           using X::jo;
3873                                  private: using X::go;
3874                                };,
3875                                X x; Y y; y.jo(x);,
3876                                ac_cv_cpp_ambiguity_resolving_using=yes,
3877                                ac_cv_cpp_ambiguity_resolving_using=no)])
3878 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3879    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3882 dnl Check to see if the |std| namespace is supported. If so, we'll want
3883 dnl to qualify any standard library calls with "std::" to ensure that
3884 dnl those functions can be resolved.
3885 AC_CACHE_CHECK(for \"std::\" namespace,
3886                ac_cv_cpp_namespace_std,
3887                [AC_TRY_COMPILE([#include <algorithm>],
3888                                [return std::min(0, 1);],
3889                                ac_cv_cpp_namespace_std=yes,
3890                                ac_cv_cpp_namespace_std=no)])
3891 if test "$ac_cv_cpp_namespace_std" = yes ; then
3892    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3895 dnl Older compilers are overly ambitious with respect to using the standard
3896 dnl template library's |operator!=()| when |operator==()| is defined. In
3897 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3898 dnl ambiguity at compile-time. This test checks for that case.
3899 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3900                ac_cv_cpp_unambiguous_std_notequal,
3901                [AC_TRY_COMPILE([#include <algorithm>
3902                                 struct T1 {};
3903                                 int operator==(const T1&, const T1&) { return 0; }
3904                                 int operator!=(const T1&, const T1&) { return 0; }],
3905                                [T1 a,b; return a != b;],
3906                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3907                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3908 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3909   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3913 AC_CACHE_CHECK(for C++ reinterpret_cast,
3914                ac_cv_cpp_reinterpret_cast,
3915                [AC_TRY_COMPILE(struct X { int i; };
3916                                struct Y { int i; };,
3917                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3918                                ac_cv_cpp_reinterpret_cast=yes,
3919                                ac_cv_cpp_reinterpret_cast=no)])
3920 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3921    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3924 dnl See if a dynamic_cast to void* gives the most derived object.
3925 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3926                ac_cv_cpp_dynamic_cast_void_ptr,
3927                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3928                             class Y { int j; public: virtual ~Y() { } };
3929                             class Z : public X, public Y { int k; };
3931                             int main() {
3932                                  Z mdo;
3933                                  X *subx = (X*)&mdo;
3934                                  Y *suby = (Y*)&mdo;
3935                                  return !((((void*)&mdo != (void*)subx) &&
3936                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3937                                           (((void*)&mdo != (void*)suby) &&
3938                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3939                             }],
3940                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3941                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3942                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3943 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3944    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3948 dnl note that this one is reversed - if the test fails, then
3949 dnl we require implementations of unused virtual methods. Which
3950 dnl really blows because it means we'll have useless vtable
3951 dnl bloat.
3952 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3953                ac_cv_cpp_unused_required,
3954                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3955                                X x;,
3956                                ac_cv_cpp_unused_required=no,
3957                                ac_cv_cpp_unused_required=yes)])
3958 if test "$ac_cv_cpp_unused_required" = yes ; then
3959    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3963 dnl Some compilers have trouble comparing a constant reference to a templatized
3964 dnl class to zero, and require an explicit operator==() to be defined that takes
3965 dnl an int. This test separates the strong from the weak.
3967 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3968                ac_cv_trouble_comparing_to_zero,
3969                [AC_TRY_COMPILE([#include <algorithm>
3970                                 template <class T> class Foo {};
3971                                 class T2;
3972                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3973                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3974                                [Foo<int> f; return (0 != f);],
3975                                ac_cv_trouble_comparing_to_zero=no,
3976                                ac_cv_trouble_comparing_to_zero=yes)])
3977 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3978   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3983 dnl End of C++ language/feature checks
3984 AC_LANG_C
3986 dnl ========================================================
3987 dnl =  Internationalization checks
3988 dnl ========================================================
3990 dnl Internationalization and Locale support is different
3991 dnl on various UNIX platforms.  Checks for specific i18n
3992 dnl features go here.
3994 dnl check for LC_MESSAGES
3995 AC_CACHE_CHECK(for LC_MESSAGES,
3996                 ac_cv_i18n_lc_messages,
3997                 [AC_TRY_COMPILE([#include <locale.h>],
3998                                 [int category = LC_MESSAGES;],
3999                                 ac_cv_i18n_lc_messages=yes,
4000                                 ac_cv_i18n_lc_messages=no)])
4001 if test "$ac_cv_i18n_lc_messages" = yes; then
4002    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4003 fi      
4005 fi # SKIP_COMPILER_CHECKS
4007 TARGET_XPCOM_ABI=
4008 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4009     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4012 dnl Mozilla specific options
4013 dnl ========================================================
4014 dnl The macros used for command line options
4015 dnl are defined in build/autoconf/altoptions.m4.
4018 dnl ========================================================
4019 dnl =
4020 dnl = Check for external package dependencies
4021 dnl =
4022 dnl ========================================================
4023 MOZ_ARG_HEADER(External Packages)
4025 MOZ_ENABLE_LIBXUL=
4027 MOZ_ARG_WITH_STRING(libxul-sdk,
4028 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4029   LIBXUL_SDK_DIR=$withval)
4031 if test "$LIBXUL_SDK_DIR" = "yes"; then
4032     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4033 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4034     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4036     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
4037         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
4038     fi
4040     MOZ_ENABLE_LIBXUL=1
4042 AC_SUBST(LIBXUL_SDK)
4044 if test -n "$LIBXUL_SDK"; then
4045     LIBXUL_DIST="$LIBXUL_SDK"
4046 else
4047     LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4049 AC_SUBST(LIBXUL_DIST)
4051 dnl ========================================================
4052 dnl = If NSPR was not detected in the system, 
4053 dnl = use the one in the source tree (mozilla/nsprpub)
4054 dnl ========================================================
4055 MOZ_ARG_WITH_BOOL(system-nspr,
4056 [  --with-system-nspr      Use system installed NSPR],
4057     _USE_SYSTEM_NSPR=1 )
4059 if test -n "$_USE_SYSTEM_NSPR"; then
4060     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4063 if test -n "$MOZ_NATIVE_NSPR"; then
4064     _SAVE_CFLAGS=$CFLAGS
4065     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4066     AC_TRY_COMPILE([#include "prlog.h"],
4067                 [#ifndef PR_STATIC_ASSERT
4068                  #error PR_STATIC_ASSERT not defined
4069                  #endif],
4070                 [MOZ_NATIVE_NSPR=1],
4071                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4072     CFLAGS=$_SAVE_CFLAGS
4073 else
4074     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4075     # explicitly set libs for Visual Age C++ for OS/2
4076     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
4077         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}"
4078     elif test "$OS_ARCH" = "WINCE"; then
4079         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4080         NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4081     elif test "$OS_ARCH" = "WINNT"; then
4082         NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4083         if test -n "$GNU_CC"; then
4084             NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4085         else
4086             NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4087         fi
4088     else
4089         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4090     fi
4093 dnl ========================================================
4094 dnl = If NSS was not detected in the system, 
4095 dnl = use the one in the source tree (mozilla/security/nss)
4096 dnl ========================================================
4098 MOZ_ARG_WITH_BOOL(system-nss,
4099 [  --with-system-nss      Use system installed NSS],
4100     _USE_SYSTEM_NSS=1 )
4102 if test -n "$_USE_SYSTEM_NSS"; then
4103     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4106 if test -n "$MOZ_NATIVE_NSS"; then
4107    NSS_LIBS="$NSS_LIBS -lcrmf"
4108 else
4109    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4110    NSS_DEP_LIBS="\
4111         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4112         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4113         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4114         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4115         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4116         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4118    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4119        NSS_LIBS="\
4120         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4121         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4122         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4123         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4124         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4125         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4126    else
4127        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4128    fi
4131 if test -z "$SKIP_LIBRARY_CHECKS"; then
4132 dnl system JPEG support
4133 dnl ========================================================
4134 MOZ_ARG_WITH_STRING(system-jpeg,
4135 [  --with-system-jpeg[=PFX]
4136                           Use system libjpeg [installed at prefix PFX]],
4137     JPEG_DIR=$withval)
4139 _SAVE_CFLAGS=$CFLAGS
4140 _SAVE_LDFLAGS=$LDFLAGS
4141 _SAVE_LIBS=$LIBS
4142 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4143     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4144     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4146 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4147     SYSTEM_JPEG=
4148 else
4149     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4152 if test "$SYSTEM_JPEG" = 1; then
4153     LIBS="$JPEG_LIBS $LIBS"
4154     AC_TRY_COMPILE([ #include <stdio.h>
4155                      #include <sys/types.h>
4156                      #include <jpeglib.h> ],
4157                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4158                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4159                      #endif ],
4160                    SYSTEM_JPEG=1,
4161                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4162 fi 
4163 CFLAGS=$_SAVE_CFLAGS
4164 LDFLAGS=$_SAVE_LDFLAGS
4165 LIBS=$_SAVE_LIBS
4167 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4168     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4169     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4172 dnl system ZLIB support
4173 dnl ========================================================
4174 MOZ_ARG_WITH_STRING(system-zlib,
4175 [  --with-system-zlib[=PFX]
4176                           Use system libz [installed at prefix PFX]],
4177     ZLIB_DIR=$withval)
4179 _SAVE_CFLAGS=$CFLAGS
4180 _SAVE_LDFLAGS=$LDFLAGS
4181 _SAVE_LIBS=$LIBS
4182 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4183     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4184     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4186 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4187     SYSTEM_ZLIB=
4188 else
4189     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4190         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4192 if test "$SYSTEM_ZLIB" = 1; then
4193     LIBS="$ZLIB_LIBS $LIBS"
4194     AC_TRY_COMPILE([ #include <stdio.h>
4195                      #include <string.h>
4196                      #include <zlib.h> ],
4197                    [ #if ZLIB_VERNUM < $MOZZLIB 
4198                      #error "Insufficient zlib version ($MOZZLIB required)."
4199                      #endif ],
4200                    SYSTEM_ZLIB=1,
4201                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4203 CFLAGS=$_SAVE_CFLAGS
4204 LDFLAGS=$_SAVE_LDFLAGS
4205 LIBS=$_SAVE_LIBS
4207 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4208     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4209     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4212 dnl system BZIP2 Support
4213 dnl ========================================================
4214 MOZ_ARG_WITH_STRING(system-bz2,
4215 [  --with-system-bz2[=PFX]
4216                           Use system libbz2 [installed at prefix PFX]],
4217     BZ2_DIR=$withval)
4219 _SAVE_CFLAGS=$CFLAGS
4220 _SAVE_LDFLAGS=$LDFLAGS
4221 _SAVE_LIBS=$LIBS
4222 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4223     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4224     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4226 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4227     SYSTEM_BZ2=
4228 else
4229     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4230         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4232 CFLAGS=$_SAVE_CFLAGS
4233 LDFLAGS=$_SAVE_LDFLAGS
4234 LIBS=$_SAVE_LIBS
4236 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4237     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4238     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4241 dnl system PNG Support
4242 dnl ========================================================
4243 MOZ_ARG_WITH_STRING(system-png, 
4244 [  --with-system-png[=PFX]
4245                           Use system libpng [installed at prefix PFX]],
4246     PNG_DIR=$withval)
4248 _SAVE_CFLAGS=$CFLAGS
4249 _SAVE_LDFLAGS=$LDFLAGS
4250 _SAVE_LIBS=$LIBS
4251 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4252 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4253 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4254     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4255     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4257 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4258     SYSTEM_PNG=
4259 else
4260     _SAVE_PNG_LIBS=$PNG_LIBS
4261     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4262                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4263                  $PNG_LIBS)
4264     AC_CHECK_LIB(png, png_get_acTL, ,
4265                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4266                  $_SAVE_PNG_LIBS)
4268 if test "$SYSTEM_PNG" = 1; then
4269     LIBS="$PNG_LIBS $LIBS"
4270     AC_TRY_COMPILE([ #include <stdio.h>
4271                      #include <sys/types.h>
4272                      #include <png.h> ],
4273                    [ #if PNG_LIBPNG_VER < $MOZPNG
4274                      #error "Insufficient libpng version ($MOZPNG required)."
4275                      #endif
4276                      #ifndef PNG_UINT_31_MAX
4277                      #error "Insufficient libpng version."
4278                      #endif ],
4279                    SYSTEM_PNG=1,
4280                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4282 CFLAGS=$_SAVE_CFLAGS
4283 LDFLAGS=$_SAVE_LDFLAGS
4284 LIBS=$_SAVE_LIBS
4286 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4287     PNG_CFLAGS="-I${PNG_DIR}/include"
4288     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4291 fi # SKIP_LIBRARY_CHECKS
4293 dnl system HunSpell Support
4294 dnl ========================================================
4295 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4296 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4297     SYSTEM_HUNSPELL=1 )
4299 if test -n "$SYSTEM_HUNSPELL"; then
4300     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4303 AC_SUBST(SYSTEM_HUNSPELL)
4305 dnl check whether to enable glitz
4306 dnl ========================================================
4307 MOZ_ARG_ENABLE_BOOL(glitz,
4308 [  --enable-glitz          Enable Glitz for use with Cairo],
4309     MOZ_ENABLE_GLITZ=1,
4310     MOZ_ENABLE_GLITZ= )
4311 if test "$MOZ_ENABLE_GLITZ"; then
4312     AC_DEFINE(MOZ_ENABLE_GLITZ)
4315 dnl ========================================================
4316 dnl Java SDK support
4317 dnl ========================================================
4318 JAVA_INCLUDE_PATH=
4319 MOZ_ARG_WITH_STRING(java-include-path,
4320 [  --with-java-include-path=dir   Location of Java SDK headers],
4321     JAVA_INCLUDE_PATH=$withval)
4323 JAVA_BIN_PATH=
4324 MOZ_ARG_WITH_STRING(java-bin-path,
4325 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4326     JAVA_BIN_PATH=$withval)
4328 dnl ========================================================
4329 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4330 dnl their usage and use them in spidermonkey.
4331 dnl ========================================================
4332 MOZ_ARG_WITH_BOOL(arm-kuser,
4333 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4334     USE_ARM_KUSER=1,
4335     USE_ARM_KUSER=)
4336 if test -n "$USE_ARM_KUSER"; then
4337    AC_DEFINE(USE_ARM_KUSER)
4340 dnl ========================================================
4341 dnl =
4342 dnl = Application
4343 dnl =
4344 dnl ========================================================
4346 MOZ_ARG_HEADER(Application)
4348 BUILD_STATIC_LIBS=
4349 ENABLE_TESTS=1
4350 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4351 MOZ_BRANDING_DIRECTORY=
4352 MOZ_DBGRINFO_MODULES=
4353 MOZ_ENABLE_CANVAS=1
4354 MOZ_EXTENSIONS_ALL=" wallet p3p venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4355 MOZ_FEEDS=1
4356 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4357 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4358 MOZ_IPCD=
4359 MOZ_JAVAXPCOM=
4360 MOZ_JSDEBUGGER=1
4361 MOZ_JSLOADER=1
4362 MOZ_LIBART_CFLAGS=
4363 MOZ_LIBART_LIBS=
4364 MOZ_MATHML=1
4365 MOZ_MORK=1
4366 MOZ_MORKREADER=
4367 MOZ_AUTH_EXTENSION=1
4368 MOZ_NO_ACTIVEX_SUPPORT=1
4369 MOZ_NO_INSPECTOR_APIS=
4370 MOZ_NO_XPCOM_OBSOLETE=
4371 MOZ_NO_FAST_LOAD=
4372 MOZ_OGG=1
4373 MOZ_MEDIA=
4374 MOZ_OJI=1
4375 MOZ_PERMISSIONS=1
4376 MOZ_PLACES=
4377 MOZ_PLAINTEXT_EDITOR_ONLY=
4378 MOZ_PLUGINS=1
4379 MOZ_PREF_EXTENSIONS=1
4380 MOZ_PROFILELOCKING=1
4381 MOZ_PROFILESHARING=1
4382 MOZ_PSM=1
4383 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4384 MOZ_PYTHON=
4385 MOZ_PYTHON_DEBUG_SUFFIX=
4386 MOZ_PYTHON_DLL_SUFFIX=
4387 MOZ_PYTHON_INCLUDES=
4388 MOZ_PYTHON_LIBS=
4389 MOZ_PYTHON_PREFIX=
4390 MOZ_PYTHON_VER=
4391 MOZ_PYTHON_VER_DOTTED=
4392 MOZ_RDF=1
4393 MOZ_REFLOW_PERF=
4394 MOZ_SAFE_BROWSING=
4395 MOZ_HELP_VIEWER=
4396 MOZ_SPELLCHECK=1
4397 MOZ_STATIC_MAIL_BUILD=
4398 MOZ_STORAGE=1
4399 MOZ_SVG=1
4400 MOZ_TIMELINE=
4401 MOZ_UI_LOCALE=en-US
4402 MOZ_UNIVERSALCHARDET=1
4403 MOZ_URL_CLASSIFIER=
4404 MOZ_USE_NATIVE_UCONV=
4405 MOZ_V1_STRING_ABI=
4406 MOZ_VIEW_SOURCE=1
4407 MOZ_XPFE_COMPONENTS=1
4408 MOZ_XPINSTALL=1
4409 MOZ_XSLT_STANDALONE=
4410 MOZ_XTF=1
4411 MOZ_XUL=1
4412 MOZ_XUL_APP=1
4413 MOZ_ZIPWRITER=1
4414 NS_PRINTING=1
4415 NECKO_COOKIES=1
4416 NECKO_DISK_CACHE=1
4417 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4418 NECKO_SMALL_BUFFERS=
4419 JS_STATIC_BUILD=
4420 XPC_IDISPATCH_SUPPORT=
4423 case "$target_os" in
4424 darwin*)
4425     ACCESSIBILITY=
4426     ;;
4428     ACCESSIBILITY=1
4429     ;;
4430 esac
4432 case "$target_os" in
4433     msvc*|mks*|cygwin*|mingw*)
4434         if test -z "$GNU_CC"; then 
4435             XPC_IDISPATCH_SUPPORT=1
4436             MOZ_NO_ACTIVEX_SUPPORT=
4437             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4438         fi
4439         ;;
4440 esac
4442 MOZ_ARG_ENABLE_STRING(application,
4443 [  --enable-application=APP
4444                           Options include:
4445                             browser (Firefox)
4446                             xulrunner
4447                             content/xslt (Standalone Transformiix XSLT)
4448                             netwerk (Standalone Necko)
4449                             tools/update-packaging (AUS-related packaging tools)
4450                             standalone (use this for standalone
4451                               xpcom/xpconnect or to manually drive a build)],
4452 [ MOZ_BUILD_APP=$enableval ] )
4454 MOZ_EMBEDDING_PROFILE=default
4455 MOZ_ARG_WITH_STRING(embedding-profile,
4456 [  --with-embedding-profile=default|basic|minimal
4457                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4458 [ MOZ_EMBEDDING_PROFILE=$withval ])
4460 case "$MOZ_EMBEDDING_PROFILE" in
4461 default)
4462   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4463   MOZ_EMBEDDING_LEVEL_BASIC=1
4464   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4465   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4466   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4467   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4468   ;;
4470 basic)
4471   MOZ_EMBEDDING_LEVEL_DEFAULT=
4472   MOZ_EMBEDDING_LEVEL_BASIC=1
4473   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4474   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4475   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4476   ENABLE_TESTS=
4477   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4478   MOZ_ENABLE_CANVAS=
4479   MOZ_ENABLE_POSTSCRIPT=
4480   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4481   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4482   MOZ_IMG_ENCODERS_DEFAULT=
4483   MOZ_IMG_ENCODERS=
4484   MOZ_INSTALLER=
4485   MOZ_JSDEBUGGER=
4486   MOZ_MATHML=
4487   MOZ_AUTH_EXTENSION=
4488   MOZ_NO_ACTIVEX_SUPPORT=1
4489   MOZ_NO_INSPECTOR_APIS=1
4490   MOZ_NO_XPCOM_OBSOLETE=1
4491   MOZ_NO_FAST_LOAD=1
4492   MOZ_OJI=
4493   MOZ_PLAINTEXT_EDITOR_ONLY=1
4494 #  MOZ_PLUGINS=
4495   MOZ_PREF_EXTENSIONS=
4496   MOZ_PROFILELOCKING=
4497   MOZ_PROFILESHARING=
4498   MOZ_SPELLCHECK=
4499   MOZ_SVG=
4500   MOZ_UNIVERSALCHARDET=
4501   MOZ_UPDATER=
4502   MOZ_USE_NATIVE_UCONV=
4503   MOZ_VIEW_SOURCE=
4504   MOZ_XPFE_COMPONENTS=
4505   MOZ_XPINSTALL=
4506   MOZ_XTF=
4507   MOZ_ZIPWRITER=
4508   NECKO_DISK_CACHE=
4509   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4510   NECKO_SMALL_BUFFERS=1
4511   NS_DISABLE_LOGGING=1
4512   NS_PRINTING=
4513   JS_STATIC_BUILD=1
4514   ;;
4516 minimal)
4517   MOZ_EMBEDDING_LEVEL_DEFAULT=
4518   MOZ_EMBEDDING_LEVEL_BASIC=
4519   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4520   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4521   ENABLE_TESTS=
4522   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4523   MOZ_ENABLE_CANVAS=
4524   MOZ_ENABLE_POSTSCRIPT=
4525   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4526   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4527   MOZ_IMG_ENCODERS_DEFAULT=
4528   MOZ_IMG_ENCODERS=
4529   MOZ_INSTALLER=
4530   MOZ_JSDEBUGGER=
4531   MOZ_MATHML=
4532   MOZ_AUTH_EXTENSION=
4533   MOZ_NO_ACTIVEX_SUPPORT=1
4534   MOZ_NO_INSPECTOR_APIS=1
4535   MOZ_NO_XPCOM_OBSOLETE=1
4536   MOZ_NO_FAST_LOAD=1
4537   MOZ_OJI=
4538   MOZ_PLAINTEXT_EDITOR_ONLY=1
4539   MOZ_PLUGINS=
4540   MOZ_PREF_EXTENSIONS=
4541   MOZ_PROFILELOCKING=
4542   MOZ_PROFILESHARING=
4543   MOZ_SPELLCHECK=
4544   MOZ_STORAGE=1
4545   MOZ_PLACES=
4546   MOZ_SVG=
4547   MOZ_UNIVERSALCHARDET=
4548   MOZ_UPDATER=
4549   MOZ_USE_NATIVE_UCONV=1
4550   MOZ_VIEW_SOURCE=
4551   MOZ_XPFE_COMPONENTS=
4552   MOZ_XPINSTALL=
4553   MOZ_XTF=
4554   MOZ_XUL=
4555   MOZ_ZIPWRITER=
4556   MOZ_RDF=
4557   NECKO_DISK_CACHE=
4558   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4559   NECKO_SMALL_BUFFERS=1
4560   NS_DISABLE_LOGGING=1
4561   NS_PRINTING=
4562   JS_STATIC_BUILD=1
4563   ;;
4566   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4567   ;;
4568 esac
4570 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4571 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4572 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4574 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4575 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4576   XULRUNNER_STUB_NAME=$withval)
4578 if test -z "$XULRUNNER_STUB_NAME"; then
4579   case "$target_os" in
4580   darwin*)
4581     XULRUNNER_STUB_NAME=xulrunner
4582     ;;
4583   *)
4584     XULRUNNER_STUB_NAME=xulrunner-stub
4585   esac
4587 AC_SUBST(XULRUNNER_STUB_NAME)
4589 if test -z "$MOZ_BUILD_APP"; then
4590   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4591 else
4592   # We have a valid application only if it has a build.mk file in its top
4593   # directory.
4594   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4595     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4596   fi
4599 # Allow the application to influence configure with a confvars.sh script.
4601 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4602 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4603   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4604   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4605 else
4606   AC_MSG_RESULT([no])
4609 # Now is a good time to test for logic errors, define mismatches, etc.
4610 case "$MOZ_BUILD_APP" in
4611 xulrunner)
4612   if test "$LIBXUL_SDK"; then
4613     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4614   fi
4615   ;;
4617   # Fix this case for folks who forget. Warn them.
4618   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4619     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4620     MOZ_XUL_APP=1
4621   fi
4622   ;;
4623 esac
4625 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4626 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4627 # MOZ_BUILD_APP.
4628 case "$MOZ_BUILD_APP" in
4629 browser)
4630   AC_DEFINE(MOZ_PHOENIX)
4631   ;;
4633 xulrunner)
4634   AC_DEFINE(MOZ_XULRUNNER)
4635   ;;
4637 content/xslt)
4638   AC_DEFINE(TX_EXE)
4639   ;;
4641 standalone) 
4642   MOZ_APP_NAME=mozilla
4643   MOZ_APP_DISPLAYNAME=Mozilla
4644   MOZ_APP_VERSION=$MOZILLA_VERSION
4645   ;;
4647 esac
4649 if test -z "$MOZ_XUL_APP"; then
4650         AC_MSG_ERROR([builds with unsetting MOZ_XUL_APP in confvars.sh are not supported.])
4653 AC_SUBST(MOZ_BUILD_APP)
4654 AC_SUBST(MOZ_XUL_APP)
4655 AC_SUBST(MOZ_PHOENIX)
4656 AC_SUBST(MOZ_XULRUNNER)
4658 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4660 if test "$MOZ_XUL_APP"; then
4661   MOZ_PROFILESHARING=
4662   AC_DEFINE(MOZ_XUL_APP)
4665 dnl ========================================================
4666 dnl = 
4667 dnl = Toolkit Options
4668 dnl = 
4669 dnl ========================================================
4670 MOZ_ARG_HEADER(Toolkit Options)
4672     dnl ========================================================
4673     dnl = Select the default toolkit
4674     dnl ========================================================
4675         MOZ_ARG_ENABLE_STRING(default-toolkit,
4676         [  --enable-default-toolkit=TK
4677                           Select default toolkit
4678                           Platform specific defaults:
4679                             BeOS - cairo-beos
4680                             Mac OS X - cairo-cocoa
4681                             Neutrino/QNX - photon
4682                             OS/2 - cairo-os2
4683                             Win32 - cairo-windows
4684                             WinCE - windows
4685                             Gtk2 with DirectFB - cairo-gtk2-dfb
4686                             * - cairo-gtk2
4687                             * - cairo-qt],
4688     [ _DEFAULT_TOOLKIT=$enableval ],
4689     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4691     if test "$_DEFAULT_TOOLKIT" = "photon" \
4692         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4693         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4694         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4695         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4696         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4697         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4698         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4699         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4700         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4701     then
4702         dnl nglayout only supports building with one toolkit,
4703         dnl so ignore everything after the first comma (",").
4704         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4705     else
4706         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4707     fi
4709 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4711 dnl ========================================================
4712 dnl = Enable the toolkit as needed                         =
4713 dnl ========================================================
4715 case "$MOZ_WIDGET_TOOLKIT" in
4716 photon)
4717         MOZ_ENABLE_PHOTON=1
4718         AC_DEFINE(MOZ_WIDGET_PHOTON)
4719     ;;
4721 cairo-windows)
4722     MOZ_WIDGET_TOOLKIT=windows
4723     MOZ_GFX_TOOLKIT=cairo
4724     ;;
4726 cairo-gtk2|cairo-gtk2-x11)
4727     MOZ_WIDGET_TOOLKIT=gtk2
4728     MOZ_GFX_TOOLKIT=cairo
4729     MOZ_ENABLE_GTK2=1
4730     MOZ_ENABLE_XREMOTE=1
4732     AC_DEFINE(MOZ_X11)
4733     MOZ_X11=1
4735     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4736     TK_LIBS='$(MOZ_GTK2_LIBS)'
4737     AC_DEFINE(MOZ_WIDGET_GTK2)
4738     ;;
4740 cairo-gtk2-dfb)
4741     MOZ_WIDGET_TOOLKIT=gtk2
4742     MOZ_GFX_TOOLKIT=cairo
4743     MOZ_ENABLE_GTK2=1
4745     AC_DEFINE(MOZ_DFB)
4746     MOZ_DFB=1
4748     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4749     TK_LIBS='$(MOZ_GTK2_LIBS)'
4750     AC_DEFINE(MOZ_WIDGET_GTK2)
4751     if test "$no_x" != "yes"; then
4752         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4753         no_x=yes
4754     fi
4755     ;;
4757 cairo-qt)
4758     MOZ_WIDGET_TOOLKIT=qt
4759     MOZ_GFX_TOOLKIT=cairo
4760     MOZ_ENABLE_QT=1
4761     MOZ_ENABLE_XREMOTE=1
4763     AC_DEFINE(MOZ_X11)
4764     MOZ_X11=1
4766     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4767     TK_LIBS='$(MOZ_QT_LIBS)'
4768     AC_DEFINE(MOZ_WIDGET_QT)
4769     ;;
4771 cairo-beos)
4772     MOZ_WIDGET_TOOLKIT=beos
4773     MOZ_GFX_TOOLKIT=cairo
4774     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4775     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4776     ;;
4778 cairo-os2)
4779     MOZ_WIDGET_TOOLKIT=os2
4780     MOZ_GFX_TOOLKIT=cairo
4781     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4782     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4783     ;;
4785 cairo-mac|cairo-cocoa)
4786     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4787         MOZ_WIDGET_TOOLKIT=cocoa
4788         AC_DEFINE(MOZ_WIDGET_COCOA)
4789         MOZ_ENABLE_COCOA=1
4790     else
4791         MOZ_WIDGET_TOOLKIT=mac
4792     fi
4793     MOZ_GFX_TOOLKIT=cairo
4794     MOZ_USER_DIR="Mozilla"
4795     AC_DEFINE(XP_MACOSX)
4796     AC_DEFINE(TARGET_CARBON)
4797     AC_DEFINE(TARGET_API_MAC_CARBON)
4798     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4799     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4800     CFLAGS="$CFLAGS $TK_CFLAGS"
4801     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4802     ;;
4803 esac
4805 if test "$MOZ_ENABLE_XREMOTE"; then
4806     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4809 if test "$COMPILE_ENVIRONMENT"; then
4810   if test "$MOZ_ENABLE_GTK2"; then
4811     if test "$MOZ_X11"; then
4812       GDK_PACKAGES=gdk-x11-2.0
4813     elif test "$MOZ_DFB"; then
4814       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4815       GDK_PACKAGES=directfb
4816     fi
4818     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4819   fi
4821 fi # COMPILE_ENVIRONMENT
4823 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4825 dnl ========================================================
4826 dnl = startup-notification support module
4827 dnl ========================================================
4829 if test "$MOZ_ENABLE_GTK2"
4830 then
4831     MOZ_ENABLE_STARTUP_NOTIFICATION=
4833     MOZ_ARG_ENABLE_BOOL(startup-notification,
4834     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4835         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4836         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4837     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4838     then
4839         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4840                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4841         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4842             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4843             then
4844                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4845             fi
4846             MOZ_ENABLE_STARTUP_NOTIFICATION=
4847         ])
4848     fi
4850     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4851         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4852     fi
4854     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4856 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4857 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4858 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4860 dnl ========================================================
4861 dnl = QT support
4862 dnl ========================================================
4863 if test "$MOZ_ENABLE_QT"
4864 then
4865     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4866     AC_SUBST(MOZ_QT_CFLAGS)
4867     AC_SUBST(MOZ_QT_LIBS)
4869     MOZ_ARG_WITH_STRING(qtdir,
4870     [  --with-qtdir=\$dir       Specify Qt directory ],
4871     [ QTDIR=$withval])
4873     if test -z "$QTDIR"; then
4874       QTDIR="/usr"
4875     fi
4876     QTINCDIR="/include/qt"
4877     if test ! -d "$QTDIR$QTINCDIR"; then
4878        QTINCDIR="/include/X11/qt"
4879     fi
4880     if test ! -d "$QTDIR$QTINCDIR"; then
4881        QTINCDIR="/include"
4882     fi
4884     if test -x "$QTDIR/bin/moc-qt4"; then
4885       HOST_MOC="$QTDIR/bin/moc-qt4"
4886     else
4887       if test -x "$QTDIR/bin/moc"; then
4888         HOST_MOC="$QTDIR/bin/moc"
4889       else
4890         AC_CHECK_PROGS(HOST_MOC, moc, "")
4891       fi
4892     fi
4893     if test -z "$HOST_MOC"; then
4894       AC_MSG_ERROR([no acceptable moc preprocessor found])
4895     fi
4896     MOC=$HOST_MOC
4899 AC_SUBST(GTK_CONFIG)
4900 AC_SUBST(TK_CFLAGS)
4901 AC_SUBST(TK_LIBS)
4903 AC_SUBST(MOZ_ENABLE_GTK2)
4904 AC_SUBST(MOZ_ENABLE_PHOTON)
4905 AC_SUBST(MOZ_ENABLE_COCOA)
4906 AC_SUBST(MOZ_ENABLE_GLITZ)
4907 AC_SUBST(MOZ_ENABLE_QT)
4908 AC_SUBST(MOZ_ENABLE_XREMOTE)
4909 AC_SUBST(MOZ_GTK2_CFLAGS)
4910 AC_SUBST(MOZ_GTK2_LIBS)
4911 AC_SUBST(MOZ_QT_CFLAGS)
4912 AC_SUBST(MOZ_QT_LIBS)
4914 AC_SUBST(MOC)
4916 AC_SUBST(MOZ_DFB)
4917 AC_SUBST(MOZ_X11)
4919 dnl ========================================================
4920 dnl =
4921 dnl = Components & Features
4922 dnl = 
4923 dnl ========================================================
4924 MOZ_ARG_HEADER(Components and Features)
4926 dnl ========================================================
4927 dnl = Localization
4928 dnl ========================================================
4929 MOZ_ARG_ENABLE_STRING(ui-locale,
4930 [  --enable-ui-locale=ab-CD
4931                           Select the user interface locale (default: en-US)],
4932     MOZ_UI_LOCALE=$enableval )
4933 AC_SUBST(MOZ_UI_LOCALE)
4935 dnl ========================================================
4936 dnl = Trademarked Branding 
4937 dnl ========================================================
4938 MOZ_ARG_ENABLE_BOOL(official-branding,
4939 [  --enable-official-branding Enable Official mozilla.org Branding
4940                           Do not distribute builds with
4941                           --enable-official-branding unless you have
4942                           permission to use trademarks per
4943                           http://www.mozilla.org/foundation/trademarks/ .],
4944 [case "$MOZ_BUILD_APP" in
4945 browser)
4946     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4947     MOZ_APP_DISPLAYNAME=Firefox
4948     ;;
4951     AC_MSG_ERROR([Official branding is only available for Firefox.])
4952 esac
4955 MOZ_ARG_WITH_STRING(branding,
4956 [  --with-branding=dir    Use branding from the specified directory.],
4957     MOZ_BRANDING_DIRECTORY=$withval)
4959 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4960 if test -z "$REAL_BRANDING_DIRECTORY"; then
4961   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4964 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4965   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4968 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4970 dnl ========================================================
4971 dnl = Distribution ID
4972 dnl ========================================================
4973 MOZ_ARG_WITH_STRING(distribution-id,
4974 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4975 [ val=`echo $withval`
4976     MOZ_DISTRIBUTION_ID="$val"])
4978 if test -z "$MOZ_DISTRIBUTION_ID"; then
4979    MOZ_DISTRIBUTION_ID="org.mozilla"
4982 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4983 AC_SUBST(MOZ_DISTRIBUTION_ID)
4986 dnl ========================================================
4987 dnl complex text support off by default
4988 dnl ========================================================
4989 MOZ_PANGO=1
4990 MOZ_ARG_DISABLE_BOOL(pango,
4991 [  --disable-pango Disable usage of Pango ],
4992     MOZ_PANGO=,
4993     MOZ_PANGO=1)
4996 dnl ========================================================
4997 dnl = Xft and Pango
4998 dnl ========================================================
4999 if test "$MOZ_ENABLE_GTK2"
5000 then
5001     if test "$MOZ_X11"; then
5002         PKG_CHECK_MODULES(MOZ_XFT, xft)
5003         AC_SUBST(MOZ_XFT_CFLAGS)
5004         AC_SUBST(MOZ_XFT_LIBS)
5005     fi
5007     AC_SUBST(MOZ_PANGO)
5009     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5011     if test "$MOZ_PANGO"
5012     then
5013         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5014         AC_SUBST(MOZ_PANGO_CFLAGS)
5015         AC_SUBST(MOZ_PANGO_LIBS)
5016         AC_DEFINE(MOZ_PANGO)
5017     else
5018         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5019         AC_SUBST(MOZ_PANGO_CFLAGS)
5020         AC_SUBST(MOZ_PANGO_LIBS)
5022         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5023         AC_SUBST(FT2_CFLAGS)
5024         AC_SUBST(FT2_LIBS)
5025     fi
5028 dnl ========================================================
5029 dnl = PostScript print module
5030 dnl ========================================================
5031 MOZ_ARG_DISABLE_BOOL(postscript,
5032 [  --disable-postscript    Disable PostScript printing support ],
5033     MOZ_ENABLE_POSTSCRIPT=,
5034     MOZ_ENABLE_POSTSCRIPT=1 )
5036 dnl ========================================================
5037 dnl = GnomeVFS support module
5038 dnl ========================================================
5040 if test "$MOZ_X11"
5041 then
5042     dnl build the gnomevfs extension by default only when the
5043     dnl GTK2 toolkit is in use.
5044     if test "$MOZ_ENABLE_GTK2"
5045     then
5046         MOZ_ENABLE_GNOMEVFS=1
5047         MOZ_ENABLE_GCONF=1
5048         MOZ_ENABLE_LIBGNOME=1
5049     fi
5051     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5052     [  --disable-gnomevfs      Disable GnomeVFS support ],
5053         MOZ_ENABLE_GNOMEVFS=,
5054         MOZ_ENABLE_GNOMEVFS=force)
5056     if test "$MOZ_ENABLE_GNOMEVFS"
5057     then
5058         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5059             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5060             MOZ_ENABLE_GNOMEVFS=1
5061         ],[
5062             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5063             then
5064                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5065             fi
5066             MOZ_ENABLE_GNOMEVFS=
5067         ])
5068     fi
5070     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5071     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5073     if test "$MOZ_ENABLE_GCONF"
5074     then
5075         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5076             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5077             MOZ_ENABLE_GCONF=1
5078         ],[
5079             MOZ_ENABLE_GCONF=
5080         ])
5081     fi
5083     if test "$MOZ_ENABLE_GCONF"; then
5084         AC_DEFINE(MOZ_ENABLE_GCONF)
5085     fi
5087     AC_SUBST(MOZ_ENABLE_GCONF)
5088     AC_SUBST(MOZ_GCONF_CFLAGS)
5089     AC_SUBST(MOZ_GCONF_LIBS)
5091     if test "$MOZ_ENABLE_LIBGNOME"
5092     then
5093         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5094             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5095             MOZ_ENABLE_LIBGNOME=1
5096         ],[
5097             MOZ_ENABLE_LIBGNOME=
5098         ])
5099     fi
5101     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5102     AC_SUBST(MOZ_LIBGNOME_LIBS)
5104     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5105     # are all available.
5107     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5108             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5109       MOZ_ENABLE_GNOME_COMPONENT=1
5110     else
5111       MOZ_ENABLE_GNOME_COMPONENT=
5112     fi
5114     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5117 dnl ========================================================
5118 dnl = libgnomeui support module
5119 dnl ========================================================
5121 if test "$MOZ_ENABLE_GTK2"
5122 then
5123     MOZ_ENABLE_GNOMEUI=1
5125     MOZ_ARG_DISABLE_BOOL(gnomeui,
5126     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5127         MOZ_ENABLE_GNOMEUI=,
5128         MOZ_ENABLE_GNOMEUI=force)
5130     if test "$MOZ_ENABLE_GNOMEUI"
5131     then
5132         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5133         [
5134             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5135             MOZ_ENABLE_GNOMEUI=1
5136         ],[
5137             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5138             then
5139                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5140             fi
5141             MOZ_ENABLE_GNOMEUI=
5142         ])
5143     fi
5145     if test "$MOZ_ENABLE_GNOMEUI"; then
5146         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5147     fi
5149 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5150 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5151 AC_SUBST(MOZ_GNOMEUI_LIBS)
5153 dnl ========================================================
5154 dnl = dbus support
5155 dnl ========================================================
5157 if test "$MOZ_ENABLE_GTK2" || "$MOZ_ENABLE_QT"
5158 then
5159     MOZ_ENABLE_DBUS=1
5161     MOZ_ARG_DISABLE_BOOL(dbus,
5162     [  --disable-dbus       Disable dbus support ],
5163         MOZ_ENABLE_DBUS=,
5164         MOZ_ENABLE_DBUS=1)
5166     if test "$MOZ_ENABLE_DBUS"
5167     then
5168         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5169         AC_DEFINE(MOZ_ENABLE_DBUS)
5170     fi
5172 AC_SUBST(MOZ_ENABLE_DBUS)
5173 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5174 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5176 dnl ========================================================
5177 dnl = Build Personal Security Manager
5178 dnl ========================================================
5179 MOZ_ARG_DISABLE_BOOL(crypto,
5180 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5181     MOZ_PSM=,
5182     MOZ_PSM=1 )
5184 dnl ========================================================
5185 dnl = JS Debugger XPCOM component (js/jsd)
5186 dnl ========================================================
5187 MOZ_ARG_DISABLE_BOOL(jsd,
5188 [  --disable-jsd           Disable JavaScript debug library],
5189     MOZ_JSDEBUGGER=,
5190     MOZ_JSDEBUGGER=1)
5193 dnl ========================================================
5194 dnl = Disable plugin support
5195 dnl ========================================================
5196 MOZ_ARG_DISABLE_BOOL(plugins,
5197 [  --disable-plugins       Disable plugins support],
5198     MOZ_PLUGINS=,
5199     MOZ_PLUGINS=1)
5201 dnl ========================================================
5202 dnl = Open JVM Interface (OJI) support
5203 dnl ========================================================
5204 MOZ_ARG_DISABLE_BOOL(oji,
5205 [  --disable-oji           Disable Open JVM Integration support],
5206     MOZ_OJI=,
5207     MOZ_OJI=1)
5208 if test -n "$MOZ_OJI"; then
5209     AC_DEFINE(OJI)
5212 dnl bi-directional support always on
5213 IBMBIDI=1
5214 AC_DEFINE(IBMBIDI)
5216 dnl ========================================================
5217 dnl view source support on by default
5218 dnl ========================================================
5219 MOZ_ARG_DISABLE_BOOL(view-source,
5220 [  --disable-view-source     Disable view source support],
5221     MOZ_VIEW_SOURCE=,
5222     MOZ_VIEW_SOURCE=1 )
5223 if test "$MOZ_VIEW_SOURCE"; then
5224     AC_DEFINE(MOZ_VIEW_SOURCE)
5228 dnl ========================================================
5229 dnl accessibility support on by default on all platforms 
5230 dnl except OS X.
5231 dnl ========================================================
5232 MOZ_ARG_DISABLE_BOOL(accessibility,
5233 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5234     ACCESSIBILITY=,
5235     ACCESSIBILITY=1 )
5236 if test "$ACCESSIBILITY"; then
5237     AC_DEFINE(ACCESSIBILITY)
5240 if test -n "$ACCESSIBILITY"; then
5241 case "$target" in
5242 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5243     if test "$ac_cv_header_atlbase_h" = "no"; then
5244         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.])
5245     fi
5246     if test "$ac_cv_header_oleacc_idl" = "no"; then
5247         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.])
5248     fi
5249     ;;
5250 esac
5253 dnl ========================================================
5254 dnl xpfe/components on by default
5255 dnl ========================================================
5256 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5257 [  --disable-xpfe-components
5258                           Disable xpfe components],
5259     MOZ_XPFE_COMPONENTS=,
5260     MOZ_XPFE_COMPONENTS=1 )
5262 dnl ========================================================
5263 dnl xpinstall support on by default
5264 dnl ========================================================
5265 MOZ_ARG_DISABLE_BOOL(xpinstall,
5266 [  --disable-xpinstall     Disable xpinstall support],
5267     MOZ_XPINSTALL=,
5268     MOZ_XPINSTALL=1 )
5269 if test "$MOZ_XPINSTALL"; then
5270     AC_DEFINE(MOZ_XPINSTALL)
5273 dnl ========================================================
5274 dnl xpcom js loader support on by default
5275 dnl ========================================================
5276 MOZ_ARG_DISABLE_BOOL(jsloader,
5277 [  --disable-jsloader      Disable xpcom js loader support],
5278     MOZ_JSLOADER=,
5279     MOZ_JSLOADER=1 )
5280 if test "$MOZ_JSLOADER"; then
5281     AC_DEFINE(MOZ_JSLOADER)
5284 dnl ========================================================
5285 dnl Disable printing
5286 dnl ========================================================
5287 MOZ_ARG_DISABLE_BOOL(printing,
5288 [  --disable-printing  Disable printing support],
5289     NS_PRINTING=,
5290     NS_PRINTING=1 )
5292 if test "$NS_PRINTING"; then
5293     AC_DEFINE(NS_PRINTING)
5294     AC_DEFINE(NS_PRINT_PREVIEW)
5297 dnl ========================================================
5298 dnl use native unicode converters
5299 dnl ========================================================
5300 MOZ_ARG_ENABLE_BOOL(native-uconv,
5301 [  --enable-native-uconv   Enable iconv support],
5302     MOZ_USE_NATIVE_UCONV=1,
5303     MOZ_USE_NATIVE_UCONV= )
5304 if test "$MOZ_USE_NATIVE_UCONV"; then
5305     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5307 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5308     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5312 dnl ========================================================
5313 dnl Libeditor can be build as plaintext-only,
5314 dnl or as a full html and text editing component.
5315 dnl We build both by default.
5316 dnl ========================================================
5317 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5318 [  --enable-plaintext-editor-only
5319                           Allow only plaintext editing],
5320     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5321     MOZ_PLAINTEXT_EDITOR_ONLY= )
5322 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5323 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5325 dnl ========================================================
5326 dnl = Drop XPCOM Obsolete library
5327 dnl ========================================================
5328 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5329 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5330     MOZ_NO_XPCOM_OBSOLETE=1,
5331     MOZ_NO_XPCOM_OBSOLETE=)
5333 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5334     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5337 dnl ========================================================
5338 dnl = Disable Fast Load
5339 dnl ========================================================
5340 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5341 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5342     MOZ_NO_FAST_LOAD=1,
5343     MOZ_NO_FAST_LOAD=)
5345 AC_SUBST(MOZ_NO_FAST_LOAD)
5347 if test -n "$MOZ_NO_FAST_LOAD"; then
5348     AC_DEFINE(MOZ_NO_FAST_LOAD)
5351 dnl ========================================================
5352 dnl = Enable Ogg Codecs
5353 dnl ========================================================
5354 MOZ_ARG_DISABLE_BOOL(ogg,
5355 [  --disable-ogg           Disable Ogg Codec support],
5356     MOZ_OGG=,
5357     MOZ_OGG=1)
5359 AC_SUBST(MOZ_OGG)
5361 if test -n "$MOZ_OGG"; then
5362     AC_DEFINE(MOZ_OGG)
5363     MOZ_MEDIA=1
5366 AC_SUBST(MOZ_MEDIA)
5368 if test -n "$MOZ_MEDIA"; then
5369     AC_DEFINE(MOZ_MEDIA)
5372 dnl If using Ogg with Linux, ensure that the alsa library is available
5373 if test -n "$MOZ_OGG"; then
5374    case "$target_os" in
5375 linux*)
5376       AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5377       ;;
5378    esac
5381 dnl ========================================================
5382 dnl Permissions System
5383 dnl ========================================================
5384 MOZ_ARG_DISABLE_BOOL(permissions,
5385 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5386     MOZ_PERMISSIONS=,
5387     MOZ_PERMISSIONS=1
5390 dnl ========================================================
5391 dnl NegotiateAuth
5392 dnl ========================================================
5393 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5394 [  --disable-negotiateauth Disable GSS-API negotiation ],
5395     MOZ_AUTH_EXTENSION=,
5396     MOZ_AUTH_EXTENSION=1 )
5398 dnl ========================================================
5399 dnl XTF
5400 dnl ========================================================
5401 MOZ_ARG_DISABLE_BOOL(xtf,
5402 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5403     MOZ_XTF=,
5404     MOZ_XTF=1 )
5405 if test "$MOZ_XTF"; then
5406   AC_DEFINE(MOZ_XTF)
5409 dnl ========================================================
5410 dnl Inspector APIs
5411 dnl ========================================================
5412 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5413 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5414     MOZ_NO_INSPECTOR_APIS=1,
5415     MOZ_NO_INSPECTOR_APIS= )
5417 dnl ========================================================
5418 dnl Pref extensions (autoconfig and system-pref)
5419 dnl ========================================================
5420 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5421 [  --disable-pref-extensions
5422                           Disable pref extensions such as autoconfig and
5423                           system-pref],
5424   MOZ_PREF_EXTENSIONS=,
5425   MOZ_PREF_EXTENSIONS=1 )
5427 dnl ========================================================
5428 dnl = Universalchardet
5429 dnl ========================================================
5430 MOZ_ARG_DISABLE_BOOL(universalchardet,
5431 [  --disable-universalchardet
5432                           Disable universal encoding detection],
5433   MOZ_UNIVERSALCHARDET=,
5434   MOZ_UNIVERSALCHARDET=1 )
5436 dnl ========================================================
5437 dnl JavaXPCOM
5438 dnl ========================================================
5439 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5440 [  --enable-javaxpcom
5441                           Enable Java-XPCOM bridge],
5442     MOZ_JAVAXPCOM=1,
5443     MOZ_JAVAXPCOM= )
5445 if test -n "${MOZ_JAVAXPCOM}"; then
5446   case "$host_os" in
5447     cygwin*|msvc*|mks*)
5448       if test -n "$JAVA_HOME"; then
5449         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5450       fi
5451       ;;
5452     *mingw*)
5453       if test -n "$JAVA_HOME"; then
5454         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5455       fi
5456       ;;
5457   esac
5459   if test -n "${JAVA_INCLUDE_PATH}"; then
5460     dnl Make sure jni.h exists in the given include path.
5461     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5462       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5463     fi
5464   else
5465     case "$target_os" in
5466       darwin*)
5467         dnl Default to java system location
5468         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5469         ;;
5470       *)
5471         dnl Try $JAVA_HOME
5472         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5473         ;;
5474     esac
5475     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5476       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.])
5477     fi
5478   fi
5480   if test -n "${JAVA_BIN_PATH}"; then
5481     dnl Look for javac and jar in the specified path.
5482     JAVA_PATH="$JAVA_BIN_PATH"
5483   else
5484     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5485     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5486   fi
5488   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5489   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5490   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5491   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5492     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.])
5493   fi
5496 dnl ========================================================
5497 dnl = Breakpad crash reporting (on by default on supported platforms)
5498 dnl ========================================================
5500 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5501     || test "$OS_ARCH" = "Darwin" \
5502     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5503     || test "$OS_ARCH" = "SunOS") \
5504    && test -z "$HAVE_64BIT_OS"; then
5505    MOZ_CRASHREPORTER=1
5508 MOZ_ARG_DISABLE_BOOL(crashreporter,
5509 [  --disable-crashreporter          Disable breakpad crash reporting],
5510     MOZ_CRASHREPORTER=,
5511     MOZ_CRASHREPORTER=1)
5513 if test -n "$MOZ_CRASHREPORTER"; then
5514    AC_DEFINE(MOZ_CRASHREPORTER)
5516   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5517     test -z "$SKIP_LIBRARY_CHECKS"; then
5518     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5519     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5520     AC_SUBST(MOZ_GTHREAD_LIBS)
5522     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.])])
5523   fi
5526 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5527 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5528 [ val=`echo $withval | sed 's/[^0-9]//g'`
5529     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5531 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5532    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5534 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5536 dnl ========================================================
5537 dnl = Enable compilation of specific extension modules
5538 dnl ========================================================
5540 MOZ_ARG_ENABLE_STRING(extensions,
5541 [  --enable-extensions     Enable extensions],
5542 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5543     if test "$option" = "yes" || test "$option" = "all"; then
5544         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5545     elif test "$option" = "no" || test "$option" = "none"; then
5546         MOZ_EXTENSIONS=""
5547     elif test "$option" = "default"; then
5548         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5549     elif test `echo "$option" | grep -c \^-` != 0; then
5550         option=`echo $option | sed 's/^-//'`
5551         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5552     else
5553         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5554     fi
5555 done],
5556     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5558 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5559     # Suppress warning on non-X11 platforms
5560     if test -n "$MOZ_X11"; then
5561         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5562     fi
5563     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5566 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5567     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5568     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5571 dnl This might be temporary: build tridentprofile only on Windows
5572 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5573     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5574     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5577 dnl cookie must be built before tridentprofile. put it at list's end.
5578 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5579   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5580   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5583 dnl xforms requires xtf and schema-validation
5584 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5585     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5586     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5588 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5589     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5590     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5593 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5594     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5595     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5598 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5599     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5600     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5603 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5604     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5605     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5608 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5609     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5610     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5613 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5614     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5615     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5618 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5619     AC_MSG_WARN([spellcheck is no longer an extension.])
5620     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5623 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5624     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5625     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5628 dnl Remove dupes
5629 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5631 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5632 dnl when trying to build a non-existent extension.
5633 for extension in $MOZ_EXTENSIONS; do
5634     if test ! -d "${srcdir}/extensions/${extension}"; then
5635         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5636     fi
5637 done
5640 dnl ========================================================
5641 dnl Image decoders
5642 dnl ========================================================
5643 case "$MOZ_WIDGET_TOOLKIT" in
5644 beos|windows|os2|mac|cocoa)
5645     ;;
5647     if test -z "$MOZ_ENABLE_GTK2"; then
5648        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
5649     fi
5650     ;;
5651 esac
5653 MOZ_ARG_ENABLE_STRING(image-decoders,
5654 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5655                           Enable specific image decoders],
5656 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5657     if test "$option" = "yes" || test "$option" = "all"; then
5658         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5659     elif test "$option" = "no" || test "$option" = "none"; then
5660         MOZ_IMG_DECODERS=""
5661     elif test "$option" = "default"; then
5662         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5663     elif test `echo "$option" | grep -c \^-` != 0; then
5664         option=`echo $option | sed 's/^-//'`
5665         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5666     else
5667         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5668     fi
5669 done],
5670     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5672 dnl Dupes are removed in the encoder section because it will also add decoders
5674 dnl ========================================================
5675 dnl Image encoders
5676 dnl ========================================================
5677 MOZ_ARG_ENABLE_STRING(image-encoders,
5678 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5679                           Enable specific image encoders],
5680 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5681     if test "$option" = "yes" || test "$option" = "all"; then
5682         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5683     elif test "$option" = "no" || test "$option" = "none"; then
5684         MOZ_IMG_ENCODERS=""
5685         addencoder=""
5686     elif test "$option" = "default"; then
5687         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5688     elif test `echo "$option" | grep -c \^-` != 0; then
5689         option=`echo $option | sed 's/^-//'`
5690         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5691     else
5692         addencoder="$option"
5693     fi
5694     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5695 done],
5696     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5698 dnl Remove dupes
5699 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5700 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5702 dnl ========================================================
5703 dnl MathML on by default
5704 dnl ========================================================
5705 MOZ_ARG_DISABLE_BOOL(mathml,
5706 [  --disable-mathml        Disable MathML support],
5707     MOZ_MATHML=,
5708     MOZ_MATHML=1 )
5709 if test "$MOZ_MATHML"; then
5710   AC_DEFINE(MOZ_MATHML)
5713 dnl ========================================================
5714 dnl Canvas
5715 dnl ========================================================
5716 MOZ_ARG_DISABLE_BOOL(canvas,
5717 [  --disable-canvas          Disable html:canvas feature],
5718     MOZ_ENABLE_CANVAS=,
5719     MOZ_ENABLE_CANVAS=1 )
5720 if test -n "$MOZ_ENABLE_CANVAS"; then
5721     AC_DEFINE(MOZ_ENABLE_CANVAS)
5723 AC_SUBST(MOZ_ENABLE_CANVAS)
5725 dnl ========================================================
5726 dnl SVG
5727 dnl ========================================================
5728 MOZ_ARG_DISABLE_BOOL(svg,
5729 [  --disable-svg            Disable SVG support],
5730     MOZ_SVG=,
5731     MOZ_SVG=1 )
5732 if test -n "$MOZ_SVG"; then
5733   AC_DEFINE(MOZ_SVG)
5736 dnl ========================================================
5737 dnl Installer
5738 dnl ========================================================
5739 case "$target_os" in
5740     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5741         MOZ_INSTALLER=1
5742         ;;
5743 esac
5745 MOZ_ARG_DISABLE_BOOL(installer,
5746 [  --disable-installer     Disable building of installer],
5747     MOZ_INSTALLER=,
5748     MOZ_INSTALLER=1 )
5749 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5750     # Disable installer for Windows builds that use the new toolkit if NSIS
5751     # isn't in the path.
5752     AC_PATH_PROGS(MAKENSIS, makensis)
5753     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5754         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5755     fi
5756     # The Windows build for NSIS requires the iconv command line utility to
5757     # convert the charset of the locale files.
5758     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5759     if test -z "$HOST_ICONV"; then
5760         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5761     fi
5764 # Automatically disable installer if xpinstall isn't built
5765 if test -z "$MOZ_XPINSTALL"; then
5766     MOZ_INSTALLER=
5768 AC_SUBST(MOZ_INSTALLER)
5770 AC_MSG_CHECKING([for tar archiver])
5771 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5772 if test -z "$TAR"; then
5773     AC_MSG_ERROR([no tar archiver found in \$PATH])
5775 AC_MSG_RESULT([$TAR])
5776 AC_SUBST(TAR)
5778 AC_MSG_CHECKING([for wget])
5779 AC_CHECK_PROGS(WGET, wget, "")
5780 AC_MSG_RESULT([$WGET])
5781 AC_SUBST(WGET)
5783 dnl ========================================================
5784 dnl Updater
5785 dnl ========================================================
5787 MOZ_ARG_DISABLE_BOOL(updater,
5788 [  --disable-updater       Disable building of updater],
5789     MOZ_UPDATER=,
5790     MOZ_UPDATER=1 )
5791 # The Windows build requires the iconv command line utility
5792 # in order to build the updater.
5793 case "$target_os" in
5794     msvc*|mks*|cygwin*|mingw*|wince*)
5795         if test -n "$MOZ_UPDATER"; then
5796             AC_MSG_CHECKING([for iconv])
5797             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5798             if test -z "$HOST_ICONV"; then
5799                 AC_MSG_ERROR([iconv not found in \$PATH])
5800             fi
5801         fi
5802         ;;
5803 esac
5804 AC_SUBST(MOZ_UPDATER)
5806 # app update channel is 'default' when not supplied.
5807 MOZ_ARG_ENABLE_STRING([update-channel],
5808 [  --enable-update-channel=CHANNEL
5809                            Select application update channel (default=default)],
5810     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5812 if test -z "$MOZ_UPDATE_CHANNEL"; then
5813     MOZ_UPDATE_CHANNEL=default
5815 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5817 # tools/update-packaging is not checked out by default.
5818 MOZ_ARG_ENABLE_BOOL(update-packaging,
5819 [  --enable-update-packaging
5820                            Enable tools/update-packaging],
5821     MOZ_UPDATE_PACKAGING=1,
5822     MOZ_UPDATE_PACKAGING= )
5823 AC_SUBST(MOZ_UPDATE_PACKAGING)
5825 dnl ========================================================
5826 dnl ActiveX
5827 dnl ========================================================
5829 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5830 [  --disable-xpconnect-idispatch
5831                           Disable building of xpconnect support for IDispatch
5832                           (win32 only)],
5833     XPC_IDISPATCH_SUPPORT=,
5834     XPC_IDISPATCH_SUPPORT=1)
5835 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5837 MOZ_ARG_DISABLE_BOOL(activex,
5838 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5839     MOZ_NO_ACTIVEX_SUPPORT=1,
5840     MOZ_NO_ACTIVEX_SUPPORT= )
5841 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5843 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5844 [  --disable-activex-scripting
5845                           Disable building of ActiveX scripting support (win32)],
5846     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5847     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5848 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5850 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5851 then
5852     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5855 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5856 case "$target" in
5857 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5858     if test "$ac_cv_header_atlbase_h" = "no"; then
5859         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.])
5860     fi
5861     ;;
5862 esac
5865 dnl ========================================================
5866 dnl leaky
5867 dnl ========================================================
5868 MOZ_ARG_ENABLE_BOOL(leaky,
5869 [  --enable-leaky          Build leaky memory tool],
5870     MOZ_LEAKY=1,
5871     MOZ_LEAKY=)
5874 dnl ========================================================
5875 dnl xpctools
5876 dnl ========================================================
5877 MOZ_ARG_ENABLE_BOOL(xpctools,
5878 [  --enable-xpctools       Build JS profiling tool],
5879     MOZ_XPCTOOLS=1,
5880     MOZ_XPCTOOLS= )
5883 dnl ========================================================
5884 dnl build the tests by default
5885 dnl ========================================================
5886 MOZ_ARG_DISABLE_BOOL(tests,
5887 [  --disable-tests         Do not build test libraries & programs],
5888     ENABLE_TESTS=,
5889     ENABLE_TESTS=1 )
5891 dnl ========================================================
5892 dnl parental controls (for Windows Vista)
5893 dnl ========================================================
5894 MOZ_ARG_DISABLE_BOOL(parental-controls,
5895 [  --disable-parental-controls
5896                            Do not build parental controls],
5897    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5898    MOZ_DISABLE_PARENTAL_CONTROLS=)
5899 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5900     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5903 dnl ========================================================
5904 dnl Vista SDK specific api
5905 dnl ========================================================
5906 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5907 [  --disable-vista-sdk-requirements
5908                            Do not build Vista SDK specific code],
5909    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5910    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5911 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5912     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5913     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5914     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5915         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5916     fi
5917     MOZ_DISABLE_PARENTAL_CONTROLS=1
5918 else
5919 case "$target" in
5920 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5921     if test "$ac_cv_header_wpcapi_h" = "no"; then
5922         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.])
5923     fi
5924     ;;
5925 esac
5927 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5928 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5930 dnl ========================================================
5931 dnl =
5932 dnl = Module specific options
5933 dnl =
5934 dnl ========================================================
5935 MOZ_ARG_HEADER(Individual module options)
5937 dnl ========================================================
5938 dnl = Enable Lea malloc in xpcom. OFF by default.
5939 dnl ========================================================
5940 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5941 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5942     XPCOM_USE_LEA=1,
5943     XPCOM_USE_LEA= )
5944 if test -n "$XPCOM_USE_LEA"; then
5945     AC_DEFINE(XPCOM_USE_LEA)
5948 dnl ========================================================
5949 dnl = Enable places (new history/bookmarks)
5950 dnl ========================================================
5951 MOZ_ARG_ENABLE_BOOL(places,
5952 [  --enable-places        Enable 'places' bookmark/history implementation],
5953     MOZ_PLACES=1,
5954     MOZ_PLACES= )
5955 if test -n "$MOZ_PLACES"; then
5956     AC_DEFINE(MOZ_PLACES)
5957     if test -z "$MOZ_MAIL_NEWS"; then
5958       MOZ_MORK=
5959     fi
5960     MOZ_MORKREADER=1
5961 else
5962   if test "$MOZ_BUILD_APP" = "browser"; then
5963     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5964   fi
5967 dnl ========================================================
5968 dnl = Disable feed handling components
5969 dnl ========================================================
5970 MOZ_ARG_DISABLE_BOOL(feeds,
5971 [  --disable-feeds        Disable feed handling and processing components],
5972     MOZ_FEEDS=,
5973     MOZ_FEEDS=1 )
5974 if test -n "$MOZ_FEEDS"; then
5975     AC_DEFINE(MOZ_FEEDS)
5976 else
5977     if test "$MOZ_BUILD_APP" = "browser"; then
5978         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5979     fi
5982 dnl ========================================================
5983 dnl = Enable mozStorage
5984 dnl ========================================================
5985 dnl Implicitly enabled by default if building calendar or places
5986 MOZ_ARG_ENABLE_BOOL(storage,
5987 [  --enable-storage        Enable mozStorage module and related components],
5988     MOZ_STORAGE=1,
5989     MOZ_STORAGE= )
5990 if test -n "$MOZ_STORAGE"; then
5991     AC_DEFINE(MOZ_STORAGE)
5994 dnl ========================================================
5995 dnl Check for sqlite
5996 dnl ========================================================
5998 MOZ_NATIVE_SQLITE=
5999 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6000 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6001 MOZ_NATIVE_SQLITE=1,
6002 MOZ_NATIVE_SQLITE= )
6004 if test -z "$MOZ_NATIVE_SQLITE"
6005 then
6006     SQLITE_CFLAGS=
6007     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6008 else
6009     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6012 AC_SUBST(MOZ_NATIVE_SQLITE)
6014 dnl ========================================================
6015 dnl = Enable help viewer (off by default)
6016 dnl ========================================================
6017 MOZ_ARG_ENABLE_BOOL(help-viewer,
6018 [  --enable-help-viewer        Enable help viewer],
6019     MOZ_HELP_VIEWER=1,
6020     MOZ_HELP_VIEWER= )
6021 if test -n "$MOZ_HELP_VIEWER"; then
6022      AC_DEFINE(MOZ_HELP_VIEWER)
6024 AC_SUBST(MOZ_HELP_VIEWER)
6025 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6026     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6029 dnl ========================================================
6030 dnl = Enable safe browsing (anti-phishing)
6031 dnl ========================================================
6032 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6033 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6034     MOZ_SAFE_BROWSING=1,
6035     MOZ_SAFE_BROWSING= )
6036 if test -n "$MOZ_SAFE_BROWSING"; then
6037     AC_DEFINE(MOZ_SAFE_BROWSING)
6039 AC_SUBST(MOZ_SAFE_BROWSING)
6041 dnl ========================================================
6042 dnl = Enable url-classifier
6043 dnl ========================================================
6044 dnl Implicitly enabled by default if building with safe-browsing
6045 if test -n "$MOZ_SAFE_BROWSING"; then
6046     MOZ_URL_CLASSIFIER=1
6048 MOZ_ARG_ENABLE_BOOL(url-classifier,
6049 [  --enable-url-classifier        Enable url classifier module],
6050     MOZ_URL_CLASSIFIER=1,
6051     MOZ_URL_CLASSIFIER= )
6052 if test -n "$MOZ_URL_CLASSIFIER"; then
6053     AC_DEFINE(MOZ_URL_CLASSIFIER)
6055 AC_SUBST(MOZ_URL_CLASSIFIER)
6057 dnl ========================================================
6058 dnl = Disable zipwriter
6059 dnl ========================================================
6060 MOZ_ARG_DISABLE_BOOL(zipwriter,
6061 [  --disable-zipwriter             Disable zipwriter component],
6062     MOZ_ZIPWRITER=,
6063     MOZ_ZIPWRITER=1 )
6064 AC_SUBST(MOZ_ZIPWRITER)
6066 dnl ========================================================
6067 dnl = Enable Ultrasparc specific optimizations for JS
6068 dnl ========================================================
6069 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6070 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6071     JS_ULTRASPARC_OPTS=1,
6072     JS_ULTRASPARC_OPTS= )
6074 dnl only enable option for ultrasparcs
6075 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6076     "$OS_TEST" != "sun4u"; then
6077     JS_ULTRASPARC_OPTS=
6079 AC_SUBST(JS_ULTRASPARC_OPTS)
6081 dnl ========================================================
6082 dnl = Hildon and OSSO checks
6083 dnl ========================================================
6084 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6085                   MOZ_PLATFORM_HILDON=1,
6086                   MOZ_PLATFORM_HILDON=)
6087 if test $MOZ_PLATFORM_HILDON; then
6088    AC_DEFINE(MOZ_PLATFORM_HILDON)
6090 AC_SUBST(LIBHILDONMIME_CFLAGS)
6091 AC_SUBST(LIBHILDONMIME_LIBS)
6093 PKG_CHECK_MODULES(LIBOSSO,libosso,
6094                   NS_OSSO=1,
6095                   NS_OSSO=)
6097 if test $NS_OSSO; then
6098     if test -z "$MOZ_ENABLE_DBUS"; then
6099         AC_MSG_ERROR([DBus is required when building for OSSO])
6100     fi
6101     AC_DEFINE(NS_OSSO)     
6103 AC_SUBST(LIBOSSO_CFLAGS)
6104 AC_SUBST(LIBOSSO_LIBS)
6106 PKG_CHECK_MODULES(MOZ_LOCATION, [liblocation gpsbt],
6107                   NS_MAEMO_LOCATION=1,
6108                   NS_MAEMO_LOCATION=)
6110 if test $NS_MAEMO_LOCATION; then
6111   AC_DEFINE(NS_MAEMO_LOCATION)
6114 AC_SUBST(MOZ_LOCATION_CFLAGS)
6115 AC_SUBST(MOZ_LOCATION_LIBS)
6117 dnl ========================================================
6118 dnl =
6119 dnl = Feature options that require extra sources to be pulled
6120 dnl =
6121 dnl ========================================================
6122 dnl MOZ_ARG_HEADER(Features that require extra sources)
6124 dnl ========================================================
6125 dnl =
6126 dnl = Debugging Options
6127 dnl = 
6128 dnl ========================================================
6129 MOZ_ARG_HEADER(Debugging and Optimizations)
6131 dnl ========================================================
6132 dnl = Disable building with debug info.
6133 dnl = Debugging is OFF by default
6134 dnl ========================================================
6135 if test -z "$MOZ_DEBUG_FLAGS"
6136 then
6137     case "$target" in
6138     *-irix*)
6139         if test "$GNU_CC"; then
6140             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6141             case "$GCC_VERSION" in
6142             2.95.*)
6143                 MOZ_DEBUG_FLAGS=""
6144                 ;;
6145             *)
6146                 MOZ_DEBUG_FLAGS="-g"
6147                 ;;
6148             esac
6149         else
6150             MOZ_DEBUG_FLAGS="-g"
6151         fi
6152         ;;
6153     *)
6154         MOZ_DEBUG_FLAGS="-g"
6155         ;;
6156     esac
6159 MOZ_ARG_ENABLE_STRING(debug,
6160 [  --enable-debug[=DBG]    Enable building with developer debug info
6161                           (Using compiler flags DBG)],
6162 [ if test "$enableval" != "no"; then
6163     MOZ_DEBUG=1
6164     if test -n "$enableval" && test "$enableval" != "yes"; then
6165         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6166     fi
6167   else
6168     MOZ_DEBUG=
6169   fi ],
6170   MOZ_DEBUG=)
6172 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6173  case "${target_os}" in
6174     beos*)
6175         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6176         ;;
6177     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6178         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6179         ;;
6180     *) 
6181         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6182         ;;
6183   esac
6184 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6186 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6188 if test -n "$MOZ_DEBUG"; then
6189     AC_MSG_CHECKING([for valid debug flags])
6190     _SAVE_CFLAGS=$CFLAGS
6191     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6192     AC_TRY_COMPILE([#include <stdio.h>], 
6193         [printf("Hello World\n");],
6194         _results=yes,
6195         _results=no)
6196     AC_MSG_RESULT([$_results])
6197     if test "$_results" = "no"; then
6198         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6199     fi
6200     CFLAGS=$_SAVE_CFLAGS
6203 dnl ========================================================
6204 dnl = Enable code optimization. ON by default.
6205 dnl ========================================================
6206 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6207         MOZ_OPTIMIZE_FLAGS="-O"
6210 MOZ_ARG_ENABLE_STRING(optimize,
6211 [  --disable-optimize      Disable compiler optimization
6212   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6213 [ if test "$enableval" != "no"; then
6214     MOZ_OPTIMIZE=1
6215     if test -n "$enableval" && test "$enableval" != "yes"; then
6216         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6217         MOZ_OPTIMIZE=2
6218     fi
6219 else
6220     MOZ_OPTIMIZE=
6221 fi ], MOZ_OPTIMIZE=1)
6223 if test "$COMPILE_ENVIRONMENT"; then
6224 if test -n "$MOZ_OPTIMIZE"; then
6225     AC_MSG_CHECKING([for valid optimization flags])
6226     _SAVE_CFLAGS=$CFLAGS
6227     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6228     AC_TRY_COMPILE([#include <stdio.h>], 
6229         [printf("Hello World\n");],
6230         _results=yes,
6231         _results=no)
6232     AC_MSG_RESULT([$_results])
6233     if test "$_results" = "no"; then
6234         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6235     fi
6236     CFLAGS=$_SAVE_CFLAGS
6238 fi # COMPILE_ENVIRONMENT
6240 AC_SUBST(MOZ_OPTIMIZE)
6241 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6242 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6243 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6245 dnl ========================================================
6246 dnl = Enable/disable debug for specific modules only
6247 dnl =   module names beginning with ^ will be disabled 
6248 dnl ========================================================
6249 MOZ_ARG_ENABLE_STRING(debug-modules,
6250 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6251 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6253 dnl ========================================================
6254 dnl = Enable/disable generation of debugger info for specific modules only
6255 dnl =    the special module name ALL_MODULES can be used to denote all modules
6256 dnl =    module names beginning with ^ will be disabled
6257 dnl ========================================================
6258 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6259 [  --enable-debugger-info-modules
6260                           Enable/disable debugger info for specific modules],
6261 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6262       dnl note that the list of module names is reversed as it is copied
6263       dnl this is important, as it will allow config.mk to interpret stuff like
6264       dnl "^ALL_MODULES xpcom" properly
6265       if test "$i" = "no"; then
6266         i="^ALL_MODULES"
6267       fi
6268       if test "$i" = "yes"; then
6269         i="ALL_MODULES"
6270       fi
6271       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6272     done ])
6274 dnl ========================================================
6275 dnl Enable garbage collector
6276 dnl ========================================================
6277 MOZ_ARG_ENABLE_BOOL(boehm,
6278 [  --enable-boehm          Enable the Boehm Garbage Collector],
6279     GC_LEAK_DETECTOR=1,
6280     GC_LEAK_DETECTOR= )
6281 if test -n "$GC_LEAK_DETECTOR"; then
6282     AC_DEFINE(GC_LEAK_DETECTOR)
6285 dnl ========================================================
6286 dnl Disable runtime logging checks
6287 dnl ========================================================
6288 MOZ_ARG_DISABLE_BOOL(logging,
6289 [  --disable-logging       Disable logging facilities],
6290     NS_DISABLE_LOGGING=1,
6291     NS_DISABLE_LOGGING= )
6292 if test "$NS_DISABLE_LOGGING"; then
6293     AC_DEFINE(NS_DISABLE_LOGGING)
6294 else
6295     AC_DEFINE(MOZ_LOGGING)
6298 dnl ========================================================
6299 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6300 dnl ========================================================
6301 _ENABLE_LOGREFCNT=42
6302 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6303 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6304     _ENABLE_LOGREFCNT=1,
6305     _ENABLE_LOGREFCNT= )
6306 if test "$_ENABLE_LOGREFCNT" = "1"; then
6307     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6308 elif test -z "$_ENABLE_LOGREFCNT"; then
6309     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6312 dnl ========================================================
6313 dnl = Enable trace malloc
6314 dnl ========================================================
6315 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6316 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6317 [  --enable-trace-malloc   Enable malloc tracing],
6318     NS_TRACE_MALLOC=1,
6319     NS_TRACE_MALLOC= )
6320 if test "$NS_TRACE_MALLOC"; then
6321   # Please, Mr. Linker Man, don't take away our symbol names
6322   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6323   USE_ELF_DYNSTR_GC=
6324   AC_DEFINE(NS_TRACE_MALLOC)
6326 AC_SUBST(NS_TRACE_MALLOC)
6328 dnl ========================================================
6329 dnl = Enable jemalloc
6330 dnl ========================================================
6331 MOZ_ARG_ENABLE_BOOL(jemalloc,
6332 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6333     MOZ_MEMORY=1,
6334     MOZ_MEMORY=)
6336 if test "$NS_TRACE_MALLOC"; then
6337     MOZ_MEMORY=
6340 if test "$MOZ_MEMORY"; then
6342   dnl Don't try to run compiler tests on Windows  
6343   if test "$OS_ARCH" = "WINNT"; then
6344     if test -z "$HAVE_64BIT_OS"; then
6345       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6346     else
6347       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6348     fi
6349   else
6350     AC_CHECK_SIZEOF([int *], [4])
6351     case "${ac_cv_sizeof_int_p}" in
6352     4)
6353       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6354       ;;
6355     8)
6356       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6357       ;;
6358     *)
6359       AC_MSG_ERROR([Unexpected pointer size])
6360       ;;
6361     esac
6362   fi
6364   AC_DEFINE(MOZ_MEMORY)
6365   if test "x$MOZ_DEBUG" = "x1"; then
6366     AC_DEFINE(MOZ_MEMORY_DEBUG)
6367   fi
6368   dnl The generic feature tests that determine how to compute ncpus are long and
6369   dnl complicated.  Therefore, simply define special cpp variables for the
6370   dnl platforms we have special knowledge of.
6371   case "${target_os}" in
6372   darwin*)
6373     AC_DEFINE(MOZ_MEMORY_DARWIN)
6374     ;;
6375   *-freebsd*)
6376     AC_DEFINE(MOZ_MEMORY_BSD)
6377     ;;
6378   *linux*)
6379     AC_DEFINE(MOZ_MEMORY_LINUX)
6380     ;;
6381   netbsd*)
6382     AC_DEFINE(MOZ_MEMORY_BSD)
6383     ;;
6384   solaris*)
6385     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6386     ;;
6387   msvc*|mks*|cygwin*|mingw*)
6388     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6389     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6390     dnl will fail miserably
6391     if test "$_CC_SUITE" -lt "8"; then
6392         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6393     fi
6394     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6395       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6396         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.])
6397       else
6398         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6399       fi
6400     fi
6401     if test -z "$WIN32_CRT_SRC_DIR"; then
6402       # pre-built dll
6403       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6404       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6405     else
6406       # CRT source directory
6407       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6408       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6409       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6410     fi
6411     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6412     dnl are to avoid m4
6413     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6414     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6415     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6416     dnl This needs to be unix style.
6417     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6418     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6419     AC_DEFINE(_STATIC_CPPLIB)
6420     dnl Don't generate a manifest, since we're linking to a custom CRT.
6421     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6422     dnl Also pass this to NSPR/NSS
6423     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6424     export DLLFLAGS
6425     ;;
6426   *)
6427     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6428     ;;
6429   esac
6431   AC_ARG_WITH([valgrind],
6432     [  --with-valgrind         Enable valgrind integration hooks],
6433     [enable_valgrind="yes"], [enable_valgrind="no"])
6434   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6435   if test "x$enable_valgrind" = "xyes" ; then
6436     AC_DEFINE(MOZ_VALGRIND)
6437   fi
6439 AC_SUBST(MOZ_MEMORY)
6440 AC_SUBST(WIN32_CRT_SRC_DIR)
6441 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6442 AC_SUBST(MOZ_LIB)
6443 AC_SUBST(MOZ_PATH)
6444 dnl Need to set this for make because NSS doesn't have configure
6445 AC_SUBST(DLLFLAGS)
6447 dnl ========================================================
6448 dnl = Use malloc wrapper lib
6449 dnl ========================================================
6450 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6451 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6452     _WRAP_MALLOC=1,
6453     _WRAP_MALLOC= )
6455 if test -n "$_WRAP_MALLOC"; then
6456     if test "$GNU_CC"; then
6457     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"
6458     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6459     fi
6462 dnl ========================================================
6463 dnl = Location of malloc wrapper lib
6464 dnl ========================================================
6465 MOZ_ARG_WITH_STRING(wrap-malloc,
6466 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6467     WRAP_MALLOC_LIB=$withval)
6469 dnl ========================================================
6470 dnl = Use Electric Fence
6471 dnl ========================================================
6472 MOZ_ARG_ENABLE_BOOL(efence,
6473 [  --enable-efence         Link with Electric Fence],
6474     _ENABLE_EFENCE=1,
6475     _ENABLE_EFENCE= )
6476 if test -n "$_ENABLE_EFENCE"; then
6477     AC_CHECK_LIB(efence,malloc)
6480 dnl ========================================================
6481 dnl jprof
6482 dnl ========================================================
6483 MOZ_ARG_ENABLE_BOOL(jprof,
6484 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6485     MOZ_JPROF=1,
6486     MOZ_JPROF= )
6487 if test -n "$MOZ_JPROF"; then
6488     AC_DEFINE(MOZ_JPROF)
6491 dnl ========================================================
6492 dnl shark
6493 dnl ========================================================
6494 MOZ_ARG_ENABLE_BOOL(shark,
6495 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6496     MOZ_SHARK=1,
6497     MOZ_SHARK= )
6498 if test -n "$MOZ_SHARK"; then
6499     AC_DEFINE(MOZ_SHARK)
6502 dnl ========================================================
6503 dnl callgrind
6504 dnl ========================================================
6505 MOZ_ARG_ENABLE_BOOL(callgrind,
6506 [  --enable-callgrind      Enable callgrind profiling],
6507     MOZ_CALLGRIND=1,
6508     MOZ_CALLGRIND= )
6509 if test -n "$MOZ_CALLGRIND"; then
6510     AC_DEFINE(MOZ_CALLGRIND)
6513 dnl ========================================================
6514 dnl vtune
6515 dnl ========================================================
6516 MOZ_ARG_ENABLE_BOOL(vtune,
6517 [  --enable-vtune          Enable vtune profiling],
6518     MOZ_VTUNE=1,
6519     MOZ_VTUNE= )
6520 if test -n "$MOZ_VTUNE"; then
6521     AC_DEFINE(MOZ_VTUNE)
6524 dnl ========================================================
6525 dnl = Enable static checking using gcc-dehydra
6526 dnl ========================================================
6528 MOZ_ARG_WITH_STRING(static-checking,
6529 [  --with-static-checking=path/to/gcc_dehydra.so
6530                             Enable static checking of code using GCC-dehydra],
6531     DEHYDRA_PATH=$withval,
6532     DEHYDRA_PATH= )
6534 if test -n "$DEHYDRA_PATH"; then
6535     if ! test -f "$DEHYDRA_PATH"; then
6536         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6537     fi
6538     AC_DEFINE(NS_STATIC_CHECKING)
6540 AC_SUBST(DEHYDRA_PATH)
6542 dnl ========================================================
6543 dnl = Enable stripping of libs & executables
6544 dnl ========================================================
6545 MOZ_ARG_ENABLE_BOOL(strip,
6546 [  --enable-strip          Enable stripping of libs & executables ],
6547     ENABLE_STRIP=1,
6548     ENABLE_STRIP= )
6550 dnl ========================================================
6551 dnl = Enable stripping of libs & executables when packaging
6552 dnl ========================================================
6553 MOZ_ARG_ENABLE_BOOL(install-strip,
6554 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6555     PKG_SKIP_STRIP= ,
6556     PKG_SKIP_STRIP=1)
6558 dnl ========================================================
6559 dnl = --enable-elf-dynstr-gc
6560 dnl ========================================================
6561 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6562 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6563     USE_ELF_DYNSTR_GC=1,
6564     USE_ELF_DYNSTR_GC= )
6566 dnl ========================================================
6567 dnl = --enable-old-abi-compat-wrappers
6568 dnl ========================================================
6569 dnl on x86 linux, the current builds of some popular plugins (notably
6570 dnl flashplayer and real) expect a few builtin symbols from libgcc
6571 dnl which were available in some older versions of gcc.  However,
6572 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6573 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6574 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6575 dnl to true on x86 linux, and false everywhere else.
6578 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6579 [  --enable-old-abi-compat-wrappers
6580                           Support old GCC ABI symbols to ease the pain 
6581                           of the linux compiler change],
6582     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6583     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6584 if test "$COMPILE_ENVIRONMENT"; then
6585 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6586     AC_LANG_SAVE
6587     AC_LANG_CPLUSPLUS
6588     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6589     AC_LANG_RESTORE
6590     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6592 fi # COMPILE_ENVIRONMENT
6594 dnl ========================================================
6595 dnl = --enable-prebinding
6596 dnl ========================================================
6597 MOZ_ARG_ENABLE_BOOL(prebinding,
6598 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6599     USE_PREBINDING=1,
6600     USE_PREBINDING= )
6602 dnl ========================================================
6603 dnl = 
6604 dnl = Profiling and Instrumenting
6605 dnl = 
6606 dnl ========================================================
6607 MOZ_ARG_HEADER(Profiling and Instrumenting)
6609 dnl ========================================================
6610 dnl = Enable timeline service, which provides lightweight
6611 dnl = instrumentation of mozilla for performance measurement.
6612 dnl = Timeline is off by default.
6613 dnl ========================================================
6614 MOZ_ARG_ENABLE_BOOL(timeline,
6615 [  --enable-timeline       Enable timeline services ],
6616     MOZ_TIMELINE=1,
6617     MOZ_TIMELINE= )
6618 if test -n "$MOZ_TIMELINE"; then
6619     AC_DEFINE(MOZ_TIMELINE)
6622 dnl ========================================================
6623 dnl Turn on reflow counting
6624 dnl ========================================================
6625 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6626 [  --enable-reflow-perf    Enable reflow performance tracing],
6627     MOZ_REFLOW_PERF=1,
6628     MOZ_REFLOW_PERF= )
6629 if test -n "$MOZ_REFLOW_PREF"; then
6630     AC_DEFINE(MOZ_REFLOW_PREF)
6632 AC_SUBST(MOZ_REFLOW_PERF)
6634 dnl ========================================================
6635 dnl Enable performance metrics.
6636 dnl ========================================================
6637 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6638 [  --enable-perf-metrics   Enable performance metrics],
6639     MOZ_PERF_METRICS=1,
6640     MOZ_PERF_METRICS= )
6641 if test -n "$MOZ_PERF_METRICS"; then
6642     AC_DEFINE(MOZ_PERF_METRICS)
6645 dnl ========================================================
6646 dnl Enable code size metrics.
6647 dnl ========================================================
6648 MOZ_ARG_ENABLE_BOOL(codesighs,
6649 [  --enable-codesighs      Enable code size analysis tools],
6650     _ENABLE_CODESIGHS=1,
6651     _ENABLE_CODESIGHS= )
6652 if test -n "$_ENABLE_CODESIGHS"; then
6653     if test -d $srcdir/tools/codesighs; then 
6654         MOZ_MAPINFO=1
6655     else
6656         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6657     fi
6660 dnl ========================================================
6661 dnl = Add support for Eazel profiler
6662 dnl ========================================================
6663 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6664 [  --enable-eazel-profiler-support
6665                           Enable Corel/Eazel profiler support],
6666     ENABLE_EAZEL_PROFILER=1,
6667     ENABLE_EAZEL_PROFILER= )
6668 if test -n "$ENABLE_EAZEL_PROFILER"; then
6669     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6670     USE_ELF_DYNSTR_GC=
6671     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6672     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6673     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6676 MOZ_ARG_ENABLE_STRING(profile-modules,
6677 [  --enable-profile-modules
6678                           Enable/disable profiling for specific modules],
6679 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6681 MOZ_ARG_ENABLE_BOOL(insure,
6682 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6683     _ENABLE_INSURE=1,
6684     _ENABLE_INSURE= )
6685 if test -n "$_ENABLE_INSURE"; then
6686     MOZ_INSURE="insure"
6687     MOZ_INSURIFYING=1
6688     MOZ_INSURE_DIRS="."
6689     MOZ_INSURE_EXCLUDE_DIRS="config"
6692 MOZ_ARG_WITH_STRING(insure-dirs,
6693 [  --with-insure-dirs=DIRS
6694                           Dirs to instrument with insure ],
6695     MOZ_INSURE_DIRS=$withval )
6697 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6698 [  --with-insure-exclude-dirs=DIRS
6699                           Dirs to not instrument with insure ],
6700     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6702 dnl ========================================================
6703 dnl = Support for Quantify (Windows)
6704 dnl ========================================================
6705 MOZ_ARG_ENABLE_BOOL(quantify,
6706 [  --enable-quantify      Enable Quantify support (Windows only) ],
6707     MOZ_QUANTIFY=1,
6708     MOZ_QUANTIFY= )
6710 dnl ========================================================
6711 dnl = Support for demangling undefined symbols
6712 dnl ========================================================
6713 if test -z "$SKIP_LIBRARY_CHECKS"; then
6714     AC_LANG_SAVE
6715     AC_LANG_CPLUSPLUS
6716     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6717     AC_LANG_RESTORE
6720 # Demangle only for debug or trace-malloc builds
6721 MOZ_DEMANGLE_SYMBOLS=
6722 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6723     MOZ_DEMANGLE_SYMBOLS=1
6724     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6726 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6728 dnl ========================================================
6729 dnl = Support for gcc stack unwinding (from gcc 3.3)
6730 dnl ========================================================
6731 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6732     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6735 dnl ========================================================
6736 dnl =
6737 dnl = Misc. Options
6738 dnl = 
6739 dnl ========================================================
6740 MOZ_ARG_HEADER(Misc. Options)
6742 dnl ========================================================
6743 dnl update xterm title
6744 dnl ========================================================
6745 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6746 [  --enable-xterm-updates  Update XTERM titles with current command.],
6747     MOZ_UPDATE_XTERM=1,
6748     MOZ_UPDATE_XTERM= )
6750 dnl =========================================================
6751 dnl = Chrome format
6752 dnl =========================================================
6753 MOZ_ARG_ENABLE_STRING([chrome-format],
6754 [  --enable-chrome-format=jar|flat|both|symlink
6755                           Select FORMAT of chrome files (default=jar)],
6756     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6758 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6759     MOZ_CHROME_FILE_FORMAT=jar
6762 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6763     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6764     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6765     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6766     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6769 dnl ========================================================
6770 dnl = Define default location for MOZILLA_FIVE_HOME
6771 dnl ========================================================
6772 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6773 [  --with-default-mozilla-five-home
6774                           Set the default value for MOZILLA_FIVE_HOME],
6775 [ val=`echo $withval`
6776   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6778 dnl ========================================================
6779 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6780 dnl ========================================================
6781 MOZ_ARG_WITH_STRING(user-appdir,
6782 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6783 [ val=`echo $withval`
6784 if echo "$val" | grep "\/" >/dev/null; then
6785     AC_MSG_ERROR("Homedir must be single relative path.")
6786 else 
6787     MOZ_USER_DIR="$val"
6788 fi])
6790 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6792 dnl ========================================================
6793 dnl = Doxygen configuration
6794 dnl ========================================================
6795 dnl Use commas to specify multiple dirs to this arg
6796 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6797 MOZ_ARG_WITH_STRING(doc-input-dirs,
6798 [  --with-doc-input-dirs=DIRS
6799                           Header/idl dirs to create docs from],
6800 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6801 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6803 dnl Use commas to specify multiple dirs to this arg
6804 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6805 MOZ_ARG_WITH_STRING(doc-include-dirs,
6806 [  --with-doc-include-dirs=DIRS  
6807                           Include dirs to preprocess doc headers],
6808 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6809 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6811 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6812 MOZ_ARG_WITH_STRING(doc-output-dir,
6813 [  --with-doc-output-dir=DIR
6814                           Dir to generate docs into],
6815 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6816 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6818 if test -z "$SKIP_COMPILER_CHECKS"; then
6819 dnl ========================================================
6820 dnl =
6821 dnl = Compiler Options
6822 dnl = 
6823 dnl ========================================================
6824 MOZ_ARG_HEADER(Compiler Options)
6826 dnl ========================================================
6827 dnl Check for gcc -pipe support
6828 dnl ========================================================
6829 AC_MSG_CHECKING([for gcc -pipe support])
6830 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6831     echo '#include <stdio.h>' > dummy-hello.c
6832     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6833     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6834     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6835     if test $? = 0; then
6836         _res_as_stdin="yes"
6837     else
6838         _res_as_stdin="no"
6839     fi
6840     if test "$_res_as_stdin" = "yes"; then
6841         _SAVE_CFLAGS=$CFLAGS
6842         CFLAGS="$CFLAGS -pipe"
6843         AC_TRY_COMPILE( [ #include <stdio.h> ],
6844             [printf("Hello World\n");],
6845             [_res_gcc_pipe="yes"],
6846             [_res_gcc_pipe="no"] )
6847         CFLAGS=$_SAVE_CFLAGS
6848     fi
6849     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6850         _res="yes";
6851         CFLAGS="$CFLAGS -pipe"
6852         CXXFLAGS="$CXXFLAGS -pipe"
6853     else
6854         _res="no"
6855     fi
6856     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6857     AC_MSG_RESULT([$_res])
6858 else
6859     AC_MSG_RESULT([no])
6862 dnl pass -Wno-long-long to the compiler
6863 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6864 [  --enable-long-long-warning 
6865                           Warn about use of non-ANSI long long type],
6866     _IGNORE_LONG_LONG_WARNINGS=,
6867     _IGNORE_LONG_LONG_WARNINGS=1)
6869 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6870      _SAVE_CFLAGS="$CFLAGS"
6871      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6872      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6873      AC_TRY_COMPILE([], [return(0);], 
6874         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6875           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6876           result="yes" ], result="no")
6877      AC_MSG_RESULT([$result])
6878      CFLAGS="$_SAVE_CFLAGS"
6881 dnl ========================================================
6882 dnl Profile guided optimization
6883 dnl ========================================================
6884 dnl Test for profiling options
6885 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6886 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6888 dnl Provide a switch to disable PGO even when called via profiledbuild.
6889 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6890 [  --disable-profile-guided-optimization
6891                            Don't build with PGO even if called via make profiledbuild],
6892 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6893 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6895 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6897 _SAVE_CFLAGS="$CFLAGS"
6898 CFLAGS="$CFLAGS -fprofile-generate"
6900 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6901 AC_TRY_COMPILE([], [return 0;],
6902                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6903                  result="yes" ], result="no")
6904 AC_MSG_RESULT([$result])
6906 if test $result = "yes"; then
6907   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6908   PROFILE_USE_CFLAGS="-fprofile-use"
6909   PROFILE_USE_LDFLAGS="-fprofile-use"
6910 else
6911   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6912   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6913   AC_TRY_COMPILE([], [return 0;],
6914                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6915                    result="yes" ], result="no")
6916   AC_MSG_RESULT([$result])
6917   if test $result = "yes"; then
6918     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6919   fi
6920   # don't really care, this is an old GCC
6921   PROFILE_GEN_LDFLAGS=
6922   PROFILE_USE_LDFLAGS=
6925 CFLAGS="$_SAVE_CFLAGS"
6927 if test -n "$INTEL_CC"; then
6928   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6929   PROFILE_GEN_LDFLAGS=
6930   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6931   PROFILE_USE_LDFLAGS=
6934 dnl Sun Studio on Solaris
6935 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6936   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6937   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6938   if test "$CPU_ARCH" != "sparc"; then
6939     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6940     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6941   else
6942     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6943     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6944   fi
6947 AC_SUBST(PROFILE_GEN_CFLAGS)
6948 AC_SUBST(PROFILE_GEN_LDFLAGS)
6949 AC_SUBST(PROFILE_USE_CFLAGS)
6950 AC_SUBST(PROFILE_USE_LDFLAGS)
6952 AC_LANG_CPLUSPLUS
6954 dnl ========================================================
6955 dnl Test for -pedantic bustage
6956 dnl ========================================================
6957 MOZ_ARG_DISABLE_BOOL(pedantic,
6958 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6959 _PEDANTIC= )
6960 if test "$_PEDANTIC"; then
6961     _SAVE_CXXFLAGS=$CXXFLAGS
6962     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6963     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6964     AC_TRY_COMPILE([$configure_static_assert_macros],
6965                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6966                    result="no", result="yes" )
6967     AC_MSG_RESULT([$result])
6968     CXXFLAGS="$_SAVE_CXXFLAGS"
6970     case "$result" in
6971     no)
6972         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6973         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6974         ;;
6975     yes)
6976         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6977         ;;
6978     esac
6981 dnl ========================================================
6982 dnl Test for correct temporary object destruction order
6983 dnl ========================================================
6984 dnl We want to make sure the compiler follows the C++ spec here as 
6985 dnl xpcom and the string classes depend on it (bug 235381).
6986 AC_MSG_CHECKING([for correct temporary object destruction order])
6987 AC_TRY_RUN([ class A {
6988              public:  A(int& x) : mValue(x) {}
6989                       ~A() { mValue--; }
6990                       operator char**() { return 0; }
6991              private:  int& mValue;
6992              };
6993              void func(char **arg) {}
6994              int m=2;
6995              void test() {
6996                   func(A(m));
6997                   if (m==1) m = 0;
6998              }
6999              int main() {
7000                  test();
7001                  return(m);
7002              }
7003              ],
7004      result="yes", result="no", result="maybe")
7005 AC_MSG_RESULT([$result])
7007 if test "$result" = "no"; then
7008     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7011 dnl ========================================================
7012 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7013 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7014 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7015 dnl ========================================================
7016 _SAVE_CXXFLAGS=$CXXFLAGS
7017 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7018 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7019     ac_nscap_nonconst_opeq_bug,
7020     [AC_TRY_COMPILE([
7021                       template <class T>
7022                       class Pointer
7023                         {
7024                         public:
7025                           T* myPtr;
7026                         };
7027                       
7028                       template <class T, class U>
7029                       int operator==(const Pointer<T>& rhs, U* lhs)
7030                         {
7031                           return rhs.myPtr == lhs;
7032                         }
7033                       
7034                       template <class T, class U>
7035                       int operator==(const Pointer<T>& rhs, const U* lhs)
7036                         {
7037                           return rhs.myPtr == lhs;
7038                         }
7039                     ],
7040                     [
7041                       Pointer<int> foo;
7042                       const int* bar;
7043                       return foo == bar;
7044                     ],
7045                     ac_nscap_nonconst_opeq_bug="no",
7046                     ac_nscap_nonconst_opeq_bug="yes")])
7047 CXXFLAGS="$_SAVE_CXXFLAGS"
7049 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7050     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7052 fi # SKIP_COMPILER_CHECKS
7054 dnl ========================================================
7055 dnl C++ rtti
7056 dnl Should be smarter and check that the compiler does indeed have rtti
7057 dnl ========================================================
7058 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7059 [  --enable-cpp-rtti       Enable C++ RTTI ],
7060 [ _MOZ_USE_RTTI=1 ],
7061 [ _MOZ_USE_RTTI= ])
7063 if test "$_MOZ_USE_RTTI"; then
7064    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7065 else
7066    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7069 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7071 dnl ========================================================
7072 dnl C++ exceptions (g++/egcs only - for now)
7073 dnl Should be smarter and check that the compiler does indeed have exceptions
7074 dnl ========================================================
7075 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7076 [  --enable-cpp-exceptions Enable C++ exceptions ],
7077 [ _MOZ_CPP_EXCEPTIONS=1 ],
7078 [ _MOZ_CPP_EXCEPTIONS= ])
7080 if test "$_MOZ_CPP_EXCEPTIONS"; then
7081     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7082 else
7083     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7086 # Irix & OSF native compilers do not like exception declarations 
7087 # when exceptions are disabled
7088 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7089     AC_DEFINE(CPP_THROW_NEW, [])
7090 else
7091     AC_DEFINE(CPP_THROW_NEW, [throw()])
7093 AC_LANG_C
7095 dnl ========================================================
7096 dnl =
7097 dnl = Build depencency options
7098 dnl =
7099 dnl ========================================================
7100 MOZ_ARG_HEADER(Build dependencies)
7102 dnl ========================================================
7103 dnl = Do not auto generate dependency info
7104 dnl ========================================================
7105 MOZ_AUTO_DEPS=1
7106 MOZ_ARG_DISABLE_BOOL(auto-deps,
7107 [  --disable-auto-deps     Do not automatically generate dependency info],
7108     MOZ_AUTO_DEPS=,
7109     MOZ_AUTO_DEPS=1)
7111 if test -n "$MOZ_AUTO_DEPS"; then
7112 dnl ========================================================
7113 dnl = Use mkdepend instead of $CC -MD for dependency generation
7114 dnl ========================================================
7115 _cpp_md_flag=
7116 MOZ_ARG_DISABLE_BOOL(md,
7117 [  --disable-md            Do not use compiler-based dependencies ],
7118   [_cpp_md_flag=],
7119   [_cpp_md_flag=1],
7120   [dnl Default is to turn on -MD if using GNU-compatible compilers
7121    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7122      _cpp_md_flag=1
7123    fi
7124   dnl Default is to use -xM if using Sun Studio on Solaris
7125    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7126      _cpp_md_flag=1
7127    fi])
7128 if test "$_cpp_md_flag"; then
7129   COMPILER_DEPEND=1
7130   if test "$OS_ARCH" = "OpenVMS"; then
7131     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
7132   else
7133     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
7134   fi
7135   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7136   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7137     _DEPEND_CFLAGS=
7138   fi
7139 else
7140   COMPILER_DEPEND=
7141   _USE_CPP_INCLUDE_FLAG=
7142   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7143   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7145 fi # MOZ_AUTO_DEPS
7146 MDDEPDIR='.deps'
7147 AC_SUBST(MOZ_AUTO_DEPS)
7148 AC_SUBST(COMPILER_DEPEND)
7149 AC_SUBST(MDDEPDIR)
7152 dnl ========================================================
7153 dnl =
7154 dnl = Static Build Options
7155 dnl =
7156 dnl ========================================================
7157 MOZ_ARG_HEADER(Static build options)
7159 MOZ_ARG_ENABLE_BOOL(static,
7160 [  --enable-static         Enable building of internal static libs],
7161     BUILD_STATIC_LIBS=1,
7162     BUILD_STATIC_LIBS=)
7164 dnl Disable libxul in debug builds, but not for xulrunner.
7165 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7166    MOZ_ENABLE_LIBXUL=
7169 MOZ_ARG_ENABLE_BOOL(libxul,
7170 [  --enable-libxul         Enable building of libxul],
7171     MOZ_ENABLE_LIBXUL=1,
7172     MOZ_ENABLE_LIBXUL=)
7174 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7175         AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7178 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7179         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7182 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7183         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7186 if test -n "$MOZ_ENABLE_LIBXUL"; then
7187     XPCOM_LIBS="$LIBXUL_LIBS"
7188     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7189 else
7190     if test -n "$BUILD_STATIC_LIBS"; then
7191         AC_DEFINE(MOZ_STATIC_BUILD)
7192     fi
7193     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7196 dnl ========================================================
7197 dnl = Force JS to be a static lib
7198 dnl ========================================================
7199 MOZ_ARG_ENABLE_BOOL(js-static-build,
7200 [  --enable-js-static-build  Force js to be a static lib],
7201     JS_STATIC_BUILD=1,
7202     JS_STATIC_BUILD= )
7204 AC_SUBST(JS_STATIC_BUILD)
7205         
7206 if test -n "$JS_STATIC_BUILD"; then
7207     AC_DEFINE(EXPORT_JS_API)
7209 if test -z "$BUILD_STATIC_LIBS"; then
7210     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7215 dnl ========================================================
7216 dnl =
7217 dnl = Standalone module options
7218 dnl = 
7219 dnl ========================================================
7220 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7222 dnl Check for GLib and libIDL.
7223 dnl ========================================================
7224 case "$target_os" in
7225 msvc*|mks*|cygwin*|mingw*|wince*)
7226     SKIP_IDL_CHECK="yes"
7227     ;;
7229     SKIP_IDL_CHECK="no"
7230     ;;
7231 esac
7233 if test -z "$COMPILE_ENVIRONMENT"; then
7234     SKIP_IDL_CHECK="yes"
7237 dnl = Allow users to disable libIDL checking for standalone modules
7238 MOZ_ARG_WITHOUT_BOOL(libIDL,
7239 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7240         SKIP_IDL_CHECK="yes")
7242 if test "$SKIP_IDL_CHECK" = "no"
7243 then
7244     _LIBIDL_FOUND=
7245     if test "$MACOS_SDK_DIR"; then 
7246       dnl xpidl, and therefore libIDL, is only needed on the build host.
7247       dnl Don't build it against the SDK, as that causes problems.
7248       _MACSAVE_CFLAGS="$CFLAGS"
7249       _MACSAVE_LIBS="$LIBS"
7250       _MACSAVE_LDFLAGS="$LDFLAGS"
7251       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7252       changequote(,)
7253       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"`
7254       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7255       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7256       changequote([,])
7257       unset NEXT_ROOT
7258     fi
7260     if test "$MOZ_ENABLE_GTK2"; then
7261         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7262     fi
7263     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7264     dnl to either libIDL1 or libIDL2.
7265     if test -z "$_LIBIDL_FOUND"; then
7266         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7267         if test -z "$_LIBIDL_FOUND"; then
7268             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7269         fi
7270     fi
7271     dnl
7272     dnl If we don't have a libIDL config program & not cross-compiling, 
7273     dnl     look for orbit-config instead.
7274     dnl
7275     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7276         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7277         if test -n "$ORBIT_CONFIG"; then
7278             AC_MSG_CHECKING([for ORBit libIDL usability])
7279                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7280             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7281             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7282             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7283             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7284             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7285             LIBIDL_CONFIG=
7286             _SAVE_CFLAGS="$CFLAGS"
7287             _SAVE_LIBS="$LIBS"
7288             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7289             LIBS="$LIBIDL_LIBS $LIBS"
7290             AC_TRY_RUN([
7291 #include <stdlib.h>
7292 #include <libIDL/IDL.h>
7293 int main() {
7294   char *s;
7295   s=strdup(IDL_get_libver_string());
7296   if(s==NULL) {
7297     exit(1);
7298   }
7299   exit(0);
7301             ], [_LIBIDL_FOUND=1
7302                 result="yes"],
7303                [LIBIDL_CFLAGS=
7304                 LIBIDL_LIBS=
7305                 result="no"],
7306                [_LIBIDL_FOUND=1
7307                 result="maybe"] )
7308             AC_MSG_RESULT($result)
7309             CFLAGS="$_SAVE_CFLAGS"
7310             LIBS="$_SAVE_LIBS"
7311         fi
7312     fi
7313     if test -z "$_LIBIDL_FOUND"; then
7314         AC_MSG_ERROR([libIDL not found.
7315         libIDL $LIBIDL_VERSION or higher is required.])
7316     fi
7317     if test "$MACOS_SDK_DIR"; then
7318       CFLAGS="$_MACSAVE_CFLAGS"
7319       LIBS="$_MACSAVE_LIBS"
7320       LDFLAGS="$_MACSAVE_LDFLAGS"
7321       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7322         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7323       fi
7324     fi
7327 if test -n "$CROSS_COMPILE"; then
7328      if test -z "$HOST_LIBIDL_CONFIG"; then
7329         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7330     fi
7331     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7332         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7333         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7334     else
7335         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7336         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7337     fi
7340 if test -z "$SKIP_PATH_CHECKS"; then
7341 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7342     if test "$MOZ_ENABLE_GTK2"; then
7343         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7344     else
7345         AM_PATH_GLIB(${GLIB_VERSION})
7346     fi
7350 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7351     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7354 AC_SUBST(LIBIDL_CFLAGS)
7355 AC_SUBST(LIBIDL_LIBS)
7356 AC_SUBST(STATIC_LIBIDL)
7357 AC_SUBST(GLIB_CFLAGS)
7358 AC_SUBST(GLIB_LIBS)
7359 AC_SUBST(GLIB_GMODULE_LIBS)
7360 AC_SUBST(HOST_LIBIDL_CONFIG)
7361 AC_SUBST(HOST_LIBIDL_CFLAGS)
7362 AC_SUBST(HOST_LIBIDL_LIBS)
7364 dnl ========================================================
7365 dnl Check for libart
7366 dnl ========================================================
7367 if test "$MOZ_SVG_RENDERER_LIBART"; then
7368   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7369     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7370 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7371   fi
7373   dnl libart's configure hasn't been run yet, but we know what the
7374   dnl answer should be anyway
7375   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7376   case "$target_os" in
7377   msvc*|mks*|cygwin*|mingw*|wince*)
7378       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7379       ;;
7380   os2*)
7381       MOZ_LIBART_LIBS='-lmoz_art -lm'
7382       ;;
7383   beos*)
7384       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7385       ;;
7386   *)
7387       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7388       ;;
7389   esac
7390   AC_FUNC_ALLOCA
7393 AC_SUBST(MOZ_LIBART_CFLAGS)
7394 AC_SUBST(MOZ_LIBART_LIBS)
7396 dnl ========================================================
7397 dnl Check for cairo
7398 dnl ========================================================
7399 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7401 MOZ_TREE_CAIRO=1
7402 MOZ_ARG_ENABLE_BOOL(system-cairo,
7403 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7404 MOZ_TREE_CAIRO=,
7405 MOZ_TREE_CAIRO=1 )
7407 # Check for headers defining standard int types.
7408 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7410 if test "$MOZ_TREE_CAIRO"; then
7411     AC_DEFINE(MOZ_TREE_CAIRO)
7413     # For now we assume that we will have a uint64_t available through
7414     # one of the above headers or mozstdint.h.
7415     AC_DEFINE(HAVE_UINT64_T)
7417     # Define macros for cairo-features.h
7418     if test "$MOZ_X11"; then
7419         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7420         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7421         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7422         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7423         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7424         MOZ_ENABLE_CAIRO_FT=1
7425         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7426     fi
7427     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7428         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7429     fi
7430     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7431         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7432         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7433         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7434     fi
7435     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7436         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7437         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7438         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7439     fi
7440     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7441         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7442         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7443         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7444         MOZ_ENABLE_CAIRO_FT=1
7445         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7446         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7447     fi
7448     if test "$MOZ_ENABLE_GLITZ"; then
7449         GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
7450     fi
7451     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7452         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7453         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7454         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7455         MOZ_ENABLE_CAIRO_FT=1
7456     fi
7457     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7458     AC_SUBST(CAIRO_FT_CFLAGS)
7460     if test "$MOZ_DEBUG"; then
7461       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7462     else
7463       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7464     fi
7466     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7468     AC_SUBST(PS_SURFACE_FEATURE)
7469     AC_SUBST(PDF_SURFACE_FEATURE)
7470     AC_SUBST(SVG_SURFACE_FEATURE)
7471     AC_SUBST(XLIB_SURFACE_FEATURE)
7472     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7473     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7474     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7475     AC_SUBST(XCB_SURFACE_FEATURE)
7476     AC_SUBST(WIN32_SURFACE_FEATURE)
7477     AC_SUBST(OS2_SURFACE_FEATURE)
7478     AC_SUBST(BEOS_SURFACE_FEATURE)
7479     AC_SUBST(GLITZ_SURFACE_FEATURE)
7480     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7481     AC_SUBST(FT_FONT_FEATURE)
7482     AC_SUBST(WIN32_FONT_FEATURE)
7483     AC_SUBST(QUARTZ_FONT_FEATURE)
7484     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7485     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7487     if test "$_WIN32_MSVC"; then
7488         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7489         if test "$MOZ_ENABLE_GLITZ"; then
7490             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
7491         fi
7492     else
7493         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"
7495         if test "$MOZ_X11"; then
7496             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7497         fi
7499         if test "$MOZ_ENABLE_GLITZ"; then
7500             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
7501             if test "$MOZ_X11"; then
7502                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
7503             fi
7504             if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7505                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
7506             fi
7507         fi
7508     fi
7510     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7511     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7513 else
7514    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7515    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7516    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7517    if test "$MOZ_X11"; then
7518         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7519         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7520         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7521    fi
7524 AC_SUBST(MOZ_TREE_CAIRO)
7525 AC_SUBST(MOZ_CAIRO_CFLAGS)
7526 AC_SUBST(MOZ_CAIRO_LIBS)
7528 dnl ========================================================
7529 dnl Check for lcms
7530 dnl ========================================================
7532 MOZ_NATIVE_LCMS=
7533 MOZ_ARG_ENABLE_BOOL(system-lcms,
7534 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7535 MOZ_NATIVE_LCMS=1,
7536 MOZ_NATIVE_LCMS= )
7538 if test -z "$MOZ_NATIVE_LCMS"
7539 then
7540     LCMS_CFLAGS=
7541     if test "$_WIN32_MSVC"; then
7542         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7543             LCMS_CFLAGS=-DLCMS_DLL
7544         fi
7545         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7546     else
7547         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7548     fi
7549 else
7550     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7553 AC_SUBST(MOZ_NATIVE_LCMS)
7554 AC_SUBST(LCMS_CFLAGS)
7555 AC_SUBST(LCMS_LIBS)
7557 dnl ========================================================
7558 dnl disable xul
7559 dnl ========================================================
7560 MOZ_ARG_DISABLE_BOOL(xul,
7561 [  --disable-xul           Disable XUL],
7562     MOZ_XUL= )
7563 if test "$MOZ_XUL"; then
7564   AC_DEFINE(MOZ_XUL)
7565 else
7566   dnl remove extensions that require XUL
7567   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7570 AC_SUBST(MOZ_XUL)
7572 dnl ========================================================
7573 dnl Two ways to enable Python support:
7574 dnl   --enable-extensions=python # select all available.
7575 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7576 dnl or:
7577 dnl   --enable-extensions=python/xpcom,... # select individual ones
7579 dnl If either is used, we locate the Python to use.
7580 dnl ========================================================
7582 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7583 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7584     dnl Allow PYTHON to point to the Python interpreter to use
7585     dnl (note that it must be the python executable - which we
7586     dnl run to locate the relevant paths etc)
7587     dnl If not set, we use whatever Python we can find.
7588     MOZ_PYTHON=$PYTHON
7589     dnl Ask Python what its version number is
7590     changequote(,)
7591     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7592     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7593     changequote([,])
7594     dnl Ask for the Python "prefix" (ie, home/source dir)
7595     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7596     dnl Setup the include and library directories.
7597     if test "$OS_ARCH" = "WINNT"; then
7598         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7599         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7600         dnl Binary trees have "include" for .h, and "libs" for .lib
7601         dnl We add 'em both - along with quotes, to handle spaces.
7602         MOZ_PYTHON_DLL_SUFFIX=.pyd
7603         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7604         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7605     else
7606         dnl Non-Windows include and libs
7607         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7608         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7609         dnl Check for dynamic Python lib
7610         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7611         dnl - core, xpcom loader, pydom etc) all need to share Python.
7612         dnl - Python 2.3's std --enable-shared configure option will
7613         dnl   create a libpython2.3.so.1.0. We should first try this
7614         dnl   dotted versioned .so file because this is the one that
7615         dnl   the PyXPCOM build mechanics tries to link to.
7616         dnl   XXX Should find a better way than hardcoding "1.0".
7617         dnl - Python developement tree dir layouts are NOT allowed here
7618         dnl   because the PyXPCOM build just dies on it later anyway.
7619         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7620         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7621             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7622         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7623             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7624         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7625             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7626         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7627             dnl Don't Python development tree directory layout.
7628             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7629             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.])
7630         elif test "$OS_ARCH" = "Darwin"; then
7631             dnl We do Darwin last, so if a custom non-framework build of
7632             dnl python is used on OSX, then it will be picked up first by
7633             dnl the logic above.
7634             MOZ_PYTHON_LIBS="-framework Python"
7635         else
7636             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7637         fi
7638         if test "$OS_ARCH" = "Linux"; then
7639             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7640         fi
7641     fi
7642     dnl Handle "_d" on Windows
7643     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7644         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7645     else
7646         MOZ_PYTHON_DEBUG_SUFFIX=
7647     fi
7648     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7651 dnl If the user asks for the 'python' extension, then we add
7652 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7653 dnl Note the careful regex - it must match 'python' followed by anything
7654 dnl other than a '/', including the end-of-string.
7655 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7656     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7657         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7658     done
7660 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7661 dnl command-line, but not yet
7662 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7663 AC_SUBST(MOZ_PYTHON)
7664 AC_SUBST(MOZ_PYTHON_PREFIX)
7665 AC_SUBST(MOZ_PYTHON_INCLUDES)
7666 AC_SUBST(MOZ_PYTHON_LIBS)
7667 AC_SUBST(MOZ_PYTHON_VER)
7668 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7669 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7670 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7672 dnl ========================================================
7673 dnl disable profile sharing
7674 dnl ========================================================
7675 MOZ_ARG_DISABLE_BOOL(profilesharing,
7676 [  --disable-profilesharing           Disable profile sharing],
7677     MOZ_PROFILESHARING=,
7678     MOZ_PROFILESHARING=1 )
7679 if test "$MOZ_PROFILESHARING"; then
7680   MOZ_IPCD=1
7681   AC_DEFINE(MOZ_PROFILESHARING)
7684 dnl ========================================================
7685 dnl enable ipc/ipcd
7686 dnl ========================================================
7687 MOZ_ARG_ENABLE_BOOL(ipcd,
7688 [  --enable-ipcd                      Enable IPC daemon],
7689     MOZ_IPCD=1,
7690     MOZ_IPCD= )
7692 dnl ========================================================
7693 dnl disable profile locking
7694 dnl   do no use this in applications that can have more than
7695 dnl   one process accessing the profile directory.
7696 dnl ========================================================
7697 MOZ_ARG_DISABLE_BOOL(profilelocking,
7698 [  --disable-profilelocking           Disable profile locking],
7699     MOZ_PROFILELOCKING=,
7700     MOZ_PROFILELOCKING=1 )
7701 if test "$MOZ_PROFILELOCKING"; then
7702   AC_DEFINE(MOZ_PROFILELOCKING)
7705 dnl ========================================================
7706 dnl disable rdf services
7707 dnl ========================================================
7708 MOZ_ARG_DISABLE_BOOL(rdf,
7709 [  --disable-rdf           Disable RDF],
7710     MOZ_RDF= )
7711 if test "$MOZ_RDF"; then
7712   AC_DEFINE(MOZ_RDF)
7715 AC_SUBST(MOZ_RDF)
7717 dnl ========================================================
7718 dnl necko configuration options
7719 dnl ========================================================
7722 dnl option to disable various necko protocols
7724 MOZ_ARG_ENABLE_STRING(necko-protocols,
7725 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7726                           Enable/disable specific protocol handlers],
7727 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7728     if test "$option" = "yes" || test "$option" = "all"; then
7729         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7730     elif test "$option" = "no" || test "$option" = "none"; then
7731         NECKO_PROTOCOLS=""
7732     elif test "$option" = "default"; then
7733         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7734     elif test `echo "$option" | grep -c \^-` != 0; then
7735         option=`echo $option | sed 's/^-//'`
7736         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7737     else
7738         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7739     fi
7740 done],
7741     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7742 dnl Remove dupes
7743 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7744 AC_SUBST(NECKO_PROTOCOLS)
7745 for p in $NECKO_PROTOCOLS; do
7746     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7747 done
7750 dnl option to disable necko's disk cache
7752 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7753 [  --disable-necko-disk-cache
7754                           Disable necko disk cache],
7755     NECKO_DISK_CACHE=,
7756     NECKO_DISK_CACHE=1)
7757 AC_SUBST(NECKO_DISK_CACHE)
7758 if test "$NECKO_DISK_CACHE"; then
7759     AC_DEFINE(NECKO_DISK_CACHE)
7763 dnl option to minimize size of necko's i/o buffers
7765 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7766 [  --enable-necko-small-buffers
7767                           Minimize size of necko's i/o buffers],
7768     NECKO_SMALL_BUFFERS=1,
7769     NECKO_SMALL_BUFFERS=)
7770 AC_SUBST(NECKO_SMALL_BUFFERS)
7771 if test "$NECKO_SMALL_BUFFERS"; then
7772     AC_DEFINE(NECKO_SMALL_BUFFERS)
7773 fi 
7776 dnl option to disable cookies
7778 MOZ_ARG_DISABLE_BOOL(cookies,
7779 [  --disable-cookies       Disable cookie support],
7780     NECKO_COOKIES=,
7781     NECKO_COOKIES=1)
7782 AC_SUBST(NECKO_COOKIES)
7783 if test "$NECKO_COOKIES"; then
7784     AC_DEFINE(NECKO_COOKIES)
7787 dnl NECKO_ configuration options are not global
7788 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7790 dnl ========================================================
7791 dnl string api compatibility
7792 dnl ========================================================
7793 MOZ_ARG_DISABLE_BOOL(v1-string-abi,
7794 [  --disable-v1-string-abi   Disable binary compatibility layer for strings],
7795     MOZ_V1_STRING_ABI=,
7796     MOZ_V1_STRING_ABI=1)
7797 AC_SUBST(MOZ_V1_STRING_ABI)
7798 if test "$MOZ_V1_STRING_ABI"; then
7799     AC_DEFINE(MOZ_V1_STRING_ABI)
7802 dnl Only build Mork if it's required
7803 AC_SUBST(MOZ_MORK)
7804 if test "$MOZ_MORK"; then
7805   AC_DEFINE(MOZ_MORK)
7808 dnl Build the lightweight Mork reader if required
7809 AC_SUBST(MOZ_MORKREADER)
7810 if test "$MOZ_MORKREADER"; then
7811   AC_DEFINE(MOZ_MORKREADER)
7814 dnl ========================================================
7815 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7816     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7819 dnl ========================================================
7820 dnl =
7821 dnl = Maintainer debug option (no --enable equivalent)
7822 dnl =
7823 dnl ========================================================
7825 AC_SUBST(AR)
7826 AC_SUBST(AR_FLAGS)
7827 AC_SUBST(AR_LIST)
7828 AC_SUBST(AR_EXTRACT)
7829 AC_SUBST(AR_DELETE)
7830 AC_SUBST(AS)
7831 AC_SUBST(ASFLAGS)
7832 AC_SUBST(AS_DASH_C_FLAG)
7833 AC_SUBST(LD)
7834 AC_SUBST(RC)
7835 AC_SUBST(RCFLAGS)
7836 AC_SUBST(WINDRES)
7837 AC_SUBST(USE_SHORT_LIBNAME)
7838 AC_SUBST(IMPLIB)
7839 AC_SUBST(FILTER)
7840 AC_SUBST(BIN_FLAGS)
7841 AC_SUBST(NS_USE_NATIVE)
7842 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7843 AC_SUBST(MOZ_GFX_TOOLKIT)
7844 AC_SUBST(MOZ_UPDATE_XTERM)
7845 AC_SUBST(MINIMO)
7846 AC_SUBST(MOZ_PLATFORM_HILDON)
7847 AC_SUBST(NS_OSSO)
7848 AC_SUBST(NS_MAEMO_LOCATION)
7849 AC_SUBST(MOZ_AUTH_EXTENSION)
7850 AC_SUBST(MOZ_MATHML)
7851 AC_SUBST(MOZ_PERMISSIONS)
7852 AC_SUBST(MOZ_XTF)
7853 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7854 AC_SUBST(MOZ_PREF_EXTENSIONS)
7855 AC_SUBST(MOZ_SVG)
7856 AC_SUBST(MOZ_XSLT_STANDALONE)
7857 AC_SUBST(MOZ_JS_LIBS)
7858 AC_SUBST(MOZ_PSM)
7859 AC_SUBST(MOZ_DEBUG)
7860 AC_SUBST(MOZ_DEBUG_MODULES)
7861 AC_SUBST(MOZ_PROFILE_MODULES)
7862 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7863 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7864 AC_SUBST(MOZ_DEBUG_FLAGS)
7865 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7866 AC_SUBST(WARNINGS_AS_ERRORS)
7867 AC_SUBST(MOZ_DBGRINFO_MODULES)
7868 AC_SUBST(MOZ_EXTENSIONS)
7869 AC_SUBST(MOZ_IMG_DECODERS)
7870 AC_SUBST(MOZ_IMG_ENCODERS)
7871 AC_SUBST(MOZ_JSDEBUGGER)
7872 AC_SUBST(MOZ_OJI)
7873 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7874 AC_SUBST(MOZ_PLUGINS)
7875 AC_SUBST(ENABLE_EAZEL_PROFILER)
7876 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7877 AC_SUBST(EAZEL_PROFILER_LIBS)
7878 AC_SUBST(MOZ_PERF_METRICS)
7879 AC_SUBST(GC_LEAK_DETECTOR)
7880 AC_SUBST(MOZ_LOG_REFCNT)
7881 AC_SUBST(MOZ_LEAKY)
7882 AC_SUBST(MOZ_JPROF)
7883 AC_SUBST(MOZ_SHARK)
7884 AC_SUBST(MOZ_CALLGRIND)
7885 AC_SUBST(MOZ_VTUNE)
7886 AC_SUBST(MOZ_XPCTOOLS)
7887 AC_SUBST(MOZ_JSLOADER)
7888 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7889 AC_SUBST(MOZ_INSURE)
7890 AC_SUBST(MOZ_INSURE_DIRS)
7891 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7892 AC_SUBST(MOZ_QUANTIFY)
7893 AC_SUBST(MOZ_INSURIFYING)
7894 AC_SUBST(LIBICONV)
7895 AC_SUBST(MOZ_PLACES)
7896 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7897 AC_SUBST(MOZ_STORAGE)
7898 AC_SUBST(MOZ_FEEDS)
7899 AC_SUBST(NS_PRINTING)
7901 AC_SUBST(MOZ_JAVAXPCOM)
7902 AC_SUBST(JAVA_INCLUDE_PATH)
7903 AC_SUBST(JAVA)
7904 AC_SUBST(JAVAC)
7905 AC_SUBST(JAR)
7907 AC_SUBST(MOZ_PROFILESHARING)
7908 AC_SUBST(MOZ_PROFILELOCKING)
7910 AC_SUBST(MOZ_IPCD)
7912 AC_SUBST(HAVE_XIE)
7913 AC_SUBST(MOZ_XIE_LIBS)
7914 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7916 AC_SUBST(XPCOM_USE_LEA)
7917 AC_SUBST(BUILD_STATIC_LIBS)
7918 AC_SUBST(MOZ_ENABLE_LIBXUL)
7919 AC_SUBST(ENABLE_TESTS)
7920 AC_SUBST(IBMBIDI)
7921 AC_SUBST(MOZ_UNIVERSALCHARDET)
7922 AC_SUBST(ACCESSIBILITY)
7923 AC_SUBST(MOZ_XPINSTALL)
7924 AC_SUBST(MOZ_VIEW_SOURCE)
7925 AC_SUBST(MOZ_SPELLCHECK)
7926 AC_SUBST(MOZ_XPFE_COMPONENTS)
7927 AC_SUBST(MOZ_USER_DIR)
7928 AC_SUBST(MOZ_CRASHREPORTER)
7930 AC_SUBST(ENABLE_STRIP)
7931 AC_SUBST(PKG_SKIP_STRIP)
7932 AC_SUBST(USE_ELF_DYNSTR_GC)
7933 AC_SUBST(USE_PREBINDING)
7934 AC_SUBST(INCREMENTAL_LINKER)
7935 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7936 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7937 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7939 AC_SUBST(MOZ_FIX_LINK_PATHS)
7940 AC_SUBST(XPCOM_LIBS)
7941 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7942 AC_SUBST(XPCOM_GLUE_LDOPTS)
7943 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7945 AC_SUBST(USE_DEPENDENT_LIBS)
7947 AC_SUBST(MOZ_BUILD_ROOT)
7948 AC_SUBST(MOZ_OS2_TOOLS)
7949 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7951 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7952 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7953 AC_SUBST(MOZ_TIMELINE)
7954 AC_SUBST(WINCE)
7955 AC_SUBST(TARGET_DEVICE)
7957 AC_SUBST(MOZ_APP_NAME)
7958 AC_SUBST(MOZ_APP_DISPLAYNAME)
7959 AC_SUBST(MOZ_APP_VERSION)
7960 AC_SUBST(FIREFOX_VERSION)
7962 AC_SUBST(MOZ_PKG_SPECIAL)
7964 AC_SUBST(MOZILLA_OFFICIAL)
7965 AC_SUBST(BUILD_OFFICIAL)
7966 AC_SUBST(MOZ_MILESTONE_RELEASE)
7968 dnl win32 options
7969 AC_SUBST(MOZ_PROFILE)
7970 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7971 AC_SUBST(MOZ_MAPINFO)
7972 AC_SUBST(MOZ_BROWSE_INFO)
7973 AC_SUBST(MOZ_TOOLS_DIR)
7974 AC_SUBST(CYGWIN_WRAPPER)
7975 AC_SUBST(AS_PERL)
7976 AC_SUBST(WIN32_REDIST_DIR)
7977 AC_SUBST(PYTHON)
7979 dnl Echo the CFLAGS to remove extra whitespace.
7980 CFLAGS=`echo \
7981         $_WARNINGS_CFLAGS \
7982         $CFLAGS`
7984 CXXFLAGS=`echo \
7985         $_MOZ_RTTI_FLAGS \
7986         $_MOZ_EXCEPTIONS_FLAGS \
7987         $_WARNINGS_CXXFLAGS \
7988         $CXXFLAGS`
7990 COMPILE_CFLAGS=`echo \
7991     $_DEFINES_CFLAGS \
7992         $_DEPEND_CFLAGS \
7993     $COMPILE_CFLAGS`
7995 COMPILE_CXXFLAGS=`echo \
7996     $_DEFINES_CXXFLAGS \
7997         $_DEPEND_CFLAGS \
7998     $COMPILE_CXXFLAGS`
8000 AC_SUBST(SYSTEM_MAKEDEPEND)
8001 AC_SUBST(SYSTEM_JPEG)
8002 AC_SUBST(SYSTEM_PNG)
8003 AC_SUBST(SYSTEM_ZLIB)
8004 AC_SUBST(SYSTEM_BZ2)
8006 AC_SUBST(JPEG_CFLAGS)
8007 AC_SUBST(JPEG_LIBS)
8008 AC_SUBST(ZLIB_CFLAGS)
8009 AC_SUBST(ZLIB_LIBS)
8010 AC_SUBST(BZ2_CFLAGS)
8011 AC_SUBST(BZ2_LIBS)
8012 AC_SUBST(PNG_CFLAGS)
8013 AC_SUBST(PNG_LIBS)
8015 AC_SUBST(MOZ_JPEG_CFLAGS)
8016 AC_SUBST(MOZ_JPEG_LIBS)
8017 AC_SUBST(MOZ_ZLIB_CFLAGS)
8018 AC_SUBST(MOZ_ZLIB_LIBS)
8019 AC_SUBST(MOZ_BZ2_CFLAGS)
8020 AC_SUBST(MOZ_BZ2_LIBS)
8021 AC_SUBST(MOZ_PNG_CFLAGS)
8022 AC_SUBST(MOZ_PNG_LIBS)
8024 AC_SUBST(NSPR_CFLAGS)
8025 AC_SUBST(NSPR_LIBS)
8026 AC_SUBST(MOZ_NATIVE_NSPR)
8028 AC_SUBST(NSS_CFLAGS)
8029 AC_SUBST(NSS_LIBS)
8030 AC_SUBST(NSS_DEP_LIBS)
8031 AC_SUBST(MOZ_NATIVE_NSS)
8033 AC_SUBST(CFLAGS)
8034 AC_SUBST(CXXFLAGS)
8035 AC_SUBST(CPPFLAGS)
8036 AC_SUBST(COMPILE_CFLAGS)
8037 AC_SUBST(COMPILE_CXXFLAGS)
8038 AC_SUBST(LDFLAGS)
8039 AC_SUBST(LIBS)
8040 AC_SUBST(CROSS_COMPILE)
8042 AC_SUBST(HOST_CC)
8043 AC_SUBST(HOST_CXX)
8044 AC_SUBST(HOST_CFLAGS)
8045 AC_SUBST(HOST_CXXFLAGS)
8046 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8047 AC_SUBST(HOST_AR)
8048 AC_SUBST(HOST_AR_FLAGS)
8049 AC_SUBST(HOST_LD)
8050 AC_SUBST(HOST_RANLIB)
8051 AC_SUBST(HOST_NSPR_MDCPUCFG)
8052 AC_SUBST(HOST_BIN_SUFFIX)
8053 AC_SUBST(HOST_OS_ARCH)
8055 AC_SUBST(TARGET_CPU)
8056 AC_SUBST(TARGET_VENDOR)
8057 AC_SUBST(TARGET_OS)
8058 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8059 AC_SUBST(TARGET_MD_ARCH)
8060 AC_SUBST(TARGET_XPCOM_ABI)
8061 AC_SUBST(OS_TARGET)
8062 AC_SUBST(OS_ARCH)
8063 AC_SUBST(OS_RELEASE)
8064 AC_SUBST(OS_TEST)
8066 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8067 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8069 AC_SUBST(WRAP_MALLOC_CFLAGS)
8070 AC_SUBST(WRAP_MALLOC_LIB)
8071 AC_SUBST(MKSHLIB)
8072 AC_SUBST(MKCSHLIB)
8073 AC_SUBST(MKSHLIB_FORCE_ALL)
8074 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8075 AC_SUBST(DSO_CFLAGS)
8076 AC_SUBST(DSO_PIC_CFLAGS)
8077 AC_SUBST(DSO_LDOPTS)
8078 AC_SUBST(LIB_PREFIX)
8079 AC_SUBST(DLL_PREFIX)
8080 AC_SUBST(DLL_SUFFIX)
8081 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8082 AC_SUBST(LIB_SUFFIX)
8083 AC_SUBST(OBJ_SUFFIX)
8084 AC_SUBST(BIN_SUFFIX)
8085 AC_SUBST(ASM_SUFFIX)
8086 AC_SUBST(IMPORT_LIB_SUFFIX)
8087 AC_SUBST(USE_N32)
8088 AC_SUBST(CC_VERSION)
8089 AC_SUBST(CXX_VERSION)
8090 AC_SUBST(MSMANIFEST_TOOL)
8092 if test "$USING_HCC"; then
8093    CC='${topsrcdir}/build/hcc'
8094    CC="$CC '$_OLDCC'"
8095    CXX='${topsrcdir}/build/hcpp'
8096    CXX="$CXX '$_OLDCXX'"
8097    AC_SUBST(CC)
8098    AC_SUBST(CXX)
8101 dnl Check for missing components
8102 if test "$COMPILE_ENVIRONMENT"; then
8103 if test "$MOZ_X11"; then
8104     dnl ====================================================
8105     dnl = Check if X headers exist
8106     dnl ====================================================
8107     _SAVE_CFLAGS=$CFLAGS
8108     CFLAGS="$CFLAGS $XCFLAGS"
8109     AC_TRY_COMPILE([
8110         #include <stdio.h>
8111         #include <stdlib.h>
8112         #include <X11/Xlib.h>
8113         #include <X11/Intrinsic.h>
8114     ],
8115     [
8116         Display *dpy = 0;
8117         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8118             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8119             exit(1);
8120         }
8121     ], [], 
8122     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8123     CFLAGS="$_SAVE_CFLAGS"
8125     if test ! -z "$MISSING_X"; then
8126         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8127     fi
8129 fi # MOZ_X11
8130 fi # COMPILE_ENVIRONMENT
8132 dnl Set various defines and substitutions
8133 dnl ========================================================
8135 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
8136       LIBS='so32dll.lib tcp32dll.lib'
8137 elif test "$OS_ARCH" = "BeOS"; then
8138   AC_DEFINE(XP_BEOS)
8139   MOZ_MOVEMAIL=1
8140 elif test "$OS_ARCH" = "Darwin"; then
8141   AC_DEFINE(XP_UNIX)
8142   AC_DEFINE(UNIX_ASYNC_DNS)
8143   MOZ_MOVEMAIL=1
8144 elif test "$OS_ARCH" = "OpenVMS"; then
8145   AC_DEFINE(XP_UNIX)
8146 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8147   AC_DEFINE(XP_UNIX)
8148   AC_DEFINE(UNIX_ASYNC_DNS)
8149   MOZ_MOVEMAIL=1
8151 AC_SUBST(MOZ_MOVEMAIL)
8153 AC_DEFINE(JS_THREADSAFE)
8155 if test "$MOZ_DEBUG"; then
8156     AC_DEFINE(MOZ_REFLOW_PERF)
8157     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8160 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8161     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8162     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8163     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8164     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8165     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8166     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8167     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8168     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8171 # Used for LD_LIBRARY_PATH of run_viewer target
8172 LIBS_PATH=
8173 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8174   case $lib_arg in
8175     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8176       * ) ;;
8177   esac
8178 done
8179 AC_SUBST(LIBS_PATH)
8181 dnl ========================================================
8182 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8183 dnl ========================================================
8184 case "$host_os" in
8185 mingw*)
8186     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8187     ;;
8188 cygwin*|msvc*|mks*)
8189     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8190     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8191     CC="\$(CYGWIN_WRAPPER) $CC"
8192     CXX="\$(CYGWIN_WRAPPER) $CXX"
8193     CPP="\$(CYGWIN_WRAPPER) $CPP"
8194     LD="\$(CYGWIN_WRAPPER) $LD"
8195     AS="\$(CYGWIN_WRAPPER) $AS"
8196     RC="\$(CYGWIN_WRAPPER) $RC"
8197     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8198     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8199     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8200     ;;
8201 esac
8203 AC_SUBST(CYGDRIVE_MOUNT)
8204 AC_SUBST(WIN_TOP_SRC)
8206 AC_SUBST(MOZILLA_VERSION)
8208 AC_SUBST(ac_configure_args)
8210 dnl Spit out some output
8211 dnl ========================================================
8213 dnl The following defines are used by xpcom
8214 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8215 CPP_THROW_NEW
8216 HAVE_CPP_2BYTE_WCHAR_T
8217 HAVE_CPP_ACCESS_CHANGING_USING
8218 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8219 HAVE_CPP_BOOL
8220 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8221 HAVE_CPP_EXPLICIT
8222 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8223 HAVE_CPP_NAMESPACE_STD
8224 HAVE_CPP_NEW_CASTS
8225 HAVE_CPP_PARTIAL_SPECIALIZATION
8226 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8227 HAVE_CPP_TYPENAME
8228 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8229 HAVE_STATVFS
8230 NEED_CPP_UNUSED_IMPLEMENTATIONS
8231 NEW_H
8232 HAVE_GETPAGESIZE
8233 HAVE_ICONV
8234 HAVE_ICONV_WITH_CONST_INPUT
8235 HAVE_MBRTOWC
8236 HAVE_SYS_MOUNT_H
8237 HAVE_SYS_VFS_H
8238 HAVE_WCRTOMB
8239 MOZ_V1_STRING_ABI
8242 AC_CONFIG_HEADER(
8243 netwerk/necko-config.h
8244 xpcom/xpcom-config.h
8245 xpcom/xpcom-private.h
8248 # Save the defines header file before autoconf removes it.
8249 # (Do not add AC_DEFINE calls after this line.)
8250   _CONFIG_TMP=confdefs-tmp.h
8251   _CONFIG_DEFS_H=mozilla-config.h
8253   cat > $_CONFIG_TMP <<\EOF
8254 /* List of defines generated by configure. Included with preprocessor flag,
8255  * -include, to avoid long list of -D defines on the compile command-line.
8256  * Do not edit.
8257  */
8259 #ifndef _MOZILLA_CONFIG_H_
8260 #define _MOZILLA_CONFIG_H_
8263 _EGREP_PATTERN='^#define ('
8264 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8265     for f in $_NON_GLOBAL_ACDEFINES; do
8266         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8267     done
8269 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8271   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8273   cat >> $_CONFIG_TMP <<\EOF
8275 #endif /* _MOZILLA_CONFIG_H_ */
8279   # Only write mozilla-config.h when something changes (or it doesn't exist)
8280   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8281     rm $_CONFIG_TMP
8282   else
8283     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8284     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8286     echo ==== $_CONFIG_DEFS_H =================================
8287     cat $_CONFIG_DEFS_H
8288   fi
8290 dnl Probably shouldn't call this manually but we always want the output of DEFS
8291 rm -f confdefs.h.save
8292 mv confdefs.h confdefs.h.save
8293 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8294 AC_OUTPUT_MAKE_DEFS()
8295 MOZ_DEFINES=$DEFS
8296 AC_SUBST(MOZ_DEFINES)
8297 rm -f confdefs.h
8298 mv confdefs.h.save confdefs.h
8300 dnl Load the list of Makefiles to generate.
8301 dnl   To add new Makefiles, edit allmakefiles.sh.
8302 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8303 . ${srcdir}/allmakefiles.sh
8304 dnl 
8305 dnl Run a perl script to quickly create the makefiles.
8306 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8307 dnl   for the files it cannot handle correctly. This way, config.status
8308 dnl   will handle these files.
8309 dnl If it fails, nothing is set and config.status will run as usual.
8311 dnl This does not change the $MAKEFILES variable.
8313 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8315 if test -z "${AS_PERL}"; then
8316 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8317 else
8318 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8320 . ./conftest.sh
8321 rm conftest.sh
8323 echo $MAKEFILES > unallmakefiles
8325 AC_OUTPUT($MAKEFILES)
8327 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8328 if test "$CAIRO_FEATURES_H"; then
8329   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8330     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8331   else
8332     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8333   fi
8336 dnl ========================================================
8337 dnl = Setup a nice relatively clean build environment for
8338 dnl = sub-configures.
8339 dnl ========================================================
8340 CC="$_SUBDIR_CC" 
8341 CXX="$_SUBDIR_CXX" 
8342 CFLAGS="$_SUBDIR_CFLAGS" 
8343 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8344 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8345 LDFLAGS="$_SUBDIR_LDFLAGS"
8346 HOST_CC="$_SUBDIR_HOST_CC" 
8347 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8348 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8351 unset MAKEFILES
8352 unset CONFIG_FILES
8354 if test "$COMPILE_ENVIRONMENT"; then
8355 if test -z "$MOZ_NATIVE_NSPR"; then
8356     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8357     if test -z "$MOZ_DEBUG"; then
8358         ac_configure_args="$ac_configure_args --disable-debug"
8359     fi
8360     if test "$MOZ_OPTIMIZE" = "1"; then
8361         ac_configure_args="$ac_configure_args --enable-optimize"
8362     fi
8363     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8364        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8365     fi
8366     if test -n "$HAVE_64BIT_OS"; then
8367         ac_configure_args="$ac_configure_args --enable-64bit"
8368     fi
8369     if test -n "$USE_ARM_KUSER"; then
8370         ac_configure_args="$ac_configure_args --with-arm-kuser"
8371     fi
8372     AC_OUTPUT_SUBDIRS(nsprpub)
8373     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8376 if test -z "$MOZ_NATIVE_NSPR"; then
8377     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8378     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8379     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8380        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8381        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8382     fi
8383     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
8384        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8385        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8386     fi
8387     rm -f config/autoconf.mk.bak
8390 fi # COMPILE_ENVIRONMENT