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