Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / js / src / configure.in
blob52bbc3cffa7edfd2b44fecce2327a7bd5a31a7c8
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(jsapi.h)
65 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
66 AC_CONFIG_HEADER(js-config.h)
67 AC_CANONICAL_SYSTEM
68 TARGET_CPU="${target_cpu}"
69 TARGET_VENDOR="${target_vendor}"
70 TARGET_OS="${target_os}"
72 dnl ========================================================
73 dnl =
74 dnl = Don't change the following two lines.  Doing so breaks:
75 dnl =
76 dnl = CFLAGS="-foo" ./configure
77 dnl =
78 dnl ========================================================
79 CFLAGS="${CFLAGS=}"
80 CPPFLAGS="${CPPFLAGS=}"
81 CXXFLAGS="${CXXFLAGS=}"
82 LDFLAGS="${LDFLAGS=}"
83 HOST_CFLAGS="${HOST_CFLAGS=}"
84 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
85 HOST_LDFLAGS="${HOST_LDFLAGS=}"
87 dnl ========================================================
88 dnl = Preserve certain environment flags passed to configure
89 dnl = We want sub projects to receive the same flags
90 dnl = untainted by this configure script
91 dnl ========================================================
92 _SUBDIR_CC="$CC"
93 _SUBDIR_CXX="$CXX"
94 _SUBDIR_CFLAGS="$CFLAGS"
95 _SUBDIR_CPPFLAGS="$CPPFLAGS"
96 _SUBDIR_CXXFLAGS="$CXXFLAGS"
97 _SUBDIR_LDFLAGS="$LDFLAGS"
98 _SUBDIR_HOST_CC="$HOST_CC"
99 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
100 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
101 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
102 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
104 dnl Set the version number of the libs included with mozilla
105 dnl ========================================================
106 NSPR_VERSION=4
108 dnl Set the minimum version of toolkit libs used by mozilla
109 dnl ========================================================
110 PERL_VERSION=5.006
111 MAKE_VERSION=3.78
112 WINDRES_VERSION=2.14.90
113 W32API_VERSION=3.8
115 MSMANIFEST_TOOL=
117 dnl Set various checks
118 dnl ========================================================
119 MISSING_X=
120 AC_PROG_AWK
122 dnl Initialize the Pthread test variables early so they can be
123 dnl  overridden by each platform.
124 dnl ========================================================
125 USE_PTHREADS=
126 _PTHREAD_LDFLAGS=""
128 dnl Do not allow a separate objdir build if a srcdir build exists.
129 dnl ==============================================================
130 _topsrcdir=`cd \`dirname $0\`; pwd`
131 _objdir=`pwd`
133 if test "$_topsrcdir" != "$_objdir"
134 then
135   # Check for a couple representative files in the source tree
136   _conflict_files=
137   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
138     if test -f $file; then
139       _conflict_files="$_conflict_files $file"
140     fi
141   done
142   if test "$_conflict_files"; then
143     echo "***"
144     echo "*   Your source tree contains these files:"
145     for file in $_conflict_files; do
146       echo "*         $file"
147     done
148     cat 1>&2 <<-EOF
149         *   This indicates that you previously built in the source tree.
150         *   A source tree build can confuse the separate objdir build.
151         *
152         *   To clean up the source tree:
153         *     1. cd $_topsrcdir
154         *     2. gmake distclean
155         ***
156         EOF
157     exit 1
158     break
159   fi
161 MOZ_BUILD_ROOT=`pwd`
163 dnl Default to MSVC for win32
164 dnl ==============================================================
165 if test -z "$CROSS_COMPILE"; then
166 case "$target" in
167 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
168     MAKE_VERSION=3.79
169     if test -z "$CC"; then CC=cl; fi
170     if test -z "$CXX"; then CXX=cl; fi
171     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
172     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
173     if test -z "$LD"; then LD=link; fi
174     if test -z "$AS"; then AS=ml; fi
175     if test -z "$MIDL"; then MIDL=midl; fi
176     ;;
177 esac
180 COMPILE_ENVIRONMENT=1
181 MOZ_ARG_ENABLE_BOOL(compile-environment,
182 [  --disable-compile-environment
183                            Disable compiler/library checks.],
184     COMPILE_ENVIRONMENT=1,
185     COMPILE_ENVIRONMENT= )
187 dnl ========================================================
188 dnl Checks for compilers.
189 dnl ========================================================
191 if test "$COMPILE_ENVIRONMENT"; then
193 if test "$target" != "$host"; then
194     echo "cross compiling from $host to $target"
196     _SAVE_CC="$CC"
197     _SAVE_CFLAGS="$CFLAGS"
198     _SAVE_LDFLAGS="$LDFLAGS"
200     AC_MSG_CHECKING([for host c compiler])
201     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
202     if test -z "$HOST_CC"; then
203         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
204     fi
205     AC_MSG_RESULT([$HOST_CC])
206     AC_MSG_CHECKING([for host c++ compiler])
207     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
208     if test -z "$HOST_CXX"; then
209         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
210     fi
211     AC_MSG_RESULT([$HOST_CXX])
213     if test -z "$HOST_CFLAGS"; then
214         HOST_CFLAGS="$CFLAGS"
215     fi
216     if test -z "$HOST_CXXFLAGS"; then
217         HOST_CXXFLAGS="$CXXFLAGS"
218     fi
219     if test -z "$HOST_LDFLAGS"; then
220         HOST_LDFLAGS="$LDFLAGS"
221     fi
222     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
223     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
224     CC="$HOST_CC"
225     CFLAGS="$HOST_CFLAGS"
226     LDFLAGS="$HOST_LDFLAGS"
228     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
229     AC_TRY_COMPILE([], [return(0);], 
230         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
231         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
233     CC="$HOST_CXX"
234     CFLAGS="$HOST_CXXFLAGS"
236     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
237     AC_TRY_COMPILE([], [return(0);], 
238         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
239         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
240     
241     CC=$_SAVE_CC
242     CFLAGS=$_SAVE_CFLAGS
243     LDFLAGS=$_SAVE_LDFLAGS
245     case "$build:$target" in
246       powerpc-apple-darwin8*:i?86-apple-darwin*)
247         dnl The Darwin cross compiler doesn't necessarily point itself at a
248         dnl root that has libraries for the proper architecture, it defaults
249         dnl to the system root.  The libraries in the system root on current
250         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
251         dnl checks will fail.  Fake a working SDK in that case.
252         _SAVE_CFLAGS=$CFLAGS
253         _SAVE_CXXFLAGS=$CXXLAGS
254         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
255         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
256         ;;
257     esac
259     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
260     unset ac_cv_prog_CC
261     AC_PROG_CC
262     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
263     unset ac_cv_prog_CXX
264     AC_PROG_CXX
266     case "$build:$target" in
267       powerpc-apple-darwin8*:i?86-apple-darwin*)
268         dnl Revert the changes made above.  From this point on, the target
269         dnl compiler will never be used without applying the SDK to CFLAGS
270         dnl (see --with-macos-sdk below).
271         CFLAGS=$_SAVE_CFLAGS
272         CXXFLAGS=$_SAVE_CXXFLAGS
273         ;;
274     esac
276     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
277     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
278     AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
279     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
280     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
281     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
282     AC_DEFINE(CROSS_COMPILE)
284     dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
285     dnl have erroneously been set to "no", because the x86 build host is
286     dnl able to run ppc code in a translated environment, making a cross
287     dnl compiler appear native.  So we override that here.
288     cross_compiling=yes
289 else
290     AC_PROG_CC
291     AC_PROG_CXX
292     AC_PROG_RANLIB
293     AC_PATH_PROGS(AS, $AS as, $CC)
294     AC_CHECK_PROGS(AR, ar, :)
295     AC_CHECK_PROGS(LD, ld, :)
296     AC_CHECK_PROGS(STRIP, strip, :)
297     AC_CHECK_PROGS(WINDRES, windres, :)
298     if test -z "$HOST_CC"; then
299         HOST_CC="$CC"
300     fi
301     if test -z "$HOST_CFLAGS"; then
302         HOST_CFLAGS="$CFLAGS"
303     fi
304     if test -z "$HOST_CXX"; then
305         HOST_CXX="$CXX"
306     fi
307     if test -z "$HOST_CXXFLAGS"; then
308         HOST_CXXFLAGS="$CXXFLAGS"
309     fi
310     if test -z "$HOST_LDFLAGS"; then
311         HOST_LDFLAGS="$LDFLAGS"
312     fi
313     if test -z "$HOST_RANLIB"; then
314         HOST_RANLIB="$RANLIB"
315     fi
316     if test -z "$HOST_AR"; then
317        HOST_AR="$AR"
318     fi
321 GNU_AS=
322 GNU_LD=
323 GNU_CC=
324 GNU_CXX=
325 CC_VERSION='N/A'
326 CXX_VERSION='N/A'
327 if test "$GCC" = "yes"; then
328     GNU_CC=1
329     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
331 if test "$GXX" = "yes"; then
332     GNU_CXX=1
333     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
335 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
336     GNU_AS=1
338 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
339     GNU_LD=1
341 if test "$GNU_CC"; then
342     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
343         GCC_USE_GNU_LD=1
344     fi
347 INTEL_CC=
348 INTEL_CXX=
349 if test "$GCC" = yes; then
350    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
351      INTEL_CC=1
352    fi
355 if test "$GXX" = yes; then
356    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
357      INTEL_CXX=1
358    fi
361 dnl Special win32 checks
362 dnl ========================================================
363 case "$target" in
364 *-wince)
365     WINVER=500
366     ;;
368     if test -n "$GNU_CC"; then  
369         WINVER=501
370     else    
371         WINVER=500
372     fi
373     ;;
374 esac
376 MOZ_ARG_WITH_STRING(windows-version,
377 [  --with-windows-version=WINVER
378                           Minimum Windows version (WINVER) to support
379                               400: Windows 95
380                               500: Windows 2000
381                               501: Windows XP],
382   WINVER=$withval)
384 case "$WINVER" in
385 400|500|501)
386     ;;
389     AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
390     ;;
392 esac
394 case "$target" in
395 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
396     if test "$GCC" != "yes"; then
397         # Check to see if we are really running in a msvc environemnt
398         _WIN32_MSVC=1
399         AC_CHECK_PROGS(MIDL, midl)
401         # Make sure compilers are valid
402         CFLAGS="$CFLAGS -TC -nologo"
403         CXXFLAGS="$CXXFLAGS -TP -nologo"
404         AC_LANG_SAVE
405         AC_LANG_C
406         AC_TRY_COMPILE([#include <stdio.h>],
407             [ printf("Hello World\n"); ],,
408             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
410         AC_LANG_CPLUSPLUS
411         AC_TRY_COMPILE([#include <new.h>],
412             [ unsigned *test = new unsigned(42); ],,
413             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
414         AC_LANG_RESTORE
415         
416         changequote(,)
417         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
418         changequote([,])
419         
420         # Determine compiler version
421         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
422         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
423         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
424         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
425         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
426         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
428         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
429         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
431         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
432             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
433         fi
434         if test "$_CC_MAJOR_VERSION" = "12"; then
435             _CC_SUITE=6
436         elif test "$_CC_MAJOR_VERSION" = "13"; then
437             _CC_SUITE=7
438         elif test "$_CC_MAJOR_VERSION" = "14"; then
439             _CC_SUITE=8
440             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
441             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
442             dnl so be very specific here!
443             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
444             if test $_CC_RELEASE -gt 50727; then
445                _USE_DYNAMICBASE=1
446             elif test $_CC_BUILD -ge 762; then
447                _USE_DYNAMICBASE=1
448             fi
449             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
450             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
451         elif test "$_CC_MAJOR_VERSION" = "15"; then
452             _CC_SUITE=9
453             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
454             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
455             _USE_DYNAMICBASE=1
456             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
457             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
458         else
459             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
460         fi
462         _MOZ_RTTI_FLAGS_ON='-GR'
463         _MOZ_RTTI_FLAGS_OFF='-GR-'
464         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
465         _MOZ_EXCEPTIONS_FLAGS_OFF=''
467         if test -n "$WIN32_REDIST_DIR"; then
468             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
469         fi
470         
471         # bug #249782
472         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
473         if test "$_CC_SUITE" -ge "8"; then
474                 changequote(,)
475                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
476                 changequote([,])
478                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
479                 if test -n "$MSMT_TOOL"; then
480                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
481                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
482                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
483                         fi
484                         MSMANIFEST_TOOL=1
485                         unset MSMT_TOOL
486                 else
487                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
488                 fi
489         fi
491         # Check linker version
492         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
493         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
494         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
495             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
496         fi
497         INCREMENTAL_LINKER=1
499         # Check midl version
500         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
501         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
502         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
503         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
504          # Add flags if necessary
505          AC_MSG_CHECKING([for midl flags])
506          if test \( "$_MIDL_MAJOR_VERSION" -gt "6" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" -gt "0" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" -gt "359" \); then
507              # Starting with MIDL version 6.0.359, the MIDL compiler
508              # generates /Oicf /robust stubs by default, which is not
509              # compatible with versions of Windows older than Win2k.
510              # This switches us back to the old behaviour. When we drop
511              # support for Windows older than Win2k, we should remove
512              # this.
513              MIDL_FLAGS="${MIDL_FLAGS} -no_robust"
514              AC_MSG_RESULT([need -no_robust])
515          else
516              MIDL_FLAGS="${MIDL_FLAGS}"
517              AC_MSG_RESULT([none needed])
518         fi
519         
520         unset _MSVC_VER_FILTER
521         
522     else
523         # Check w32api version
524         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
525         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
526         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
527         AC_TRY_COMPILE([#include <w32api.h>],
528             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
529                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
530                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
531                 #error "test failed."
532             #endif
533             , [ res=yes ], [ res=no ])
534         AC_MSG_RESULT([$res])
535         if test "$res" != "yes"; then
536             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
537         fi
538         # Check windres version
539         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
540         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
541         AC_MSG_RESULT([$_WINDRES_VERSION])
542         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
543         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
544         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
545         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
546         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
547         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
548         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
549                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
550                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
551                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
552                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
553                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
554         then
555             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
556         fi
557     fi # !GNU_CC
559     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
560     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
561     # Require OS features provided by IE 5.0
562     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
563     ;;
564 esac
566 dnl Test breaks icc on OS/2 && MSVC
567 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
568     AC_PROG_CC_C_O
569     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
570         USING_HCC=1
571         _OLDCC=$CC
572         _OLDCXX=$CXX
573         CC="${srcdir}/build/hcc '$CC'"
574         CXX="${srcdir}/build/hcpp '$CXX'"
575     fi
578 AC_PROG_CPP
579 AC_PROG_CXXCPP
581 if test -n "$_WIN32_MSVC"; then
582     SKIP_PATH_CHECKS=1
583     SKIP_COMPILER_CHECKS=1
584     SKIP_LIBRARY_CHECKS=1
587 fi # COMPILE_ENVIRONMENT
589 if test "$cross_compiling"  = "yes"; then
590     CROSS_COMPILE=1
591 else
592     CROSS_COMPILE=
595 AC_SUBST(MIDL_FLAGS)
596 AC_SUBST(_MSC_VER)
598 AC_SUBST(GNU_AS)
599 AC_SUBST(GNU_LD)
600 AC_SUBST(GNU_CC)
601 AC_SUBST(GNU_CXX)
602 AC_SUBST(INTEL_CC)
603 AC_SUBST(INTEL_CXX)
605 dnl ========================================================
606 dnl Checks for programs.
607 dnl ========================================================
608 AC_PROG_INSTALL
609 AC_PROG_LN_S
610 AC_PATH_PROGS(PERL, $PERL perl5 perl )
611 if test -z "$PERL" || test "$PERL" = ":"; then
612     AC_MSG_ERROR([perl not found in \$PATH])
615 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
616 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
617 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
618 _perl_res=$?
619 AC_MSG_RESULT([$_perl_version])
621 if test "$_perl_res" != 0; then
622     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
626 AC_MSG_CHECKING([for full perl installation])
627 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
628 _perl_res=$?
629 if test "$_perl_res" != 0; then
630     AC_MSG_RESULT([no])
631     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
632 else
633     AC_MSG_RESULT([yes])    
636 AC_PATH_PROGS(PYTHON, $PYTHON python)
637 if test -z "$PYTHON"; then
638     AC_MSG_ERROR([python was not found in \$PATH])
641 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
642 if test -z "$COMPILE_ENVIRONMENT"; then
643 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
644     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
647 AC_SUBST(NSINSTALL_BIN)
649 AC_PATH_PROG(DOXYGEN, doxygen, :)
650 AC_PATH_PROG(WHOAMI, whoami, :)
651 AC_PATH_PROG(AUTOCONF, autoconf, :)
652 AC_PATH_PROG(UNZIP, unzip, :)
653 AC_PATH_PROGS(ZIP, zip)
654 if test -z "$ZIP" || test "$ZIP" = ":"; then
655     AC_MSG_ERROR([zip not found in \$PATH])
657 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
658 AC_PATH_PROG(XARGS, xargs)
659 if test -z "$XARGS" || test "$XARGS" = ":"; then
660     AC_MSG_ERROR([xargs not found in \$PATH .])
663 if test "$COMPILE_ENVIRONMENT"; then
665 dnl ========================================================
666 dnl = Mac OS X toolchain support
667 dnl ========================================================
669 case "$target_os" in
670 darwin*)
671     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
672     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
673     dnl the environment and includedir purposes (when using an SDK, below),
674     dnl but remember the full version number for the libdir (SDK).
675     changequote(,)
676     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
677     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
678     changequote([,])
679     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
680         dnl Bug 280479, but this keeps popping up in bug 292530 too because
681         dnl 4.0.0/4061 is the default compiler in Tiger.
682         changequote(,)
683         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
684         changequote([,])
685         if test "$GCC_BUILD" = "4061" ; then
686             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
687 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
688 from building Mozilla. Upgrade to Xcode 2.1 or later.])
689         fi
690     fi
692     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
693     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
694     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
695     AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
697     case "$PBBUILD" in
698       *xcodebuild*)
699         changequote(,)
700         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
701         changequote([,])
702         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
703           HAS_XCODE_2_1=1;
704         fi
705       ;;
706     esac
708     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
709     dnl it has moved into /usr/bin.
710     AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
711     ;;
712 esac
714 AC_SUBST(GCC_VERSION)
715 AC_SUBST(XCODEBUILD_VERSION)
716 AC_SUBST(HAS_XCODE_2_1)
718 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
719 dnl that a universal binary is being produced.
720 AC_SUBST(UNIVERSAL_BINARY)
722 dnl ========================================================
723 dnl Check for MacOS deployment target version
724 dnl ========================================================
726 MOZ_ARG_ENABLE_STRING(macos-target,
727                       [  --enable-macos-target=VER (default=10.4)
728                           Set the minimum MacOS version needed at runtime],
729                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
731 case "$target" in
732 *-darwin*)
733     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
734         dnl Use the specified value
735         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
736         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
737     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
738         dnl No value specified on the command line or in the environment,
739         dnl use the lesser of the application's minimum or the architecture's
740         dnl minimum.
741         export MACOSX_DEPLOYMENT_TARGET=10.4
742     fi
743     ;;
744 esac
746 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
748 dnl ========================================================
749 dnl = Mac OS X SDK support
750 dnl ========================================================
751 MACOS_SDK_DIR=
752 NEXT_ROOT=
753 MOZ_ARG_WITH_STRING(macos-sdk,
754 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
755     MACOS_SDK_DIR=$withval)
757 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
758 dnl NEXT_ROOT will be set and exported only if it's needed.
759 AC_SUBST(MACOS_SDK_DIR)
760 AC_SUBST(NEXT_ROOT)
762 if test "$MACOS_SDK_DIR"; then
763   dnl Sync this section with the ones in NSPR and NSS.
764   dnl Changes to the cross environment here need to be accounted for in
765   dnl the libIDL checks (below) and xpidl build.
767   if test ! -d "$MACOS_SDK_DIR"; then
768     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
769 specify a valid SDK.  SDKs are installed when the optional cross-development
770 tools are selected during the Xcode/Developer Tools installation.])
771   fi
773   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
774   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
775     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"
776     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
777       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
778     fi
779     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"
781     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
782     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
784     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
785     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
786     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
788     dnl ld support for -syslibroot is compiler-agnostic, but only available
789     dnl on Tiger.  Although it's possible to switch on the build host's
790     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
791     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
792     dnl set because both the compiler and linker use it.
793     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"
794     export NEXT_ROOT=$MACOS_SDK_DIR
796     if test -n "$CROSS_COMPILE" ; then
797       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
798       dnl the build host.  HOST_CXX is presently unused.
799       HOST_CC="NEXT_ROOT= $HOST_CC"
800       HOST_CXX="NEXT_ROOT= $HOST_CXX"
801     fi
802   else
803     dnl gcc >= 4.0 uses different paths than above, but knows how to find
804     dnl them itself.
805     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
806     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
808     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
809     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
810     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
812     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
813       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
814       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
815       dnl be ignored and cause warnings when -syslibroot is specified.
816       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
817       dnl the -isysroot it receives, so this is only needed with 4.0.0.
818       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
819     fi
820   fi
822   AC_LANG_SAVE
823   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
824   AC_LANG_CPLUSPLUS
825   AC_TRY_COMPILE([#include <new>
826                  int main() { return 0; }],
827    result=yes,
828    result=no)
829   AC_LANG_RESTORE
830   AC_MSG_RESULT($result)
832   if test "$result" = "no" ; then
833     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
834   fi
837 fi # COMPILE_ENVIRONMENT
839 dnl Be sure the make we use is GNU make.
840 dnl on win32, gmake.exe is the generally the wrong version
841 case "$host_os" in
842 cygwin*|mingw*|mks*|msvc*)
843     AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
844     ;;
846     AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
847     ;;
848 esac
849 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
850 if test ! "$_make_try"
851 then
852         echo
853         echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
854         echo
855         exit 1
857 dnl Now exit if version if < MAKE_VERSION
858 rm -f dummy.mk
859 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
860 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
861 rm -f dummy.mk
862 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
863 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
864 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
865 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
866 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
867    test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
868         "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
869    AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
871 AC_SUBST(MAKE)
873 if test "$COMPILE_ENVIRONMENT"; then
875 AC_PATH_XTRA
877 dnl Check in X11 include directory too.
878 if test "$no_x" != "yes"; then
879     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
882 XCFLAGS="$X_CFLAGS"
884 fi # COMPILE_ENVIRONMENT
886 dnl ========================================================
887 dnl set the defaults first
888 dnl ========================================================
889 AS_BIN=$AS
890 AR_FLAGS='cr $@'
891 AR_LIST='$(AR) t'
892 AR_EXTRACT='$(AR) x'
893 AR_DELETE='$(AR) d'
894 AS='$(CC)'
895 AS_DASH_C_FLAG='-c'
896 DLL_PREFIX=lib
897 LIB_PREFIX=lib
898 DLL_SUFFIX=.so
899 OBJ_SUFFIX=o
900 LIB_SUFFIX=a
901 ASM_SUFFIX=s
902 IMPORT_LIB_SUFFIX=
903 TARGET_MD_ARCH=unix
904 DIRENT_INO=d_ino
905 CYGWIN_WRAPPER=
906 WIN_TOP_SRC=
907 MOZ_USER_DIR=".mozilla"
908 HOST_AR='$(AR)'
909 HOST_AR_FLAGS='$(AR_FLAGS)'
911 MOZ_JS_LIBS='-L$(libdir) -lmozjs'
912 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(PREFIX)/lib'
914 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
915 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
917 USE_DEPENDENT_LIBS=1
919 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
920 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
922 MOZ_ENABLE_POSTSCRIPT=1 
924 if test -n "$CROSS_COMPILE"; then
925     OS_TARGET="${target_os}"
926     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
927     OS_RELEASE=
928     case "${target_os}" in
929         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
930         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
931         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
932         mingw*)       OS_ARCH=WINNT ;;
933         wince*)       OS_ARCH=WINCE ;;
934         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
935     esac
936 else
937     OS_TARGET=`uname -s`
938     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
939     OS_RELEASE=`uname -r`
942 # Before this used `uname -m` when not cross compiling
943 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
944 OS_TEST="${target_cpu}"
946 _COMPILER_PREFIX=
948 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
950 #######################################################################
951 # Master "Core Components" macros for getting the OS target           #
952 #######################################################################
955 # Note: OS_TARGET should be specified on the command line for gmake.
956 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
957 # The difference between the Win95 target and the WinNT target is that
958 # the WinNT target uses Windows NT specific features not available
959 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
960 # at lesser performance (the Win95 target uses threads; the WinNT target
961 # uses fibers).
963 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
964 # cross-compilation.
968 # The following hack allows one to build on a WIN95 machine (as if
969 # s/he were cross-compiling on a WINNT host for a WIN95 target).
970 # It also accomodates for MKS's uname.exe.  If you never intend
971 # to do development on a WIN95 machine, you don't need this hack.
973 case "$OS_ARCH" in
974 WIN95)
975     OS_ARCH=WINNT
976     OS_TARGET=WIN95
977     ;;
978 Windows_95)
979     OS_ARCH=Windows_NT
980     OS_TARGET=WIN95
981     ;;
982 Windows_98)
983     OS_ARCH=Windows_NT
984     OS_TARGET=WIN95
985     ;;
986 CYGWIN_9*|CYGWIN_ME*)
987     OS_ARCH='CYGWIN_NT-4.0'
988     OS_TARGET=WIN95
989     ;;
990 esac
993 # Define and override various archtecture-specific variables, including
994 # HOST_OS_ARCH
995 # OS_ARCH
996 # OS_TEST
997 # OS_TARGET
998 # OS_RELEASE
999 # OS_MINOR_RELEASE
1002 case "$HOST_OS_ARCH" in
1003 cygwin*|mingw*|mks*|msvc*)
1004     HOST_OS_ARCH=WINNT
1005     ;;
1006 linux*)
1007     HOST_OS_ARCH=Linux
1008     ;;
1009 solaris*)
1010     HOST_OS_ARCH=SunOS
1011     ;;
1012 BSD_386)
1013     HOST_OS_ARCH=BSD
1014     ;;
1015 dgux)
1016     HOST_OS_ARCH=DGUX
1017     ;;
1018 IRIX64)
1019     HOST_OS_ARCH=IRIX
1020     ;;
1021 UNIX_SV)
1022     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1023         HOST_OS_ARCH=NCR
1024     else
1025         HOST_OS_ARCH=UNIXWARE
1026     fi
1027     ;;
1028 ncr)
1029     HOST_OS_ARCH=NCR
1030     ;;
1031 UNIX_SYSTEM_V)
1032     HOST_OS_ARCH=NEC
1033     ;;
1034 OSF1)
1035     ;;
1036 *OpenVMS*)
1037     HOST_OS_ARCH=OpenVMS
1038     ;;
1039 OS_2)
1040     HOST_OS_ARCH=OS2
1041     ;;
1042 QNX)
1043     ;;
1044 SCO_SV)
1045     HOST_OS_ARCH=SCOOS
1046     ;;
1047 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1048     HOST_OS_ARCH=SINIX
1049     ;;
1050 UnixWare)
1051     HOST_OS_ARCH=UNIXWARE
1052     ;;
1053 esac
1055 case "$OS_ARCH" in
1056 WINNT)
1057     OS_TEST=`uname -p`
1058     ;;
1059 Windows_NT)
1061 # If uname -s returns "Windows_NT", we assume that we are using
1062 # the uname.exe in MKS toolkit.
1064 # The -r option of MKS uname only returns the major version number.
1065 # So we need to use its -v option to get the minor version number.
1066 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1068     OS_ARCH=WINNT
1069     OS_TARGET=WINNT
1070     OS_MINOR_RELEASE=`uname -v`
1071     if test "$OS_MINOR_RELEASE" = "00"; then
1072         OS_MINOR_RELEASE=0
1073     fi
1074     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1075     ;;
1076 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1078 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1079 # the uname.exe in the Cygwin tools.
1080 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1081 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1082 # the uname.exe in the GNU-Win32 tools.
1083 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1084 # the uname.exe in the MSYS tools.
1086     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1087     OS_ARCH=WINNT
1088     OS_TARGET=WINNT
1089     ;;
1090 AIX)
1091     OS_RELEASE=`uname -v`.`uname -r`
1092     OS_TEST=${target_cpu}
1093     ;;
1094 BSD_386)
1095     OS_ARCH=BSD
1096     ;;
1097 dgux)
1098     OS_ARCH=DGUX
1099     ;;
1100 IRIX64)
1101     OS_ARCH=IRIX
1102     ;;
1103 UNIX_SV)
1104     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1105         OS_ARCH=NCR
1106     else
1107         OS_ARCH=UNIXWARE
1108         OS_RELEASE=`uname -v`
1109     fi
1110     ;;
1111 ncr)
1112     OS_ARCH=NCR
1113     ;;
1114 UNIX_SYSTEM_V)
1115     OS_ARCH=NEC
1116     ;;
1117 OSF1)
1118     case `uname -v` in
1119     148)
1120         OS_RELEASE=V3.2C
1121         ;;
1122     564)
1123         OS_RELEASE=V4.0B
1124         ;;
1125     878)
1126         OS_RELEASE=V4.0D
1127         ;;
1128     esac
1129     ;;
1130 *OpenVMS*)
1131     OS_ARCH=OpenVMS
1132     OS_RELEASE=`uname -v`
1133     OS_TEST=`uname -p`
1134     ;;
1135 OS_2)
1136     OS_ARCH=OS2
1137     OS_TARGET=OS2
1138     OS_RELEASE=`uname -v`
1139     ;;
1140 QNX)
1141     if test "$OS_TARGET" != "NTO"; then
1142         changequote(,)
1143         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1144         changequote([,])
1145     fi
1146     OS_TEST=x86
1147     ;;
1148 SCO_SV)
1149     OS_ARCH=SCOOS
1150     OS_RELEASE=5.0
1151     ;;
1152 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1153     OS_ARCH=SINIX
1154     OS_TEST=`uname -p`
1155     ;;
1156 UnixWare)
1157     OS_ARCH=UNIXWARE
1158     OS_RELEASE=`uname -v`
1159     ;;
1160 WINCE)
1161     WINCE=1
1162     OS_ARCH=WINCE
1163     OS_TARGET=WINCE
1164     ;;
1165 Darwin)
1166     case "${target_cpu}" in
1167     powerpc*)
1168         OS_TEST=ppc
1169         ;;
1170     i*86*)
1171         OS_TEST=i386 
1172         ;;
1173     x86_64)
1174         OS_TEST=x86_64
1175         ;;
1176     *)
1177         if test -z "$CROSS_COMPILE" ; then
1178             OS_TEST=`uname -p`
1179         fi
1180         ;;
1181     esac
1182     ;;
1183 esac
1185 if test "$OS_ARCH" = "NCR"; then
1186     changequote(,)
1187     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1188     changequote([,])
1191 # Only set CPU_ARCH if we recognize the value of OS_TEST
1193 case "$OS_TEST" in
1194 *86 | i86pc)
1195     CPU_ARCH=x86
1196     ;;
1198 powerpc* | ppc | rs6000)
1199     CPU_ARCH=ppc
1200     ;;
1202 Alpha | alpha | ALPHA)
1203     CPU_ARCH=Alpha
1204     ;;
1206 hppa* | parisc)
1207     CPU_ARCH=hppa
1208     ;;
1210 sun4u | sparc*)
1211     CPU_ARCH=sparc
1212     ;;
1214 x86_64 | ia64)
1215     CPU_ARCH="$OS_TEST"
1216     ;;
1217 esac
1219 if test -z "$OS_TARGET"; then
1220     OS_TARGET=$OS_ARCH
1222 if test "$OS_TARGET" = "WIN95"; then
1223     OS_RELEASE="4.0"
1225 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1227 dnl ========================================================
1228 dnl GNU specific defaults
1229 dnl ========================================================
1230 if test "$GNU_CC"; then
1231     # FIXME: Let us build with strict aliasing. bug 414641.
1232     CFLAGS="$CFLAGS -fno-strict-aliasing"
1233     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1234     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1235     DSO_LDOPTS='-shared'
1236     if test "$GCC_USE_GNU_LD"; then
1237         # Don't allow undefined symbols in libraries
1238         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1239     fi
1240     WARNINGS_AS_ERRORS='-Werror'
1241     DSO_CFLAGS=''
1242     DSO_PIC_CFLAGS='-fPIC'
1243     ASFLAGS="$ASFLAGS -fPIC"
1244     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1245     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1246     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1247     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1249     # Turn on GNU specific features
1250     # -Wall - turn on all warnings
1251     # -pedantic - make compiler warn about non-ANSI stuff, and
1252     #             be a little bit stricter
1253     # Warnings slamm took out for now (these were giving more noise than help):
1254     # -Wbad-function-cast - warns when casting a function to a new return type
1255     # -Wshadow - removed because it generates more noise than help --pete
1256     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1257     if test -z "$INTEL_CC"; then
1258        # Don't use -Wcast-align with ICC
1259        case "$CPU_ARCH" in
1260            # And don't use it on hppa, ia64, sparc, since it's noisy there
1261            hppa | ia64 | sparc)
1262            ;;
1263            *)
1264         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1265            ;;
1266        esac
1267     fi
1269     dnl Turn pedantic on but disable the warnings for long long
1270     _PEDANTIC=1
1272     if test -z "$INTEL_CC"; then
1273       _IGNORE_LONG_LONG_WARNINGS=1
1274       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1275     else
1276       _IGNORE_LONG_LONG_WARNINGS=
1277     fi
1280     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1281     _USE_CPP_INCLUDE_FLAG=1
1282 else
1283     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1284     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1286     DSO_LDOPTS='-shared'
1287     if test "$GNU_LD"; then
1288         # Don't allow undefined symbols in libraries
1289         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1290     fi
1292     DSO_CFLAGS=''
1293     DSO_PIC_CFLAGS='-KPIC'
1294     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1297 if test "$GNU_CXX"; then
1298     # FIXME: Let us build with strict aliasing. bug 414641.
1299     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1300     # Turn on GNU specific features
1301     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1302     if test -z "$INTEL_CC"; then
1303        # Don't use -Wcast-align with ICC
1304        case "$CPU_ARCH" in
1305            # And don't use it on hppa, ia64, sparc, since it's noisy there
1306            hppa | ia64 | sparc)
1307            ;;
1308            *)
1309         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1310            ;;
1311        esac
1312     fi
1314     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1315     _USE_CPP_INCLUDE_FLAG=1
1317     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1318                    ac_has_wno_invalid_offsetof,
1319         [
1320             AC_LANG_SAVE
1321             AC_LANG_CPLUSPLUS
1322             _SAVE_CXXFLAGS="$CXXFLAGS"
1323             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1324             AC_TRY_COMPILE([],
1325                            [return(0);],
1326                            ac_has_wno_invalid_offsetof="yes",
1327                            ac_has_wno_invalid_offsetof="no")
1328             CXXFLAGS="$_SAVE_CXXFLAGS"
1329             AC_LANG_RESTORE
1330         ])
1331     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1332         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1333     fi
1334 else
1335     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1338 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1339 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1340 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1341 dnl normal behavior.
1342 dnl ========================================================
1343 MKSHLIB_FORCE_ALL=
1344 MKSHLIB_UNFORCE_ALL=
1346 if test "$COMPILE_ENVIRONMENT"; then
1347 if test "$GNU_CC"; then
1348   AC_MSG_CHECKING(whether ld has archive extraction flags)
1349   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1350    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1351     ac_cv_mkshlib_force_and_unforce="no"
1352     exec 3<&0 <<LOOP_INPUT
1353         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1354         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1355         force="-Wl,-all";              unforce="-Wl,-none"
1356 LOOP_INPUT
1357     while read line
1358     do
1359       eval $line
1360       LDFLAGS=$force
1361       LIBS=$unforce
1362       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1363     done
1364     exec 0<&3 3<&-
1365     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1366    ])
1367   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1368     AC_MSG_RESULT(no)
1369   else
1370     AC_MSG_RESULT(yes)
1371     eval $ac_cv_mkshlib_force_and_unforce
1372     MKSHLIB_FORCE_ALL=$force
1373     MKSHLIB_UNFORCE_ALL=$unforce
1374   fi
1375 fi # GNU_CC
1376 fi # COMPILE_ENVIRONMENT
1378 dnl =================================================================
1379 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1380 dnl which is bad when cross compiling.
1381 dnl =================================================================
1382 if test "$COMPILE_ENVIRONMENT"; then
1383 configure_static_assert_macros='
1384 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1385 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1386 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1389 dnl test that the macros actually work:
1390 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1391 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1392  [AC_LANG_SAVE
1393   AC_LANG_C
1394   ac_cv_static_assertion_macros_work="yes"
1395   AC_TRY_COMPILE([$configure_static_assert_macros],
1396                  [CONFIGURE_STATIC_ASSERT(1)],
1397                  ,
1398                  ac_cv_static_assertion_macros_work="no")
1399   AC_TRY_COMPILE([$configure_static_assert_macros],
1400                  [CONFIGURE_STATIC_ASSERT(0)],
1401                  ac_cv_static_assertion_macros_work="no",
1402                  )
1403   AC_LANG_CPLUSPLUS
1404   AC_TRY_COMPILE([$configure_static_assert_macros],
1405                  [CONFIGURE_STATIC_ASSERT(1)],
1406                  ,
1407                  ac_cv_static_assertion_macros_work="no")
1408   AC_TRY_COMPILE([$configure_static_assert_macros],
1409                  [CONFIGURE_STATIC_ASSERT(0)],
1410                  ac_cv_static_assertion_macros_work="no",
1411                  )
1412   AC_LANG_RESTORE
1413  ])
1414 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1415 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1416     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1418 fi # COMPILE_ENVIRONMENT
1420 dnl ========================================================
1421 dnl Checking for 64-bit OS
1422 dnl ========================================================
1423 if test "$COMPILE_ENVIRONMENT"; then
1424 AC_LANG_SAVE
1425 AC_LANG_C
1426 AC_MSG_CHECKING(for 64-bit OS)
1427 AC_TRY_COMPILE([$configure_static_assert_macros],
1428                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1429                result="yes", result="no")
1430 AC_MSG_RESULT("$result")
1431 if test "$result" = "yes"; then
1432     AC_DEFINE(HAVE_64BIT_OS)
1433     HAVE_64BIT_OS=1
1435 AC_SUBST(HAVE_64BIT_OS)
1436 AC_LANG_RESTORE
1437 fi # COMPILE_ENVIRONMENT
1439 dnl ========================================================
1440 dnl Enable high-memory support on OS/2 by default.
1441 dnl ========================================================
1442 MOZ_OS2_HIGH_MEMORY=1
1443 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1444 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1445     MOZ_OS2_HIGH_MEMORY=,
1446     MOZ_OS2_HIGH_MEMORY=1 )
1447 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1449 dnl ========================================================
1450 dnl System overrides of the defaults for host
1451 dnl ========================================================
1452 case "$host" in
1453 *-beos*)
1454     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1455     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1456     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1457     ;;
1459 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1460     if test -n "$_WIN32_MSVC"; then
1461         HOST_AR=lib
1462         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1463         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1464         HOST_RANLIB='echo ranlib'
1465     else
1466         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1467     fi
1468     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1469     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1470     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1471     HOST_BIN_SUFFIX=.exe
1472     case "$host" in
1473     *mingw*)
1474     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1475         ;;
1476     *)
1477         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1478         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1479             _pwd=`pwd`
1480             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1481         fi
1482         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1483             AS_PERL=1
1484             PERL="${CYGWIN_WRAPPER} $PERL"
1485         fi
1487         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1488             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1489         fi
1490         ;;
1491     esac
1492     ;;
1494 *-darwin*)
1495     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1496     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1497     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1498     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1499     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1500     ;;
1502 *-linux*|*-kfreebsd*-gnu)
1503     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1504     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1505     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1506     ;;
1508 *os2*)
1509     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1510     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1511     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1512     HOST_BIN_SUFFIX=.exe
1513     MOZ_FIX_LINK_PATHS=
1514     ;;
1516 *-osf*)
1517     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1518     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1519     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1520     ;;
1523     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1524     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1525     ;;
1526 esac
1528 dnl ========================================================
1529 dnl System overrides of the defaults for target
1530 dnl ========================================================
1532 case "$target" in
1533 *-aix*)
1534     AC_DEFINE(AIX)
1535     if test ! "$GNU_CC"; then
1536         if test ! "$HAVE_64BIT_OS"; then
1537             # Compiling with Visual Age C++ object model compat is the
1538             # default. To compile with object model ibm, add 
1539             # AIX_OBJMODEL=ibm to .mozconfig.
1540             if test "$AIX_OBJMODEL" = "ibm"; then
1541                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1542             else
1543                 AIX_OBJMODEL=compat
1544             fi
1545         else
1546             AIX_OBJMODEL=compat
1547         fi
1548         AC_SUBST(AIX_OBJMODEL)
1549         DSO_LDOPTS='-qmkshrobj=1'
1550         DSO_CFLAGS='-qflag=w:w'
1551         DSO_PIC_CFLAGS=
1552         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1553         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1554         MOZ_FIX_LINK_PATHS=
1555         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1556         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1557         if test "$COMPILE_ENVIRONMENT"; then
1558             AC_LANG_SAVE
1559             AC_LANG_CPLUSPLUS
1560             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1561             AC_TRY_COMPILE([],
1562                 [#if (__IBMCPP__ < 600)
1563                  #error "Bad compiler"
1564                  #endif],
1565                 _BAD_COMPILER=,_BAD_COMPILER=1)
1566             if test -n "$_BAD_COMPILER"; then
1567                 AC_MSG_RESULT([no])    
1568                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1569             else
1570                 AC_MSG_RESULT([yes])    
1571             fi
1572             AC_LANG_RESTORE
1573             TARGET_COMPILER_ABI="ibmc"
1574             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1575             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1576         fi
1577     fi
1578     case "${target_os}" in
1579     aix4.1*)
1580         DLL_SUFFIX='_shr.a'
1581         ;;
1582     esac
1583     if test "$COMPILE_ENVIRONMENT"; then
1584         AC_CHECK_HEADERS(sys/inttypes.h)
1585     fi
1586     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1587     ;;
1589 *-beos*)
1590     no_x=yes
1591     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1592     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1593     DSO_LDOPTS='-nostart'
1594     TK_LIBS='-lbe -lroot'
1595     LIBS="$LIBS -lbe"
1596     if test "$COMPILE_ENVIRONMENT"; then
1597         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1598         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1599     fi
1600     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1601     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1602     _MOZ_USE_RTTI=1
1603     USE_DEPENDENT_LIBS=
1604     MOZ_USER_DIR="Mozilla"
1605     ;;
1607 *-bsdi*)
1608     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1609     _PEDANTIC=
1610     _IGNORE_LONG_LONG_WARNINGS=
1611     case $OS_RELEASE in
1612         4.*|5.*)
1613             STRIP="$STRIP -d"
1614             ;;
1615         *)
1616             DSO_CFLAGS=''
1617             DSO_LDOPTS='-r'
1618             _WARNINGS_CFLAGS="-Wall"
1619             _WARNINGS_CXXFLAGS="-Wall"
1620             # The test above doesn't work properly, at least on 3.1.
1621             MKSHLIB_FORCE_ALL=''
1622             MKSHLIB_UNFORCE_ALL=''
1623         ;;
1624     esac
1625     ;;
1627 *-darwin*) 
1628     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1629     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1630     MOZ_OPTIMIZE_FLAGS="-O2"
1631     _PEDANTIC=
1632     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1633     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1634     DLL_SUFFIX=".dylib"
1635     DSO_LDOPTS=''
1636     STRIP="$STRIP -x -S"
1637     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1638     MOZ_ENABLE_POSTSCRIPT=
1639     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1640     LDFLAGS="$LDFLAGS -framework Cocoa"
1641     # The ExceptionHandling framework is needed for Objective-C exception
1642     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1643     # builds.
1644     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1645     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1646     MACOSX=1
1648     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1649     dnl ===================================================================
1650     if test "x$enable_dtrace" = "xyes"; then
1651         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1652     else
1653         dnl check for the presence of the -dead_strip linker flag
1654         AC_MSG_CHECKING([for -dead_strip option to ld])
1655         _SAVE_LDFLAGS=$LDFLAGS
1656         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1657         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1658         if test -n "$_HAVE_DEAD_STRIP" ; then
1659             AC_MSG_RESULT([yes])
1660             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1661         else
1662             AC_MSG_RESULT([no])
1663         fi
1664         
1665         LDFLAGS=$_SAVE_LDFLAGS
1666     fi
1667     ;;
1669 *-freebsd*)
1670     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1671         DLL_SUFFIX=".so.1.0"
1672         DSO_LDOPTS="-shared"
1673     fi
1674     if test ! "$GNU_CC"; then
1675         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1676     fi
1677 # Can't have force w/o an unforce.
1678 #    # Hack for FreeBSD 2.2
1679 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1680 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1681 #       MKSHLIB_UNFORCE_ALL=''
1682 #    fi
1683     ;; 
1685 *-hpux*)
1686     DLL_SUFFIX=".sl"
1687     if test ! "$GNU_CC"; then
1688         DSO_LDOPTS='-b -Wl,+s'
1689         DSO_CFLAGS=""
1690         DSO_PIC_CFLAGS="+Z"
1691         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1692         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1693         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1694     else
1695         DSO_LDOPTS='-b -E +s'
1696         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1697         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1698     fi
1699     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1700     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1701     ;;
1703 *-irix5*)
1704     AC_DEFINE(IRIX)
1705     DSO_LDOPTS='-elf -shared'
1707     if test "$GNU_CC"; then
1708        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1709        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1710        MKSHLIB_FORCE_ALL='-Wl,-all'
1711        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1712        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1713     else
1714        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1715        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1716        MKSHLIB_FORCE_ALL='-all'
1717        MKSHLIB_UNFORCE_ALL='-none'
1718     fi
1719     ;;
1721 *-irix6*)
1722     AC_DEFINE(IRIX)
1723     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1724     dnl compile and link using -n32
1725     USE_N32=1
1726     TARGET_COMPILER_ABI=n32
1727     DSO_LDOPTS='-elf -shared'
1728     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1729     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1730     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1731     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1732     if test "$GNU_CC"; then
1733        MKSHLIB_FORCE_ALL='-Wl,-all'
1734        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1735        _WARNINGS_CFLAGS="-Wall"
1736        _WARNINGS_CXXFLAGS="-Wall"
1737        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1738     else
1739        MKSHLIB_FORCE_ALL='-all'
1740        MKSHLIB_UNFORCE_ALL='-none'
1741            AR_LIST="$AR t"
1742            AR_EXTRACT="$AR x"
1743            AR_DELETE="$AR d"
1744            AR='$(CXX) -ar'
1745            AR_FLAGS='-o $@'
1746        CFLAGS="$CFLAGS -woff 3262 -G 4"
1747        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1748        if test -n "$USE_N32"; then
1749            ASFLAGS="$ASFLAGS -n32"
1750            CFLAGS="$CFLAGS -n32"
1751            CXXFLAGS="$CXXFLAGS -n32"
1752            LDFLAGS="$LDFLAGS -n32"
1753        fi
1754        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1755        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1756        MOZ_FIX_LINK_PATHS=
1757     fi
1758     if test -z "$GNU_CXX"; then
1759       MIPSPRO_CXX=1
1760     fi
1761     ;;
1763 *-*linux*)
1764     # Note: both GNU_CXX and INTEL_CXX are set when using Intel's C compiler.
1765     if test "$INTEL_CXX"; then
1766         # -Os has been broken on Intel's C/C++ compilers for quite a
1767         # while; Intel recommends against using it.
1768         MOZ_OPTIMIZE_FLAGS="-O2"
1769         MOZ_DEBUG_FLAGS="-g -fno-inline"
1770     elif test "$GNU_CXX"; then
1771         GCC_VERSION=`$CXX -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1772         case $GCC_VERSION in
1773         4.1.*|4.2.*)
1774             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1775             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1776         esac
1777         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1778         MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1779                                           # and that combo is not yet good at
1780                                           # debugging inlined functions (even
1781                                           # when using DWARF2 as the debugging
1782                                           # format)
1783     fi
1785     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1787     case "${target_cpu}" in
1788     alpha*)
1789         CFLAGS="$CFLAGS -mieee"
1790         CXXFLAGS="$CXXFLAGS -mieee"
1791     ;;
1792     i*86)
1793         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1794     ;;
1795     mips*)
1796         MOZ_DEBUG_FLAGS="-g" # We want inlining
1797     ;;
1798     esac
1799     ;;
1801 *-wince*)
1803     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1804     AR_LIST="$AR -list"
1805     AR_EXTRACT="$AR -extract"
1806     AR_DELETE="$AR d"
1807     AR_FLAGS='-OUT:"$@"'
1809     if test -z "$AS_BIN"; then
1810         AS="$AS_BIN"
1811     fi
1812     DSO_CFLAGS=
1813     DSO_PIC_CFLAGS=
1814     DLL_SUFFIX=.dll
1815     BIN_SUFFIX='.exe'
1816     if test -z "$RC"; then 
1817         RC=rc.exe  
1818     fi
1819     # certain versions of cygwin's makedepend barf on the 
1820     # #include <string> vs -I./dist/include/string issue so don't use it
1821     SYSTEM_MAKEDEPEND=
1823     HOST_CC=cl
1824     HOST_CXX=cl
1825     HOST_LD=link
1826     HOST_AR='lib -OUT:$@'
1827     HOST_RANLIB='echo ranlib'
1828     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1829         
1830         
1831     WARNINGS_AS_ERRORS='-WX'
1832         MOZ_OPTIMIZE_FLAGS='-O1'
1833     AR_FLAGS='-NOLOGO -OUT:"$@"'
1834     ASM_SUFFIX=asm
1835     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1836     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1837     DLL_PREFIX=
1838     DOXYGEN=:
1839     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1840     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1841     GARBAGE=
1842     IMPORT_LIB_SUFFIX=lib
1843     LIBS="$LIBS"
1844     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1845     LIB_PREFIX=
1846     LIB_SUFFIX=lib 
1847     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1848     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1849     MKSHLIB_FORCE_ALL=
1850     MKSHLIB_UNFORCE_ALL=
1851     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1852     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1853     MOZ_DEBUG_FLAGS='-Zi'
1854     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1855     MOZ_FIX_LINK_PATHS=
1856     MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1857     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1858     OBJ_SUFFIX=obj
1859     RANLIB='echo not_ranlib'
1860     STRIP='echo not_strip'
1861     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1862     UNZIP=unzip
1863     XARGS=xargs
1864     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1865     ZIP=zip
1867     AC_DEFINE(WINCE)
1868     AC_DEFINE(HAVE_SNPRINTF)
1869     AC_DEFINE(_WINDOWS)
1870     AC_DEFINE(_WIN32)
1871     AC_DEFINE(WIN32)
1872     AC_DEFINE(XP_WIN)
1873     AC_DEFINE(XP_WIN32)
1874     AC_DEFINE(HW_THREADS)
1875     AC_DEFINE(STDC_HEADERS)
1876     AC_DEFINE(NEW_H, <new>)
1877     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1879     TARGET_MD_ARCH=win32
1880     _PLATFORM_DEFAULT_TOOLKIT='windows'
1881     BIN_SUFFIX='.exe'
1882     USE_SHORT_LIBNAME=1
1883     MOZ_ENABLE_POSTSCRIPT=
1884     MOZ_USER_DIR="Mozilla"
1888 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1889     DSO_CFLAGS=
1890     DSO_PIC_CFLAGS=
1891     DLL_SUFFIX=.dll
1892     RC=rc.exe
1893     # certain versions of cygwin's makedepend barf on the 
1894     # #include <string> vs -I./dist/include/string issue so don't use it
1895     SYSTEM_MAKEDEPEND=
1896     if test -n "$GNU_CC"; then
1897         CC="$CC -mno-cygwin"
1898         CXX="$CXX -mno-cygwin"
1899         CPP="$CPP -mno-cygwin"
1900         CFLAGS="$CFLAGS -mms-bitfields"
1901         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1902         DSO_LDOPTS='-shared'
1903         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1904         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1905         RC='$(WINDRES)'
1906         # Use temp file for windres (bug 213281)
1907         RCFLAGS='-O coff --use-temp-file'
1908         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1909         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1910         MOZ_JS_LIBS='-L$(libdir) -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1911         MOZ_FIX_LINK_PATHS=
1912         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1913         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1914         DLL_PREFIX=
1915         IMPORT_LIB_SUFFIX=dll.a
1916     else
1917         TARGET_COMPILER_ABI=msvc
1918         HOST_CC='$(CC)'
1919         HOST_CXX='$(CXX)'
1920         HOST_LD='$(LD)'
1921         AR='lib -NOLOGO -OUT:"$@"'
1922         AR_FLAGS=
1923         RANLIB='echo not_ranlib'
1924         STRIP='echo not_strip'
1925         XARGS=xargs
1926         ZIP=zip
1927         UNZIP=unzip
1928         DOXYGEN=:
1929         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1930         OBJ_SUFFIX=obj
1931         LIB_SUFFIX=lib
1932         DLL_PREFIX=
1933         LIB_PREFIX=
1934         IMPORT_LIB_SUFFIX=lib
1935         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1936         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1937         MKSHLIB_FORCE_ALL=
1938         MKSHLIB_UNFORCE_ALL=
1939         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1940         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1941         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1942         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1943         MOZ_DEBUG_FLAGS='-Zi'
1944         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1945         WARNINGS_AS_ERRORS='-WX'
1946         MOZ_OPTIMIZE_FLAGS='-O1'
1947         MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1948         MOZ_FIX_LINK_PATHS=
1949         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1950         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1951         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1952         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1953         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1954         if test $_MSC_VER -ge 1400; then
1955             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
1956             dnl For profile-guided optimization
1957             PROFILE_GEN_CFLAGS="-GL"
1958             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1959             dnl XXX: PGO builds can fail with warnings treated as errors,
1960             dnl specifically "no profile data available" appears to be
1961             dnl treated as an error sometimes. This might be a consequence
1962             dnl of using WARNINGS_AS_ERRORS in some modules, combined
1963             dnl with the linker doing most of the work in the whole-program
1964             dnl optimization/PGO case. I think it's probably a compiler bug,
1965             dnl but we work around it here.
1966             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1967             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1968             dnl Probably also a compiler bug, but what can you do?
1969             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1970             if test -n "$_USE_DYNAMICBASE"; then
1971                LDFLAGS="$LDFLAGS -DYNAMICBASE"
1972             fi
1973         fi
1974     fi
1975     AC_DEFINE(HAVE_SNPRINTF)
1976     AC_DEFINE(_WINDOWS)
1977     AC_DEFINE(_WIN32)
1978     AC_DEFINE(WIN32)
1979     AC_DEFINE(XP_WIN)
1980     AC_DEFINE(XP_WIN32)
1981     AC_DEFINE(HW_THREADS)
1982     AC_DEFINE(STDC_HEADERS)
1983     AC_DEFINE(NEW_H, <new>)
1984     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1985     TARGET_MD_ARCH=win32
1986     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
1987     BIN_SUFFIX='.exe'
1988     USE_SHORT_LIBNAME=1
1989     MOZ_ENABLE_POSTSCRIPT=
1990     MOZ_USER_DIR="Mozilla"
1992     dnl Hardcode to win95 for now - cls
1993     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
1995     dnl set NO_X11 defines here as the general check is skipped on win32
1996     no_x=yes
1997     AC_DEFINE(NO_X11)
1999     dnl MinGW/MSYS doesn't provide or need cygpath
2000     case "$host" in
2001     *-mingw*)
2002         CYGPATH_W=echo
2003         CYGPATH_S=cat
2004         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2005         ;;
2006     *-cygwin*|*-msvc*|*-mks*)
2007         CYGPATH_W="cygpath -a -w"
2008         CYGPATH_S="sed -e s|\\\\|/|g"
2009         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2010         ;;
2011     esac
2012     case "$host" in
2013     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2015     if test -z "$MOZ_TOOLS"; then
2016         AC_MSG_ERROR([MOZ_TOOLS is not set])
2017     fi
2019     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2020     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2021         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2022     fi
2023     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2024         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2025     fi
2026     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2027     ;;
2028     esac 
2031     case "$host_os" in
2032     cygwin*|msvc*|mks*)
2033         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])
2034         ;;
2036     *)
2037         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2039         AC_LANG_SAVE
2040         AC_LANG_CPLUSPLUS
2041         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2042         AC_LANG_RESTORE
2043         ;;
2044     esac
2046     case "$target" in
2047     i*86-*)
2048         AC_DEFINE(_X86_)
2049         ;;
2050     alpha-*)
2051         AC_DEFINE(_ALPHA_)
2052         ;;
2053     mips-*)
2054         AC_DEFINE(_MIPS_)
2055         ;;
2056     *)
2057         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2058         ;;
2059     esac
2060     ;;
2062 *-netbsd*)
2063     DSO_CFLAGS=''
2064     CFLAGS="$CFLAGS -Dunix"
2065     CXXFLAGS="$CXXFLAGS -Dunix"
2066     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2067         DLL_SUFFIX=".so"
2068         DSO_PIC_CFLAGS='-fPIC -DPIC'
2069         DSO_LDOPTS='-shared'
2070         BIN_FLAGS='-Wl,--export-dynamic'
2071     else
2072         DSO_PIC_CFLAGS='-fPIC -DPIC'
2073         DLL_SUFFIX=".so.1.0"
2074         DSO_LDOPTS='-shared'
2075     fi
2076     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2077     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2078     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2079     if test "$LIBRUNPATH"; then
2080         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2081     fi
2082     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2083     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2084     ;;
2086 *-nto*) 
2087         AC_DEFINE(NTO)  
2088         AC_DEFINE(_QNX_SOURCE)
2089         AC_DEFINE(_i386)
2090         OS_TARGET=NTO
2091         WARNINGS_AS_ERRORS=''
2092         MOZ_OPTIMIZE_FLAGS="-O"
2093         MOZ_DEBUG_FLAGS="-gstabs"
2094         USE_PTHREADS=1
2095         _PEDANTIC=
2096         LIBS="$LIBS -lsocket -lstdc++"
2097         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2098         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2099         if test "$with_x" != "yes"
2100         then
2101                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2102             TK_CFLAGS='-I/usr/include/photon'
2103                 TK_LIBS='-lph'
2104         fi
2105         case "${target_cpu}" in
2106         ppc*)
2107         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2108         ;;
2109         esac
2110         ;;
2112 *-openbsd*)
2113     DLL_SUFFIX=".so.1.0"
2114     DSO_CFLAGS=''
2115     DSO_PIC_CFLAGS='-fPIC'
2116     DSO_LDOPTS='-shared -fPIC'
2117     if test "$LIBRUNPATH"; then
2118         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2119     fi
2120     ;;
2122 *-openvms*) 
2123     AC_DEFINE(NO_PW_GECOS)
2124     AC_DEFINE(NO_UDSOCK)
2125     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2126     USE_PTHREADS=1
2127     MKSHLIB_FORCE_ALL='-all'
2128     MKSHLIB_UNFORCE_ALL='-none'
2129     AS='as'
2130     AS_DASH_C_FLAG='-Wc/names=as_is'
2131     AR_FLAGS='c $@'
2132     DSO_LDOPTS='-shared -auto_symvec'
2133     DSO_PIC_CFLAGS=
2134     MOZ_DEBUG_LDFLAGS='-g'
2135     COMPAQ_CXX=1
2136     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2137     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2138     ;;
2141 *-os2*)
2142     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2143     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2144     AC_DEFINE(OS2)
2145     AC_DEFINE(XP_OS2)
2146     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2147     AC_DEFINE(TCPV40HDRS)
2148     USE_SHORT_LIBNAME=1
2149     DLL_PREFIX=
2150     LIB_PREFIX=
2151     LIB_SUFFIX=lib
2152     BIN_SUFFIX=".exe"
2153     DLL_SUFFIX=".dll"
2154     IMPORT_LIB_SUFFIX=lib
2155     DSO_PIC_CFLAGS=
2156     AR=emxomfar
2157     AR_FLAGS='r $@'
2158     CFLAGS="$CFLAGS -Zomf"
2159     CXXFLAGS="$CXXFLAGS -Zomf"
2160     DSO_LDOPTS='-Zdll'
2161     BIN_FLAGS='-Zlinker /ST:0x100000'
2162     IMPLIB='emximp -o'
2163     FILTER='emxexp -o'
2164     LDFLAGS='-Zmap'
2165     WARNINGS_AS_ERRORS='-Werror'
2166     MOZ_DEBUG_FLAGS="-g -fno-inline"
2167     MOZ_OPTIMIZE_FLAGS="-O2"
2168     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2169     MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2170     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2171     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2172     TARGET_MD_ARCH=os2
2173     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2174     MOZ_ENABLE_POSTSCRIPT=
2175     RC=rc.exe
2176     RCFLAGS='-n'
2177     MOZ_USER_DIR="Mozilla"
2179     if test "$MOZTOOLS"; then
2180         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2181     else
2182         AC_MSG_ERROR([MOZTOOLS is not set])
2183     fi
2184     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2185         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2186         LDFLAGS="$LDFLAGS -Zhigh-mem"
2187         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2188         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2189     fi
2191     # GCC for OS/2 currently predefines these, but we don't want them
2192     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2193     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2195     AC_CACHE_CHECK(for __declspec(dllexport),
2196         ac_os2_declspec,
2197         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2198                         [return 0;],
2199                         ac_os2_declspec="yes",
2200                         ac_os2_declspec="no")])
2201     if test "$ac_os2_declspec" = "yes"; then
2202         FILTER='true'
2203         MOZ_OS2_USE_DECLSPEC='1'
2204     fi
2205     ;;
2207 alpha*-*-osf*)
2208     if test "$GNU_CC"; then
2209       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2210       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2212     else
2213         MOZ_DEBUG_FLAGS='-g'
2214         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2215         CFLAGS="$CFLAGS -ieee"
2216         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2217         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2218         DSO_CFLAGS=
2219         DSO_PIC_CFLAGS=
2220         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2221         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2222         MKSHLIB_FORCE_ALL='-all'
2223         MKSHLIB_UNFORCE_ALL='-none'
2224         dnl Might fix the libxpcom.so breakage on this platform as well....
2225         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2226         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2227     fi
2228     if test -z "$GNU_CXX"; then
2229       COMPAQ_CXX=1
2230     fi
2231     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2232     ;;
2234 *-qnx*) 
2235     DIRENT_INO=d_stat.st_ino
2236     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2237     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2238     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2239     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2240     AC_DEFINE(STDC_HEADERS)
2241     if test "$no_x" = "yes"; then
2242             _PLATFORM_DEFAULT_TOOLKIT='photon'
2243             TK_CFLAGS='-I/usr/nto/include/photon'
2244             TK_LIBS='-lphoton -lphrender'
2245     fi
2246     ;;
2248 *-sco*) 
2249     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2250     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2251     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2252     if test ! "$GNU_CC"; then
2253        DSO_LDOPTS='-G'
2254     fi
2255     ;;
2257 dnl the qsort routine under solaris is faulty
2258 *-solaris*) 
2259     AC_DEFINE(SOLARIS)
2260     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2261     SYSTEM_MAKEDEPEND=
2262     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2263     # libraries one level up (e.g. libnspr4.so)
2264     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2265     LIBS="-lCrun -lCstd $LIBS"
2266     if test -z "$GNU_CC"; then
2267        NS_USE_NATIVE=1
2268        MOZ_FIX_LINK_PATHS=
2269        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2271        if test "$CPU_ARCH" != "sparc"; then
2272           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2273           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2274        else
2275           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2276           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2277           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2278        fi
2280        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2281        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2282            _SAVE_LDFLAGS=$LDFLAGS
2283            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2284            AC_TRY_LINK([#include <stdio.h>],
2285                        [printf("Hello World\n");],
2286                        ,
2287                        [LDFLAGS=$_SAVE_LDFLAGS])
2288        fi
2289        WARNINGS_AS_ERRORS='-Werror'
2290        MOZ_OPTIMIZE_FLAGS="-xO4"
2291        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2292        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2293        MKSHLIB_FORCE_ALL='-z allextract'
2294        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2295        DSO_LDOPTS='-G -z muldefs'
2296        AR_LIST="$AR t"
2297        AR_EXTRACT="$AR x"
2298        AR_DELETE="$AR d"
2299        AR='$(CXX) -xar'
2300        AR_FLAGS='-o $@'
2301        AS='/usr/ccs/bin/as'
2302        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2303        AS_DASH_C_FLAG=''
2304        TARGET_COMPILER_ABI="sunc"
2305         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2306         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2307        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2308        AC_LANG_SAVE
2309        AC_LANG_CPLUSPLUS
2310        AC_TRY_COMPILE([],
2311            [#if (__SUNPRO_CC < 0x530)
2312            #error "Denied"
2313            #endif],
2314            _BAD_COMPILER=,_BAD_COMPILER=1)
2315         if test -n "$_BAD_COMPILER"; then
2316             _res="no"
2317             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2318         else
2319             _res="yes"
2320         fi
2321         AC_MSG_RESULT([$_res])
2322         AC_LANG_RESTORE
2323     else
2324        ASFLAGS="$ASFLAGS -fPIC"
2325        DSO_LDOPTS='-G'
2326        _WARNINGS_CFLAGS=''
2327        _WARNINGS_CXXFLAGS=''
2328        if test "$OS_RELEASE" = "5.3"; then
2329           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2330        fi
2331     fi
2332     if test "$OS_RELEASE" = "5.5.1"; then
2333        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2334     fi
2335     ;;
2337 *-sunos*) 
2338     DSO_LDOPTS='-Bdynamic'
2339     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2340     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2341     AC_DEFINE(SUNOS4)
2342     AC_DEFINE(SPRINTF_RETURNS_STRING)
2343     case "$(target_os)" in
2344     sunos4.1*)
2345         DLL_SUFFIX='.so.1.0'
2346         ;;
2347     esac
2348     ;;
2350 *-sysv4.2uw7*) 
2351         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2352     ;;
2354 *-os2*)
2355     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2356     ;;
2358 esac
2360 dnl Only one oddball right now (QNX), but this gives us flexibility
2361 dnl if any other platforms need to override this in the future.
2362 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2364 dnl ========================================================
2365 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2366 dnl by now will not have any way to link most binaries (tests
2367 dnl as well as viewer, apprunner, etc.), because some symbols
2368 dnl will be left out of the "composite" .so's by ld as unneeded.
2369 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2370 dnl they can link in the static libs that provide the missing
2371 dnl symbols.
2372 dnl ========================================================
2373 NO_LD_ARCHIVE_FLAGS=
2374 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2375     NO_LD_ARCHIVE_FLAGS=1
2377 case "$target" in
2378 *-os2*)
2379     NO_LD_ARCHIVE_FLAGS=
2380     ;;
2381 *-aix4.3*|*-aix5*)
2382     NO_LD_ARCHIVE_FLAGS=
2383     ;;
2384 *-openvms*)
2385     NO_LD_ARCHIVE_FLAGS=
2386     ;;
2387 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2388     if test -z "$GNU_CC"; then
2389         NO_LD_ARCHIVE_FLAGS=
2390     fi
2391     ;;
2392 esac
2393 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2396 dnl Indicate that platform requires special thread safe 
2397 dnl locking when starting up the OJI JVM 
2398 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2399 dnl ========================================================
2400 case "$target" in
2401     *-hpux*)      
2402         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2403         ;;
2404 esac
2406 dnl ========================================================
2407 dnl = Flags to strip unused symbols from .so components
2408 dnl ========================================================
2409 case "$target" in
2410     *-linux*|*-kfreebsd*-gnu)
2411         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2412         ;;
2413     *-solaris*)
2414         if test -z "$GNU_CC"; then
2415          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2416         else
2417          if test -z "$GCC_USE_GNU_LD"; then
2418           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2419          else
2420           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2421          fi
2422         fi
2423         ;;
2424     *-nto*) 
2425         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2426         ;;
2427     *-darwin*)
2428         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2429         ;;
2430     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2431         if test -n "$GNU_CC"; then
2432            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2433         fi
2434         ;;
2435 esac
2437 if test -z "$COMPILE_ENVIRONMENT"; then
2438     SKIP_COMPILER_CHECKS=1
2439     SKIP_LIBRARY_CHECKS=1
2442 if test -z "$SKIP_COMPILER_CHECKS"; then
2443 dnl Checks for typedefs, structures, and compiler characteristics.
2444 dnl ========================================================
2445 AC_LANG_C
2446 AC_HEADER_STDC
2447 AC_C_CONST
2448 AC_TYPE_MODE_T
2449 AC_TYPE_OFF_T
2450 AC_TYPE_PID_T
2451 AC_TYPE_SIZE_T
2452 AC_STRUCT_ST_BLKSIZE
2453 AC_MSG_CHECKING(for siginfo_t)
2454 AC_CACHE_VAL(ac_cv_siginfo_t,
2455  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2456                   #include <signal.h>],
2457                  [siginfo_t* info;],
2458                  [ac_cv_siginfo_t=true],
2459                  [ac_cv_siginfo_t=false])])
2460 if test "$ac_cv_siginfo_t" = true ; then
2461   AC_DEFINE(HAVE_SIGINFO_T)
2462   AC_MSG_RESULT(yes)
2463 else
2464   AC_MSG_RESULT(no)
2467 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2468 dnl ========================================================
2469 AC_MSG_CHECKING(for int16_t)
2470 AC_CACHE_VAL(ac_cv_int16_t,
2471  [AC_TRY_COMPILE([#include <stdio.h>
2472                   #include <sys/types.h>],
2473                  [int16_t foo = 0;],
2474                  [ac_cv_int16_t=true],
2475                  [ac_cv_int16_t=false])])
2476 if test "$ac_cv_int16_t" = true ; then
2477   AC_DEFINE(HAVE_INT16_T)
2478   AC_MSG_RESULT(yes)
2479 else
2480   AC_MSG_RESULT(no)
2482 AC_MSG_CHECKING(for int32_t)
2483 AC_CACHE_VAL(ac_cv_int32_t,
2484  [AC_TRY_COMPILE([#include <stdio.h>
2485                   #include <sys/types.h>],
2486                  [int32_t foo = 0;],
2487                  [ac_cv_int32_t=true],
2488                  [ac_cv_int32_t=false])])
2489 if test "$ac_cv_int32_t" = true ; then
2490   AC_DEFINE(HAVE_INT32_T)
2491   AC_MSG_RESULT(yes)
2492 else
2493   AC_MSG_RESULT(no)
2495 AC_MSG_CHECKING(for int64_t)
2496 AC_CACHE_VAL(ac_cv_int64_t,
2497  [AC_TRY_COMPILE([#include <stdio.h>
2498                   #include <sys/types.h>],
2499                  [int64_t foo = 0;],
2500                  [ac_cv_int64_t=true],
2501                  [ac_cv_int64_t=false])])
2502 if test "$ac_cv_int64_t" = true ; then
2503   AC_DEFINE(HAVE_INT64_T)
2504   AC_MSG_RESULT(yes)
2505 else
2506   AC_MSG_RESULT(no)
2508 AC_MSG_CHECKING(for int64)
2509 AC_CACHE_VAL(ac_cv_int64,
2510  [AC_TRY_COMPILE([#include <stdio.h>
2511                   #include <sys/types.h>],
2512                  [int64 foo = 0;],
2513                  [ac_cv_int64=true],
2514                  [ac_cv_int64=false])])
2515 if test "$ac_cv_int64" = true ; then
2516   AC_DEFINE(HAVE_INT64)
2517   AC_MSG_RESULT(yes)
2518 else
2519   AC_MSG_RESULT(no)
2521 AC_MSG_CHECKING(for uint)
2522 AC_CACHE_VAL(ac_cv_uint,
2523  [AC_TRY_COMPILE([#include <stdio.h>
2524                   #include <sys/types.h>],
2525                  [uint foo = 0;],
2526                  [ac_cv_uint=true],
2527                  [ac_cv_uint=false])])
2528 if test "$ac_cv_uint" = true ; then
2529   AC_DEFINE(HAVE_UINT)
2530   AC_MSG_RESULT(yes)
2531 else
2532   AC_MSG_RESULT(no)
2534 AC_MSG_CHECKING(for uint_t)
2535 AC_CACHE_VAL(ac_cv_uint_t,
2536  [AC_TRY_COMPILE([#include <stdio.h>
2537                   #include <sys/types.h>],
2538                  [uint_t foo = 0;],
2539                  [ac_cv_uint_t=true],
2540                  [ac_cv_uint_t=false])])
2541 if test "$ac_cv_uint_t" = true ; then
2542   AC_DEFINE(HAVE_UINT_T)
2543   AC_MSG_RESULT(yes)
2544 else
2545   AC_MSG_RESULT(no)
2547 AC_MSG_CHECKING(for uint16_t)
2548 AC_CACHE_VAL(ac_cv_uint16_t,
2549  [AC_TRY_COMPILE([#include <stdio.h>
2550                   #include <sys/types.h>],
2551                  [uint16_t foo = 0;],
2552                  [ac_cv_uint16_t=true],
2553                  [ac_cv_uint16_t=false])])
2554 if test "$ac_cv_uint16_t" = true ; then
2555   AC_DEFINE(HAVE_UINT16_T)
2556   AC_MSG_RESULT(yes)
2557 else
2558   AC_MSG_RESULT(no)
2561 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2562 dnl are defined when compiling C++ but not C.  Since the result of this
2563 dnl test is used only in C++, do it in C++.
2564 AC_LANG_CPLUSPLUS
2566 AC_MSG_CHECKING(for uname.domainname)
2567 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2568     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2569         [ struct utsname *res; char *domain; 
2570             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2571         [ac_cv_have_uname_domainname_field=true],
2572         [ac_cv_have_uname_domainname_field=false])])
2574 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2575     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2576     AC_MSG_RESULT(yes)
2577 else
2578     AC_MSG_RESULT(no)
2581 AC_MSG_CHECKING(for uname.__domainname)
2582 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2583     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2584         [ struct utsname *res; char *domain; 
2585             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2586         [ac_cv_have_uname_us_domainname_field=true],
2587         [ac_cv_have_uname_us_domainname_field=false])])
2589 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2590     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2591     AC_MSG_RESULT(yes)
2592 else
2593     AC_MSG_RESULT(no)
2596 AC_LANG_C
2598 dnl Check for usable wchar_t (2 bytes, unsigned)
2599 dnl (we really don't need the unsignedness check anymore)
2600 dnl ========================================================
2602 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2603     ac_cv_have_usable_wchar_v2,
2604     [AC_TRY_COMPILE([#include <stddef.h>
2605                      $configure_static_assert_macros],
2606                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2607                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2608                     ac_cv_have_usable_wchar_v2="yes",
2609                     ac_cv_have_usable_wchar_v2="no")])
2610 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2611     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2612     HAVE_CPP_2BYTE_WCHAR_T=1
2613 else
2614 dnl This is really gcc-only
2615 dnl Do this test using CXX only since some versions of gcc
2616 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2617 dnl only have short-wchar support for c++.
2618 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2620     AC_LANG_SAVE
2621     AC_LANG_CPLUSPLUS
2622     _SAVE_CXXFLAGS=$CXXFLAGS
2623     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2625     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2626         ac_cv_have_usable_wchar_option_v2,
2627         [AC_TRY_LINK([#include <stddef.h>
2628                       $configure_static_assert_macros],
2629                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2630                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2631                      ac_cv_have_usable_wchar_option_v2="yes",
2632                      ac_cv_have_usable_wchar_option_v2="no")])
2634     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2635         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2636         HAVE_CPP_2BYTE_WCHAR_T=1
2637         WCHAR_CFLAGS="-fshort-wchar"
2638     else    
2639         CXXFLAGS=$_SAVE_CXXFLAGS
2640     fi
2641     AC_LANG_RESTORE
2644 dnl Check for .hidden assembler directive and visibility attribute.
2645 dnl Borrowed from glibc configure.in
2646 dnl ===============================================================
2647 if test "$GNU_CC"; then
2648   AC_CACHE_CHECK(for visibility(hidden) attribute,
2649                  ac_cv_visibility_hidden,
2650                  [cat > conftest.c <<EOF
2651                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2653                   ac_cv_visibility_hidden=no
2654                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2655                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2656                       ac_cv_visibility_hidden=yes
2657                     fi
2658                   fi
2659                   rm -f conftest.[cs]
2660                  ])
2661   if test "$ac_cv_visibility_hidden" = "yes"; then
2662     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2664     AC_CACHE_CHECK(for visibility(default) attribute,
2665                    ac_cv_visibility_default,
2666                    [cat > conftest.c <<EOF
2667                     int foo __attribute__ ((visibility ("default"))) = 1;
2669                     ac_cv_visibility_default=no
2670                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2671                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2672                         ac_cv_visibility_default=yes
2673                       fi
2674                     fi
2675                     rm -f conftest.[cs]
2676                    ])
2677     if test "$ac_cv_visibility_default" = "yes"; then
2678       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2680       AC_CACHE_CHECK(for visibility pragma support,
2681                      ac_cv_visibility_pragma,
2682                      [cat > conftest.c <<EOF
2683 #pragma GCC visibility push(hidden)
2684                       int foo_hidden = 1;
2685 #pragma GCC visibility push(default)
2686                       int foo_default = 1;
2688                       ac_cv_visibility_pragma=no
2689                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2690                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2691                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2692                             ac_cv_visibility_pragma=yes
2693                           fi
2694                         fi
2695                       fi
2696                       rm -f conftest.[cs]
2697                     ])
2698       if test "$ac_cv_visibility_pragma" = "yes"; then
2699         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2700                        ac_cv_have_visibility_class_bug,
2701                        [cat > conftest.c <<EOF
2702 #pragma GCC visibility push(hidden)
2703 struct __attribute__ ((visibility ("default"))) TestStruct {
2704   static void Init();
2706 __attribute__ ((visibility ("default"))) void TestFunc() {
2707   TestStruct::Init();
2710                        ac_cv_have_visibility_class_bug=no
2711                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2712                          ac_cv_have_visibility_class_bug=yes
2713                        else
2714                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2715                            ac_cv_have_visibility_class_bug=yes
2716                          fi
2717                        fi
2718                        rm -rf conftest.{c,S}
2719                        ])
2721         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2722                        ac_cv_have_visibility_builtin_bug,
2723                        [cat > conftest.c <<EOF
2724 #pragma GCC visibility push(hidden)
2725 #pragma GCC visibility push(default)
2726 #include <string.h>
2727 #pragma GCC visibility pop
2729 __attribute__ ((visibility ("default"))) void Func() {
2730   char c[[100]];
2731   memset(c, 0, sizeof(c));
2734                        ac_cv_have_visibility_builtin_bug=no
2735                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2736                          ac_cv_have_visibility_builtin_bug=yes
2737                        else
2738                          if test `grep -c "@PLT" conftest.S` = 0; then
2739                            ac_cv_visibility_builtin_bug=yes
2740                          fi
2741                        fi
2742                        rm -f conftest.{c,S}
2743                        ])
2744         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2745                 "$ac_cv_have_visibility_class_bug" = "no"; then
2746           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2747           WRAP_SYSTEM_INCLUDES=1
2748         else
2749           VISIBILITY_FLAGS='-fvisibility=hidden'
2750         fi # have visibility pragma bug
2751       fi   # have visibility pragma
2752     fi     # have visibility(default) attribute
2753   fi       # have visibility(hidden) attribute
2754 fi         # GNU_CC
2756 # visibility hidden flag for Sun Studio on Solaris
2757 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
2758 VISIBILITY_FLAGS='-xldscope=hidden'
2759 fi         # Sun Studio on Solaris
2761 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2762 AC_SUBST(VISIBILITY_FLAGS)
2764 dnl Checks for header files.
2765 dnl ========================================================
2766 AC_HEADER_DIRENT
2767 case "$target_os" in
2768 freebsd*)
2769 # for stuff like -lXshm
2770     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2771     ;;
2772 esac
2773 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2774 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2775 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2776 AC_CHECK_HEADERS(malloc.h)
2777 AC_CHECK_HEADERS(X11/XKBlib.h)
2779 dnl These are all the places some variant of statfs can be hiding.
2780 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2782 dnl Try for MMX support
2783 dnl NB - later gcc versions require -mmmx for this header to be successfully
2784 dnl included (or another option which implies it, such as -march=pentium-mmx)
2785 AC_CHECK_HEADERS(mmintrin.h)
2787 AC_MSG_CHECKING(for ARM SIMD support)
2788 AC_TRY_COMPILE([],
2789                [asm("uqadd8 r1, r1, r2");],
2790                result="yes", result="no")
2791 AC_MSG_RESULT("$result")
2792 if test "$result" = "yes"; then
2793     AC_DEFINE(HAVE_ARM_SIMD)
2794     HAVE_ARM_SIMD=1
2796 AC_SUBST(HAVE_ARM_SIMD)
2798 dnl Check whether the compiler supports the new-style C++ standard
2799 dnl library headers (i.e. <new>) or needs the old "new.h"
2800 AC_LANG_CPLUSPLUS
2801 NEW_H=new.h
2802 AC_CHECK_HEADER(new, [NEW_H=new])
2803 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2804 AC_LANG_C
2806 AC_ARG_ENABLE(dtrace,
2807               [  --enable-dtrace         build with dtrace support if available (default=no)],
2808               [enable_dtrace="yes"],)
2809 if test "x$enable_dtrace" = "xyes"; then
2810   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2811   if test -n "$HAVE_DTRACE"; then
2812       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2813   else
2814       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2815   fi
2817 AC_SUBST(HAVE_DTRACE)
2819 case $target in
2820 *-aix4.3*|*-aix5*)
2821         ;;
2823         AC_CHECK_HEADERS(sys/cdefs.h)
2824         ;;
2825 esac
2827 dnl Checks for libraries.
2828 dnl ========================================================
2829 case $target in
2830 *-hpux11.*)
2831         ;;
2833         AC_CHECK_LIB(c_r, gethostbyname_r)
2834         ;;
2835 esac
2837 dnl We don't want to link with libdl even if it's present on OS X, since
2838 dnl it's not used and not part of the default installation.
2839 dnl The same goes for BeOS.
2840 dnl We don't want to link against libm or libpthread on Darwin since
2841 dnl they both are just symlinks to libSystem and explicitly linking
2842 dnl against libSystem causes issues when debugging (see bug 299601).
2843 case $target in
2844 *-darwin*)
2845     ;;
2846 *-beos*)
2847     ;;
2849     AC_CHECK_LIB(m, atan)
2850     AC_CHECK_LIB(dl, dlopen,
2851     AC_CHECK_HEADER(dlfcn.h, 
2852         LIBS="-ldl $LIBS"
2853         AC_DEFINE(HAVE_LIBDL)))
2854     ;;
2855 esac
2857 _SAVE_CFLAGS="$CFLAGS"
2858 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2859 AC_CHECK_FUNCS(dladdr)
2860 CFLAGS="$_SAVE_CFLAGS"
2862 if test ! "$GNU_CXX"; then
2864     case $target in
2865     *-aix*)
2866         AC_CHECK_LIB(C_r, demangle)
2867         ;;
2868      *)
2869         AC_CHECK_LIB(C, demangle)
2870         ;;
2871      esac
2873 AC_CHECK_LIB(socket, socket)
2875 dnl Enable VFP support on ARM
2876 MOZ_ARG_DISABLE_BOOL(arm-vfp,
2877 [  --disable-arm-vfp       Disable ARM VFP instructions in JavaScript JIT],
2878    MOZ_ARM_VFP=, MOZ_ARM_VFP=1, MOZ_ARM_VFP=1)
2879 if test "$MOZ_ARM_VFP"; then
2880    AC_DEFINE(NJ_ARM_VFP)
2883 dnl ========================================================
2884 dnl = pthread support
2885 dnl = Start by checking whether the system support pthreads
2886 dnl ========================================================
2887 case "$target_os" in
2888 darwin*)
2889     USE_PTHREADS=1
2890     ;;
2892     MOZ_CHECK_PTHREADS(pthreads,
2893         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2894         MOZ_CHECK_PTHREADS(pthread,
2895             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2896             MOZ_CHECK_PTHREADS(c_r,
2897                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2898                 MOZ_CHECK_PTHREADS(c,
2899                     USE_PTHREADS=1
2900                 )
2901             )
2902         )
2903     )
2904     ;;
2905 esac
2907 dnl ========================================================
2908 dnl Check the command line for --with-pthreads 
2909 dnl ========================================================
2910 MOZ_ARG_WITH_BOOL(pthreads,
2911 [  --with-pthreads         Force use of system pthread library with NSPR ],
2912 [ if test "$USE_PTHREADS"x = x; then
2913     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2914 fi],
2915     USE_PTHREADS=
2916     _PTHREAD_LDFLAGS=
2919 dnl ========================================================
2920 dnl Do the platform specific pthread hackery
2921 dnl ========================================================
2922 if test "$USE_PTHREADS"x != x
2923 then
2924         dnl
2925         dnl See if -pthread is supported.
2926         dnl
2927         rm -f conftest*
2928         ac_cv_have_dash_pthread=no
2929         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2930         echo 'int main() { return 0; }' | cat > conftest.c
2931         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2932         if test $? -eq 0; then
2933                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2934                         ac_cv_have_dash_pthread=yes
2935                 case "$target_os" in
2936                 freebsd*)
2937 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2938                 ;;
2939                 *)
2940                             CFLAGS="$CFLAGS -pthread"
2941                             CXXFLAGS="$CXXFLAGS -pthread"
2942                 ;;
2943                 esac
2944                 fi
2945         fi
2946         rm -f conftest*
2947     AC_MSG_RESULT($ac_cv_have_dash_pthread)
2949         dnl
2950         dnl See if -pthreads is supported.
2951         dnl
2952     ac_cv_have_dash_pthreads=no
2953     if test "$ac_cv_have_dash_pthread" = "no"; then
2954             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2955         echo 'int main() { return 0; }' | cat > conftest.c
2956             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2957         if test $? -eq 0; then
2958                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2959                             ac_cv_have_dash_pthreads=yes
2960                             CFLAGS="$CFLAGS -pthreads"
2961                             CXXFLAGS="$CXXFLAGS -pthreads"
2962                     fi
2963             fi
2964             rm -f conftest*
2965         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2966     fi
2968         case "$target" in
2969             *-*-freebsd*)
2970                         AC_DEFINE(_REENTRANT)
2971                         AC_DEFINE(_THREAD_SAFE)
2972                         dnl -pthread links in -lc_r, so don't specify it explicitly.
2973                         if test "$ac_cv_have_dash_pthread" = "yes"; then
2974                                 _PTHREAD_LDFLAGS="-pthread"
2975                         else
2976                                 _PTHREAD_LDFLAGS="-lc_r"
2977                         fi
2978                         ;;
2980             *-*-openbsd*|*-*-bsdi*)
2981                         AC_DEFINE(_REENTRANT)
2982                         AC_DEFINE(_THREAD_SAFE)
2983                         dnl -pthread links in -lc_r, so don't specify it explicitly.
2984                         if test "$ac_cv_have_dash_pthread" = "yes"; then
2985                 _PTHREAD_LDFLAGS="-pthread"
2986                         fi
2987                         ;;
2989             *-*-linux*|*-*-kfreebsd*-gnu)
2990                         AC_DEFINE(_REENTRANT) 
2991                         ;;
2993             *-*-nto*) 
2994                         AC_DEFINE(_REENTRANT) 
2995                         ;;
2997             *-aix4.3*|*-aix5*)
2998                         AC_DEFINE(_REENTRANT) 
2999                         ;;
3001             *-hpux11.*)
3002                         AC_DEFINE(_REENTRANT) 
3003                         ;;
3005             alpha*-*-osf*)
3006                         AC_DEFINE(_REENTRANT)
3007                         ;;
3009             *-*-solaris*) 
3010                         AC_DEFINE(_REENTRANT) 
3011                         if test ! "$GNU_CC"; then
3012                                 CFLAGS="$CFLAGS -mt" 
3013                                 CXXFLAGS="$CXXFLAGS -mt" 
3014                         fi
3015                         ;;
3016         esac
3017     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3020 dnl ========================================================
3021 dnl See if mmap sees writes
3022 dnl For cross compiling, just define it as no, which is a safe default
3023 dnl ========================================================
3024 AC_MSG_CHECKING(whether mmap() sees write()s)
3026 changequote(,)
3027 mmap_test_prog='
3028     #include <stdlib.h>
3029     #include <unistd.h>
3030     #include <sys/mman.h>
3031     #include <sys/types.h>
3032     #include <sys/stat.h>
3033     #include <fcntl.h>
3035     char fname[] = "conftest.file";
3036     char zbuff[1024]; /* Fractional page is probably worst case */
3038     int main() {
3039         char *map;
3040         int fd;
3041         int i;
3042         unlink(fname);
3043         fd = open(fname, O_RDWR | O_CREAT, 0660);
3044         if(fd<0) return 1;
3045         unlink(fname);
3046         write(fd, zbuff, sizeof(zbuff));
3047         lseek(fd, 0, SEEK_SET);
3048         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3049         if(map==(char*)-1) return 2;
3050         for(i=0; fname[i]; i++) {
3051             int rc = write(fd, &fname[i], 1);
3052             if(map[i]!=fname[i]) return 4;
3053         }
3054         return 0;
3055     }
3057 changequote([,])
3059 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3061 AC_MSG_RESULT("$result")
3063 if test "$result" = "no"; then
3064     AC_DEFINE(MMAP_MISSES_WRITES)
3068 dnl Checks for library functions.
3069 dnl ========================================================
3070 AC_PROG_GCC_TRADITIONAL
3071 AC_FUNC_MEMCMP
3072 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3073 AC_CHECK_FUNCS(flockfile getpagesize)
3075 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3076 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3077   AC_CHECK_FUNCS(localtime_r strtok_r)
3080 dnl check for wcrtomb/mbrtowc
3081 dnl =======================================================================
3082 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3083 AC_LANG_SAVE
3084 AC_LANG_CPLUSPLUS
3085 AC_CACHE_CHECK(for wcrtomb,
3086     ac_cv_have_wcrtomb,
3087     [AC_TRY_LINK([#include <wchar.h>],
3088                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3089                  ac_cv_have_wcrtomb="yes",
3090                  ac_cv_have_wcrtomb="no")])
3091 if test "$ac_cv_have_wcrtomb" = "yes"; then
3092     AC_DEFINE(HAVE_WCRTOMB)
3094 AC_CACHE_CHECK(for mbrtowc,
3095     ac_cv_have_mbrtowc,
3096     [AC_TRY_LINK([#include <wchar.h>],
3097                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3098                  ac_cv_have_mbrtowc="yes",
3099                  ac_cv_have_mbrtowc="no")])
3100 if test "$ac_cv_have_mbrtowc" = "yes"; then
3101     AC_DEFINE(HAVE_MBRTOWC)
3103 AC_LANG_RESTORE
3106 AC_CACHE_CHECK(
3107     [for res_ninit()],
3108     ac_cv_func_res_ninit,
3109     [AC_TRY_LINK([
3110         #ifdef linux
3111         #define _BSD_SOURCE 1
3112         #endif
3113         #include <resolv.h>
3114         ],
3115         [int foo = res_ninit(&_res);],
3116         [ac_cv_func_res_ninit=yes],
3117         [ac_cv_func_res_ninit=no])
3118     ])
3120 if test "$ac_cv_func_res_ninit" = "yes"; then
3121     AC_DEFINE(HAVE_RES_NINIT)
3122 dnl must add the link line we do something as foolish as this... dougt
3123 dnl else
3124 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3125 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3128 AC_LANG_CPLUSPLUS
3129 AC_CACHE_CHECK(
3130     [for gnu_get_libc_version()],
3131     ac_cv_func_gnu_get_libc_version,
3132     [AC_TRY_LINK([
3133         #ifdef HAVE_GNU_LIBC_VERSION_H
3134         #include <gnu/libc-version.h>
3135         #endif
3136         ],
3137         [const char *glibc_version = gnu_get_libc_version();],
3138         [ac_cv_func_gnu_get_libc_version=yes],
3139         [ac_cv_func_gnu_get_libc_version=no] 
3140         )]
3141     )
3143 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3144     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3147 case $target_os in
3148     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3149         ;;
3150     *)
3151     
3152 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3153     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3154         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3155 _SAVE_LIBS=$LIBS
3156 LIBS="$LIBS $_ICONV_LIBS"
3157 AC_CACHE_CHECK(
3158     [for iconv()],
3159     ac_cv_func_iconv,
3160     [AC_TRY_LINK([
3161         #include <stdlib.h>
3162         #include <iconv.h>
3163         ],
3164         [
3165             iconv_t h = iconv_open("", "");
3166             iconv(h, NULL, NULL, NULL, NULL);
3167             iconv_close(h);
3168         ],
3169         [ac_cv_func_iconv=yes],
3170         [ac_cv_func_iconv=no] 
3171         )]
3172     )
3173 if test "$ac_cv_func_iconv" = "yes"; then
3174     AC_DEFINE(HAVE_ICONV)
3175     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3176     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3177     LIBICONV="$_ICONV_LIBS"
3178     AC_CACHE_CHECK(
3179         [for iconv() with const input],
3180         ac_cv_func_const_iconv,
3181         [AC_TRY_COMPILE([
3182             #include <stdlib.h>
3183             #include <iconv.h>
3184             ],
3185             [
3186                 const char *input = "testing";
3187                 iconv_t h = iconv_open("", "");
3188                 iconv(h, &input, NULL, NULL, NULL);
3189                 iconv_close(h);
3190             ],
3191             [ac_cv_func_const_iconv=yes],
3192             [ac_cv_func_const_iconv=no] 
3193             )]
3194         )
3195     if test "$ac_cv_func_const_iconv" = "yes"; then
3196         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3197     fi
3199 LIBS=$_SAVE_LIBS
3201     ;;
3202 esac
3204 AC_LANG_C
3206 dnl **********************
3207 dnl *** va_copy checks ***
3208 dnl **********************
3209 dnl we currently check for all three va_copy possibilities, so we get
3210 dnl all results in config.log for bug reports.
3211 AC_MSG_CHECKING(for an implementation of va_copy())
3212 AC_CACHE_VAL(ac_cv_va_copy,[
3213     AC_TRY_RUN([
3214         #include <stdarg.h>
3215         void f (int i, ...) {
3216             va_list args1, args2;
3217             va_start (args1, i);
3218             va_copy (args2, args1);
3219             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3220                 exit (1);
3221             va_end (args1); va_end (args2);
3222         }
3223         int main() { f (0, 42); return 0; }],
3224         ac_cv_va_copy=yes,
3225         ac_cv_va_copy=no,
3226         ac_cv_va_copy=no
3227     )
3229 AC_MSG_RESULT($ac_cv_va_copy)
3230 AC_MSG_CHECKING(for an implementation of __va_copy())
3231 AC_CACHE_VAL(ac_cv___va_copy,[
3232     AC_TRY_RUN([
3233         #include <stdarg.h>
3234         void f (int i, ...) {
3235             va_list args1, args2;
3236             va_start (args1, i);
3237             __va_copy (args2, args1);
3238             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3239                 exit (1);
3240             va_end (args1); va_end (args2);
3241         }
3242         int main() { f (0, 42); return 0; }],
3243         ac_cv___va_copy=yes,
3244         ac_cv___va_copy=no,
3245         ac_cv___va_copy=no
3246     )
3248 AC_MSG_RESULT($ac_cv___va_copy)
3249 AC_MSG_CHECKING(whether va_lists can be copied by value)
3250 AC_CACHE_VAL(ac_cv_va_val_copy,[
3251     AC_TRY_RUN([
3252         #include <stdarg.h>
3253         void f (int i, ...) {
3254             va_list args1, args2;
3255             va_start (args1, i);
3256             args2 = args1;
3257             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3258                 exit (1);
3259             va_end (args1); va_end (args2);
3260         }
3261         int main() { f (0, 42); return 0; }],
3262         ac_cv_va_val_copy=yes,
3263         ac_cv_va_val_copy=no,
3264         ac_cv_va_val_copy=yes
3265     )
3267 if test "x$ac_cv_va_copy" = "xyes"; then
3268     AC_DEFINE(VA_COPY, va_copy)
3269     AC_DEFINE(HAVE_VA_COPY)
3270 elif test "x$ac_cv___va_copy" = "xyes"; then
3271     AC_DEFINE(VA_COPY, __va_copy)
3272     AC_DEFINE(HAVE_VA_COPY)
3275 if test "x$ac_cv_va_val_copy" = "xno"; then
3276    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3278 AC_MSG_RESULT($ac_cv_va_val_copy)
3280 dnl Check for dll-challenged libc's.
3281 dnl This check is apparently only needed for Linux.
3282 case "$target" in
3283         *-linux*)
3284             dnl ===================================================================
3285             _curdir=`pwd`
3286             export _curdir
3287             rm -rf conftest* _conftest
3288             mkdir _conftest
3289             cat >> conftest.C <<\EOF
3290 #include <stdio.h>
3291 #include <link.h>
3292 #include <dlfcn.h>
3293 #ifdef _dl_loaded
3294 void __dump_link_map(void) {
3295   struct link_map *map = _dl_loaded;
3296   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3298 int main() {
3299   dlopen("./conftest1.so",RTLD_LAZY);
3300   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3301   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3302   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3303   __dump_link_map();
3305 #else
3306 /* _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).*/
3307 int main() { printf("./conftest1.so\n"); }
3308 #endif
3311             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3313             cat >> conftest1.C <<\EOF
3314 #include <stdio.h>
3315 void foo(void) {printf("foo in dll called\n");}
3317             ${CXX-g++} -fPIC -c -g conftest1.C
3318             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3319             ${CXX-g++} -g conftest.C -o conftest -ldl
3320             cp -f conftest1.so conftest _conftest
3321             cd _conftest
3322             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3323             then
3324                 echo
3325                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3326                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3327                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3328                 echo "*** will be excessive memory usage at runtime."
3329                 echo
3330             fi
3331             cd ${_curdir}
3332             rm -rf conftest* _conftest
3333             dnl ===================================================================
3334             ;;
3335 esac
3337 dnl ===================================================================
3338 dnl ========================================================
3339 dnl By default, turn rtti and exceptions off on g++/egcs
3340 dnl ========================================================
3341 if test "$GNU_CXX"; then
3343   AC_MSG_CHECKING(for C++ exceptions flag)
3345   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3346   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3347   [echo "int main() { return 0; }" | cat > conftest.C
3349   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3351   if egrep "warning.*renamed" conftest.out >/dev/null; then
3352     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3353   else
3354     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3355   fi
3357   rm -f conftest*])
3359   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3360   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3361   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3364 dnl ========================================================
3365 dnl Put your C++ language/feature checks below
3366 dnl ========================================================
3367 AC_LANG_CPLUSPLUS
3369 HAVE_GCC3_ABI=
3370 if test "$GNU_CC"; then
3371   AC_CACHE_CHECK(for gcc 3.0 ABI,
3372       ac_cv_gcc_three_abi,
3373       [AC_TRY_COMPILE([],
3374                       [
3375 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3376   return 0;
3377 #else
3378 #error Not gcc3.
3379 #endif
3380                       ],
3381                       ac_cv_gcc_three_abi="yes",
3382                       ac_cv_gcc_three_abi="no")])
3383   if test "$ac_cv_gcc_three_abi" = "yes"; then
3384       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3385       HAVE_GCC3_ABI=1
3386   else
3387       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3388   fi
3390 AC_SUBST(HAVE_GCC3_ABI)
3393 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3394                ac_cv_cpp_explicit,
3395                [AC_TRY_COMPILE(class X {
3396                                public: explicit X(int i) : i_(i) {}
3397                                private: int i_;
3398                                };,
3399                                X x(3);,
3400                                ac_cv_cpp_explicit=yes,
3401                                ac_cv_cpp_explicit=no)])
3402 if test "$ac_cv_cpp_explicit" = yes ; then
3403    AC_DEFINE(HAVE_CPP_EXPLICIT)
3406 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3407                ac_cv_cpp_typename,
3408                [AC_TRY_COMPILE(class param {
3409                                public:
3410                                    typedef unsigned long num_type;
3411                                };
3413                                template <class T> class tplt {
3414                                public:
3415                                    typedef typename T::num_type t_num_type;
3416                                    t_num_type foo(typename T::num_type num) {
3417                                        return num;
3418                                    }
3419                                };,
3420                                tplt<param> A;
3421                                A.foo(0);,
3422                                ac_cv_cpp_typename=yes,
3423                                ac_cv_cpp_typename=no)])
3424 if test "$ac_cv_cpp_typename" = yes ; then
3425    AC_DEFINE(HAVE_CPP_TYPENAME)
3428 dnl Check for support of modern template specialization syntax
3429 dnl Test code and requirement from scc@netscape.com.
3430 dnl Autoconf cut-and-paste job by waterson@netscape.com
3431 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3432                ac_cv_cpp_modern_specialize_template_syntax,
3433                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3434                                class Y {};
3435                                template <> struct X<Y> { double a; };,
3436                                X<int> int_x;
3437                                X<Y> y_x;,
3438                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3439                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3440 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3441   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3445 dnl Some compilers support only full specialization, and some don't.
3446 AC_CACHE_CHECK(whether partial template specialization works,
3447                ac_cv_cpp_partial_specialization,
3448                [AC_TRY_COMPILE(template <class T> class Foo {};
3449                                template <class T> class Foo<T*> {};,
3450                                return 0;,
3451                                ac_cv_cpp_partial_specialization=yes,
3452                                ac_cv_cpp_partial_specialization=no)])
3453 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3454   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3457 dnl Some compilers have limited support for operators with templates;
3458 dnl specifically, it is necessary to define derived operators when a base
3459 dnl class's operator declaration should suffice.
3460 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3461                ac_cv_need_derived_template_operators,
3462                [AC_TRY_COMPILE([template <class T> class Base { };
3463                                 template <class T>
3464                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3465                                 template <class T> class Derived : public Base<T> { };],
3466                                [Derived<char> a, b;
3467                                 Base<char> c = a + b;
3468                                 return 0;],
3469                                ac_cv_need_derived_template_operators=no,
3470                                ac_cv_need_derived_template_operators=yes)])
3471 if test "$ac_cv_need_derived_template_operators" = yes ; then
3472   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3476 dnl Some compilers have trouble detecting that a template class
3477 dnl that derives from another template is actually an instance
3478 dnl of the base class. This test checks for that.
3479 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3480                ac_cv_need_cpp_template_cast_to_base,
3481                [AC_TRY_COMPILE([template <class T> class Base { };
3482                                 template <class T> class Derived : public Base<T> { };
3483                                 template <class T> int foo(const Base<T>&) { return 0; }],
3484                                [Derived<char> bar; return foo(bar);],
3485                                ac_cv_need_cpp_template_cast_to_base=no,
3486                                ac_cv_need_cpp_template_cast_to_base=yes)])
3487 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3488   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3491 dnl Some compilers have trouble resolving the ambiguity between two
3492 dnl functions whose arguments differ only by cv-qualifications.
3493 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3494                ac_cv_can_resolve_const_ambiguity,
3495                [AC_TRY_COMPILE([
3496                                 template <class T> class ptrClass {
3497                                   public: T* ptr;
3498                                 };
3500                                 template <class T> T* a(ptrClass<T> *arg) {
3501                                   return arg->ptr;
3502                                 }
3504                                 template <class T>
3505                                 const T* a(const ptrClass<T> *arg) {
3506                                   return arg->ptr;
3507                                 }
3508                                ],
3509                                [ ptrClass<int> i;
3510                                  a(&i); ],
3511                                ac_cv_can_resolve_const_ambiguity=yes,
3512                                ac_cv_can_resolve_const_ambiguity=no)])
3513 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3514   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3518 dnl We don't do exceptions on unix.  The only reason this used to be here
3519 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3520 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3521 dnl So im commenting this out until someone writes some artificial 
3522 dnl intelligence to detect not only if the compiler has exceptions, but if 
3523 dnl they are enabled as well.
3524 dnl 
3525 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3526 dnl                ac_cv_cpp_exceptions,
3527 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3528 dnl                                static void F() { throw X(); },
3529 dnl                                try { F(); } catch(X & e) { },
3530 dnl                                ac_cv_cpp_exceptions=yes,
3531 dnl                                ac_cv_cpp_exceptions=no)])
3532 dnl if test $ac_cv_cpp_exceptions = yes ; then
3533 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3534 dnl fi
3536 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3537 dnl supports it well enough to allow us to use it to change access, but not
3538 dnl to resolve ambiguity. The next two tests determine how well the |using|
3539 dnl keyword is supported.
3541 dnl Check to see if we can change access with |using|.  Test both a
3542 dnl legal and an illegal example.
3543 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3544                ac_cv_cpp_access_changing_using2,
3545                [AC_TRY_COMPILE(
3546                    class A { protected: int foo() { return 0; } };
3547                    class B : public A { public: using A::foo; };,
3548                    B b; return b.foo();,
3549                    [AC_TRY_COMPILE(
3550                        class A { public: int foo() { return 1; } };
3551                        class B : public A { private: using A::foo; };,
3552                        B b; return b.foo();,
3553                        ac_cv_cpp_access_changing_using2=no,
3554                        ac_cv_cpp_access_changing_using2=yes)],
3555                    ac_cv_cpp_access_changing_using2=no)])
3556 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3557    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3560 dnl Check to see if we can resolve ambiguity with |using|.
3561 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3562                ac_cv_cpp_ambiguity_resolving_using,
3563                [AC_TRY_COMPILE(class X { 
3564                                  public: int go(const X&) {return 3;}
3565                                          int jo(const X&) {return 3;}
3566                                };
3567                                class Y : public X {
3568                                  public:  int go(int) {return 2;}
3569                                           int jo(int) {return 2;}
3570                                           using X::jo;
3571                                  private: using X::go;
3572                                };,
3573                                X x; Y y; y.jo(x);,
3574                                ac_cv_cpp_ambiguity_resolving_using=yes,
3575                                ac_cv_cpp_ambiguity_resolving_using=no)])
3576 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3577    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3580 dnl Check to see if the |std| namespace is supported. If so, we'll want
3581 dnl to qualify any standard library calls with "std::" to ensure that
3582 dnl those functions can be resolved.
3583 AC_CACHE_CHECK(for \"std::\" namespace,
3584                ac_cv_cpp_namespace_std,
3585                [AC_TRY_COMPILE([#include <algorithm>],
3586                                [return std::min(0, 1);],
3587                                ac_cv_cpp_namespace_std=yes,
3588                                ac_cv_cpp_namespace_std=no)])
3589 if test "$ac_cv_cpp_namespace_std" = yes ; then
3590    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3593 dnl Older compilers are overly ambitious with respect to using the standard
3594 dnl template library's |operator!=()| when |operator==()| is defined. In
3595 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3596 dnl ambiguity at compile-time. This test checks for that case.
3597 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3598                ac_cv_cpp_unambiguous_std_notequal,
3599                [AC_TRY_COMPILE([#include <algorithm>
3600                                 struct T1 {};
3601                                 int operator==(const T1&, const T1&) { return 0; }
3602                                 int operator!=(const T1&, const T1&) { return 0; }],
3603                                [T1 a,b; return a != b;],
3604                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3605                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3606 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3607   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3611 AC_CACHE_CHECK(for C++ reinterpret_cast,
3612                ac_cv_cpp_reinterpret_cast,
3613                [AC_TRY_COMPILE(struct X { int i; };
3614                                struct Y { int i; };,
3615                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3616                                ac_cv_cpp_reinterpret_cast=yes,
3617                                ac_cv_cpp_reinterpret_cast=no)])
3618 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3619    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3622 dnl See if a dynamic_cast to void* gives the most derived object.
3623 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3624                ac_cv_cpp_dynamic_cast_void_ptr,
3625                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3626                             class Y { int j; public: virtual ~Y() { } };
3627                             class Z : public X, public Y { int k; };
3629                             int main() {
3630                                  Z mdo;
3631                                  X *subx = (X*)&mdo;
3632                                  Y *suby = (Y*)&mdo;
3633                                  return !((((void*)&mdo != (void*)subx) &&
3634                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3635                                           (((void*)&mdo != (void*)suby) &&
3636                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3637                             }],
3638                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3639                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3640                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3641 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3642    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3646 dnl note that this one is reversed - if the test fails, then
3647 dnl we require implementations of unused virtual methods. Which
3648 dnl really blows because it means we'll have useless vtable
3649 dnl bloat.
3650 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3651                ac_cv_cpp_unused_required,
3652                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3653                                X x;,
3654                                ac_cv_cpp_unused_required=no,
3655                                ac_cv_cpp_unused_required=yes)])
3656 if test "$ac_cv_cpp_unused_required" = yes ; then
3657    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3661 dnl Some compilers have trouble comparing a constant reference to a templatized
3662 dnl class to zero, and require an explicit operator==() to be defined that takes
3663 dnl an int. This test separates the strong from the weak.
3665 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3666                ac_cv_trouble_comparing_to_zero,
3667                [AC_TRY_COMPILE([#include <algorithm>
3668                                 template <class T> class Foo {};
3669                                 class T2;
3670                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3671                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3672                                [Foo<int> f; return (0 != f);],
3673                                ac_cv_trouble_comparing_to_zero=no,
3674                                ac_cv_trouble_comparing_to_zero=yes)])
3675 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3676   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3681 dnl End of C++ language/feature checks
3682 AC_LANG_C
3684 dnl ========================================================
3685 dnl =  Internationalization checks
3686 dnl ========================================================
3688 dnl Internationalization and Locale support is different
3689 dnl on various UNIX platforms.  Checks for specific i18n
3690 dnl features go here.
3692 dnl check for LC_MESSAGES
3693 AC_CACHE_CHECK(for LC_MESSAGES,
3694                 ac_cv_i18n_lc_messages,
3695                 [AC_TRY_COMPILE([#include <locale.h>],
3696                                 [int category = LC_MESSAGES;],
3697                                 ac_cv_i18n_lc_messages=yes,
3698                                 ac_cv_i18n_lc_messages=no)])
3699 if test "$ac_cv_i18n_lc_messages" = yes; then
3700    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3701 fi      
3703 fi # SKIP_COMPILER_CHECKS
3705 TARGET_XPCOM_ABI=
3706 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3707     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3710 dnl Mozilla specific options
3711 dnl ========================================================
3712 dnl The macros used for command line options
3713 dnl are defined in build/autoconf/altoptions.m4.
3716 dnl ========================================================
3717 dnl =
3718 dnl = Check for external package dependencies
3719 dnl =
3720 dnl ========================================================
3721 MOZ_ARG_HEADER(External Packages)
3723 dnl ========================================================
3724 dnl = Find the right NSPR to use.
3725 dnl ========================================================
3726 MOZ_ARG_WITH_BOOL(system-nspr,
3727 [  --with-system-nspr      Use an NSPR that is already built and installed.
3728                           Use the 'nspr-config' script in the current path,
3729                           or look for the script in the directories given with
3730                           --with-nspr-exec-prefix or --with-nspr-prefix.],
3731     _USE_SYSTEM_NSPR=1 )
3733 MOZ_ARG_WITH_STRING(nspr-cflags,
3734 [  --with-nspr-cflags=FLAGS Pass FLAGS to CC when building code that uses NSPR.
3735                           Use this when there's no accurate nspr-config
3736                           script available.  This is the case when building
3737                           SpiderMonkey as part of the Mozilla tree: the
3738                           top-level configure script computes NSPR flags
3739                           that accomodate the quirks of that environment.],
3740     NSPR_CFLAGS=$withval)
3741 MOZ_ARG_WITH_STRING(nspr-libs,
3742 [  --with-nspr-libs=LIBS   Pass LIBS to LD when linking code that uses NSPR.
3743                           See --with-nspr-cflags for more details.],
3744     NSPR_LIBS=$withval)
3745 AC_SUBST(NSPR_CFLAGS)
3746 AC_SUBST(NSPR_LIBS)
3748 dnl Pass either --with-system-nspr or (--with-nspr-cflags and
3749 dnl --with-nspr-libs), but not both.
3750 if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" || test "$NSPR_LIBS"); then
3751     AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive.
3752 See 'configure --help'.])
3755 if test -n "$_USE_SYSTEM_NSPR"; then
3756     MOZ_NATIVE_NSPR=
3757     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1])
3758     if test -z "$MOZ_NATIVE_NSPR"; then
3759         AC_MSG_ERROR([--with-system-nspr given, but configure could not find a suitable NSPR.
3760 Pass --with-nspr-exec-prefix, --with-nspr-prefix, or --with-nspr-cflags/libs.
3761 See 'configure --help'.])
3762     fi
3765 if test -n "$MOZ_NATIVE_NSPR"; then
3766     _SAVE_CFLAGS=$CFLAGS
3767     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3768     AC_TRY_COMPILE([#include "prlog.h"],
3769                 [#ifndef PR_STATIC_ASSERT
3770                  #error PR_STATIC_ASSERT not defined
3771                  #endif],
3772                 [MOZ_NATIVE_NSPR=1],
3773                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
3774     CFLAGS=$_SAVE_CFLAGS
3777 dnl ========================================================
3778 dnl Use ARM userspace kernel helpers; tell NSPR to enable
3779 dnl their usage and use them in spidermonkey.
3780 dnl ========================================================
3781 MOZ_ARG_WITH_BOOL(arm-kuser,
3782 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
3783     USE_ARM_KUSER=1,
3784     USE_ARM_KUSER=)
3785 if test -n "$USE_ARM_KUSER"; then
3786    AC_DEFINE(USE_ARM_KUSER)
3789 dnl ========================================================
3790 dnl =
3791 dnl = Application
3792 dnl =
3793 dnl ========================================================
3795 MOZ_ARG_HEADER(Application)
3797 BUILD_STATIC_LIBS=
3798 ENABLE_TESTS=1
3799 MOZ_DBGRINFO_MODULES=
3800 JS_STATIC_BUILD=
3802 dnl ========================================================
3803 dnl =
3804 dnl = Components & Features
3805 dnl = 
3806 dnl ========================================================
3807 MOZ_ARG_HEADER(Components and Features)
3809 dnl ========================================================
3810 dnl = Localization
3811 dnl ========================================================
3812 MOZ_ARG_ENABLE_STRING(ui-locale,
3813 [  --enable-ui-locale=ab-CD
3814                           Select the user interface locale (default: en-US)],
3815     MOZ_UI_LOCALE=$enableval )
3816 AC_SUBST(MOZ_UI_LOCALE)
3818 dnl ========================================================
3819 dnl build the tests by default
3820 dnl ========================================================
3821 MOZ_ARG_DISABLE_BOOL(tests,
3822 [  --disable-tests         Do not build test libraries & programs],
3823     ENABLE_TESTS=,
3824     ENABLE_TESTS=1 )
3826 dnl ========================================================
3827 dnl =
3828 dnl = Module specific options
3829 dnl =
3830 dnl ========================================================
3831 MOZ_ARG_HEADER(Individual module options)
3833 dnl ========================================================
3834 dnl = Enable Ultrasparc specific optimizations for JS
3835 dnl ========================================================
3836 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
3837 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
3838     JS_ULTRASPARC_OPTS=1,
3839     JS_ULTRASPARC_OPTS= )
3841 dnl only enable option for ultrasparcs
3842 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
3843     "$OS_TEST" != "sun4u"; then
3844     JS_ULTRASPARC_OPTS=
3846 AC_SUBST(JS_ULTRASPARC_OPTS)
3848 dnl ========================================================
3849 dnl =
3850 dnl = Debugging Options
3851 dnl = 
3852 dnl ========================================================
3853 MOZ_ARG_HEADER(Debugging and Optimizations)
3855 dnl ========================================================
3856 dnl = Disable building with debug info.
3857 dnl = Debugging is OFF by default
3858 dnl ========================================================
3859 if test -z "$MOZ_DEBUG_FLAGS"
3860 then
3861     case "$target" in
3862     *-irix*)
3863         if test "$GNU_CC"; then
3864             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
3865             case "$GCC_VERSION" in
3866             2.95.*)
3867                 MOZ_DEBUG_FLAGS=""
3868                 ;;
3869             *)
3870                 MOZ_DEBUG_FLAGS="-g"
3871                 ;;
3872             esac
3873         else
3874             MOZ_DEBUG_FLAGS="-g"
3875         fi
3876         ;;
3877     *)
3878         MOZ_DEBUG_FLAGS="-g"
3879         ;;
3880     esac
3883 MOZ_ARG_ENABLE_STRING(debug,
3884 [  --enable-debug[=DBG]    Enable building with developer debug info
3885                           (Using compiler flags DBG)],
3886 [ if test "$enableval" != "no"; then
3887     MOZ_DEBUG=1
3888     if test -n "$enableval" && test "$enableval" != "yes"; then
3889         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
3890     fi
3891   else
3892     MOZ_DEBUG=
3893   fi ],
3894   MOZ_DEBUG=)
3896 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
3897  case "${target_os}" in
3898     beos*)
3899         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
3900         ;;
3901     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
3902         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
3903         ;;
3904     *) 
3905         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
3906         ;;
3907   esac
3908 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
3910 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
3912 if test -n "$MOZ_DEBUG"; then
3913     AC_MSG_CHECKING([for valid debug flags])
3914     _SAVE_CFLAGS=$CFLAGS
3915     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
3916     AC_TRY_COMPILE([#include <stdio.h>], 
3917         [printf("Hello World\n");],
3918         _results=yes,
3919         _results=no)
3920     AC_MSG_RESULT([$_results])
3921     if test "$_results" = "no"; then
3922         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
3923     fi
3924     CFLAGS=$_SAVE_CFLAGS
3927 dnl ========================================================
3928 dnl = Enable code optimization. ON by default.
3929 dnl ========================================================
3930 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
3931         MOZ_OPTIMIZE_FLAGS="-O"
3934 MOZ_ARG_ENABLE_STRING(optimize,
3935 [  --disable-optimize      Disable compiler optimization
3936   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
3937 [ if test "$enableval" != "no"; then
3938     MOZ_OPTIMIZE=1
3939     if test -n "$enableval" && test "$enableval" != "yes"; then
3940         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
3941         MOZ_OPTIMIZE=2
3942     fi
3943 else
3944     MOZ_OPTIMIZE=
3945 fi ], MOZ_OPTIMIZE=1)
3947 if test "$COMPILE_ENVIRONMENT"; then
3948 if test -n "$MOZ_OPTIMIZE"; then
3949     AC_MSG_CHECKING([for valid optimization flags])
3950     _SAVE_CFLAGS=$CFLAGS
3951     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3952     AC_TRY_COMPILE([#include <stdio.h>], 
3953         [printf("Hello World\n");],
3954         _results=yes,
3955         _results=no)
3956     AC_MSG_RESULT([$_results])
3957     if test "$_results" = "no"; then
3958         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
3959     fi
3960     CFLAGS=$_SAVE_CFLAGS
3962 fi # COMPILE_ENVIRONMENT
3964 AC_SUBST(MOZ_OPTIMIZE)
3965 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
3966 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
3967 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
3969 dnl ========================================================
3970 dnl = Enable/disable debug for specific modules only
3971 dnl =   module names beginning with ^ will be disabled 
3972 dnl ========================================================
3973 MOZ_ARG_ENABLE_STRING(debug-modules,
3974 [  --enable-debug-modules  Enable/disable debug info for specific modules],
3975 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
3977 dnl ========================================================
3978 dnl = Enable/disable generation of debugger info for specific modules only
3979 dnl =    the special module name ALL_MODULES can be used to denote all modules
3980 dnl =    module names beginning with ^ will be disabled
3981 dnl ========================================================
3982 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
3983 [  --enable-debugger-info-modules
3984                           Enable/disable debugger info for specific modules],
3985 [ for i in `echo $enableval | sed 's/,/ /g'`; do
3986       dnl note that the list of module names is reversed as it is copied
3987       dnl this is important, as it will allow config.mk to interpret stuff like
3988       dnl "^ALL_MODULES xpcom" properly
3989       if test "$i" = "no"; then
3990         i="^ALL_MODULES"
3991       fi
3992       if test "$i" = "yes"; then
3993         i="ALL_MODULES"
3994       fi
3995       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
3996     done ])
3998 dnl ========================================================
3999 dnl Enable garbage collector
4000 dnl ========================================================
4001 MOZ_ARG_ENABLE_BOOL(boehm,
4002 [  --enable-boehm          Enable the Boehm Garbage Collector],
4003     GC_LEAK_DETECTOR=1,
4004     GC_LEAK_DETECTOR= )
4005 if test -n "$GC_LEAK_DETECTOR"; then
4006     AC_DEFINE(GC_LEAK_DETECTOR)
4009 dnl ========================================================
4010 dnl = Enable trace malloc
4011 dnl ========================================================
4012 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
4013 MOZ_ARG_ENABLE_BOOL(trace-malloc,
4014 [  --enable-trace-malloc   Enable malloc tracing],
4015     NS_TRACE_MALLOC=1,
4016     NS_TRACE_MALLOC= )
4017 if test "$NS_TRACE_MALLOC"; then
4018   # Please, Mr. Linker Man, don't take away our symbol names
4019   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4020   AC_DEFINE(NS_TRACE_MALLOC)
4022 AC_SUBST(NS_TRACE_MALLOC)
4024 dnl ========================================================
4025 dnl = Enable jemalloc
4026 dnl ========================================================
4027 MOZ_ARG_ENABLE_BOOL(jemalloc,
4028 [  --enable-jemalloc       Replace memory allocator with jemalloc],
4029     MOZ_MEMORY=1,
4030     MOZ_MEMORY=)
4032 if test "$NS_TRACE_MALLOC"; then
4033     MOZ_MEMORY=
4036 if test "$MOZ_MEMORY"; then
4038   dnl Don't try to run compiler tests on Windows  
4039   if test "$OS_ARCH" = "WINNT"; then
4040     if test -z "$HAVE_64BIT_OS"; then
4041       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4042     else
4043       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4044     fi
4045   else
4046     AC_CHECK_SIZEOF([int *], [4])
4047     case "${ac_cv_sizeof_int_p}" in
4048     4)
4049       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4050       ;;
4051     8)
4052       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4053       ;;
4054     *)
4055       AC_MSG_ERROR([Unexpected pointer size])
4056       ;;
4057     esac
4058   fi
4060   AC_DEFINE(MOZ_MEMORY)
4061   if test "x$MOZ_DEBUG" = "x1"; then
4062     AC_DEFINE(MOZ_MEMORY_DEBUG)
4063   fi
4064   dnl The generic feature tests that determine how to compute ncpus are long and
4065   dnl complicated.  Therefore, simply define special cpp variables for the
4066   dnl platforms we have special knowledge of.
4067   case "${target_os}" in
4068   darwin*)
4069     AC_DEFINE(MOZ_MEMORY_DARWIN)
4070     ;;
4071   *freebsd*)
4072     AC_DEFINE(MOZ_MEMORY_BSD)
4073     ;;
4074   *linux*)
4075     AC_DEFINE(MOZ_MEMORY_LINUX)
4076     ;;
4077   netbsd*)
4078     AC_DEFINE(MOZ_MEMORY_BSD)
4079     ;;
4080   solaris*)
4081     AC_DEFINE(MOZ_MEMORY_SOLARIS)
4082     ;;
4083   msvc*|mks*|cygwin*|mingw*)
4084     AC_DEFINE(MOZ_MEMORY_WINDOWS)
4085     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
4086     dnl will fail miserably
4087     if test "$_CC_SUITE" -lt "8"; then
4088         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
4089     fi
4090     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
4091       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
4092         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.])
4093       else
4094         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
4095       fi
4096     fi
4097     if test -z "$WIN32_CRT_SRC_DIR"; then
4098       # pre-built dll
4099       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
4100       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
4101     else
4102       # CRT source directory
4103       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
4104       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
4105       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
4106     fi
4107     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
4108     dnl are to avoid m4
4109     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
4110     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
4111     dnl Needs to be in PATH too, since our tools will wind up linked against it.
4112     dnl This needs to be unix style.
4113     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
4114     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
4115     AC_DEFINE(_STATIC_CPPLIB)
4116     dnl Don't generate a manifest, since we're linking to a custom CRT.
4117     LDFLAGS="$LDFLAGS -MANIFEST:NO"
4118     dnl Also pass this to NSPR/NSS
4119     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
4120     export DLLFLAGS
4121     ;;
4122   *)
4123     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
4124     ;;
4125   esac
4127   AC_ARG_WITH([valgrind],
4128     [  --with-valgrind         Enable valgrind integration hooks],
4129     [enable_valgrind="yes"], [enable_valgrind="no"])
4130   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
4131   if test "x$enable_valgrind" = "xyes" ; then
4132     AC_DEFINE(MOZ_VALGRIND)
4133   fi
4135 AC_SUBST(MOZ_MEMORY)
4136 AC_SUBST(WIN32_CRT_SRC_DIR)
4137 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
4138 AC_SUBST(MOZ_LIB)
4139 AC_SUBST(MOZ_PATH)
4140 dnl Need to set this for make because NSS doesn't have configure
4141 AC_SUBST(DLLFLAGS)
4143 dnl ========================================================
4144 dnl = Use malloc wrapper lib
4145 dnl ========================================================
4146 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
4147 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
4148     _WRAP_MALLOC=1,
4149     _WRAP_MALLOC= )
4151 if test -n "$_WRAP_MALLOC"; then
4152     if test "$GNU_CC"; then
4153     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"
4154     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
4155     fi
4158 dnl ========================================================
4159 dnl = Location of malloc wrapper lib
4160 dnl ========================================================
4161 MOZ_ARG_WITH_STRING(wrap-malloc,
4162 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
4163     WRAP_MALLOC_LIB=$withval)
4165 dnl ========================================================
4166 dnl = Use Electric Fence
4167 dnl ========================================================
4168 MOZ_ARG_ENABLE_BOOL(efence,
4169 [  --enable-efence         Link with Electric Fence],
4170     _ENABLE_EFENCE=1,
4171     _ENABLE_EFENCE= )
4172 if test -n "$_ENABLE_EFENCE"; then
4173     AC_CHECK_LIB(efence,malloc)
4176 dnl ========================================================
4177 dnl jprof
4178 dnl ========================================================
4179 MOZ_ARG_ENABLE_BOOL(jprof,
4180 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
4181     MOZ_JPROF=1,
4182     MOZ_JPROF= )
4183 if test -n "$MOZ_JPROF"; then
4184     AC_DEFINE(MOZ_JPROF)
4187 dnl ========================================================
4188 dnl shark
4189 dnl ========================================================
4190 MOZ_ARG_ENABLE_BOOL(shark,
4191 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
4192     MOZ_SHARK=1,
4193     MOZ_SHARK= )
4194 if test -n "$MOZ_SHARK"; then
4195     AC_DEFINE(MOZ_SHARK)
4198 dnl ========================================================
4199 dnl callgrind
4200 dnl ========================================================
4201 MOZ_ARG_ENABLE_BOOL(callgrind,
4202 [  --enable-callgrind      Enable callgrind profiling],
4203     MOZ_CALLGRIND=1,
4204     MOZ_CALLGRIND= )
4205 if test -n "$MOZ_CALLGRIND"; then
4206     AC_DEFINE(MOZ_CALLGRIND)
4209 dnl ========================================================
4210 dnl vtune
4211 dnl ========================================================
4212 MOZ_ARG_ENABLE_BOOL(vtune,
4213 [  --enable-vtune          Enable vtune profiling],
4214     MOZ_VTUNE=1,
4215     MOZ_VTUNE= )
4216 if test -n "$MOZ_VTUNE"; then
4217     AC_DEFINE(MOZ_VTUNE)
4220 dnl ========================================================
4221 dnl = Enable static checking using gcc-dehydra
4222 dnl ========================================================
4224 MOZ_ARG_WITH_STRING(static-checking,
4225 [  --with-static-checking=path/to/gcc_dehydra.so
4226                             Enable static checking of code using GCC-dehydra],
4227     DEHYDRA_PATH=$withval,
4228     DEHYDRA_PATH= )
4230 if test -n "$DEHYDRA_PATH"; then
4231     if ! test -f "$DEHYDRA_PATH"; then
4232         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
4233     fi
4234     AC_DEFINE(NS_STATIC_CHECKING)
4236 AC_SUBST(DEHYDRA_PATH)
4238 dnl ========================================================
4239 dnl = Enable stripping of libs & executables
4240 dnl ========================================================
4241 MOZ_ARG_ENABLE_BOOL(strip,
4242 [  --enable-strip          Enable stripping of libs & executables ],
4243     ENABLE_STRIP=1,
4244     ENABLE_STRIP= )
4246 dnl ========================================================
4247 dnl = Enable stripping of libs & executables when packaging
4248 dnl ========================================================
4249 MOZ_ARG_ENABLE_BOOL(install-strip,
4250 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
4251     PKG_SKIP_STRIP= ,
4252     PKG_SKIP_STRIP=1)
4254 dnl ========================================================
4255 dnl = --enable-old-abi-compat-wrappers
4256 dnl ========================================================
4257 dnl on x86 linux, the current builds of some popular plugins (notably
4258 dnl flashplayer and real) expect a few builtin symbols from libgcc
4259 dnl which were available in some older versions of gcc.  However,
4260 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
4261 dnl we want those plugin to work with a gcc-3.1 built binary, we need
4262 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
4263 dnl to true on x86 linux, and false everywhere else.
4266 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
4267 [  --enable-old-abi-compat-wrappers
4268                           Support old GCC ABI symbols to ease the pain 
4269                           of the linux compiler change],
4270     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
4271     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
4272 if test "$COMPILE_ENVIRONMENT"; then
4273 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
4274     AC_LANG_SAVE
4275     AC_LANG_CPLUSPLUS
4276     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
4277     AC_LANG_RESTORE
4278     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
4280 fi # COMPILE_ENVIRONMENT
4282 dnl ========================================================
4283 dnl = 
4284 dnl = Profiling and Instrumenting
4285 dnl = 
4286 dnl ========================================================
4287 MOZ_ARG_HEADER(Profiling and Instrumenting)
4289 dnl ========================================================
4290 dnl = Enable timeline service, which provides lightweight
4291 dnl = instrumentation of mozilla for performance measurement.
4292 dnl = Timeline is off by default.
4293 dnl ========================================================
4294 MOZ_ARG_ENABLE_BOOL(timeline,
4295 [  --enable-timeline       Enable timeline services ],
4296     MOZ_TIMELINE=1,
4297     MOZ_TIMELINE= )
4298 if test -n "$MOZ_TIMELINE"; then
4299     AC_DEFINE(MOZ_TIMELINE)
4302 dnl ========================================================
4303 dnl = Add support for Eazel profiler
4304 dnl ========================================================
4305 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
4306 [  --enable-eazel-profiler-support
4307                           Enable Corel/Eazel profiler support],
4308     ENABLE_EAZEL_PROFILER=1,
4309     ENABLE_EAZEL_PROFILER= )
4310 if test -n "$ENABLE_EAZEL_PROFILER"; then
4311     AC_DEFINE(ENABLE_EAZEL_PROFILER)
4312     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4313     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
4314     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
4317 MOZ_ARG_ENABLE_STRING(profile-modules,
4318 [  --enable-profile-modules
4319                           Enable/disable profiling for specific modules],
4320 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
4322 MOZ_ARG_ENABLE_BOOL(insure,
4323 [  --enable-insure         Enable insure++ instrumentation (linux only)],
4324     _ENABLE_INSURE=1,
4325     _ENABLE_INSURE= )
4326 if test -n "$_ENABLE_INSURE"; then
4327     MOZ_INSURE="insure"
4328     MOZ_INSURIFYING=1
4329     MOZ_INSURE_DIRS="."
4330     MOZ_INSURE_EXCLUDE_DIRS="config"
4333 MOZ_ARG_WITH_STRING(insure-dirs,
4334 [  --with-insure-dirs=DIRS
4335                           Dirs to instrument with insure ],
4336     MOZ_INSURE_DIRS=$withval )
4338 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
4339 [  --with-insure-exclude-dirs=DIRS
4340                           Dirs to not instrument with insure ],
4341     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
4343 dnl ========================================================
4344 dnl = Support for Quantify (Windows)
4345 dnl ========================================================
4346 MOZ_ARG_ENABLE_BOOL(quantify,
4347 [  --enable-quantify      Enable Quantify support (Windows only) ],
4348     MOZ_QUANTIFY=1,
4349     MOZ_QUANTIFY= )
4351 dnl ========================================================
4352 dnl = Support for demangling undefined symbols
4353 dnl ========================================================
4354 if test -z "$SKIP_LIBRARY_CHECKS"; then
4355     AC_LANG_SAVE
4356     AC_LANG_CPLUSPLUS
4357     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4358     AC_LANG_RESTORE
4361 # Demangle only for debug or trace-malloc builds
4362 MOZ_DEMANGLE_SYMBOLS=
4363 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
4364     MOZ_DEMANGLE_SYMBOLS=1
4365     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4367 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4369 dnl ========================================================
4370 dnl = Support for gcc stack unwinding (from gcc 3.3)
4371 dnl ========================================================
4372 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
4373     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
4376 dnl ========================================================
4377 dnl =
4378 dnl = Misc. Options
4379 dnl = 
4380 dnl ========================================================
4381 MOZ_ARG_HEADER(Misc. Options)
4383 dnl ========================================================
4384 dnl update xterm title
4385 dnl ========================================================
4386 MOZ_ARG_ENABLE_BOOL(xterm-updates,
4387 [  --enable-xterm-updates  Update XTERM titles with current command.],
4388     MOZ_UPDATE_XTERM=1,
4389     MOZ_UPDATE_XTERM= )
4391 if test -z "$SKIP_COMPILER_CHECKS"; then
4392 dnl ========================================================
4393 dnl =
4394 dnl = Compiler Options
4395 dnl = 
4396 dnl ========================================================
4397 MOZ_ARG_HEADER(Compiler Options)
4399 dnl ========================================================
4400 dnl Check for gcc -pipe support
4401 dnl ========================================================
4402 AC_MSG_CHECKING([for gcc -pipe support])
4403 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
4404     echo '#include <stdio.h>' > dummy-hello.c
4405     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
4406     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
4407     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
4408     if test $? = 0; then
4409         _res_as_stdin="yes"
4410     else
4411         _res_as_stdin="no"
4412     fi
4413     if test "$_res_as_stdin" = "yes"; then
4414         _SAVE_CFLAGS=$CFLAGS
4415         CFLAGS="$CFLAGS -pipe"
4416         AC_TRY_COMPILE( [ #include <stdio.h> ],
4417             [printf("Hello World\n");],
4418             [_res_gcc_pipe="yes"],
4419             [_res_gcc_pipe="no"] )
4420         CFLAGS=$_SAVE_CFLAGS
4421     fi
4422     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
4423         _res="yes";
4424         CFLAGS="$CFLAGS -pipe"
4425         CXXFLAGS="$CXXFLAGS -pipe"
4426     else
4427         _res="no"
4428     fi
4429     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
4430     AC_MSG_RESULT([$_res])
4431 else
4432     AC_MSG_RESULT([no])
4435 dnl pass -Wno-long-long to the compiler
4436 MOZ_ARG_ENABLE_BOOL(long-long-warning,
4437 [  --enable-long-long-warning 
4438                           Warn about use of non-ANSI long long type],
4439     _IGNORE_LONG_LONG_WARNINGS=,
4440     _IGNORE_LONG_LONG_WARNINGS=1)
4442 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
4443      _SAVE_CFLAGS="$CFLAGS"
4444      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
4445      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
4446      AC_TRY_COMPILE([], [return(0);], 
4447         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
4448           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
4449           result="yes" ], result="no")
4450      AC_MSG_RESULT([$result])
4451      CFLAGS="$_SAVE_CFLAGS"
4454 dnl ========================================================
4455 dnl Profile guided optimization
4456 dnl ========================================================
4457 dnl Test for profiling options
4458 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
4459 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
4461 dnl Provide a switch to disable PGO even when called via profiledbuild.
4462 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
4463 [  --disable-profile-guided-optimization
4464                            Don't build with PGO even if called via make profiledbuild],
4465 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
4466 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
4468 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
4470 _SAVE_CFLAGS="$CFLAGS"
4471 CFLAGS="$CFLAGS -fprofile-generate"
4473 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
4474 AC_TRY_COMPILE([], [return 0;],
4475                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
4476                  result="yes" ], result="no")
4477 AC_MSG_RESULT([$result])
4479 if test $result = "yes"; then
4480   PROFILE_GEN_LDFLAGS="-fprofile-generate"
4481   PROFILE_USE_CFLAGS="-fprofile-use"
4482   PROFILE_USE_LDFLAGS="-fprofile-use"
4483 else
4484   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
4485   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
4486   AC_TRY_COMPILE([], [return 0;],
4487                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
4488                    result="yes" ], result="no")
4489   AC_MSG_RESULT([$result])
4490   if test $result = "yes"; then
4491     PROFILE_USE_CFLAGS="-fbranch-probabilities"
4492   fi
4493   # don't really care, this is an old GCC
4494   PROFILE_GEN_LDFLAGS=
4495   PROFILE_USE_LDFLAGS=
4498 CFLAGS="$_SAVE_CFLAGS"
4500 if test -n "$INTEL_CC"; then
4501   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
4502   PROFILE_GEN_LDFLAGS=
4503   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
4504   PROFILE_USE_LDFLAGS=
4507 dnl Sun Studio on Solaris
4508 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
4509   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
4510   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
4511   if test "$CPU_ARCH" != "sparc"; then
4512     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
4513     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
4514   else
4515     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
4516     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
4517   fi
4520 AC_SUBST(PROFILE_GEN_CFLAGS)
4521 AC_SUBST(PROFILE_GEN_LDFLAGS)
4522 AC_SUBST(PROFILE_USE_CFLAGS)
4523 AC_SUBST(PROFILE_USE_LDFLAGS)
4525 AC_LANG_CPLUSPLUS
4527 dnl ========================================================
4528 dnl Test for -pedantic bustage
4529 dnl ========================================================
4530 MOZ_ARG_DISABLE_BOOL(pedantic,
4531 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
4532 _PEDANTIC= )
4533 if test "$_PEDANTIC"; then
4534     _SAVE_CXXFLAGS=$CXXFLAGS
4535     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
4536     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
4537     AC_TRY_COMPILE([$configure_static_assert_macros],
4538                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
4539                    result="no", result="yes" )
4540     AC_MSG_RESULT([$result])
4541     CXXFLAGS="$_SAVE_CXXFLAGS"
4543     case "$result" in
4544     no)
4545         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
4546         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
4547         ;;
4548     yes)
4549         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
4550         ;;
4551     esac
4554 dnl ========================================================
4555 dnl Test for correct temporary object destruction order
4556 dnl ========================================================
4557 dnl We want to make sure the compiler follows the C++ spec here as 
4558 dnl xpcom and the string classes depend on it (bug 235381).
4559 AC_MSG_CHECKING([for correct temporary object destruction order])
4560 AC_TRY_RUN([ class A {
4561              public:  A(int& x) : mValue(x) {}
4562                       ~A() { mValue--; }
4563                       operator char**() { return 0; }
4564              private:  int& mValue;
4565              };
4566              void func(char **arg) {}
4567              int m=2;
4568              void test() {
4569                   func(A(m));
4570                   if (m==1) m = 0;
4571              }
4572              int main() {
4573                  test();
4574                  return(m);
4575              }
4576              ],
4577      result="yes", result="no", result="maybe")
4578 AC_MSG_RESULT([$result])
4580 if test "$result" = "no"; then
4581     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
4584 dnl ========================================================
4585 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
4586 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
4587 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
4588 dnl ========================================================
4589 _SAVE_CXXFLAGS=$CXXFLAGS
4590 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
4591 AC_CACHE_CHECK(for correct overload resolution with const and templates,
4592     ac_nscap_nonconst_opeq_bug,
4593     [AC_TRY_COMPILE([
4594                       template <class T>
4595                       class Pointer
4596                         {
4597                         public:
4598                           T* myPtr;
4599                         };
4600                       
4601                       template <class T, class U>
4602                       int operator==(const Pointer<T>& rhs, U* lhs)
4603                         {
4604                           return rhs.myPtr == lhs;
4605                         }
4606                       
4607                       template <class T, class U>
4608                       int operator==(const Pointer<T>& rhs, const U* lhs)
4609                         {
4610                           return rhs.myPtr == lhs;
4611                         }
4612                     ],
4613                     [
4614                       Pointer<int> foo;
4615                       const int* bar;
4616                       return foo == bar;
4617                     ],
4618                     ac_nscap_nonconst_opeq_bug="no",
4619                     ac_nscap_nonconst_opeq_bug="yes")])
4620 CXXFLAGS="$_SAVE_CXXFLAGS"
4622 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
4623     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
4625 fi # SKIP_COMPILER_CHECKS
4627 dnl ========================================================
4628 dnl C++ rtti
4629 dnl Should be smarter and check that the compiler does indeed have rtti
4630 dnl ========================================================
4631 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
4632 [  --enable-cpp-rtti       Enable C++ RTTI ],
4633 [ _MOZ_USE_RTTI=1 ],
4634 [ _MOZ_USE_RTTI= ])
4636 if test "$_MOZ_USE_RTTI"; then
4637    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
4638 else
4639    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
4642 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
4644 dnl ========================================================
4645 dnl C++ exceptions (g++/egcs only - for now)
4646 dnl Should be smarter and check that the compiler does indeed have exceptions
4647 dnl ========================================================
4648 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
4649 [  --enable-cpp-exceptions Enable C++ exceptions ],
4650 [ _MOZ_CPP_EXCEPTIONS=1 ],
4651 [ _MOZ_CPP_EXCEPTIONS= ])
4653 if test "$_MOZ_CPP_EXCEPTIONS"; then
4654     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
4655 else
4656     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
4659 # Irix & OSF native compilers do not like exception declarations 
4660 # when exceptions are disabled
4661 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
4662     AC_DEFINE(CPP_THROW_NEW, [])
4663 else
4664     AC_DEFINE(CPP_THROW_NEW, [throw()])
4666 AC_LANG_C
4668 dnl ========================================================
4669 dnl =
4670 dnl = Build depencency options
4671 dnl =
4672 dnl ========================================================
4673 MOZ_ARG_HEADER(Build dependencies)
4675 dnl ========================================================
4676 dnl = Do not auto generate dependency info
4677 dnl ========================================================
4678 MOZ_AUTO_DEPS=1
4679 MOZ_ARG_DISABLE_BOOL(auto-deps,
4680 [  --disable-auto-deps     Do not automatically generate dependency info],
4681     MOZ_AUTO_DEPS=,
4682     MOZ_AUTO_DEPS=1)
4684 if test -n "$MOZ_AUTO_DEPS"; then
4685 dnl ========================================================
4686 dnl = Use mkdepend instead of $CC -MD for dependency generation
4687 dnl ========================================================
4688 _cpp_md_flag=
4689 MOZ_ARG_DISABLE_BOOL(md,
4690 [  --disable-md            Do not use compiler-based dependencies ],
4691   [_cpp_md_flag=],
4692   [_cpp_md_flag=1],
4693   [dnl Default is to turn on -MD if using GNU-compatible compilers
4694    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
4695      _cpp_md_flag=1
4696    fi
4697   dnl Default is to use -xM if using Sun Studio on Solaris
4698    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
4699      _cpp_md_flag=1
4700    fi])
4701 if test "$_cpp_md_flag"; then
4702   COMPILER_DEPEND=1
4703   if test "$OS_ARCH" = "OpenVMS"; then
4704     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
4705   else
4706     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
4707   fi
4708   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
4709   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
4710     _DEPEND_CFLAGS=
4711   fi
4712 else
4713   COMPILER_DEPEND=
4714   _USE_CPP_INCLUDE_FLAG=
4715   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4716   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4718 fi # MOZ_AUTO_DEPS
4719 MDDEPDIR='.deps'
4720 AC_SUBST(MOZ_AUTO_DEPS)
4721 AC_SUBST(COMPILER_DEPEND)
4722 AC_SUBST(MDDEPDIR)
4725 dnl ========================================================
4726 dnl =
4727 dnl = Static Build Options
4728 dnl =
4729 dnl ========================================================
4730 MOZ_ARG_HEADER(Static build options)
4732 MOZ_ARG_ENABLE_BOOL(static,
4733 [  --enable-static         Enable building of internal static libs],
4734     BUILD_STATIC_LIBS=1,
4735     BUILD_STATIC_LIBS=)
4737 dnl ========================================================
4738 dnl = Force JS to be a static lib
4739 dnl ========================================================
4740 MOZ_ARG_ENABLE_BOOL(js-static-build,
4741 [  --enable-js-static-build  Force js to be a static lib],
4742     JS_STATIC_BUILD=1,
4743     JS_STATIC_BUILD= )
4745 AC_SUBST(JS_STATIC_BUILD)
4746         
4747 if test -n "$JS_STATIC_BUILD"; then
4748     AC_DEFINE(EXPORT_JS_API)
4750 if test -z "$BUILD_STATIC_LIBS"; then
4751     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
4756 dnl ========================================================
4757 dnl =
4758 dnl = Standalone module options
4759 dnl = 
4760 dnl ========================================================
4761 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
4763 dnl ========================================================
4764 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
4765     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4768 MOZ_ARG_WITH_STRING(sync-build-files,
4769 [  --with-sync-build-files=DIR
4770                           Check that files in 'config' and 'build' match
4771                           their originals in 'DIR/config' and 'DIR/build'.
4772                           This helps keep the SpiderMonkey build machinery
4773                           in sync with Mozilla's, on which it is based.],
4774 [MOZ_SYNC_BUILD_FILES=$withval ] )
4775 AC_SUBST(MOZ_SYNC_BUILD_FILES)
4777 dnl ========================================================
4778 dnl =
4779 dnl = Maintainer debug option (no --enable equivalent)
4780 dnl =
4781 dnl ========================================================
4783 AC_SUBST(AR)
4784 AC_SUBST(AR_FLAGS)
4785 AC_SUBST(AR_LIST)
4786 AC_SUBST(AR_EXTRACT)
4787 AC_SUBST(AR_DELETE)
4788 AC_SUBST(AS)
4789 AC_SUBST(ASFLAGS)
4790 AC_SUBST(AS_DASH_C_FLAG)
4791 AC_SUBST(LD)
4792 AC_SUBST(RC)
4793 AC_SUBST(RCFLAGS)
4794 AC_SUBST(WINDRES)
4795 AC_SUBST(USE_SHORT_LIBNAME)
4796 AC_SUBST(IMPLIB)
4797 AC_SUBST(FILTER)
4798 AC_SUBST(BIN_FLAGS)
4799 AC_SUBST(NS_USE_NATIVE)
4800 AC_SUBST(MOZ_JS_LIBS)
4801 AC_SUBST(MOZ_PSM)
4802 AC_SUBST(MOZ_DEBUG)
4803 AC_SUBST(MOZ_DEBUG_MODULES)
4804 AC_SUBST(MOZ_PROFILE_MODULES)
4805 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
4806 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
4807 AC_SUBST(MOZ_DEBUG_FLAGS)
4808 AC_SUBST(MOZ_DEBUG_LDFLAGS)
4809 AC_SUBST(WARNINGS_AS_ERRORS)
4810 AC_SUBST(MOZ_DBGRINFO_MODULES)
4811 AC_SUBST(ENABLE_EAZEL_PROFILER)
4812 AC_SUBST(EAZEL_PROFILER_CFLAGS)
4813 AC_SUBST(EAZEL_PROFILER_LIBS)
4814 AC_SUBST(MOZ_PERF_METRICS)
4815 AC_SUBST(GC_LEAK_DETECTOR)
4816 AC_SUBST(MOZ_LEAKY)
4817 AC_SUBST(MOZ_JPROF)
4818 AC_SUBST(MOZ_SHARK)
4819 AC_SUBST(MOZ_CALLGRIND)
4820 AC_SUBST(MOZ_VTUNE)
4821 AC_SUBST(MOZ_XPCTOOLS)
4822 AC_SUBST(MOZ_JSLOADER)
4823 AC_SUBST(MOZ_INSURE)
4824 AC_SUBST(MOZ_INSURE_DIRS)
4825 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
4826 AC_SUBST(MOZ_QUANTIFY)
4827 AC_SUBST(MOZ_INSURIFYING)
4828 AC_SUBST(LIBICONV)
4830 AC_SUBST(BUILD_STATIC_LIBS)
4831 AC_SUBST(ENABLE_TESTS)
4833 AC_SUBST(ENABLE_STRIP)
4834 AC_SUBST(PKG_SKIP_STRIP)
4835 AC_SUBST(INCREMENTAL_LINKER)
4836 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
4837 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
4839 AC_SUBST(MOZ_FIX_LINK_PATHS)
4841 AC_SUBST(USE_DEPENDENT_LIBS)
4843 AC_SUBST(MOZ_BUILD_ROOT)
4844 AC_SUBST(MOZ_OS2_TOOLS)
4845 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
4847 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
4848 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4849 AC_SUBST(MOZ_TIMELINE)
4850 AC_SUBST(WINCE)
4851 AC_SUBST(TARGET_DEVICE)
4853 AC_SUBST(MOZ_APP_NAME)
4854 AC_SUBST(MOZ_APP_DISPLAYNAME)
4855 AC_SUBST(MOZ_APP_VERSION)
4857 AC_SUBST(MOZ_PKG_SPECIAL)
4859 AC_SUBST(MOZILLA_OFFICIAL)
4860 AC_SUBST(BUILD_OFFICIAL)
4861 AC_SUBST(MOZ_MILESTONE_RELEASE)
4863 dnl win32 options
4864 AC_SUBST(MOZ_PROFILE)
4865 AC_SUBST(MOZ_DEBUG_SYMBOLS)
4866 AC_SUBST(MOZ_MAPINFO)
4867 AC_SUBST(MOZ_BROWSE_INFO)
4868 AC_SUBST(MOZ_TOOLS_DIR)
4869 AC_SUBST(CYGWIN_WRAPPER)
4870 AC_SUBST(AS_PERL)
4871 AC_SUBST(WIN32_REDIST_DIR)
4872 AC_SUBST(PYTHON)
4874 dnl Echo the CFLAGS to remove extra whitespace.
4875 CFLAGS=`echo \
4876         $_WARNINGS_CFLAGS \
4877         $CFLAGS`
4879 CXXFLAGS=`echo \
4880         $_MOZ_RTTI_FLAGS \
4881         $_MOZ_EXCEPTIONS_FLAGS \
4882         $_WARNINGS_CXXFLAGS \
4883         $CXXFLAGS`
4885 COMPILE_CFLAGS=`echo \
4886     $_DEFINES_CFLAGS \
4887         $_DEPEND_CFLAGS \
4888     $COMPILE_CFLAGS`
4890 COMPILE_CXXFLAGS=`echo \
4891     $_DEFINES_CXXFLAGS \
4892         $_DEPEND_CFLAGS \
4893     $COMPILE_CXXFLAGS`
4895 AC_SUBST(SYSTEM_MAKEDEPEND)
4897 AC_SUBST(NSPR_CFLAGS)
4898 AC_SUBST(NSPR_LIBS)
4899 AC_SUBST(MOZ_NATIVE_NSPR)
4901 AC_SUBST(CFLAGS)
4902 AC_SUBST(CXXFLAGS)
4903 AC_SUBST(CPPFLAGS)
4904 AC_SUBST(COMPILE_CFLAGS)
4905 AC_SUBST(COMPILE_CXXFLAGS)
4906 AC_SUBST(LDFLAGS)
4907 AC_SUBST(LIBS)
4908 AC_SUBST(CROSS_COMPILE)
4909 AC_SUBST(WCHAR_CFLAGS)
4911 AC_SUBST(HOST_CC)
4912 AC_SUBST(HOST_CXX)
4913 AC_SUBST(HOST_CFLAGS)
4914 AC_SUBST(HOST_CXXFLAGS)
4915 AC_SUBST(HOST_OPTIMIZE_FLAGS)
4916 AC_SUBST(HOST_AR)
4917 AC_SUBST(HOST_AR_FLAGS)
4918 AC_SUBST(HOST_LD)
4919 AC_SUBST(HOST_RANLIB)
4920 AC_SUBST(HOST_NSPR_MDCPUCFG)
4921 AC_SUBST(HOST_BIN_SUFFIX)
4922 AC_SUBST(HOST_OS_ARCH)
4924 AC_SUBST(TARGET_CPU)
4925 AC_SUBST(TARGET_VENDOR)
4926 AC_SUBST(TARGET_OS)
4927 AC_SUBST(TARGET_NSPR_MDCPUCFG)
4928 AC_SUBST(TARGET_MD_ARCH)
4929 AC_SUBST(TARGET_XPCOM_ABI)
4930 AC_SUBST(OS_TARGET)
4931 AC_SUBST(OS_ARCH)
4932 AC_SUBST(OS_RELEASE)
4933 AC_SUBST(OS_TEST)
4935 AC_SUBST(WRAP_MALLOC_CFLAGS)
4936 AC_SUBST(WRAP_MALLOC_LIB)
4937 AC_SUBST(MKSHLIB)
4938 AC_SUBST(MKCSHLIB)
4939 AC_SUBST(MKSHLIB_FORCE_ALL)
4940 AC_SUBST(MKSHLIB_UNFORCE_ALL)
4941 AC_SUBST(DSO_CFLAGS)
4942 AC_SUBST(DSO_PIC_CFLAGS)
4943 AC_SUBST(DSO_LDOPTS)
4944 AC_SUBST(LIB_PREFIX)
4945 AC_SUBST(DLL_PREFIX)
4946 AC_SUBST(DLL_SUFFIX)
4947 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
4948 AC_SUBST(LIB_SUFFIX)
4949 AC_SUBST(OBJ_SUFFIX)
4950 AC_SUBST(BIN_SUFFIX)
4951 AC_SUBST(ASM_SUFFIX)
4952 AC_SUBST(IMPORT_LIB_SUFFIX)
4953 AC_SUBST(USE_N32)
4954 AC_SUBST(CC_VERSION)
4955 AC_SUBST(CXX_VERSION)
4956 AC_SUBST(MSMANIFEST_TOOL)
4958 if test "$USING_HCC"; then
4959    CC='${topsrcdir}/build/hcc'
4960    CC="$CC '$_OLDCC'"
4961    CXX='${topsrcdir}/build/hcpp'
4962    CXX="$CXX '$_OLDCXX'"
4963    AC_SUBST(CC)
4964    AC_SUBST(CXX)
4967 dnl Check for missing components
4968 if test "$COMPILE_ENVIRONMENT"; then
4969 if test "$MOZ_X11"; then
4970     dnl ====================================================
4971     dnl = Check if X headers exist
4972     dnl ====================================================
4973     _SAVE_CFLAGS=$CFLAGS
4974     CFLAGS="$CFLAGS $XCFLAGS"
4975     AC_TRY_COMPILE([
4976         #include <stdio.h>
4977         #include <stdlib.h>
4978         #include <X11/Xlib.h>
4979         #include <X11/Intrinsic.h>
4980     ],
4981     [
4982         Display *dpy = 0;
4983         if ((dpy = XOpenDisplay(NULL)) == NULL) {
4984             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4985             exit(1);
4986         }
4987     ], [], 
4988     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
4989     CFLAGS="$_SAVE_CFLAGS"
4991     if test ! -z "$MISSING_X"; then
4992         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4993     fi
4995 fi # MOZ_X11
4996 fi # COMPILE_ENVIRONMENT
4998 dnl Set various defines and substitutions
4999 dnl ========================================================
5001 if test "$OS_ARCH" = "BeOS"; then
5002   AC_DEFINE(XP_BEOS)
5003   MOZ_MOVEMAIL=1
5004 elif test "$OS_ARCH" = "Darwin"; then
5005   AC_DEFINE(XP_UNIX)
5006   AC_DEFINE(UNIX_ASYNC_DNS)
5007   MOZ_MOVEMAIL=1
5008 elif test "$OS_ARCH" = "OpenVMS"; then
5009   AC_DEFINE(XP_UNIX)
5010 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
5011   AC_DEFINE(XP_UNIX)
5012   AC_DEFINE(UNIX_ASYNC_DNS)
5013   MOZ_MOVEMAIL=1
5015 AC_SUBST(MOZ_MOVEMAIL)
5017 AC_ARG_ENABLE(threadsafe,
5018               [  --enable-threadsafe     Enable support for multiple threads.],
5019               [AC_DEFINE(JS_THREADSAFE)],)
5021 if test "$MOZ_DEBUG"; then
5022     AC_DEFINE(MOZ_REFLOW_PERF)
5023     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
5026 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
5027     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
5028     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
5029     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
5030     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
5031     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
5032     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
5033     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
5034     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
5037 # Used for LD_LIBRARY_PATH of run_viewer target
5038 LIBS_PATH=
5039 for lib_arg in $NSPR_LIBS $TK_LIBS; do
5040   case $lib_arg in
5041     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
5042       * ) ;;
5043   esac
5044 done
5045 AC_SUBST(LIBS_PATH)
5047 dnl ========================================================
5048 dnl JavaScript shell
5049 dnl ========================================================
5051 AC_HAVE_FUNCS(setlocale)
5053 dnl ========================================================
5054 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
5055 dnl ========================================================
5056 case "$host_os" in
5057 mingw*)
5058     WIN_TOP_SRC=`cd $srcdir; pwd -W`
5059     ;;
5060 cygwin*|msvc*|mks*)
5061     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
5062     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
5063     CC="\$(CYGWIN_WRAPPER) $CC"
5064     CXX="\$(CYGWIN_WRAPPER) $CXX"
5065     CPP="\$(CYGWIN_WRAPPER) $CPP"
5066     LD="\$(CYGWIN_WRAPPER) $LD"
5067     AS="\$(CYGWIN_WRAPPER) $AS"
5068     RC="\$(CYGWIN_WRAPPER) $RC"
5069     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
5070     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
5071     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
5072     ;;
5073 esac
5075 AC_SUBST(CYGDRIVE_MOUNT)
5076 AC_SUBST(WIN_TOP_SRC)
5078 AC_SUBST(MOZILLA_VERSION)
5080 AC_SUBST(ac_configure_args)
5082 dnl Spit out some output
5083 dnl ========================================================
5085 # Save the defines header file before autoconf removes it.
5086 # (Do not add AC_DEFINE calls after this line.)
5087   _CONFIG_TMP=confdefs-tmp.h
5088   _CONFIG_DEFS_H=mozilla-config.h
5090   cat > $_CONFIG_TMP <<\EOF
5091 /* List of defines generated by configure. Included with preprocessor flag,
5092  * -include, to avoid long list of -D defines on the compile command-line.
5093  * Do not edit.
5094  */
5096 #ifndef _MOZILLA_CONFIG_H_
5097 #define _MOZILLA_CONFIG_H_
5100 _EGREP_PATTERN='^#define ('
5101 if test -n "$_NON_GLOBAL_ACDEFINES"; then
5102     for f in $_NON_GLOBAL_ACDEFINES; do
5103         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
5104     done
5106 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
5108   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
5110   cat >> $_CONFIG_TMP <<\EOF
5112 #endif /* _MOZILLA_CONFIG_H_ */
5116   # Only write mozilla-config.h when something changes (or it doesn't exist)
5117   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
5118     rm $_CONFIG_TMP
5119   else
5120     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
5121     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
5123     echo ==== $_CONFIG_DEFS_H =================================
5124     cat $_CONFIG_DEFS_H
5125   fi
5127 dnl Probably shouldn't call this manually but we always want the output of DEFS
5128 rm -f confdefs.h.save
5129 mv confdefs.h confdefs.h.save
5130 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
5131 AC_OUTPUT_MAKE_DEFS()
5132 MOZ_DEFINES=$DEFS
5133 AC_SUBST(MOZ_DEFINES)
5134 rm -f confdefs.h
5135 mv confdefs.h.save confdefs.h
5137 MAKEFILES="
5138   Makefile
5139   config/Makefile
5140   config/autoconf.mk
5141   config/mkdepend/Makefile
5144 dnl 
5145 dnl Run a perl script to quickly create the makefiles.
5146 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
5147 dnl   for the files it cannot handle correctly. This way, config.status
5148 dnl   will handle these files.
5149 dnl If it fails, nothing is set and config.status will run as usual.
5151 dnl This does not change the $MAKEFILES variable.
5153 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
5155 if test -z "${AS_PERL}"; then
5156 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
5157 else
5158 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
5160 . ./conftest.sh
5161 rm conftest.sh
5163 echo $MAKEFILES > unallmakefiles
5165 AC_OUTPUT($MAKEFILES)
5167 # Produce the js-config script at configure time; see the comments for
5168 # 'js-config' in Makefile.in.
5169 AC_MSG_RESULT(invoking make to create js-config script)
5170 $MAKE js-config