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