Changed --enable-jit to --enable-tracejit (bug 545245, r=sayrer).
[mozilla-central.git] / js / src / configure.in
blob5fcb33944e7abde0bb205b4a9af83430f4c4a28f
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 WINDRES_VERSION=2.14.90
112 W32API_VERSION=3.8
114 MSMANIFEST_TOOL=
116 dnl Set various checks
117 dnl ========================================================
118 MISSING_X=
119 AC_PROG_AWK
121 dnl Initialize the Pthread test variables early so they can be
122 dnl  overridden by each platform.
123 dnl ========================================================
124 USE_PTHREADS=
125 _PTHREAD_LDFLAGS=""
127 dnl Do not allow a separate objdir build if a srcdir build exists.
128 dnl ==============================================================
129 _topsrcdir=`cd \`dirname $0\`; pwd`
130 _objdir=`pwd`
132 if test "$_topsrcdir" != "$_objdir"
133 then
134   # Check for a couple representative files in the source tree
135   _conflict_files=
136   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
137     if test -f $file; then
138       _conflict_files="$_conflict_files $file"
139     fi
140   done
141   if test "$_conflict_files"; then
142     echo "***"
143     echo "*   Your source tree contains these files:"
144     for file in $_conflict_files; do
145       echo "*         $file"
146     done
147     cat 1>&2 <<-EOF
148         *   This indicates that you previously built in the source tree.
149         *   A source tree build can confuse the separate objdir build.
150         *
151         *   To clean up the source tree:
152         *     1. cd $_topsrcdir
153         *     2. gmake distclean
154         ***
155         EOF
156     exit 1
157     break
158   fi
160 MOZ_BUILD_ROOT=`pwd`
162 dnl Choose where to put the 'dist' directory.
163 dnl ==============================================================
165 MOZ_ARG_WITH_STRING(dist-dir,
166 [  --with-dist-dir=DIR     Use DIR as 'dist' staging area.  DIR may be
167                           relative to the top of SpiderMonkey build tree,
168                           or absolute.],
169     TOP_DIST=$withval,
170     TOP_DIST=dist)
171 AC_SUBST(TOP_DIST)
173 dnl Default to MSVC for win32 and gcc-4.2 for darwin
174 dnl ==============================================================
175 if test -z "$CROSS_COMPILE"; then
176 case "$target" in
177 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
178     if test -z "$CC"; then CC=cl; fi
179     if test -z "$CXX"; then CXX=cl; fi
180     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
181     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
182     if test -z "$LD"; then LD=link; fi
183     if test -z "$AS"; then
184         case "${target_cpu}" in
185         i*86)
186             AS=ml;
187             ;;
188         x86_64)
189             AS=ml64;
190             ;;
191         esac
192     fi
193     if test -z "$MIDL"; then MIDL=midl; fi
194     ;;
195 *-darwin*)
196     if test -z "$CC"; then CC=gcc-4.2; fi
197     if test -z "$CXX"; then CXX=g++-4.2; fi
198     ;;
199 esac
202 COMPILE_ENVIRONMENT=1
203 MOZ_ARG_ENABLE_BOOL(compile-environment,
204 [  --disable-compile-environment
205                            Disable compiler/library checks.],
206     COMPILE_ENVIRONMENT=1,
207     COMPILE_ENVIRONMENT= )
209 dnl ========================================================
210 dnl Checks for compilers.
211 dnl ========================================================
213 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
214 AR_FLAGS='cr $@'
216 if test "$COMPILE_ENVIRONMENT"; then
218 if test "$target" != "$host"; then
219     echo "cross compiling from $host to $target"
221     _SAVE_CC="$CC"
222     _SAVE_CFLAGS="$CFLAGS"
223     _SAVE_LDFLAGS="$LDFLAGS"
225     AC_MSG_CHECKING([for host c compiler])
226     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
227     if test -z "$HOST_CC"; then
228         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
229     fi
230     AC_MSG_RESULT([$HOST_CC])
231     AC_MSG_CHECKING([for host c++ compiler])
232     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
233     if test -z "$HOST_CXX"; then
234         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
235     fi
236     AC_MSG_RESULT([$HOST_CXX])
238     if test -z "$HOST_CFLAGS"; then
239         HOST_CFLAGS="$CFLAGS"
240     fi
241     if test -z "$HOST_CXXFLAGS"; then
242         HOST_CXXFLAGS="$CXXFLAGS"
243     fi
244     if test -z "$HOST_LDFLAGS"; then
245         HOST_LDFLAGS="$LDFLAGS"
246     fi
247     if test -z "$HOST_AR_FLAGS"; then
248         HOST_AR_FLAGS="$AR_FLAGS"
249     fi
250     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
251     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
252     CC="$HOST_CC"
253     CFLAGS="$HOST_CFLAGS"
254     LDFLAGS="$HOST_LDFLAGS"
256     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
257     AC_TRY_COMPILE([], [return(0);], 
258         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
259         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
261     CC="$HOST_CXX"
262     CFLAGS="$HOST_CXXFLAGS"
264     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
265     AC_TRY_COMPILE([], [return(0);], 
266         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
267         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
268     
269     CC=$_SAVE_CC
270     CFLAGS=$_SAVE_CFLAGS
271     LDFLAGS=$_SAVE_LDFLAGS
273     case "$build:$target" in
274       powerpc-apple-darwin8*:i?86-apple-darwin*)
275         dnl The Darwin cross compiler doesn't necessarily point itself at a
276         dnl root that has libraries for the proper architecture, it defaults
277         dnl to the system root.  The libraries in the system root on current
278         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
279         dnl checks will fail.  Fake a working SDK in that case.
280         _SAVE_CFLAGS=$CFLAGS
281         _SAVE_CXXFLAGS=$CXXLAGS
282         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
283         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
284         ;;
285     esac
287     case "$target" in
288     *symbian*)
289         AC_ARG_WITH(symbian-sdk,
290         [  --with-symbian-sdk=SYMBIAN_SDK_DIR
291                               The path to the Symbian SDK],
292         SYMBIAN_SDK_DIR=$withval)
294         OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
295         CFLAGS="-MD -nostdinc"
296         SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
298         case "$target" in
299         *-symbianelf)
300             OS_TARGET=GCCE
301             CC=arm-none-symbianelf-gcc.exe
302             CXX=arm-none-symbianelf-g++.exe
303             LD=arm-none-symbianelf-ld.exe
304             AR=arm-none-symbianelf-ar.exe
305             CPP=arm-none-symbianelf-cpp.exe
306             CFLAGS="$CFLAGS -c -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -msoft-float"
307             CXXFLAGS="$CFLAGS -Wno-ctor-dtor-privacy"
308             GCCE_INCLUDE="-include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
309             CFLAGS="$CFLAGS ${GCCE_INCLUDE} -x c"
310             CXXFLAGS="$CXXFLAGS ${GCCE_INCLUDE} -x c++"
311             CPPFLAGS="$CPPFLAGS ${SYMBIAN_SYS_INCLUDE}"
312             ;;
313         *-symbianwinscw)
314             dnl TODO: add emulator build code
315             OS_TARGET=WINSCW
316             ;;
317         esac
318         ;;
319     esac
321     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
322     unset ac_cv_prog_CC
323     AC_PROG_CC
324     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
325     unset ac_cv_prog_CXX
326     AC_PROG_CXX
328     case "$build:$target" in
329       powerpc-apple-darwin8*:i?86-apple-darwin*)
330         dnl Revert the changes made above.  From this point on, the target
331         dnl compiler will never be used without applying the SDK to CFLAGS
332         dnl (see --with-macos-sdk below).
333         CFLAGS=$_SAVE_CFLAGS
334         CXXFLAGS=$_SAVE_CXXFLAGS
335         ;;
336     esac
338     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
339     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
340     MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
341     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
342     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
343     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
344     AC_DEFINE(CROSS_COMPILE)
346     dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
347     dnl have erroneously been set to "no", because the x86 build host is
348     dnl able to run ppc code in a translated environment, making a cross
349     dnl compiler appear native.  So we override that here.
350     cross_compiling=yes
351 else
352     AC_PROG_CC
353     AC_PROG_CXX
354     AC_PROG_RANLIB
355     MOZ_PATH_PROGS(AS, $AS as, $CC)
356     AC_CHECK_PROGS(AR, ar, :)
357     AC_CHECK_PROGS(LD, ld, :)
358     AC_CHECK_PROGS(STRIP, strip, :)
359     AC_CHECK_PROGS(WINDRES, windres, :)
360     if test -z "$HOST_CC"; then
361         HOST_CC="$CC"
362     fi
363     if test -z "$HOST_CFLAGS"; then
364         HOST_CFLAGS="$CFLAGS"
365     fi
366     if test -z "$HOST_CXX"; then
367         HOST_CXX="$CXX"
368     fi
369     if test -z "$HOST_CXXFLAGS"; then
370         HOST_CXXFLAGS="$CXXFLAGS"
371     fi
372     if test -z "$HOST_LDFLAGS"; then
373         HOST_LDFLAGS="$LDFLAGS"
374     fi
375     if test -z "$HOST_RANLIB"; then
376         HOST_RANLIB="$RANLIB"
377     fi
378     if test -z "$HOST_AR"; then
379         HOST_AR="$AR"
380     fi
381     if test -z "$HOST_AR_FLAGS"; then
382         HOST_AR_FLAGS="$AR_FLAGS"
383     fi
386 GNU_AS=
387 GNU_LD=
388 GNU_CC=
389 GNU_CXX=
390 CC_VERSION='N/A'
391 CXX_VERSION='N/A'
392 if test "$GCC" = "yes"; then
393     GNU_CC=1
394     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
396 if test "$GXX" = "yes"; then
397     GNU_CXX=1
398     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
400 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
401     GNU_AS=1
403 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
404     GNU_LD=1
406 if test "$GNU_CC"; then
407     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
408         GCC_USE_GNU_LD=1
409     fi
412 INTEL_CC=
413 INTEL_CXX=
414 if test "$GCC" = yes; then
415    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
416      INTEL_CC=1
417    fi
420 if test "$GXX" = yes; then
421    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
422      INTEL_CXX=1
423    fi
426 dnl Special win32 checks
427 dnl ========================================================
428 case "$target" in
429 *-wince|*-winmo)
430     WINVER=500
431     ;;
433     if test -n "$GNU_CC"; then  
434         WINVER=501
435     else    
436         WINVER=500
437     fi
438     ;;
439 esac
441 case "$target" in
442 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
443     if test "$GCC" != "yes"; then
444         # Check to see if we are really running in a msvc environemnt
445         _WIN32_MSVC=1
447         # Make sure compilers are valid
448         CFLAGS="$CFLAGS -TC -nologo"
449         CXXFLAGS="$CXXFLAGS -TP -nologo"
450         AC_LANG_SAVE
451         AC_LANG_C
452         AC_TRY_COMPILE([#include <stdio.h>],
453             [ printf("Hello World\n"); ],,
454             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
456         AC_LANG_CPLUSPLUS
457         AC_TRY_COMPILE([#include <new.h>],
458             [ unsigned *test = new unsigned(42); ],,
459             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
460         AC_LANG_RESTORE
461         
462         changequote(,)
463         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
464         changequote([,])
465         
466         # Determine compiler version
467         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
468         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
469         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
470         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
471         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
472         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
474         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
475         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
477         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
478             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
479         fi
480         if test "$_CC_MAJOR_VERSION" = "13"; then
481             _CC_SUITE=7
482         elif test "$_CC_MAJOR_VERSION" = "14"; then
483             _CC_SUITE=8
484             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
485             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
486             dnl so be very specific here!
487             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
488             if test $_CC_RELEASE -gt 50727; then
489                _USE_DYNAMICBASE=1
490             elif test $_CC_BUILD -ge 762; then
491                _USE_DYNAMICBASE=1
492             fi
493             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
494             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
495         elif test "$_CC_MAJOR_VERSION" = "15"; then
496             _CC_SUITE=9
497             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
498             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
499             _USE_DYNAMICBASE=1
500             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
501             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
502         elif test "$_CC_MAJOR_VERSION" = "16"; then
503             _CC_SUITE=10
504             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
505             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
506             _USE_DYNAMICBASE=1
507             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
508             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
509         else
510             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
511         fi
513         _MOZ_RTTI_FLAGS_ON='-GR'
514         _MOZ_RTTI_FLAGS_OFF='-GR-'
515         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
516         _MOZ_EXCEPTIONS_FLAGS_OFF=''
518         if test -n "$WIN32_REDIST_DIR"; then
519             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
520         fi
521         
522         # bug #249782
523         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
524         if test "$_CC_SUITE" -ge "8"; then
525                 changequote(,)
526                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
527                 changequote([,])
529                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
530                 if test -n "$MSMT_TOOL"; then
531                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
532                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
533                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
534                         fi
535                         MSMANIFEST_TOOL=1
536                         unset MSMT_TOOL
537                 else
538                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
539                 fi
540         fi
542         # Check linker version
543         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
544         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
545         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
546             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
547         fi
548         INCREMENTAL_LINKER=1
550         unset _MSVC_VER_FILTER
552     else
553         # Check w32api version
554         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
555         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
556         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
557         AC_TRY_COMPILE([#include <w32api.h>],
558             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
559                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
560                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
561                 #error "test failed."
562             #endif
563             , [ res=yes ], [ res=no ])
564         AC_MSG_RESULT([$res])
565         if test "$res" != "yes"; then
566             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
567         fi
568         # Check windres version
569         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
570         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
571         AC_MSG_RESULT([$_WINDRES_VERSION])
572         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
573         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
574         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
575         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
576         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
577         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
578         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
579                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
580                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
581                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
582                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
583                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
584         then
585             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
586         fi
587     fi # !GNU_CC
589     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
590     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
591     # Require OS features provided by IE 5.0
592     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
593     ;;
594 esac
596 dnl Test breaks icc on OS/2 && MSVC
597 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
598     AC_PROG_CC_C_O
599     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
600         USING_HCC=1
601         _OLDCC=$CC
602         _OLDCXX=$CXX
603         CC="${srcdir}/build/hcc '$CC'"
604         CXX="${srcdir}/build/hcpp '$CXX'"
605     fi
608 AC_PROG_CPP
609 AC_PROG_CXXCPP
611 if test -n "$_WIN32_MSVC"; then
612     SKIP_PATH_CHECKS=1
613     SKIP_COMPILER_CHECKS=1
614     SKIP_LIBRARY_CHECKS=1
616     # Since we're skipping compiler and library checks, hard-code
617     # some facts here.
619     # Common to all MSVC environments:
620     # Windows lacks <stdint.h>, but has __int8, and so on.
621     AC_DEFINE(JS_HAVE___INTN)
623     case "$target" in
624     *-wince|*-winmo)
625         AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
626         AC_DEFINE(JS_CRTDEFS_H_HAS_INTPTR_T)
627         ;;
628     *)
629         AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
630         AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
631         # Windows <stddef.h> defines intptr_t and uintptr_t.
632         # VS2005: http://msdn.microsoft.com/en-us/library/323b6b3k(VS.80).aspx
633         # VS2008: http://msdn.microsoft.com/en-us/library/323b6b3k.aspx
634         AC_DEFINE(JS_STDDEF_H_HAS_INTPTR_T)
635         ;;
636     esac
639 fi # COMPILE_ENVIRONMENT
641 if test "$cross_compiling"  = "yes"; then
642     CROSS_COMPILE=1
643 else
644     CROSS_COMPILE=
647 AC_SUBST(_MSC_VER)
649 AC_SUBST(GNU_AS)
650 AC_SUBST(GNU_LD)
651 AC_SUBST(GNU_CC)
652 AC_SUBST(GNU_CXX)
653 AC_SUBST(INTEL_CC)
654 AC_SUBST(INTEL_CXX)
656 dnl ========================================================
657 dnl Checks for programs.
658 dnl ========================================================
659 AC_PROG_INSTALL
660 AC_PROG_LN_S
661 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
662 if test -z "$PERL" || test "$PERL" = ":"; then
663     AC_MSG_ERROR([perl not found in \$PATH])
666 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
667 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
668 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
669 _perl_res=$?
670 AC_MSG_RESULT([$_perl_version])
672 if test "$_perl_res" != 0; then
673     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
677 AC_MSG_CHECKING([for full perl installation])
678 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
679 _perl_res=$?
680 if test "$_perl_res" != 0; then
681     AC_MSG_RESULT([no])
682     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
683 else
684     AC_MSG_RESULT([yes])    
687 MOZ_PATH_PROGS(PYTHON, $PYTHON python)
688 if test -z "$PYTHON"; then
689     AC_MSG_ERROR([python was not found in \$PATH])
692 if test -z "$COMPILE_ENVIRONMENT"; then
693     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
695 AC_SUBST(NSINSTALL_BIN)
697 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
698 MOZ_PATH_PROG(WHOAMI, whoami, :)
699 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
700 MOZ_PATH_PROG(UNZIP, unzip, :)
701 MOZ_PATH_PROGS(ZIP, zip)
702 if test -z "$ZIP" || test "$ZIP" = ":"; then
703     AC_MSG_ERROR([zip not found in \$PATH])
705 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
706 MOZ_PATH_PROG(XARGS, xargs)
707 if test -z "$XARGS" || test "$XARGS" = ":"; then
708     AC_MSG_ERROR([xargs not found in \$PATH .])
711 if test "$COMPILE_ENVIRONMENT"; then
713 dnl ========================================================
714 dnl = Mac OS X toolchain support
715 dnl ========================================================
717 case "$target_os" in
718 darwin*)
719     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
720     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
721     dnl the environment and includedir purposes (when using an SDK, below),
722     dnl but remember the full version number for the libdir (SDK).
723     changequote(,)
724     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
725     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
726     changequote([,])
727     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
728         dnl Bug 280479, but this keeps popping up in bug 292530 too because
729         dnl 4.0.0/4061 is the default compiler in Tiger.
730         changequote(,)
731         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
732         changequote([,])
733         if test "$GCC_BUILD" = "4061" ; then
734             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
735 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
736 from building Mozilla. Upgrade to Xcode 2.1 or later.])
737         fi
738     fi
740     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
741     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
742     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
743     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
745     case "$PBBUILD" in
746       *xcodebuild*)
747         changequote(,)
748         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
749         changequote([,])
750         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
751           HAS_XCODE_2_1=1;
752         fi
753       ;;
754     esac
756     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
757     dnl it has moved into /usr/bin.
758     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
759     ;;
760 esac
762 AC_SUBST(GCC_VERSION)
763 AC_SUBST(XCODEBUILD_VERSION)
764 AC_SUBST(HAS_XCODE_2_1)
766 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
767 dnl that a universal binary is being produced.
768 AC_SUBST(UNIVERSAL_BINARY)
770 dnl ========================================================
771 dnl Check for MacOS deployment target version
772 dnl ========================================================
774 MOZ_ARG_ENABLE_STRING(macos-target,
775                       [  --enable-macos-target=VER (default=10.4)
776                           Set the minimum MacOS version needed at runtime],
777                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
779 case "$target" in
780 *-darwin*)
781     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
782         dnl Use the specified value
783         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
784         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
785     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
786         dnl No value specified on the command line or in the environment,
787         dnl use the lesser of the application's minimum or the architecture's
788         dnl minimum.
789         export MACOSX_DEPLOYMENT_TARGET=10.4
790     fi
791     ;;
792 esac
794 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
796 dnl ========================================================
797 dnl = Mac OS X SDK support
798 dnl ========================================================
799 MACOS_SDK_DIR=
800 NEXT_ROOT=
801 MOZ_ARG_WITH_STRING(macos-sdk,
802 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
803     MACOS_SDK_DIR=$withval)
805 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
806 dnl NEXT_ROOT will be set and exported only if it's needed.
807 AC_SUBST(MACOS_SDK_DIR)
808 AC_SUBST(NEXT_ROOT)
810 if test "$MACOS_SDK_DIR"; then
811   dnl Sync this section with the ones in NSPR and NSS.
812   dnl Changes to the cross environment here need to be accounted for in
813   dnl the libIDL checks (below) and xpidl build.
815   if test ! -d "$MACOS_SDK_DIR"; then
816     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
817 specify a valid SDK.  SDKs are installed when the optional cross-development
818 tools are selected during the Xcode/Developer Tools installation.])
819   fi
821   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
822   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
823     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
824   else
825     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
826     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
828     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
829     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
830     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
832     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
833       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
834       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
835       dnl be ignored and cause warnings when -syslibroot is specified.
836       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
837       dnl the -isysroot it receives, so this is only needed with 4.0.0.
838       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
839     fi
840   fi
842   AC_LANG_SAVE
843   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
844   AC_LANG_CPLUSPLUS
845   AC_TRY_COMPILE([#include <new>
846                  int main() { return 0; }],
847    result=yes,
848    result=no)
849   AC_LANG_RESTORE
850   AC_MSG_RESULT($result)
852   if test "$result" = "no" ; then
853     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
854   fi
857 fi # COMPILE_ENVIRONMENT
859 if test -z "$MAKE"; then
860     case "$host_os" in
861     cygwin*|mingw*|mks*|msvc*)
862         MOZ_PATH_PROGS(MAKE, $MAKE make gmake, :)
863         ;;
864     *)
865         MOZ_PATH_PROGS(MAKE, $MAKE gmake make, :)
866         ;;
867     esac
870 if test "$COMPILE_ENVIRONMENT"; then
872 AC_PATH_XTRA
874 XCFLAGS="$X_CFLAGS"
876 fi # COMPILE_ENVIRONMENT
878 dnl ========================================================
879 dnl set the defaults first
880 dnl ========================================================
881 AS_BIN=$AS
882 AR_LIST='$(AR) t'
883 AR_EXTRACT='$(AR) x'
884 AR_DELETE='$(AR) d'
885 AS='$(CC)'
886 AS_DASH_C_FLAG='-c'
887 DLL_PREFIX=lib
888 LIB_PREFIX=lib
889 DLL_SUFFIX=.so
890 OBJ_SUFFIX=o
891 LIB_SUFFIX=a
892 ASM_SUFFIX=s
893 IMPORT_LIB_SUFFIX=
894 TARGET_MD_ARCH=unix
895 DIRENT_INO=d_ino
896 CYGWIN_WRAPPER=
897 WIN_TOP_SRC=
898 MOZ_USER_DIR=".mozilla"
900 MOZ_JS_LIBS='-L$(libdir) -lmozjs'
901 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(PREFIX)/lib'
903 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
905 USE_DEPENDENT_LIBS=1
907 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
909 MOZ_ENABLE_POSTSCRIPT=1 
911 if test -n "$CROSS_COMPILE"; then
912     OS_TARGET="${target_os}"
913     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
914     OS_RELEASE=
915     case "${target_os}" in
916         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
917         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
918         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
919         mingw*)       OS_ARCH=WINNT ;;
920         wince*)       OS_ARCH=WINCE ;;
921         winmo*)       OS_ARCH=WINCE ;;
922         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
923     esac
924 else
925     OS_TARGET=`uname -s`
926     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
927     OS_RELEASE=`uname -r`
930 # Before this used `uname -m` when not cross compiling
931 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
932 OS_TEST="${target_cpu}"
934 _COMPILER_PREFIX=
936 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
938 #######################################################################
939 # Master "Core Components" macros for getting the OS target           #
940 #######################################################################
943 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
944 # cross-compilation.
948 # Define and override various archtecture-specific variables, including
949 # HOST_OS_ARCH
950 # OS_ARCH
951 # OS_TEST
952 # OS_TARGET
953 # OS_RELEASE
954 # OS_MINOR_RELEASE
957 case "$HOST_OS_ARCH" in
958 cygwin*|mingw*|mks*|msvc*)
959     HOST_OS_ARCH=WINNT
960     ;;
961 linux*)
962     HOST_OS_ARCH=Linux
963     ;;
964 solaris*)
965     HOST_OS_ARCH=SunOS
966     SOLARIS_SUNPRO_CC=
967     SOLARIS_SUNPRO_CXX=
968     if test -z "$GNU_CC"; then
969         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
970             SOLARIS_SUNPRO_CC=1
971        fi
972     fi
974     if test -z "$GNU_CXX"; then
975        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
976            SOLARIS_SUNPRO_CXX=1
977        fi
978     fi
979     AC_SUBST(SOLARIS_SUNPRO_CC)
980     AC_SUBST(SOLARIS_SUNPRO_CXX)
981     ;;
982 BSD_386)
983     HOST_OS_ARCH=BSD
984     ;;
985 dgux)
986     HOST_OS_ARCH=DGUX
987     ;;
988 IRIX64)
989     HOST_OS_ARCH=IRIX
990     ;;
991 UNIX_SV)
992     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
993         HOST_OS_ARCH=NCR
994     else
995         HOST_OS_ARCH=UNIXWARE
996     fi
997     ;;
998 ncr)
999     HOST_OS_ARCH=NCR
1000     ;;
1001 UNIX_SYSTEM_V)
1002     HOST_OS_ARCH=NEC
1003     ;;
1004 OSF1)
1005     ;;
1006 *OpenVMS*)
1007     HOST_OS_ARCH=OpenVMS
1008     ;;
1009 OS_2)
1010     HOST_OS_ARCH=OS2
1011     ;;
1012 QNX)
1013     ;;
1014 SCO_SV)
1015     HOST_OS_ARCH=SCOOS
1016     ;;
1017 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1018     HOST_OS_ARCH=SINIX
1019     ;;
1020 UnixWare)
1021     HOST_OS_ARCH=UNIXWARE
1022     ;;
1023 esac
1025 case "$OS_ARCH" in
1026 WINNT)
1027     OS_TEST=`uname -p`
1028     ;;
1029 Windows_NT)
1031 # If uname -s returns "Windows_NT", we assume that we are using
1032 # the uname.exe in MKS toolkit.
1034 # The -r option of MKS uname only returns the major version number.
1035 # So we need to use its -v option to get the minor version number.
1036 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1038     OS_ARCH=WINNT
1039     OS_TARGET=WINNT
1040     OS_MINOR_RELEASE=`uname -v`
1041     if test "$OS_MINOR_RELEASE" = "00"; then
1042         OS_MINOR_RELEASE=0
1043     fi
1044     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1045     ;;
1046 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1048 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1049 # the uname.exe in the Cygwin tools.
1050 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1051 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1052 # the uname.exe in the GNU-Win32 tools.
1053 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1054 # the uname.exe in the MSYS tools.
1056     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1057     OS_ARCH=WINNT
1058     OS_TARGET=WINNT
1059     ;;
1060 AIX)
1061     OS_RELEASE=`uname -v`.`uname -r`
1062     OS_TEST=${target_cpu}
1063     ;;
1064 BSD_386)
1065     OS_ARCH=BSD
1066     ;;
1067 dgux)
1068     OS_ARCH=DGUX
1069     ;;
1070 IRIX64)
1071     OS_ARCH=IRIX
1072     ;;
1073 UNIX_SV)
1074     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1075         OS_ARCH=NCR
1076     else
1077         OS_ARCH=UNIXWARE
1078         OS_RELEASE=`uname -v`
1079     fi
1080     ;;
1081 ncr)
1082     OS_ARCH=NCR
1083     ;;
1084 UNIX_SYSTEM_V)
1085     OS_ARCH=NEC
1086     ;;
1087 OSF1)
1088     case `uname -v` in
1089     148)
1090         OS_RELEASE=V3.2C
1091         ;;
1092     564)
1093         OS_RELEASE=V4.0B
1094         ;;
1095     878)
1096         OS_RELEASE=V4.0D
1097         ;;
1098     esac
1099     ;;
1100 *OpenVMS*)
1101     OS_ARCH=OpenVMS
1102     OS_RELEASE=`uname -v`
1103     OS_TEST=`uname -p`
1104     ;;
1105 OS_2)
1106     OS_ARCH=OS2
1107     OS_TARGET=OS2
1108     OS_RELEASE=`uname -v`
1109     ;;
1110 QNX)
1111     if test "$OS_TARGET" != "NTO"; then
1112         changequote(,)
1113         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1114         changequote([,])
1115     fi
1116     OS_TEST=x86
1117     ;;
1118 SCO_SV)
1119     OS_ARCH=SCOOS
1120     OS_RELEASE=5.0
1121     ;;
1122 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1123     OS_ARCH=SINIX
1124     OS_TEST=`uname -p`
1125     ;;
1126 UnixWare)
1127     OS_ARCH=UNIXWARE
1128     OS_RELEASE=`uname -v`
1129     ;;
1130 WINCE)
1131     WINCE=1
1132     OS_ARCH=WINCE
1133     if test "$WINCE_WINDOWS_MOBILE"; then
1134         OS_TARGET=WINMO
1135     else
1136         OS_TARGET=WINCE
1137     fi
1138     ;;
1139 Darwin)
1140     case "${target_cpu}" in
1141     powerpc*)
1142         OS_TEST=ppc
1143         ;;
1144     i*86*)
1145         OS_TEST=i386 
1146         ;;
1147     x86_64)
1148         OS_TEST=x86_64
1149         ;;
1150     *)
1151         if test -z "$CROSS_COMPILE" ; then
1152             OS_TEST=`uname -p`
1153         fi
1154         ;;
1155     esac
1156     ;;
1157 esac
1159 if test "$OS_ARCH" = "NCR"; then
1160     changequote(,)
1161     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1162     changequote([,])
1165 # Only set CPU_ARCH if we recognize the value of OS_TEST
1167 case "$OS_TEST" in
1168 *86 | i86pc)
1169     CPU_ARCH=x86
1170     ;;
1172 powerpc* | ppc | rs6000)
1173     CPU_ARCH=ppc
1174     ;;
1176 Alpha | alpha | ALPHA)
1177     CPU_ARCH=Alpha
1178     ;;
1180 hppa* | parisc)
1181     CPU_ARCH=hppa
1182     ;;
1184 sun4u | sparc*)
1185     CPU_ARCH=sparc
1186     ;;
1188 x86_64 | ia64)
1189     CPU_ARCH="$OS_TEST"
1190     ;;
1192 arm)
1193     if test "$OS_ARCH" = "WINCE"; then
1194         CPU_ARCH="$OS_TEST"
1195     fi
1196     ;;
1197 esac
1199 if test -z "$OS_TARGET"; then
1200     OS_TARGET=$OS_ARCH
1202 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1204 dnl ========================================================
1205 dnl GNU specific defaults
1206 dnl ========================================================
1207 if test "$GNU_CC"; then
1208     # FIXME: Let us build with strict aliasing. bug 414641.
1209     CFLAGS="$CFLAGS -fno-strict-aliasing"
1210     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1211     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1212     DSO_LDOPTS='-shared'
1213     if test "$GCC_USE_GNU_LD"; then
1214         # Don't allow undefined symbols in libraries
1215         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1216     fi
1217     WARNINGS_AS_ERRORS='-Werror'
1218     DSO_CFLAGS=''
1219     DSO_PIC_CFLAGS='-fPIC'
1220     ASFLAGS="$ASFLAGS -fPIC"
1221     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1222     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1223     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1224     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1226     # Turn on GNU specific features
1227     # -Wall - turn on all warnings
1228     # -pedantic - make compiler warn about non-ANSI stuff, and
1229     #             be a little bit stricter
1230     # Warnings slamm took out for now (these were giving more noise than help):
1231     # -Wbad-function-cast - warns when casting a function to a new return type
1232     # -Wshadow - removed because it generates more noise than help --pete
1233     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1234     if test -z "$INTEL_CC"; then
1235        # Don't use -Wcast-align with ICC
1236        case "$CPU_ARCH" in
1237            # And don't use it on hppa, ia64, sparc, since it's noisy there
1238            hppa | ia64 | sparc)
1239            ;;
1240            *)
1241         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1242            ;;
1243        esac
1244     fi
1246     dnl Turn pedantic on but disable the warnings for long long
1247     _PEDANTIC=1
1249     if test -z "$INTEL_CC"; then
1250       _IGNORE_LONG_LONG_WARNINGS=1
1251       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1252     else
1253       _IGNORE_LONG_LONG_WARNINGS=
1254     fi
1257     _DEFINES_CFLAGS='-include $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
1258     _USE_CPP_INCLUDE_FLAG=1
1259 elif test "$SOLARIS_SUNPRO_CC"; then
1260     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1261     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1263     DSO_LDOPTS='-shared'
1264     if test "$GNU_LD"; then
1265         # Don't allow undefined symbols in libraries
1266         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1267     fi
1269     DSO_CFLAGS=''
1270     if test "$CPU_ARCH" = "sparc"; then
1271         # for Sun Studio on Solaris/SPARC
1272         DSO_PIC_CFLAGS='-xcode=pic32'
1273     else
1274         DSO_PIC_CFLAGS='-KPIC'
1275     fi
1276     _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1277 else
1278     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1279     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1281     DSO_LDOPTS='-shared'
1282     if test "$GNU_LD"; then
1283         # Don't allow undefined symbols in libraries
1284         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1285     fi
1287     DSO_CFLAGS=''
1288     DSO_PIC_CFLAGS='-KPIC'
1289     _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1292 if test "$GNU_CXX"; then
1293     # FIXME: Let us build with strict aliasing. bug 414641.
1294     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1295     # Turn on GNU specific features
1296     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1297     if test -z "$INTEL_CC"; then
1298        # Don't use -Wcast-align with ICC
1299        case "$CPU_ARCH" in
1300            # And don't use it on hppa, ia64, sparc, since it's noisy there
1301            hppa | ia64 | sparc)
1302            ;;
1303            *)
1304         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1305            ;;
1306        esac
1307     fi
1309     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js-confdefs.h'
1310     _USE_CPP_INCLUDE_FLAG=1
1312     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1313                    ac_has_wno_invalid_offsetof,
1314         [
1315             AC_LANG_SAVE
1316             AC_LANG_CPLUSPLUS
1317             _SAVE_CXXFLAGS="$CXXFLAGS"
1318             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1319             AC_TRY_COMPILE([],
1320                            [return(0);],
1321                            ac_has_wno_invalid_offsetof="yes",
1322                            ac_has_wno_invalid_offsetof="no")
1323             CXXFLAGS="$_SAVE_CXXFLAGS"
1324             AC_LANG_RESTORE
1325         ])
1326     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1327         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1328     fi
1330     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1331                    ac_has_wno_variadic_macros,
1332         [
1333             AC_LANG_SAVE
1334             AC_LANG_CPLUSPLUS
1335             _SAVE_CXXFLAGS="$CXXFLAGS"
1336             CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1337             AC_TRY_COMPILE([],
1338                            [return(0);],
1339                            ac_has_wno_variadic_macros="yes",
1340                            ac_has_wno_variadic_macros="no")
1341             CXXFLAGS="$_SAVE_CXXFLAGS"
1342             AC_LANG_RESTORE
1343         ])
1344     if test "$ac_has_wno_variadic_macros" = "yes"; then
1345         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1346     fi
1347 else
1348     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)'
1351 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1352 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1353 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1354 dnl normal behavior.
1355 dnl ========================================================
1356 MKSHLIB_FORCE_ALL=
1357 MKSHLIB_UNFORCE_ALL=
1359 if test "$COMPILE_ENVIRONMENT"; then
1360 if test "$GNU_CC"; then
1361   AC_MSG_CHECKING(whether ld has archive extraction flags)
1362   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1363    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1364     ac_cv_mkshlib_force_and_unforce="no"
1365     exec 3<&0 <<LOOP_INPUT
1366         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1367         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1368         force="-Wl,-all";              unforce="-Wl,-none"
1369 LOOP_INPUT
1370     while read line
1371     do
1372       eval $line
1373       LDFLAGS=$force
1374       LIBS=$unforce
1375       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1376     done
1377     exec 0<&3 3<&-
1378     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1379    ])
1380   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1381     AC_MSG_RESULT(no)
1382   else
1383     AC_MSG_RESULT(yes)
1384     eval $ac_cv_mkshlib_force_and_unforce
1385     MKSHLIB_FORCE_ALL=$force
1386     MKSHLIB_UNFORCE_ALL=$unforce
1387   fi
1388 fi # GNU_CC
1389 fi # COMPILE_ENVIRONMENT
1391 dnl =================================================================
1392 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1393 dnl which is bad when cross compiling.
1394 dnl =================================================================
1395 if test "$COMPILE_ENVIRONMENT"; then
1396 configure_static_assert_macros='
1397 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1398 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1399 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1402 dnl test that the macros actually work:
1403 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1404 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1405  [AC_LANG_SAVE
1406   AC_LANG_C
1407   ac_cv_static_assertion_macros_work="yes"
1408   AC_TRY_COMPILE([$configure_static_assert_macros],
1409                  [CONFIGURE_STATIC_ASSERT(1)],
1410                  ,
1411                  ac_cv_static_assertion_macros_work="no")
1412   AC_TRY_COMPILE([$configure_static_assert_macros],
1413                  [CONFIGURE_STATIC_ASSERT(0)],
1414                  ac_cv_static_assertion_macros_work="no",
1415                  )
1416   AC_LANG_CPLUSPLUS
1417   AC_TRY_COMPILE([$configure_static_assert_macros],
1418                  [CONFIGURE_STATIC_ASSERT(1)],
1419                  ,
1420                  ac_cv_static_assertion_macros_work="no")
1421   AC_TRY_COMPILE([$configure_static_assert_macros],
1422                  [CONFIGURE_STATIC_ASSERT(0)],
1423                  ac_cv_static_assertion_macros_work="no",
1424                  )
1425   AC_LANG_RESTORE
1426  ])
1427 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1428 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1429     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1431 fi # COMPILE_ENVIRONMENT
1433 dnl ========================================================
1434 dnl Checking for 64-bit OS
1435 dnl ========================================================
1436 if test "$COMPILE_ENVIRONMENT"; then
1437 AC_LANG_SAVE
1438 AC_LANG_C
1439 AC_MSG_CHECKING(for 64-bit OS)
1440 AC_TRY_COMPILE([$configure_static_assert_macros],
1441                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1442                result="yes", result="no")
1443 AC_MSG_RESULT("$result")
1444 if test "$result" = "yes"; then
1445     AC_DEFINE(HAVE_64BIT_OS)
1446     HAVE_64BIT_OS=1
1448 AC_SUBST(HAVE_64BIT_OS)
1449 AC_LANG_RESTORE
1450 fi # COMPILE_ENVIRONMENT
1452 dnl ========================================================
1453 dnl Enable high-memory support on OS/2 by default.
1454 dnl ========================================================
1455 MOZ_OS2_HIGH_MEMORY=1
1456 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1457 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1458     MOZ_OS2_HIGH_MEMORY=,
1459     MOZ_OS2_HIGH_MEMORY=1 )
1460 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1462 dnl ========================================================
1463 dnl System overrides of the defaults for host
1464 dnl ========================================================
1465 case "$host" in
1466 *-beos*)
1467     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1468     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1469     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1470     ;;
1472 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1473     if test -n "$_WIN32_MSVC"; then
1474         HOST_AR=lib
1475         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1476         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1477         HOST_RANLIB='echo ranlib'
1478     else
1479         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1480     fi
1481     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1482     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1483     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1484     HOST_BIN_SUFFIX=.exe
1485     case "$host" in
1486     *mingw*)
1487     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1488         ;;
1489     *)
1490         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1491         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1492             _pwd=`pwd`
1493             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1494         fi
1495         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1496             AS_PERL=1
1497             PERL="${CYGWIN_WRAPPER} $PERL"
1498         fi
1500         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1501             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1502         fi
1503         ;;
1504     esac
1505     ;;
1507 *-darwin*)
1508     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1509     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1510     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1511     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1512     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1513     ;;
1515 *-linux*|*-kfreebsd*-gnu)
1516     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1517     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1518     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1519     ;;
1521 *os2*)
1522     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1523     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1524     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1525     HOST_BIN_SUFFIX=.exe
1526     MOZ_FIX_LINK_PATHS=
1527     ;;
1529 *-osf*)
1530     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1531     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1532     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1533     ;;
1536     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1537     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1538     ;;
1539 esac
1541 dnl ========================================================
1542 dnl System overrides of the defaults for target
1543 dnl ========================================================
1545 case "$target" in
1546 *-aix*)
1547     AC_DEFINE(AIX)
1548     if test ! "$GNU_CC"; then
1549         if test ! "$HAVE_64BIT_OS"; then
1550             # Compiling with Visual Age C++ object model compat is the
1551             # default. To compile with object model ibm, add 
1552             # AIX_OBJMODEL=ibm to .mozconfig.
1553             if test "$AIX_OBJMODEL" = "ibm"; then
1554                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1555             else
1556                 AIX_OBJMODEL=compat
1557             fi
1558         else
1559             AIX_OBJMODEL=compat
1560         fi
1561         AC_SUBST(AIX_OBJMODEL)
1562         DSO_LDOPTS='-qmkshrobj=1'
1563         DSO_CFLAGS='-qflag=w:w'
1564         DSO_PIC_CFLAGS=
1565         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1566         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1567         MOZ_FIX_LINK_PATHS=
1568         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1569         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1570         if test "$COMPILE_ENVIRONMENT"; then
1571             AC_LANG_SAVE
1572             AC_LANG_CPLUSPLUS
1573             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1574             AC_TRY_COMPILE([],
1575                 [#if (__IBMCPP__ < 600)
1576                  #error "Bad compiler"
1577                  #endif],
1578                 _BAD_COMPILER=,_BAD_COMPILER=1)
1579             if test -n "$_BAD_COMPILER"; then
1580                 AC_MSG_RESULT([no])    
1581                 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1582             else
1583                 AC_MSG_RESULT([yes])    
1584             fi
1585             AC_LANG_RESTORE
1586             TARGET_COMPILER_ABI="ibmc"
1587             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1588             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1589         fi
1590     fi
1591     case "${target_os}" in
1592     aix4.1*)
1593         DLL_SUFFIX='_shr.a'
1594         ;;
1595     esac
1596     if test "$COMPILE_ENVIRONMENT"; then
1597         AC_CHECK_HEADERS(sys/inttypes.h)
1598     fi
1599     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1600     ;;
1602 *-beos*)
1603     no_x=yes
1604     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1605     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1606     DSO_LDOPTS='-nostart'
1607     TK_LIBS='-lbe -lroot'
1608     LIBS="$LIBS -lbe"
1609     if test "$COMPILE_ENVIRONMENT"; then
1610         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1611         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1612     fi
1613     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1614     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1615     _MOZ_USE_RTTI=1
1616     USE_DEPENDENT_LIBS=
1617     MOZ_USER_DIR="Mozilla"
1618     ;;
1620 *-bsdi*)
1621     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1622     _PEDANTIC=
1623     _IGNORE_LONG_LONG_WARNINGS=
1624     case $OS_RELEASE in
1625         4.*|5.*)
1626             STRIP="$STRIP -d"
1627             ;;
1628         *)
1629             DSO_CFLAGS=''
1630             DSO_LDOPTS='-r'
1631             _WARNINGS_CFLAGS="-Wall"
1632             _WARNINGS_CXXFLAGS="-Wall"
1633             # The test above doesn't work properly, at least on 3.1.
1634             MKSHLIB_FORCE_ALL=''
1635             MKSHLIB_UNFORCE_ALL=''
1636         ;;
1637     esac
1638     ;;
1640 *-darwin*) 
1641     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1642     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1643     MOZ_OPTIMIZE_FLAGS="-O3"
1644     _PEDANTIC=
1645     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1646     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1647     DLL_SUFFIX=".dylib"
1648     DSO_LDOPTS=''
1649     STRIP="$STRIP -x -S"
1650     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1651     MOZ_ENABLE_POSTSCRIPT=
1652     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1653     LDFLAGS="$LDFLAGS -framework Cocoa"
1654     # The ExceptionHandling framework is needed for Objective-C exception
1655     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1656     # builds.
1657     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1658     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1659     MACOSX=1
1661     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1662     dnl ===================================================================
1663     if test "x$enable_dtrace" = "xyes"; then
1664         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1665     else
1666         dnl check for the presence of the -dead_strip linker flag
1667         AC_MSG_CHECKING([for -dead_strip option to ld])
1668         _SAVE_LDFLAGS=$LDFLAGS
1669         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1670         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1671         if test -n "$_HAVE_DEAD_STRIP" ; then
1672             AC_MSG_RESULT([yes])
1673             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1674         else
1675             AC_MSG_RESULT([no])
1676         fi
1677         
1678         LDFLAGS=$_SAVE_LDFLAGS
1679     fi
1680     ;;
1682 *-freebsd*)
1683     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1684         DLL_SUFFIX=".so.1.0"
1685         DSO_LDOPTS="-shared"
1686     fi
1687     if test ! "$GNU_CC"; then
1688         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1689     fi
1690 # Can't have force w/o an unforce.
1691 #    # Hack for FreeBSD 2.2
1692 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1693 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1694 #       MKSHLIB_UNFORCE_ALL=''
1695 #    fi
1696     ;; 
1698 *-hpux*)
1699     DLL_SUFFIX=".sl"
1700     if test ! "$GNU_CC"; then
1701         DSO_LDOPTS='-b -Wl,+s'
1702         DSO_CFLAGS=""
1703         DSO_PIC_CFLAGS="+Z"
1704         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1705         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1706         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1707     else
1708         DSO_LDOPTS='-b -E +s'
1709         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1710         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1711     fi
1712     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1713     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1714     ;;
1716 *-irix5*)
1717     AC_DEFINE(IRIX)
1718     DSO_LDOPTS='-elf -shared'
1720     if test "$GNU_CC"; then
1721        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1722        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1723        MKSHLIB_FORCE_ALL='-Wl,-all'
1724        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1725        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1726     else
1727        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1728        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1729        MKSHLIB_FORCE_ALL='-all'
1730        MKSHLIB_UNFORCE_ALL='-none'
1731     fi
1732     ;;
1734 *-irix6*)
1735     AC_DEFINE(IRIX)
1736     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1737     dnl compile and link using -n32
1738     USE_N32=1
1739     TARGET_COMPILER_ABI=n32
1740     DSO_LDOPTS='-elf -shared'
1741     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1742     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1743     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1744     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1745     if test "$GNU_CC"; then
1746        MKSHLIB_FORCE_ALL='-Wl,-all'
1747        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1748        _WARNINGS_CFLAGS="-Wall"
1749        _WARNINGS_CXXFLAGS="-Wall"
1750        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1751     else
1752        MKSHLIB_FORCE_ALL='-all'
1753        MKSHLIB_UNFORCE_ALL='-none'
1754            AR_LIST="$AR t"
1755            AR_EXTRACT="$AR x"
1756            AR_DELETE="$AR d"
1757            AR='$(CXX) -ar'
1758            AR_FLAGS='-o $@'
1759        CFLAGS="$CFLAGS -woff 3262 -G 4"
1760        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1761        if test -n "$USE_N32"; then
1762            ASFLAGS="$ASFLAGS -n32"
1763            CFLAGS="$CFLAGS -n32"
1764            CXXFLAGS="$CXXFLAGS -n32"
1765            LDFLAGS="$LDFLAGS -n32"
1766        fi
1767        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1768        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1769        MOZ_FIX_LINK_PATHS=
1770     fi
1771     if test -z "$GNU_CXX"; then
1772       MIPSPRO_CXX=1
1773     fi
1774     ;;
1776 *-*linux*)
1777     # Note: both GNU_CXX and INTEL_CXX are set when using Intel's C compiler.
1778     if test "$INTEL_CXX"; then
1779         # -Os has been broken on Intel's C/C++ compilers for quite a
1780         # while; Intel recommends against using it.
1781         MOZ_OPTIMIZE_FLAGS="-O2"
1782         MOZ_DEBUG_FLAGS="-g -fno-inline"
1783     elif test "$GNU_CXX"; then
1784         GCC_VERSION=`$CXX -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1785         case $GCC_VERSION in
1786         4.1.*|4.2.*)
1787             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1788             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1789         esac
1790         MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1791         MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1792                                           # and that combo is not yet good at
1793                                           # debugging inlined functions (even
1794                                           # when using DWARF2 as the debugging
1795                                           # format)
1796     fi
1798     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1800     case "${target_cpu}" in
1801     alpha*)
1802         CFLAGS="$CFLAGS -mieee"
1803         CXXFLAGS="$CXXFLAGS -mieee"
1804     ;;
1805     mips*)
1806         MOZ_DEBUG_FLAGS="-g" # We want inlining
1807     ;;
1808     esac
1809     ;;
1811 *-wince*|*-winmo*)
1812     TARGET_COMPILER_ABI=msvc
1813     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1814     AR_LIST="$AR -list"
1815     AR_EXTRACT="$AR -extract"
1816     AR_DELETE="$AR d"
1817     AR_FLAGS='-OUT:"$@"'
1818     AS="$AS_BIN"
1820     DSO_CFLAGS=
1821     DSO_PIC_CFLAGS=
1822     DLL_SUFFIX=.dll
1823     BIN_SUFFIX='.exe'
1824     if test -z "$RC"; then 
1825         RC=rc.exe  
1826     fi
1827     # certain versions of cygwin's makedepend barf on the 
1828     # #include <string> vs -I./dist/include/string issue so don't use it
1829     SYSTEM_MAKEDEPEND=
1831     HOST_CC=cl
1832     HOST_CXX=cl
1833     HOST_LD=link
1834     HOST_AR='lib -OUT:$@'
1835     HOST_RANLIB='echo ranlib'
1836     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1837         
1838         
1839     WARNINGS_AS_ERRORS='-WX'
1840         MOZ_OPTIMIZE_FLAGS='-O1'
1841     AR_FLAGS='-NOLOGO -OUT:"$@"'
1842     ASM_SUFFIX=asm
1843     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1844     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1845     DLL_PREFIX=
1846     DOXYGEN=:
1847     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1848     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1849     GARBAGE=
1850     IMPORT_LIB_SUFFIX=lib
1851     LIBS="$LIBS"
1852     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1853     LIB_PREFIX=
1854     LIB_SUFFIX=lib 
1855     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1856     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1857     MKSHLIB_FORCE_ALL=
1858     MKSHLIB_UNFORCE_ALL=
1859     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1860     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1861     MOZ_DEBUG_FLAGS='-Zi'
1862     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1863     MOZ_FIX_LINK_PATHS=
1864     MOZ_JS_LIBS='$(libdir)/mozjs.lib'
1865     OBJ_SUFFIX=obj
1866     RANLIB='echo not_ranlib'
1867     STRIP='echo not_strip'
1868     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1869     UNZIP=unzip
1870     XARGS=xargs
1871     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1872     ZIP=zip
1874     AC_DEFINE(WINCE)
1875     AC_DEFINE(HAVE_SNPRINTF)
1876     AC_DEFINE(_WINDOWS)
1877     AC_DEFINE(WIN32)
1878     AC_DEFINE(XP_WIN)
1879     AC_DEFINE(XP_WIN32)
1880     AC_DEFINE(HW_THREADS)
1881     AC_DEFINE(STDC_HEADERS)
1882     AC_DEFINE(NEW_H, <new>)
1883     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1885     TARGET_MD_ARCH=win32
1886     _PLATFORM_DEFAULT_TOOLKIT='windows'
1887     BIN_SUFFIX='.exe'
1888     MOZ_ENABLE_POSTSCRIPT=
1889     MOZ_USER_DIR="Mozilla"
1891     dnl Default to Windows Mobile components enabled
1892     WINCE_WINDOWS_MOBILE=1
1894     MOZ_ARG_DISABLE_BOOL(windows-mobile-components,
1895     [  --disable-windows-mobile-components
1896          Disable Windows Mobile specific components from CE build],
1897     WINCE_WINDOWS_MOBILE=,
1898     WINCE_WINDOWS_MOBILE=1)
1900     if test "$WINCE_WINDOWS_MOBILE"; then
1901         AC_DEFINE(WINCE_WINDOWS_MOBILE)
1902     fi
1905 *-symbian*)
1907     AC_DEFINE(XP_UNIX)
1908     AC_DEFINE(SYMBIAN)
1909     AC_DEFINE(__arm__)
1910     AC_DEFINE(__SYMBIAN32__)
1911     AC_DEFINE(_UNICODE)
1912     AC_DEFINE(NDEBUG)
1913     AC_DEFINE(__SUPPORT_CPP_EXCEPTIONS__)
1914     AC_DEFINE(MOZ_STDERR_TO_STDOUT)
1915     AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1916     AC_DEFINE(HAVE_SOCKLEN_T)
1917     AC_DEFINE(__GCCE__)
1919     CPU_ARCH=ARM
1920     OS_RELEASE=9.2
1921     OS_ARCH=SYMBIAN
1922     USE_PTHREADS=1
1923     LIB_SUFFIX=lib
1924     DLL_SUFFIX=dll
1925     MKSHLIB=
1926     DSO_LDOPTS=
1927     DSO_CFLAGS=
1928     VISIBILITY_FLAGS=
1929     TARGET_NSPR_MDCPUCFG='\"md/_symbian.cfg\"'
1930     RANLIB='echo no ranlib '
1933 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1934     DSO_CFLAGS=
1935     DSO_PIC_CFLAGS=
1936     DLL_SUFFIX=.dll
1937     RC=rc.exe
1938     # certain versions of cygwin's makedepend barf on the 
1939     # #include <string> vs -I./dist/include/string issue so don't use it
1940     SYSTEM_MAKEDEPEND=
1941     if test -n "$GNU_CC"; then
1942         CC="$CC -mno-cygwin"
1943         CXX="$CXX -mno-cygwin"
1944         CPP="$CPP -mno-cygwin"
1945         CFLAGS="$CFLAGS -mms-bitfields"
1946         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1947         DSO_LDOPTS='-shared'
1948         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1949         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1950         RC='$(WINDRES)'
1951         # Use temp file for windres (bug 213281)
1952         RCFLAGS='-O coff --use-temp-file'
1953         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1954         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1955         MOZ_JS_LIBS='-L$(libdir) -lmozjs'
1956         MOZ_FIX_LINK_PATHS=
1957         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1958         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1959         DLL_PREFIX=
1960         IMPORT_LIB_SUFFIX=dll.a
1961     else
1962         TARGET_COMPILER_ABI=msvc
1963         HOST_CC='$(CC)'
1964         HOST_CXX='$(CXX)'
1965         HOST_LD='$(LD)'
1966         AR='lib -NOLOGO -OUT:"$@"'
1967         AR_FLAGS=
1968         RANLIB='echo not_ranlib'
1969         STRIP='echo not_strip'
1970         XARGS=xargs
1971         ZIP=zip
1972         UNZIP=unzip
1973         DOXYGEN=:
1974         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1975         OBJ_SUFFIX=obj
1976         LIB_SUFFIX=lib
1977         DLL_PREFIX=
1978         LIB_PREFIX=
1979         IMPORT_LIB_SUFFIX=lib
1980         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1981         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1982         MKSHLIB_FORCE_ALL=
1983         MKSHLIB_UNFORCE_ALL=
1984         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1985         _USE_CPP_INCLUDE_FLAG=1
1986         _DEFINES_CFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
1987         _DEFINES_CXXFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
1988         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1989         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1990         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1991         MOZ_DEBUG_FLAGS='-Zi'
1992         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1993         WARNINGS_AS_ERRORS='-WX'
1994         MOZ_OPTIMIZE_FLAGS='-O1'
1995         MOZ_JS_LIBS='$(libdir)/mozjs.lib'
1996         MOZ_FIX_LINK_PATHS=
1997         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1998         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1999         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2000         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2001         if test $_MSC_VER -ge 1400; then
2002             LDFLAGS="$LDFLAGS -NXCOMPAT"
2003             dnl For profile-guided optimization
2004             PROFILE_GEN_CFLAGS="-GL"
2005             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2006             dnl XXX: PGO builds can fail with warnings treated as errors,
2007             dnl specifically "no profile data available" appears to be
2008             dnl treated as an error sometimes. This might be a consequence
2009             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2010             dnl with the linker doing most of the work in the whole-program
2011             dnl optimization/PGO case. I think it's probably a compiler bug,
2012             dnl but we work around it here.
2013             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2014             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2015             dnl Probably also a compiler bug, but what can you do?
2016             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2017             if test -n "$_USE_DYNAMICBASE"; then
2018                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2019             fi
2020         fi
2021     fi
2022     AC_DEFINE(HAVE_SNPRINTF)
2023     AC_DEFINE(_WINDOWS)
2024     AC_DEFINE(WIN32)
2025     AC_DEFINE(XP_WIN)
2026     AC_DEFINE(XP_WIN32)
2027     AC_DEFINE(HW_THREADS)
2028     AC_DEFINE(STDC_HEADERS)
2029     AC_DEFINE(NEW_H, <new>)
2030     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2031     TARGET_MD_ARCH=win32
2032     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2033     BIN_SUFFIX='.exe'
2034     MOZ_ENABLE_POSTSCRIPT=
2035     MOZ_USER_DIR="Mozilla"
2037     dnl Hardcode to win95 for now - cls
2038     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2040     dnl set NO_X11 defines here as the general check is skipped on win32
2041     no_x=yes
2042     AC_DEFINE(NO_X11)
2044     dnl MinGW/MSYS doesn't provide or need cygpath
2045     case "$host" in
2046     *-mingw*)
2047         CYGPATH_W=echo
2048         CYGPATH_S=cat
2049         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2050         ;;
2051     *-cygwin*|*-msvc*|*-mks*)
2052         CYGPATH_W="cygpath -a -w"
2053         CYGPATH_S="sed -e s|\\\\|/|g"
2054         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2055         ;;
2056     esac
2057     case "$host" in
2058     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2060     if test -z "$MOZ_TOOLS"; then
2061         AC_MSG_ERROR([MOZ_TOOLS is not set])
2062     fi
2064     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2065     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2066         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2067     fi
2068     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2069         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2070     fi
2071     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2072     ;;
2073     esac 
2076     case "$host_os" in
2077     cygwin*|msvc*|mks*)
2078         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])
2079         ;;
2081     *)
2082         AC_CHECK_HEADERS(oleacc.idl)
2084         AC_LANG_SAVE
2085         AC_LANG_CPLUSPLUS
2086         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2087         AC_LANG_RESTORE
2088         ;;
2089     esac
2091     case "$target" in
2092     i*86-*)
2093         if test "$HAVE_64BIT_OS"; then
2094             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2095         fi
2097         if test $_MSC_VER -ge 1400; then
2098             LDFLAGS="$LDFLAGS -SAFESEH"
2099         fi
2100         AC_CHECK_HEADERS(mmintrin.h)
2101         AC_DEFINE(_X86_)
2102         ;;
2103     alpha-*)
2104         AC_DEFINE(_ALPHA_)
2105         ;;
2106     mips-*)
2107         AC_DEFINE(_MIPS_)
2108         ;;
2109     x86_64-*)
2110         AC_DEFINE(_AMD64_)
2111         ;;
2112     *)
2113         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2114         ;;
2115     esac
2117     if test "$HAVE_64BIT_OS"; then
2118         AC_DEFINE(_WIN64)
2119     fi
2120     ;;
2122 *-netbsd*)
2123     DSO_CFLAGS=''
2124     CFLAGS="$CFLAGS -Dunix"
2125     CXXFLAGS="$CXXFLAGS -Dunix"
2126     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2127         DLL_SUFFIX=".so"
2128         DSO_PIC_CFLAGS='-fPIC -DPIC'
2129         DSO_LDOPTS='-shared'
2130         BIN_FLAGS='-Wl,--export-dynamic'
2131     else
2132         DSO_PIC_CFLAGS='-fPIC -DPIC'
2133         DLL_SUFFIX=".so.1.0"
2134         DSO_LDOPTS='-shared'
2135     fi
2136     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2137     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2138     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2139     if test "$LIBRUNPATH"; then
2140         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2141     fi
2142     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2143     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2144     ;;
2146 *-nto*) 
2147         AC_DEFINE(NTO)  
2148         AC_DEFINE(_QNX_SOURCE)
2149         AC_DEFINE(_i386)
2150         OS_TARGET=NTO
2151         WARNINGS_AS_ERRORS=''
2152         MOZ_OPTIMIZE_FLAGS="-O"
2153         MOZ_DEBUG_FLAGS="-gstabs"
2154         USE_PTHREADS=1
2155         _PEDANTIC=
2156         LIBS="$LIBS -lsocket -lstdc++"
2157         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2158         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/js-confdefs.h -D_POSIX_C_SOURCE=199506'
2159         if test "$with_x" != "yes"
2160         then
2161                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2162             TK_CFLAGS='-I/usr/include/photon'
2163                 TK_LIBS='-lph'
2164         fi
2165         case "${target_cpu}" in
2166         ppc*)
2167         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2168         ;;
2169         esac
2170         ;;
2172 *-openbsd*)
2173     DLL_SUFFIX=".so.1.0"
2174     DSO_CFLAGS=''
2175     DSO_PIC_CFLAGS='-fPIC'
2176     DSO_LDOPTS='-shared -fPIC'
2177     if test "$LIBRUNPATH"; then
2178         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2179     fi
2180     ;;
2182 *-openvms*) 
2183     AC_DEFINE(NO_PW_GECOS)
2184     AC_DEFINE(NO_UDSOCK)
2185     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2186     USE_PTHREADS=1
2187     MKSHLIB_FORCE_ALL='-all'
2188     MKSHLIB_UNFORCE_ALL='-none'
2189     AS='as'
2190     AS_DASH_C_FLAG='-Wc/names=as_is'
2191     AR_FLAGS='c $@'
2192     DSO_LDOPTS='-shared -auto_symvec'
2193     DSO_PIC_CFLAGS=
2194     MOZ_DEBUG_LDFLAGS='-g'
2195     COMPAQ_CXX=1
2196     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2197     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2198     ;;
2201 *-os2*)
2202     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2203     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2204     AC_DEFINE(OS2)
2205     AC_DEFINE(XP_OS2)
2206     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2207     AC_DEFINE(TCPV40HDRS)
2208     DLL_PREFIX=
2209     LIB_PREFIX=
2210     LIB_SUFFIX=lib
2211     BIN_SUFFIX=".exe"
2212     DLL_SUFFIX=".dll"
2213     IMPORT_LIB_SUFFIX=lib
2214     DSO_PIC_CFLAGS=
2215     AR=emxomfar
2216     AR_FLAGS='r $@'
2217     CFLAGS="$CFLAGS -Zomf"
2218     CXXFLAGS="$CXXFLAGS -Zomf"
2219     DSO_LDOPTS='-Zdll'
2220     BIN_FLAGS='-Zlinker /ST:0x100000'
2221     IMPLIB='emximp -o'
2222     FILTER='emxexp -o'
2223     LDFLAGS='-Zmap'
2224     WARNINGS_AS_ERRORS='-Werror'
2225     MOZ_DEBUG_FLAGS="-g -fno-inline"
2226     MOZ_OPTIMIZE_FLAGS="-O2"
2227     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2228     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2229     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2230     TARGET_MD_ARCH=os2
2231     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2232     MOZ_ENABLE_POSTSCRIPT=
2233     RC=rc.exe
2234     RCFLAGS='-n'
2235     MOZ_USER_DIR="Mozilla"
2237     if test "$MOZTOOLS"; then
2238         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2239     else
2240         AC_MSG_ERROR([MOZTOOLS is not set])
2241     fi
2242     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2243         DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2244         LDFLAGS="$LDFLAGS -Zhigh-mem"
2245         MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2246         AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2247     fi
2249     # GCC for OS/2 currently predefines these, but we don't want them
2250     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2251     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2253     AC_CACHE_CHECK(for __declspec(dllexport),
2254         ac_os2_declspec,
2255         [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2256                         [return 0;],
2257                         ac_os2_declspec="yes",
2258                         ac_os2_declspec="no")])
2259     if test "$ac_os2_declspec" = "yes"; then
2260         FILTER='true'
2261         MOZ_OS2_USE_DECLSPEC='1'
2262     fi
2263     ;;
2265 alpha*-*-osf*)
2266     if test "$GNU_CC"; then
2267       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2268       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2270     else
2271         MOZ_DEBUG_FLAGS='-g'
2272         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2273         CFLAGS="$CFLAGS -ieee"
2274         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2275         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2276         DSO_CFLAGS=
2277         DSO_PIC_CFLAGS=
2278         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2279         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2280         MKSHLIB_FORCE_ALL='-all'
2281         MKSHLIB_UNFORCE_ALL='-none'
2282         dnl Might fix the libxpcom.so breakage on this platform as well....
2283         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2284         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2285     fi
2286     if test -z "$GNU_CXX"; then
2287       COMPAQ_CXX=1
2288     fi
2289     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2290     ;;
2292 *-qnx*) 
2293     DIRENT_INO=d_stat.st_ino
2294     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2295     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2296     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2297     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2298     AC_DEFINE(STDC_HEADERS)
2299     if test "$no_x" = "yes"; then
2300             _PLATFORM_DEFAULT_TOOLKIT='photon'
2301             TK_CFLAGS='-I/usr/nto/include/photon'
2302             TK_LIBS='-lphoton -lphrender'
2303     fi
2304     ;;
2306 *-sco*) 
2307     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2308     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2309     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2310     if test ! "$GNU_CC"; then
2311        DSO_LDOPTS='-G'
2312     fi
2313     ;;
2315 *-solaris*) 
2316     AC_DEFINE(SOLARIS)
2317     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2318     if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then
2319        NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4"
2320        NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps"
2321        NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"]
2322     fi
2323     SYSTEM_MAKEDEPEND=
2324     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2325     # libraries one level up (e.g. libnspr4.so)
2326     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2327     if test "$SOLARIS_SUNPRO_CC"; then
2328        LIBS="-lCrun -lCstd $LIBS"
2329        NS_USE_NATIVE=1
2330        MOZ_FIX_LINK_PATHS=
2331        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2332        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2333        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2334        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2335        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2336            _SAVE_LDFLAGS=$LDFLAGS
2337            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2338            AC_TRY_LINK([#include <stdio.h>],
2339                        [printf("Hello World\n");],
2340                        ,
2341                        [LDFLAGS=$_SAVE_LDFLAGS])
2342        fi
2343        WARNINGS_AS_ERRORS='-Werror'
2344        MOZ_OPTIMIZE_FLAGS="-xO4"
2345        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2346        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2347        MKSHLIB_FORCE_ALL='-z allextract'
2348        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2349        DSO_LDOPTS='-G -z muldefs'
2350        AR_LIST="$AR t"
2351        AR_EXTRACT="$AR x"
2352        AR_DELETE="$AR d"
2353        AR='$(CXX) -xar'
2354        AR_FLAGS='-o $@'
2355        AS='/usr/ccs/bin/as'
2356        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2357        AS_DASH_C_FLAG=''
2358        TARGET_COMPILER_ABI="sunc"
2359        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2360        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2361        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2362        AC_LANG_SAVE
2363        AC_LANG_CPLUSPLUS
2364        AC_TRY_COMPILE([],
2365            [#if (__SUNPRO_CC < 0x590)
2366            #error "Denied"
2367            #endif],
2368            _BAD_COMPILER=,_BAD_COMPILER=1)
2369         if test -n "$_BAD_COMPILER"; then
2370             _res="no"
2371             AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2372         else
2373             _res="yes"
2374         fi
2375         AC_MSG_RESULT([$_res])
2376         AC_LANG_RESTORE
2377     else
2378        ASFLAGS="$ASFLAGS -fPIC"
2379        DSO_LDOPTS='-G'
2380        _WARNINGS_CFLAGS=''
2381        _WARNINGS_CXXFLAGS=''
2382        if test "$OS_RELEASE" = "5.3"; then
2383           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2384        fi
2385     fi
2386     if test "$OS_RELEASE" = "5.5.1"; then
2387        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2388     fi
2389     ;;
2391 *-sunos*) 
2392     DSO_LDOPTS='-Bdynamic'
2393     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2394     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2395     AC_DEFINE(SUNOS4)
2396     AC_DEFINE(SPRINTF_RETURNS_STRING)
2397     case "$(target_os)" in
2398     sunos4.1*)
2399         DLL_SUFFIX='.so.1.0'
2400         ;;
2401     esac
2402     ;;
2404 *-sysv4.2uw7*) 
2405         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2406     ;;
2408 *-os2*)
2409     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2410     ;;
2412 esac
2414 dnl Only one oddball right now (QNX), but this gives us flexibility
2415 dnl if any other platforms need to override this in the future.
2416 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2418 dnl ========================================================
2419 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2420 dnl by now will not have any way to link most binaries (tests
2421 dnl as well as viewer, apprunner, etc.), because some symbols
2422 dnl will be left out of the "composite" .so's by ld as unneeded.
2423 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2424 dnl they can link in the static libs that provide the missing
2425 dnl symbols.
2426 dnl ========================================================
2427 NO_LD_ARCHIVE_FLAGS=
2428 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2429     NO_LD_ARCHIVE_FLAGS=1
2431 case "$target" in
2432 *-os2*)
2433     NO_LD_ARCHIVE_FLAGS=
2434     ;;
2435 *-aix4.3*|*-aix5*)
2436     NO_LD_ARCHIVE_FLAGS=
2437     ;;
2438 *-openvms*)
2439     NO_LD_ARCHIVE_FLAGS=
2440     ;;
2441 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2442     if test -z "$GNU_CC"; then
2443         NO_LD_ARCHIVE_FLAGS=
2444     fi
2445     ;;
2446 esac
2447 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2450 dnl Indicate that platform requires special thread safe 
2451 dnl locking when starting up the OJI JVM 
2452 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2453 dnl ========================================================
2454 case "$target" in
2455     *-hpux*)      
2456         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2457         ;;
2458 esac
2460 dnl ========================================================
2461 dnl = Flags to strip unused symbols from .so components
2462 dnl ========================================================
2463 case "$target" in
2464     *-linux*|*-kfreebsd*-gnu)
2465         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2466         ;;
2467     *-solaris*)
2468         if test -z "$GNU_CC"; then
2469          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2470         else
2471          if test -z "$GCC_USE_GNU_LD"; then
2472           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2473          else
2474           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2475          fi
2476         fi
2477         ;;
2478     *-nto*) 
2479         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2480         ;;
2481     *-darwin*)
2482         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2483         ;;
2484     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2485         if test -n "$GNU_CC"; then
2486            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2487         fi
2488         ;;
2489 esac
2491 if test -z "$COMPILE_ENVIRONMENT"; then
2492     SKIP_COMPILER_CHECKS=1
2493     SKIP_LIBRARY_CHECKS=1
2496 dnl Configure JIT support
2498 case "$target" in
2499 i?86-*)
2500     ENABLE_TRACEJIT=1
2501     NANOJIT_ARCH=i386
2502     ;;
2503 x86_64*-*)
2504     ENABLE_TRACEJIT=1
2505     NANOJIT_ARCH=X64
2506     ;;
2507 arm*-*)
2508     ENABLE_TRACEJIT=1
2509     NANOJIT_ARCH=ARM
2510     ;;
2511 sparc*-*)
2512     ENABLE_TRACEJIT=1
2513     NANOJIT_ARCH=Sparc
2514     ;;
2515 esac
2517 MOZ_ARG_DISABLE_BOOL(tracejit,
2518 [  --disable-tracejit           Disable tracing JIT support],
2519   ENABLE_TRACEJIT=)
2521 if test "$ENABLE_TRACEJIT"; then
2523 AC_DEFINE(FEATURE_NANOJIT)
2524 AC_DEFINE(JS_TRACER)
2526 case "$target" in
2527 i?86-*)
2528     AC_DEFINE(AVMPLUS_IA32)
2529     ;;
2530 x86_64*-*)
2531     AC_DEFINE(AVMPLUS_AMD64)
2532     AC_DEFINE(AVMPLUS_64BIT)
2533     ;;
2534 arm*-*)
2535     AC_DEFINE(AVMPLUS_ARM)
2536     ;;
2537 sparc-*)
2538     AC_DEFINE(AVMPLUS_SPARC)
2539     ;;
2540 esac
2542 case "$target_os" in
2543 linux*)
2544     AC_DEFINE(AVMPLUS_UNIX)
2545     AC_DEFINE(AVMPLUS_LINUX)
2546     ;;
2547 darwin*)
2548     AC_DEFINE(AVMPLUS_UNIX)
2549     ;;
2550 solaris*)
2551     AC_DEFINE(AVMPLUS_UNIX)
2552     ;;
2553 freebsd*|kfreebsd*)
2554     AC_DEFINE(AVMPLUS_UNIX)
2555     ;;
2556 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
2557     AC_DEFINE(AVMPLUS_WIN32)
2558     ;;
2559 *os2*)
2560     AC_DEFINE(AVMPLUS_OS2)
2561     ;;
2563     AC_MSG_ERROR([Unrecognized nanojit platform. Use --disable-tracejit to build without tracing JIT support.])
2564 esac
2566 fi # ENABLE_TRACEJIT
2568 AC_SUBST(ENABLE_TRACEJIT)
2569 AC_SUBST(NANOJIT_ARCH)
2571 if test -z "$SKIP_COMPILER_CHECKS"; then
2572 dnl Checks for typedefs, structures, and compiler characteristics.
2573 dnl ========================================================
2574 AC_LANG_C
2575 AC_HEADER_STDC
2576 AC_C_CONST
2577 AC_TYPE_MODE_T
2578 AC_TYPE_OFF_T
2579 AC_TYPE_PID_T
2580 AC_TYPE_SIZE_T
2581 AC_STRUCT_ST_BLKSIZE
2582 AC_MSG_CHECKING(for siginfo_t)
2583 AC_CACHE_VAL(ac_cv_siginfo_t,
2584  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2585                   #include <signal.h>],
2586                  [siginfo_t* info;],
2587                  [ac_cv_siginfo_t=true],
2588                  [ac_cv_siginfo_t=false])])
2589 if test "$ac_cv_siginfo_t" = true ; then
2590   AC_DEFINE(HAVE_SIGINFO_T)
2591   AC_MSG_RESULT(yes)
2592 else
2593   AC_MSG_RESULT(no)
2596 dnl Find exact-width integer types, or figure them out
2597 dnl ourselves.
2598 dnl ========================================================
2599 dnl Once this is working, we can delete the code for int16_t,
2600 dnl etc. below.
2602 AC_CHECK_HEADER(stdint.h)
2603 if test "$ac_cv_header_stdint_h" = yes; then
2604     AC_DEFINE(JS_HAVE_STDINT_H)
2605 else
2606     dnl We'll figure them out for ourselves.  List more likely types
2607     dnl earlier.  If we ever really encounter a size for which none of
2608     dnl the listed types are appropriate, we'll get a configure-time
2609     dnl error; just add the right answer.
2610     MOZ_N_BYTE_TYPE(JS_INT8_TYPE,  1, [char])
2611     MOZ_N_BYTE_TYPE(JS_INT16_TYPE, 2, [short int long])
2612     MOZ_N_BYTE_TYPE(JS_INT32_TYPE, 4, [int long 'long long' short])
2613     MOZ_N_BYTE_TYPE(JS_INT64_TYPE, 8, [int long 'long long'])
2614     MOZ_N_BYTE_TYPE(JS_INTPTR_TYPE, sizeof (void *),
2615                                       [int long 'long long' short])
2618 MOZ_SIZE_OF_TYPE(JS_BYTES_PER_WORD, void*, 4 8)
2619 if test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "4"; then
2620   AC_DEFINE(JS_BITS_PER_WORD_LOG2, 5)
2621 elif test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "8"; then
2622   AC_DEFINE(JS_BITS_PER_WORD_LOG2, 6)
2623 else
2624   AC_MSG_ERROR([Unexpected JS_BYTES_PER_WORD])
2627 MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
2628 MOZ_SIZE_OF_TYPE(JS_BYTES_PER_DOUBLE, double, 6 8 10 12 14)
2630 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2631 dnl ========================================================
2632 AC_MSG_CHECKING(for int16_t)
2633 AC_CACHE_VAL(ac_cv_int16_t,
2634  [AC_TRY_COMPILE([#include <stdio.h>
2635                   #include <sys/types.h>],
2636                  [int16_t foo = 0;],
2637                  [ac_cv_int16_t=true],
2638                  [ac_cv_int16_t=false])])
2639 if test "$ac_cv_int16_t" = true ; then
2640   AC_DEFINE(HAVE_INT16_T)
2641   AC_MSG_RESULT(yes)
2642 else
2643   AC_MSG_RESULT(no)
2645 AC_MSG_CHECKING(for int32_t)
2646 AC_CACHE_VAL(ac_cv_int32_t,
2647  [AC_TRY_COMPILE([#include <stdio.h>
2648                   #include <sys/types.h>],
2649                  [int32_t foo = 0;],
2650                  [ac_cv_int32_t=true],
2651                  [ac_cv_int32_t=false])])
2652 if test "$ac_cv_int32_t" = true ; then
2653   AC_DEFINE(HAVE_INT32_T)
2654   AC_MSG_RESULT(yes)
2655 else
2656   AC_MSG_RESULT(no)
2658 AC_MSG_CHECKING(for int64_t)
2659 AC_CACHE_VAL(ac_cv_int64_t,
2660  [AC_TRY_COMPILE([#include <stdio.h>
2661                   #include <sys/types.h>],
2662                  [int64_t foo = 0;],
2663                  [ac_cv_int64_t=true],
2664                  [ac_cv_int64_t=false])])
2665 if test "$ac_cv_int64_t" = true ; then
2666   AC_DEFINE(HAVE_INT64_T)
2667   AC_MSG_RESULT(yes)
2668 else
2669   AC_MSG_RESULT(no)
2671 AC_MSG_CHECKING(for int64)
2672 AC_CACHE_VAL(ac_cv_int64,
2673  [AC_TRY_COMPILE([#include <stdio.h>
2674                   #include <sys/types.h>],
2675                  [int64 foo = 0;],
2676                  [ac_cv_int64=true],
2677                  [ac_cv_int64=false])])
2678 if test "$ac_cv_int64" = true ; then
2679   AC_DEFINE(HAVE_INT64)
2680   AC_MSG_RESULT(yes)
2681 else
2682   AC_MSG_RESULT(no)
2684 AC_MSG_CHECKING(for uint)
2685 AC_CACHE_VAL(ac_cv_uint,
2686  [AC_TRY_COMPILE([#include <stdio.h>
2687                   #include <sys/types.h>],
2688                  [uint foo = 0;],
2689                  [ac_cv_uint=true],
2690                  [ac_cv_uint=false])])
2691 if test "$ac_cv_uint" = true ; then
2692   AC_DEFINE(HAVE_UINT)
2693   AC_MSG_RESULT(yes)
2694 else
2695   AC_MSG_RESULT(no)
2697 AC_MSG_CHECKING(for uint_t)
2698 AC_CACHE_VAL(ac_cv_uint_t,
2699  [AC_TRY_COMPILE([#include <stdio.h>
2700                   #include <sys/types.h>],
2701                  [uint_t foo = 0;],
2702                  [ac_cv_uint_t=true],
2703                  [ac_cv_uint_t=false])])
2704 if test "$ac_cv_uint_t" = true ; then
2705   AC_DEFINE(HAVE_UINT_T)
2706   AC_MSG_RESULT(yes)
2707 else
2708   AC_MSG_RESULT(no)
2710 AC_MSG_CHECKING(for uint16_t)
2711 AC_CACHE_VAL(ac_cv_uint16_t,
2712  [AC_TRY_COMPILE([#include <stdio.h>
2713                   #include <sys/types.h>],
2714                  [uint16_t foo = 0;],
2715                  [ac_cv_uint16_t=true],
2716                  [ac_cv_uint16_t=false])])
2717 if test "$ac_cv_uint16_t" = true ; then
2718   AC_DEFINE(HAVE_UINT16_T)
2719   AC_MSG_RESULT(yes)
2720 else
2721   AC_MSG_RESULT(no)
2724 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2725 dnl are defined when compiling C++ but not C.  Since the result of this
2726 dnl test is used only in C++, do it in C++.
2727 AC_LANG_CPLUSPLUS
2729 AC_MSG_CHECKING(for uname.domainname)
2730 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2731     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2732         [ struct utsname *res; char *domain; 
2733             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2734         [ac_cv_have_uname_domainname_field=true],
2735         [ac_cv_have_uname_domainname_field=false])])
2737 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2738     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2739     AC_MSG_RESULT(yes)
2740 else
2741     AC_MSG_RESULT(no)
2744 AC_MSG_CHECKING(for uname.__domainname)
2745 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2746     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2747         [ struct utsname *res; char *domain; 
2748             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2749         [ac_cv_have_uname_us_domainname_field=true],
2750         [ac_cv_have_uname_us_domainname_field=false])])
2752 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2753     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2754     AC_MSG_RESULT(yes)
2755 else
2756     AC_MSG_RESULT(no)
2759 AC_LANG_C
2761 dnl Check for .hidden assembler directive and visibility attribute.
2762 dnl Borrowed from glibc configure.in
2763 dnl ===============================================================
2764 if test "$GNU_CC"; then
2765   AC_CACHE_CHECK(for visibility(hidden) attribute,
2766                  ac_cv_visibility_hidden,
2767                  [cat > conftest.c <<EOF
2768                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2770                   ac_cv_visibility_hidden=no
2771                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2772                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2773                       ac_cv_visibility_hidden=yes
2774                     fi
2775                   fi
2776                   rm -f conftest.[cs]
2777                  ])
2778   if test "$ac_cv_visibility_hidden" = "yes"; then
2779     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2781     AC_CACHE_CHECK(for visibility(default) attribute,
2782                    ac_cv_visibility_default,
2783                    [cat > conftest.c <<EOF
2784                     int foo __attribute__ ((visibility ("default"))) = 1;
2786                     ac_cv_visibility_default=no
2787                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2788                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2789                         ac_cv_visibility_default=yes
2790                       fi
2791                     fi
2792                     rm -f conftest.[cs]
2793                    ])
2794     if test "$ac_cv_visibility_default" = "yes"; then
2795       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2797       AC_CACHE_CHECK(for visibility pragma support,
2798                      ac_cv_visibility_pragma,
2799                      [cat > conftest.c <<EOF
2800 #pragma GCC visibility push(hidden)
2801                       int foo_hidden = 1;
2802 #pragma GCC visibility push(default)
2803                       int foo_default = 1;
2805                       ac_cv_visibility_pragma=no
2806                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2807                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2808                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2809                             ac_cv_visibility_pragma=yes
2810                           fi
2811                         fi
2812                       fi
2813                       rm -f conftest.[cs]
2814                     ])
2815       if test "$ac_cv_visibility_pragma" = "yes"; then
2816         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2817                        ac_cv_have_visibility_class_bug,
2818                        [cat > conftest.c <<EOF
2819 #pragma GCC visibility push(hidden)
2820 struct __attribute__ ((visibility ("default"))) TestStruct {
2821   static void Init();
2823 __attribute__ ((visibility ("default"))) void TestFunc() {
2824   TestStruct::Init();
2827                        ac_cv_have_visibility_class_bug=no
2828                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2829                          ac_cv_have_visibility_class_bug=yes
2830                        else
2831                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2832                            ac_cv_have_visibility_class_bug=yes
2833                          fi
2834                        fi
2835                        rm -rf conftest.{c,S}
2836                        ])
2838         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2839                        ac_cv_have_visibility_builtin_bug,
2840                        [cat > conftest.c <<EOF
2841 #pragma GCC visibility push(hidden)
2842 #pragma GCC visibility push(default)
2843 #include <string.h>
2844 #pragma GCC visibility pop
2846 __attribute__ ((visibility ("default"))) void Func() {
2847   char c[[100]];
2848   memset(c, 0, sizeof(c));
2851                        ac_cv_have_visibility_builtin_bug=no
2852                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2853                          ac_cv_have_visibility_builtin_bug=yes
2854                        else
2855                          if test `grep -c "@PLT" conftest.S` = 0; then
2856                            ac_cv_visibility_builtin_bug=yes
2857                          fi
2858                        fi
2859                        rm -f conftest.{c,S}
2860                        ])
2861         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2862                 "$ac_cv_have_visibility_class_bug" = "no"; then
2863           VISIBILITY_FLAGS='-I$(DIST)/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h'
2864           WRAP_SYSTEM_INCLUDES=1
2865         else
2866           VISIBILITY_FLAGS='-fvisibility=hidden'
2867         fi # have visibility pragma bug
2868       fi   # have visibility pragma
2869     fi     # have visibility(default) attribute
2870   fi       # have visibility(hidden) attribute
2871 fi         # GNU_CC
2873 # visibility hidden flag for Sun Studio on Solaris
2874 if test "$SOLARIS_SUNPRO_CC"; then
2875 VISIBILITY_FLAGS='-xldscope=hidden'
2876 fi         # Sun Studio on Solaris
2878 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2879 AC_SUBST(VISIBILITY_FLAGS)
2881 dnl Checks for header files.
2882 dnl ========================================================
2883 AC_HEADER_DIRENT
2884 case "$target_os" in
2885 freebsd*)
2886 # for stuff like -lXshm
2887     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2888     ;;
2889 esac
2890 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2891 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2892 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2893 AC_CHECK_HEADERS(malloc.h)
2894 AC_CHECK_HEADERS(X11/XKBlib.h)
2896 dnl These are all the places some variant of statfs can be hiding.
2897 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2899 dnl Try for MMX support
2900 dnl NB - later gcc versions require -mmmx for this header to be successfully
2901 dnl included (or another option which implies it, such as -march=pentium-mmx)
2902 AC_CHECK_HEADERS(mmintrin.h)
2904 dnl Check whether the compiler supports the new-style C++ standard
2905 dnl library headers (i.e. <new>) or needs the old "new.h"
2906 AC_LANG_CPLUSPLUS
2907 NEW_H=new.h
2908 AC_CHECK_HEADER(new, [NEW_H=new])
2909 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2910 AC_LANG_C
2912 AC_ARG_ENABLE(dtrace,
2913               [  --enable-dtrace         build with dtrace support if available (default=no)],
2914               [enable_dtrace="yes"],)
2915 if test "x$enable_dtrace" = "xyes"; then
2916   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2917   if test -n "$HAVE_DTRACE"; then
2918       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2919   else
2920       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2921   fi
2923 AC_SUBST(HAVE_DTRACE)
2925 case $target in
2926 *-aix4.3*|*-aix5*)
2927         ;;
2929         AC_CHECK_HEADERS(sys/cdefs.h)
2930         ;;
2931 esac
2933 dnl Checks for libraries.
2934 dnl ========================================================
2935 case $target in
2936 *-hpux11.*)
2937         ;;
2939         AC_CHECK_LIB(c_r, gethostbyname_r)
2940         ;;
2941 esac
2943 dnl We don't want to link with libdl even if it's present on OS X, since
2944 dnl it's not used and not part of the default installation.
2945 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
2946 dnl We don't want to link against libm or libpthread on Darwin since
2947 dnl they both are just symlinks to libSystem and explicitly linking
2948 dnl against libSystem causes issues when debugging (see bug 299601).
2949 case $target in
2950 *-darwin*)
2951     ;;
2952 *-beos*)
2953     ;;
2954 *-os2*)
2955     ;;
2957     AC_CHECK_LIB(m, atan)
2958     AC_CHECK_LIB(dl, dlopen,
2959     AC_CHECK_HEADER(dlfcn.h, 
2960         LIBS="-ldl $LIBS"
2961         AC_DEFINE(HAVE_LIBDL)))
2962     ;;
2963 esac
2965 _SAVE_CFLAGS="$CFLAGS"
2966 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2967 AC_CHECK_FUNCS(dladdr)
2968 CFLAGS="$_SAVE_CFLAGS"
2970 if test ! "$GNU_CXX"; then
2972     case $target in
2973     *-aix*)
2974         AC_CHECK_LIB(C_r, demangle)
2975         ;;
2976      *)
2977         AC_CHECK_LIB(C, demangle)
2978         ;;
2979      esac
2982 dnl OS/2 has socket in libc.
2983 case $target in
2984 *-os2*)
2985     ;;
2987     AC_CHECK_LIB(socket, socket)
2988 esac
2990 dnl ========================================================
2991 dnl = pthread support
2992 dnl = Start by checking whether the system support pthreads
2993 dnl ========================================================
2994 case "$target_os" in
2995 darwin*)
2996     USE_PTHREADS=1
2997     ;;
2999     MOZ_CHECK_PTHREADS(pthreads,
3000         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3001         MOZ_CHECK_PTHREADS(pthread,
3002             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3003             MOZ_CHECK_PTHREADS(c_r,
3004                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3005                 MOZ_CHECK_PTHREADS(c,
3006                     USE_PTHREADS=1
3007                 )
3008             )
3009         )
3010     )
3011     ;;
3012 esac
3014 dnl ========================================================
3015 dnl Check the command line for --with-pthreads 
3016 dnl ========================================================
3017 MOZ_ARG_WITH_BOOL(pthreads,
3018 [  --with-pthreads         Force use of system pthread library with NSPR ],
3019 [ if test "$USE_PTHREADS"x = x; then
3020     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3021 fi],
3022     USE_PTHREADS=
3023     _PTHREAD_LDFLAGS=
3026 dnl ========================================================
3027 dnl Do the platform specific pthread hackery
3028 dnl ========================================================
3029 if test "$USE_PTHREADS"x != x
3030 then
3031         dnl
3032         dnl See if -pthread is supported.
3033         dnl
3034         rm -f conftest*
3035         ac_cv_have_dash_pthread=no
3036         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3037         echo 'int main() { return 0; }' | cat > conftest.c
3038         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3039         if test $? -eq 0; then
3040                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3041                         ac_cv_have_dash_pthread=yes
3042                 case "$target_os" in
3043                 freebsd*)
3044 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3045                 ;;
3046                 *)
3047                             CFLAGS="$CFLAGS -pthread"
3048                             CXXFLAGS="$CXXFLAGS -pthread"
3049                 ;;
3050                 esac
3051                 fi
3052         fi
3053         rm -f conftest*
3054     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3056         dnl
3057         dnl See if -pthreads is supported.
3058         dnl
3059     ac_cv_have_dash_pthreads=no
3060     if test "$ac_cv_have_dash_pthread" = "no"; then
3061             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3062         echo 'int main() { return 0; }' | cat > conftest.c
3063             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3064         if test $? -eq 0; then
3065                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3066                             ac_cv_have_dash_pthreads=yes
3067                             CFLAGS="$CFLAGS -pthreads"
3068                             CXXFLAGS="$CXXFLAGS -pthreads"
3069                     fi
3070             fi
3071             rm -f conftest*
3072         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3073     fi
3075         case "$target" in
3076             *-*-freebsd*)
3077                         AC_DEFINE(_REENTRANT)
3078                         AC_DEFINE(_THREAD_SAFE)
3079                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3080                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3081                                 _PTHREAD_LDFLAGS="-pthread"
3082                         else
3083                                 _PTHREAD_LDFLAGS="-lc_r"
3084                         fi
3085                         ;;
3087             *-*-openbsd*|*-*-bsdi*)
3088                         AC_DEFINE(_REENTRANT)
3089                         AC_DEFINE(_THREAD_SAFE)
3090                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3091                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3092                 _PTHREAD_LDFLAGS="-pthread"
3093                         fi
3094                         ;;
3096             *-*-linux*|*-*-kfreebsd*-gnu)
3097                         AC_DEFINE(_REENTRANT) 
3098                         ;;
3100             *-*-nto*) 
3101                         AC_DEFINE(_REENTRANT) 
3102                         ;;
3104             *-aix4.3*|*-aix5*)
3105                         AC_DEFINE(_REENTRANT) 
3106                         ;;
3108             *-hpux11.*)
3109                         AC_DEFINE(_REENTRANT) 
3110                         ;;
3112             alpha*-*-osf*)
3113                         AC_DEFINE(_REENTRANT)
3114                         ;;
3116             *-*-solaris*) 
3117                         AC_DEFINE(_REENTRANT)
3118                         if test "$SOLARIS_SUNPRO_CC"; then
3119                                 CFLAGS="$CFLAGS -mt" 
3120                                 CXXFLAGS="$CXXFLAGS -mt" 
3121                         fi
3122                         ;;
3123         esac
3124     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3127 dnl ========================================================
3128 dnl See if mmap sees writes
3129 dnl For cross compiling, just define it as no, which is a safe default
3130 dnl ========================================================
3131 AC_MSG_CHECKING(whether mmap() sees write()s)
3133 changequote(,)
3134 mmap_test_prog='
3135     #include <stdlib.h>
3136     #include <unistd.h>
3137     #include <sys/mman.h>
3138     #include <sys/types.h>
3139     #include <sys/stat.h>
3140     #include <fcntl.h>
3142     char fname[] = "conftest.file";
3143     char zbuff[1024]; /* Fractional page is probably worst case */
3145     int main() {
3146         char *map;
3147         int fd;
3148         int i;
3149         unlink(fname);
3150         fd = open(fname, O_RDWR | O_CREAT, 0660);
3151         if(fd<0) return 1;
3152         unlink(fname);
3153         write(fd, zbuff, sizeof(zbuff));
3154         lseek(fd, 0, SEEK_SET);
3155         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3156         if(map==(char*)-1) return 2;
3157         for(i=0; fname[i]; i++) {
3158             int rc = write(fd, &fname[i], 1);
3159             if(map[i]!=fname[i]) return 4;
3160         }
3161         return 0;
3162     }
3164 changequote([,])
3166 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3168 AC_MSG_RESULT("$result")
3170 if test "$result" = "no"; then
3171     AC_DEFINE(MMAP_MISSES_WRITES)
3175 dnl Checks for library functions.
3176 dnl ========================================================
3177 AC_PROG_GCC_TRADITIONAL
3178 AC_FUNC_MEMCMP
3180 AC_CHECK_FUNCS([fchmod flockfile getc_unlocked _getc_nolock getpagesize \
3181                 lchown localtime_r lstat64 memmove random rint sbrk snprintf \
3182                 stat64 statvfs statvfs64 strerror strtok_r truncate64])
3184 dnl Windows functions, for mingw.
3185 AC_TRY_LINK([#include <windows.h>],
3186              [SYSTEMTIME st;FILETIME ft;SystemTimeToFileTime(&st,&ft);],
3187              ac_cv_have_systemtimetofiletime="yes",
3188              ac_cv_have_systemtimetofiletime="no")
3189 if test "$ac_cv_have_systemtimetofiletime" = "yes"; then
3190     AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
3192 AC_TRY_LINK([#include <windows.h>],
3193              [FILETIME ft;GetSystemTimeAsFileTime(&ft);],
3194              ac_cv_have_getsystemtimeasfiletime="yes",
3195              ac_cv_have_getsystemtimeasfiletime="no")
3196 if test "$ac_cv_have_getsystemtimeasfiletime" = "yes"; then
3197     AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
3200 dnl check for wcrtomb/mbrtowc
3201 dnl =======================================================================
3202 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3203 AC_LANG_SAVE
3204 AC_LANG_CPLUSPLUS
3205 AC_CACHE_CHECK(for wcrtomb,
3206     ac_cv_have_wcrtomb,
3207     [AC_TRY_LINK([#include <wchar.h>],
3208                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3209                  ac_cv_have_wcrtomb="yes",
3210                  ac_cv_have_wcrtomb="no")])
3211 if test "$ac_cv_have_wcrtomb" = "yes"; then
3212     AC_DEFINE(HAVE_WCRTOMB)
3214 AC_CACHE_CHECK(for mbrtowc,
3215     ac_cv_have_mbrtowc,
3216     [AC_TRY_LINK([#include <wchar.h>],
3217                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3218                  ac_cv_have_mbrtowc="yes",
3219                  ac_cv_have_mbrtowc="no")])
3220 if test "$ac_cv_have_mbrtowc" = "yes"; then
3221     AC_DEFINE(HAVE_MBRTOWC)
3223 AC_LANG_RESTORE
3226 AC_CACHE_CHECK(
3227     [for res_ninit()],
3228     ac_cv_func_res_ninit,
3229     [AC_TRY_LINK([
3230         #ifdef linux
3231         #define _BSD_SOURCE 1
3232         #endif
3233         #include <resolv.h>
3234         ],
3235         [int foo = res_ninit(&_res);],
3236         [ac_cv_func_res_ninit=yes],
3237         [ac_cv_func_res_ninit=no])
3238     ])
3240 if test "$ac_cv_func_res_ninit" = "yes"; then
3241     AC_DEFINE(HAVE_RES_NINIT)
3242 dnl must add the link line we do something as foolish as this... dougt
3243 dnl else
3244 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3245 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3248 AC_LANG_CPLUSPLUS
3249 AC_CACHE_CHECK(
3250     [for gnu_get_libc_version()],
3251     ac_cv_func_gnu_get_libc_version,
3252     [AC_TRY_LINK([
3253         #ifdef HAVE_GNU_LIBC_VERSION_H
3254         #include <gnu/libc-version.h>
3255         #endif
3256         ],
3257         [const char *glibc_version = gnu_get_libc_version();],
3258         [ac_cv_func_gnu_get_libc_version=yes],
3259         [ac_cv_func_gnu_get_libc_version=no] 
3260         )]
3261     )
3263 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3264     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3267 case $target_os in
3268     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3269         ;;
3270     *)
3271     
3272 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3273     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3274         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3275 _SAVE_LIBS=$LIBS
3276 LIBS="$LIBS $_ICONV_LIBS"
3277 AC_CACHE_CHECK(
3278     [for iconv()],
3279     ac_cv_func_iconv,
3280     [AC_TRY_LINK([
3281         #include <stdlib.h>
3282         #include <iconv.h>
3283         ],
3284         [
3285             iconv_t h = iconv_open("", "");
3286             iconv(h, NULL, NULL, NULL, NULL);
3287             iconv_close(h);
3288         ],
3289         [ac_cv_func_iconv=yes],
3290         [ac_cv_func_iconv=no] 
3291         )]
3292     )
3293 if test "$ac_cv_func_iconv" = "yes"; then
3294     AC_DEFINE(HAVE_ICONV)
3295     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3296     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3297     LIBICONV="$_ICONV_LIBS"
3298     AC_CACHE_CHECK(
3299         [for iconv() with const input],
3300         ac_cv_func_const_iconv,
3301         [AC_TRY_COMPILE([
3302             #include <stdlib.h>
3303             #include <iconv.h>
3304             ],
3305             [
3306                 const char *input = "testing";
3307                 iconv_t h = iconv_open("", "");
3308                 iconv(h, &input, NULL, NULL, NULL);
3309                 iconv_close(h);
3310             ],
3311             [ac_cv_func_const_iconv=yes],
3312             [ac_cv_func_const_iconv=no] 
3313             )]
3314         )
3315     if test "$ac_cv_func_const_iconv" = "yes"; then
3316         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3317     fi
3319 LIBS=$_SAVE_LIBS
3321     ;;
3322 esac
3324 AC_LANG_C
3326 dnl **********************
3327 dnl *** va_copy checks ***
3328 dnl **********************
3329 dnl we currently check for all three va_copy possibilities, so we get
3330 dnl all results in config.log for bug reports.
3331 AC_MSG_CHECKING(for an implementation of va_copy())
3332 AC_CACHE_VAL(ac_cv_va_copy,[
3333     AC_TRY_RUN([
3334         #include <stdarg.h>
3335         void f (int i, ...) {
3336             va_list args1, args2;
3337             va_start (args1, i);
3338             va_copy (args2, args1);
3339             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3340                 exit (1);
3341             va_end (args1); va_end (args2);
3342         }
3343         int main() { f (0, 42); return 0; }],
3344         ac_cv_va_copy=yes,
3345         ac_cv_va_copy=no,
3346         ac_cv_va_copy=no
3347     )
3349 AC_MSG_RESULT($ac_cv_va_copy)
3350 AC_MSG_CHECKING(for an implementation of __va_copy())
3351 AC_CACHE_VAL(ac_cv___va_copy,[
3352     AC_TRY_RUN([
3353         #include <stdarg.h>
3354         void f (int i, ...) {
3355             va_list args1, args2;
3356             va_start (args1, i);
3357             __va_copy (args2, args1);
3358             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3359                 exit (1);
3360             va_end (args1); va_end (args2);
3361         }
3362         int main() { f (0, 42); return 0; }],
3363         ac_cv___va_copy=yes,
3364         ac_cv___va_copy=no,
3365         ac_cv___va_copy=no
3366     )
3368 AC_MSG_RESULT($ac_cv___va_copy)
3369 AC_MSG_CHECKING(whether va_lists can be copied by value)
3370 AC_CACHE_VAL(ac_cv_va_val_copy,[
3371     AC_TRY_RUN([
3372         #include <stdarg.h>
3373         void f (int i, ...) {
3374             va_list args1, args2;
3375             va_start (args1, i);
3376             args2 = args1;
3377             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3378                 exit (1);
3379             va_end (args1); va_end (args2);
3380         }
3381         int main() { f (0, 42); return 0; }],
3382         ac_cv_va_val_copy=yes,
3383         ac_cv_va_val_copy=no,
3384         ac_cv_va_val_copy=yes
3385     )
3387 if test "x$ac_cv_va_copy" = "xyes"; then
3388     AC_DEFINE(VA_COPY, va_copy)
3389     AC_DEFINE(HAVE_VA_COPY)
3390 elif test "x$ac_cv___va_copy" = "xyes"; then
3391     AC_DEFINE(VA_COPY, __va_copy)
3392     AC_DEFINE(HAVE_VA_COPY)
3395 if test "x$ac_cv_va_val_copy" = "xno"; then
3396    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3398 AC_MSG_RESULT($ac_cv_va_val_copy)
3400 dnl Check for dll-challenged libc's.
3401 dnl This check is apparently only needed for Linux.
3402 case "$target" in
3403         *-linux*)
3404             dnl ===================================================================
3405             _curdir=`pwd`
3406             export _curdir
3407             rm -rf conftest* _conftest
3408             mkdir _conftest
3409             cat >> conftest.C <<\EOF
3410 #include <stdio.h>
3411 #include <link.h>
3412 #include <dlfcn.h>
3413 #ifdef _dl_loaded
3414 void __dump_link_map(void) {
3415   struct link_map *map = _dl_loaded;
3416   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3418 int main() {
3419   dlopen("./conftest1.so",RTLD_LAZY);
3420   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3421   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3422   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3423   __dump_link_map();
3425 #else
3426 /* _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).*/
3427 int main() { printf("./conftest1.so\n"); }
3428 #endif
3431             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3433             cat >> conftest1.C <<\EOF
3434 #include <stdio.h>
3435 void foo(void) {printf("foo in dll called\n");}
3437             ${CXX-g++} -fPIC -c -g conftest1.C
3438             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3439             ${CXX-g++} -g conftest.C -o conftest -ldl
3440             cp -f conftest1.so conftest _conftest
3441             cd _conftest
3442             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3443             then
3444                 echo
3445                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3446                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3447                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3448                 echo "*** will be excessive memory usage at runtime."
3449                 echo
3450             fi
3451             cd ${_curdir}
3452             rm -rf conftest* _conftest
3453             dnl ===================================================================
3454             ;;
3455 esac
3457 dnl ===================================================================
3458 dnl ========================================================
3459 dnl By default, turn rtti and exceptions off on g++/egcs
3460 dnl ========================================================
3461 if test "$GNU_CXX"; then
3463   AC_MSG_CHECKING(for C++ exceptions flag)
3465   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3466   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3467   [echo "int main() { return 0; }" | cat > conftest.C
3469   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3471   if egrep "warning.*renamed" conftest.out >/dev/null; then
3472     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3473   else
3474     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3475   fi
3477   rm -f conftest*])
3479   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3480   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3481   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3484 dnl ========================================================
3485 dnl Put your C++ language/feature checks below
3486 dnl ========================================================
3487 AC_LANG_CPLUSPLUS
3489 HAVE_GCC3_ABI=
3490 if test "$GNU_CC"; then
3491   AC_CACHE_CHECK(for gcc 3.0 ABI,
3492       ac_cv_gcc_three_abi,
3493       [AC_TRY_COMPILE([],
3494                       [
3495 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3496   return 0;
3497 #else
3498 #error Not gcc3.
3499 #endif
3500                       ],
3501                       ac_cv_gcc_three_abi="yes",
3502                       ac_cv_gcc_three_abi="no")])
3503   if test "$ac_cv_gcc_three_abi" = "yes"; then
3504       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3505       HAVE_GCC3_ABI=1
3506   else
3507       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3508   fi
3510 AC_SUBST(HAVE_GCC3_ABI)
3513 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3514                ac_cv_cpp_explicit,
3515                [AC_TRY_COMPILE(class X {
3516                                public: explicit X(int i) : i_(i) {}
3517                                private: int i_;
3518                                };,
3519                                X x(3);,
3520                                ac_cv_cpp_explicit=yes,
3521                                ac_cv_cpp_explicit=no)])
3522 if test "$ac_cv_cpp_explicit" = yes ; then
3523    AC_DEFINE(HAVE_CPP_EXPLICIT)
3526 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3527                ac_cv_cpp_typename,
3528                [AC_TRY_COMPILE(class param {
3529                                public:
3530                                    typedef unsigned long num_type;
3531                                };
3533                                template <class T> class tplt {
3534                                public:
3535                                    typedef typename T::num_type t_num_type;
3536                                    t_num_type foo(typename T::num_type num) {
3537                                        return num;
3538                                    }
3539                                };,
3540                                tplt<param> A;
3541                                A.foo(0);,
3542                                ac_cv_cpp_typename=yes,
3543                                ac_cv_cpp_typename=no)])
3544 if test "$ac_cv_cpp_typename" = yes ; then
3545    AC_DEFINE(HAVE_CPP_TYPENAME)
3548 dnl Check for support of modern template specialization syntax
3549 dnl Test code and requirement from scc@netscape.com.
3550 dnl Autoconf cut-and-paste job by waterson@netscape.com
3551 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3552                ac_cv_cpp_modern_specialize_template_syntax,
3553                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3554                                class Y {};
3555                                template <> struct X<Y> { double a; };,
3556                                X<int> int_x;
3557                                X<Y> y_x;,
3558                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3559                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3560 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3561   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3565 dnl Some compilers support only full specialization, and some don't.
3566 AC_CACHE_CHECK(whether partial template specialization works,
3567                ac_cv_cpp_partial_specialization,
3568                [AC_TRY_COMPILE(template <class T> class Foo {};
3569                                template <class T> class Foo<T*> {};,
3570                                return 0;,
3571                                ac_cv_cpp_partial_specialization=yes,
3572                                ac_cv_cpp_partial_specialization=no)])
3573 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3574   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3577 dnl Some compilers have limited support for operators with templates;
3578 dnl specifically, it is necessary to define derived operators when a base
3579 dnl class's operator declaration should suffice.
3580 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3581                ac_cv_need_derived_template_operators,
3582                [AC_TRY_COMPILE([template <class T> class Base { };
3583                                 template <class T>
3584                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3585                                 template <class T> class Derived : public Base<T> { };],
3586                                [Derived<char> a, b;
3587                                 Base<char> c = a + b;
3588                                 return 0;],
3589                                ac_cv_need_derived_template_operators=no,
3590                                ac_cv_need_derived_template_operators=yes)])
3591 if test "$ac_cv_need_derived_template_operators" = yes ; then
3592   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3596 dnl Some compilers have trouble detecting that a template class
3597 dnl that derives from another template is actually an instance
3598 dnl of the base class. This test checks for that.
3599 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3600                ac_cv_need_cpp_template_cast_to_base,
3601                [AC_TRY_COMPILE([template <class T> class Base { };
3602                                 template <class T> class Derived : public Base<T> { };
3603                                 template <class T> int foo(const Base<T>&) { return 0; }],
3604                                [Derived<char> bar; return foo(bar);],
3605                                ac_cv_need_cpp_template_cast_to_base=no,
3606                                ac_cv_need_cpp_template_cast_to_base=yes)])
3607 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3608   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3611 dnl Some compilers have trouble resolving the ambiguity between two
3612 dnl functions whose arguments differ only by cv-qualifications.
3613 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3614                ac_cv_can_resolve_const_ambiguity,
3615                [AC_TRY_COMPILE([
3616                                 template <class T> class ptrClass {
3617                                   public: T* ptr;
3618                                 };
3620                                 template <class T> T* a(ptrClass<T> *arg) {
3621                                   return arg->ptr;
3622                                 }
3624                                 template <class T>
3625                                 const T* a(const ptrClass<T> *arg) {
3626                                   return arg->ptr;
3627                                 }
3628                                ],
3629                                [ ptrClass<int> i;
3630                                  a(&i); ],
3631                                ac_cv_can_resolve_const_ambiguity=yes,
3632                                ac_cv_can_resolve_const_ambiguity=no)])
3633 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3634   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3638 dnl We don't do exceptions on unix.  The only reason this used to be here
3639 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3640 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3641 dnl So im commenting this out until someone writes some artificial 
3642 dnl intelligence to detect not only if the compiler has exceptions, but if 
3643 dnl they are enabled as well.
3644 dnl 
3645 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3646 dnl                ac_cv_cpp_exceptions,
3647 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3648 dnl                                static void F() { throw X(); },
3649 dnl                                try { F(); } catch(X & e) { },
3650 dnl                                ac_cv_cpp_exceptions=yes,
3651 dnl                                ac_cv_cpp_exceptions=no)])
3652 dnl if test $ac_cv_cpp_exceptions = yes ; then
3653 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3654 dnl fi
3656 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3657 dnl supports it well enough to allow us to use it to change access, but not
3658 dnl to resolve ambiguity. The next two tests determine how well the |using|
3659 dnl keyword is supported.
3661 dnl Check to see if we can change access with |using|.  Test both a
3662 dnl legal and an illegal example.
3663 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3664                ac_cv_cpp_access_changing_using2,
3665                [AC_TRY_COMPILE(
3666                    class A { protected: int foo() { return 0; } };
3667                    class B : public A { public: using A::foo; };,
3668                    B b; return b.foo();,
3669                    [AC_TRY_COMPILE(
3670                        class A { public: int foo() { return 1; } };
3671                        class B : public A { private: using A::foo; };,
3672                        B b; return b.foo();,
3673                        ac_cv_cpp_access_changing_using2=no,
3674                        ac_cv_cpp_access_changing_using2=yes)],
3675                    ac_cv_cpp_access_changing_using2=no)])
3676 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3677    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3680 dnl Check to see if we can resolve ambiguity with |using|.
3681 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3682                ac_cv_cpp_ambiguity_resolving_using,
3683                [AC_TRY_COMPILE(class X { 
3684                                  public: int go(const X&) {return 3;}
3685                                          int jo(const X&) {return 3;}
3686                                };
3687                                class Y : public X {
3688                                  public:  int go(int) {return 2;}
3689                                           int jo(int) {return 2;}
3690                                           using X::jo;
3691                                  private: using X::go;
3692                                };,
3693                                X x; Y y; y.jo(x);,
3694                                ac_cv_cpp_ambiguity_resolving_using=yes,
3695                                ac_cv_cpp_ambiguity_resolving_using=no)])
3696 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3697    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3700 dnl Check to see if the |std| namespace is supported. If so, we'll want
3701 dnl to qualify any standard library calls with "std::" to ensure that
3702 dnl those functions can be resolved.
3703 AC_CACHE_CHECK(for \"std::\" namespace,
3704                ac_cv_cpp_namespace_std,
3705                [AC_TRY_COMPILE([#include <algorithm>],
3706                                [return std::min(0, 1);],
3707                                ac_cv_cpp_namespace_std=yes,
3708                                ac_cv_cpp_namespace_std=no)])
3709 if test "$ac_cv_cpp_namespace_std" = yes ; then
3710    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3713 dnl Older compilers are overly ambitious with respect to using the standard
3714 dnl template library's |operator!=()| when |operator==()| is defined. In
3715 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3716 dnl ambiguity at compile-time. This test checks for that case.
3717 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3718                ac_cv_cpp_unambiguous_std_notequal,
3719                [AC_TRY_COMPILE([#include <algorithm>
3720                                 struct T1 {};
3721                                 int operator==(const T1&, const T1&) { return 0; }
3722                                 int operator!=(const T1&, const T1&) { return 0; }],
3723                                [T1 a,b; return a != b;],
3724                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3725                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3726 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3727   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3731 AC_CACHE_CHECK(for C++ reinterpret_cast,
3732                ac_cv_cpp_reinterpret_cast,
3733                [AC_TRY_COMPILE(struct X { int i; };
3734                                struct Y { int i; };,
3735                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3736                                ac_cv_cpp_reinterpret_cast=yes,
3737                                ac_cv_cpp_reinterpret_cast=no)])
3738 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3739    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3742 dnl See if a dynamic_cast to void* gives the most derived object.
3743 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3744                ac_cv_cpp_dynamic_cast_void_ptr,
3745                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3746                             class Y { int j; public: virtual ~Y() { } };
3747                             class Z : public X, public Y { int k; };
3749                             int main() {
3750                                  Z mdo;
3751                                  X *subx = (X*)&mdo;
3752                                  Y *suby = (Y*)&mdo;
3753                                  return !((((void*)&mdo != (void*)subx) &&
3754                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3755                                           (((void*)&mdo != (void*)suby) &&
3756                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3757                             }],
3758                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3759                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3760                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3761 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3762    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3766 dnl note that this one is reversed - if the test fails, then
3767 dnl we require implementations of unused virtual methods. Which
3768 dnl really blows because it means we'll have useless vtable
3769 dnl bloat.
3770 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3771                ac_cv_cpp_unused_required,
3772                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3773                                X x;,
3774                                ac_cv_cpp_unused_required=no,
3775                                ac_cv_cpp_unused_required=yes)])
3776 if test "$ac_cv_cpp_unused_required" = yes ; then
3777    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3781 dnl Some compilers have trouble comparing a constant reference to a templatized
3782 dnl class to zero, and require an explicit operator==() to be defined that takes
3783 dnl an int. This test separates the strong from the weak.
3785 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3786                ac_cv_trouble_comparing_to_zero,
3787                [AC_TRY_COMPILE([#include <algorithm>
3788                                 template <class T> class Foo {};
3789                                 class T2;
3790                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3791                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3792                                [Foo<int> f; return (0 != f);],
3793                                ac_cv_trouble_comparing_to_zero=no,
3794                                ac_cv_trouble_comparing_to_zero=yes)])
3795 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3796   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3801 dnl End of C++ language/feature checks
3802 AC_LANG_C
3804 dnl ========================================================
3805 dnl =  Internationalization checks
3806 dnl ========================================================
3808 dnl Internationalization and Locale support is different
3809 dnl on various UNIX platforms.  Checks for specific i18n
3810 dnl features go here.
3812 dnl check for LC_MESSAGES
3813 AC_CACHE_CHECK(for LC_MESSAGES,
3814                 ac_cv_i18n_lc_messages,
3815                 [AC_TRY_COMPILE([#include <locale.h>],
3816                                 [int category = LC_MESSAGES;],
3817                                 ac_cv_i18n_lc_messages=yes,
3818                                 ac_cv_i18n_lc_messages=no)])
3819 if test "$ac_cv_i18n_lc_messages" = yes; then
3820    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3821 fi      
3823 fi # SKIP_COMPILER_CHECKS
3825 TARGET_XPCOM_ABI=
3826 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3827     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3830 dnl Mozilla specific options
3831 dnl ========================================================
3832 dnl The macros used for command line options
3833 dnl are defined in build/autoconf/altoptions.m4.
3836 dnl ========================================================
3837 dnl =
3838 dnl = Check for external package dependencies
3839 dnl =
3840 dnl ========================================================
3841 MOZ_ARG_HEADER(External Packages)
3843 dnl ========================================================
3844 dnl = Find the right NSPR to use.
3845 dnl ========================================================
3846 MOZ_ARG_WITH_BOOL(system-nspr,
3847 [  --with-system-nspr      Use an NSPR that is already built and installed.
3848                           Use the 'nspr-config' script in the current path,
3849                           or look for the script in the directories given with
3850                           --with-nspr-exec-prefix or --with-nspr-prefix.
3851                           (Those flags are only checked if you specify
3852                           --with-system-nspr.)],
3853     _USE_SYSTEM_NSPR=1 )
3855 MOZ_ARG_WITH_STRING(nspr-cflags,
3856 [  --with-nspr-cflags=FLAGS Pass FLAGS to CC when building code that uses NSPR.
3857                           Use this when there's no accurate nspr-config
3858                           script available.  This is the case when building
3859                           SpiderMonkey as part of the Mozilla tree: the
3860                           top-level configure script computes NSPR flags
3861                           that accomodate the quirks of that environment.],
3862     NSPR_CFLAGS=$withval)
3863 MOZ_ARG_WITH_STRING(nspr-libs,
3864 [  --with-nspr-libs=LIBS   Pass LIBS to LD when linking code that uses NSPR.
3865                           See --with-nspr-cflags for more details.],
3866     NSPR_LIBS=$withval)
3867 AC_SUBST(NSPR_CFLAGS)
3868 AC_SUBST(NSPR_LIBS)
3870 dnl Pass either --with-system-nspr or (--with-nspr-cflags and
3871 dnl --with-nspr-libs), but not both.
3872 if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" || test "$NSPR_LIBS"); then
3873     AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive.
3874 See 'configure --help'.])
3877 if test -n "$_USE_SYSTEM_NSPR"; then
3878     MOZ_NATIVE_NSPR=
3879     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1])
3880     if test -z "$MOZ_NATIVE_NSPR"; then
3881         AC_MSG_ERROR([--with-system-nspr given, but configure could not find a suitable NSPR.
3882 Pass --with-nspr-exec-prefix, --with-nspr-prefix, or --with-nspr-cflags/libs.
3883 See 'configure --help'.])
3884     fi
3887 if test -n "$MOZ_NATIVE_NSPR"; then
3888     _SAVE_CFLAGS=$CFLAGS
3889     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3890     AC_TRY_COMPILE([#include "prlog.h"],
3891                 [#ifndef PR_STATIC_ASSERT
3892                  #error PR_STATIC_ASSERT not defined
3893                  #endif],
3894                 [MOZ_NATIVE_NSPR=1],
3895                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
3896     CFLAGS=$_SAVE_CFLAGS
3899 dnl ========================================================
3900 dnl Use ARM userspace kernel helpers; tell NSPR to enable
3901 dnl their usage and use them in spidermonkey.
3902 dnl ========================================================
3903 MOZ_ARG_WITH_BOOL(arm-kuser,
3904 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
3905     USE_ARM_KUSER=1,
3906     USE_ARM_KUSER=)
3907 if test -n "$USE_ARM_KUSER"; then
3908    AC_DEFINE(USE_ARM_KUSER)
3911 dnl ========================================================
3912 dnl =
3913 dnl = Application
3914 dnl =
3915 dnl ========================================================
3917 MOZ_ARG_HEADER(Application)
3919 BUILD_STATIC_LIBS=
3920 ENABLE_TESTS=1
3921 MOZ_DBGRINFO_MODULES=
3923 dnl ========================================================
3924 dnl =
3925 dnl = Components & Features
3926 dnl = 
3927 dnl ========================================================
3928 MOZ_ARG_HEADER(Components and Features)
3930 dnl ========================================================
3931 dnl = Localization
3932 dnl ========================================================
3933 MOZ_ARG_ENABLE_STRING(ui-locale,
3934 [  --enable-ui-locale=ab-CD
3935                           Select the user interface locale (default: en-US)],
3936     MOZ_UI_LOCALE=$enableval )
3937 AC_SUBST(MOZ_UI_LOCALE)
3939 dnl ========================================================
3940 dnl build the tests by default
3941 dnl ========================================================
3942 MOZ_ARG_DISABLE_BOOL(tests,
3943 [  --disable-tests         Do not build test libraries & programs],
3944     ENABLE_TESTS=,
3945     ENABLE_TESTS=1 )
3947 dnl ========================================================
3948 dnl =
3949 dnl = Module specific options
3950 dnl =
3951 dnl ========================================================
3952 MOZ_ARG_HEADER(Individual module options)
3954 dnl ========================================================
3955 dnl =
3956 dnl = Debugging Options
3957 dnl = 
3958 dnl ========================================================
3959 MOZ_ARG_HEADER(Debugging and Optimizations)
3961 dnl ========================================================
3962 dnl = Disable building with debug info.
3963 dnl = Debugging is OFF by default
3964 dnl ========================================================
3965 if test -z "$MOZ_DEBUG_FLAGS"
3966 then
3967     case "$target" in
3968     *-irix*)
3969         if test "$GNU_CC"; then
3970             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
3971             case "$GCC_VERSION" in
3972             2.95.*)
3973                 MOZ_DEBUG_FLAGS=""
3974                 ;;
3975             *)
3976                 MOZ_DEBUG_FLAGS="-g"
3977                 ;;
3978             esac
3979         else
3980             MOZ_DEBUG_FLAGS="-g"
3981         fi
3982         ;;
3983     *)
3984         MOZ_DEBUG_FLAGS="-g"
3985         ;;
3986     esac
3989 MOZ_ARG_ENABLE_STRING(debug,
3990 [  --enable-debug[=DBG]    Enable building with developer debug info
3991                           (Using compiler flags DBG)],
3992 [ if test "$enableval" != "no"; then
3993     MOZ_DEBUG=1
3994     if test -n "$enableval" && test "$enableval" != "yes"; then
3995         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
3996     fi
3997   else
3998     MOZ_DEBUG=
3999   fi ],
4000   MOZ_DEBUG=)
4002 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
4003  case "${target_os}" in
4004     beos*)
4005         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
4006         ;;
4007     msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
4008         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
4009         ;;
4010     *) 
4011         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
4012         ;;
4013   esac
4014 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
4016 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
4018 if test -n "$MOZ_DEBUG"; then
4019     AC_MSG_CHECKING([for valid debug flags])
4020     _SAVE_CFLAGS=$CFLAGS
4021     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
4022     AC_TRY_COMPILE([#include <stdio.h>], 
4023         [printf("Hello World\n");],
4024         _results=yes,
4025         _results=no)
4026     AC_MSG_RESULT([$_results])
4027     if test "$_results" = "no"; then
4028         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
4029     fi
4030     CFLAGS=$_SAVE_CFLAGS
4033 dnl ========================================================
4034 dnl = Enable code optimization. ON by default.
4035 dnl ========================================================
4036 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
4037         MOZ_OPTIMIZE_FLAGS="-O"
4040 MOZ_ARG_ENABLE_STRING(optimize,
4041 [  --disable-optimize      Disable compiler optimization
4042   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
4043 [ if test "$enableval" != "no"; then
4044     MOZ_OPTIMIZE=1
4045     if test -n "$enableval" && test "$enableval" != "yes"; then
4046         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
4047         MOZ_OPTIMIZE=2
4048     fi
4049 else
4050     MOZ_OPTIMIZE=
4051 fi ], MOZ_OPTIMIZE=1)
4053 if test "$COMPILE_ENVIRONMENT"; then
4054 if test -n "$MOZ_OPTIMIZE"; then
4055     AC_MSG_CHECKING([for valid optimization flags])
4056     _SAVE_CFLAGS=$CFLAGS
4057     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
4058     AC_TRY_COMPILE([#include <stdio.h>], 
4059         [printf("Hello World\n");],
4060         _results=yes,
4061         _results=no)
4062     AC_MSG_RESULT([$_results])
4063     if test "$_results" = "no"; then
4064         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
4065     fi
4066     CFLAGS=$_SAVE_CFLAGS
4068 fi # COMPILE_ENVIRONMENT
4070 AC_SUBST(MOZ_OPTIMIZE)
4071 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
4072 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
4073 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
4075 dnl ========================================================
4076 dnl = Enable/disable debug for specific modules only
4077 dnl =   module names beginning with ^ will be disabled 
4078 dnl ========================================================
4079 MOZ_ARG_ENABLE_STRING(debug-modules,
4080 [  --enable-debug-modules  Enable/disable debug info for specific modules],
4081 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
4083 dnl ========================================================
4084 dnl = Enable/disable generation of debugger info for specific modules only
4085 dnl =    the special module name ALL_MODULES can be used to denote all modules
4086 dnl =    module names beginning with ^ will be disabled
4087 dnl ========================================================
4088 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
4089 [  --enable-debugger-info-modules
4090                           Enable/disable debugger info for specific modules],
4091 [ for i in `echo $enableval | sed 's/,/ /g'`; do
4092       dnl note that the list of module names is reversed as it is copied
4093       dnl this is important, as it will allow config.mk to interpret stuff like
4094       dnl "^ALL_MODULES xpcom" properly
4095       if test "$i" = "no"; then
4096         i="^ALL_MODULES"
4097       fi
4098       if test "$i" = "yes"; then
4099         i="ALL_MODULES"
4100       fi
4101       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
4102     done ])
4104 dnl ========================================================
4105 dnl Enable Narcissus
4106 dnl ========================================================
4107 MOZ_ARG_ENABLE_BOOL(narcissus,
4108 [  --enable-narcissus          Build with Narcissus code enabled],
4109     NARCISSUS=1,
4110     NARCISSUS= )
4111 if test -n "$NARCISSUS"; then
4112     AC_DEFINE(NARCISSUS)
4115 dnl ========================================================
4116 dnl = Enable trace malloc
4117 dnl ========================================================
4118 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
4119 MOZ_ARG_ENABLE_BOOL(trace-malloc,
4120 [  --enable-trace-malloc   Enable malloc tracing],
4121     NS_TRACE_MALLOC=1,
4122     NS_TRACE_MALLOC= )
4123 if test "$NS_TRACE_MALLOC"; then
4124   # Please, Mr. Linker Man, don't take away our symbol names
4125   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4126   AC_DEFINE(NS_TRACE_MALLOC)
4128 AC_SUBST(NS_TRACE_MALLOC)
4130 dnl ========================================================
4131 dnl = Enable jemalloc
4132 dnl ========================================================
4133 MOZ_ARG_ENABLE_BOOL(jemalloc,
4134 [  --enable-jemalloc       Replace memory allocator with jemalloc],
4135     MOZ_MEMORY=1,
4136     MOZ_MEMORY=)
4138 if test "$NS_TRACE_MALLOC"; then
4139     MOZ_MEMORY=
4142 if test "$MOZ_MEMORY"; then
4144   dnl Don't try to run compiler tests on Windows  
4145   if test "$OS_ARCH" = "WINNT"; then
4146     if test -z "$HAVE_64BIT_OS"; then
4147       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4148     else
4149       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4150     fi
4151   else
4152     AC_CHECK_SIZEOF([int *], [4])
4153     case "${ac_cv_sizeof_int_p}" in
4154     4)
4155       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4156       ;;
4157     8)
4158       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4159       ;;
4160     *)
4161       AC_MSG_ERROR([Unexpected pointer size])
4162       ;;
4163     esac
4164   fi
4166   AC_DEFINE(MOZ_MEMORY)
4167   if test "x$MOZ_DEBUG" = "x1"; then
4168     AC_DEFINE(MOZ_MEMORY_DEBUG)
4169   fi
4170   dnl The generic feature tests that determine how to compute ncpus are long and
4171   dnl complicated.  Therefore, simply define special cpp variables for the
4172   dnl platforms we have special knowledge of.
4173   case "${target_os}" in
4174   darwin*)
4175     AC_DEFINE(MOZ_MEMORY_DARWIN)
4176     ;;
4177   *freebsd*)
4178     AC_DEFINE(MOZ_MEMORY_BSD)
4179     ;;
4180   *linux*)
4181     AC_DEFINE(MOZ_MEMORY_LINUX)
4182     ;;
4183   netbsd*)
4184     AC_DEFINE(MOZ_MEMORY_BSD)
4185     ;;
4186   solaris*)
4187     AC_DEFINE(MOZ_MEMORY_SOLARIS)
4188     ;;
4189   msvc*|mks*|cygwin*|mingw*)
4190     AC_DEFINE(MOZ_MEMORY_WINDOWS)
4191     # the interesting bits will get passed down in MOZ_MEMORY_LDFLAGS
4192     ;;
4193   *wince|*winmo)
4194     AC_DEFINE(MOZ_MEMORY_WINCE)
4195     AC_DEFINE(MOZ_MEMORY_WINDOWS)
4196     ;;
4197   *)
4198     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
4199     ;;
4200   esac
4202 AC_SUBST(MOZ_MEMORY)
4203 AC_SUBST(MOZ_MEMORY_LDFLAGS)
4205 dnl ========================================================
4206 dnl = Use malloc wrapper lib
4207 dnl ========================================================
4208 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
4209 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
4210     _WRAP_MALLOC=1,
4211     _WRAP_MALLOC= )
4213 if test -n "$_WRAP_MALLOC"; then
4214     if test "$GNU_CC"; then
4215     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"
4216     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
4217     fi
4220 dnl ========================================================
4221 dnl = Location of malloc wrapper lib
4222 dnl ========================================================
4223 MOZ_ARG_WITH_STRING(wrap-malloc,
4224 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
4225     WRAP_MALLOC_LIB=$withval)
4227 dnl ========================================================
4228 dnl = Use TraceVis
4229 dnl ========================================================
4230 MOZ_ARG_ENABLE_BOOL(tracevis,
4231 [  --enable-tracevis       Enable TraceVis tracing tool (default=no)],
4232     MOZ_TRACEVIS=1,
4233     MOZ_TRACEVIS= )
4234 if test -n "$MOZ_TRACEVIS"; then
4235     AC_DEFINE(MOZ_TRACEVIS)
4236     if test -z "$ENABLE_TRACEJIT"; then
4237        AC_MSG_ERROR([--enable-tracevis is incompatible with --disable-tracejit])
4238     fi
4242 dnl ========================================================
4243 dnl = Use Valgrind
4244 dnl ========================================================
4245 MOZ_ARG_ENABLE_BOOL(valgrind,
4246 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
4247     MOZ_VALGRIND=1,
4248     MOZ_VALGRIND= )
4249 if test -n "$MOZ_VALGRIND"; then
4250     AC_CHECK_HEADER([valgrind/valgrind.h], [],
4251         AC_MSG_ERROR(
4252             [--enable-valgrind specified but Valgrind is not installed]))
4253     AC_DEFINE(MOZ_VALGRIND)
4256 dnl ========================================================
4257 dnl jprof
4258 dnl ========================================================
4259 MOZ_ARG_ENABLE_BOOL(jprof,
4260 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
4261     MOZ_JPROF=1,
4262     MOZ_JPROF= )
4263 if test -n "$MOZ_JPROF"; then
4264     AC_DEFINE(MOZ_JPROF)
4267 dnl ========================================================
4268 dnl shark
4269 dnl ========================================================
4270 MOZ_ARG_ENABLE_BOOL(shark,
4271 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
4272     MOZ_SHARK=1,
4273     MOZ_SHARK= )
4274 if test -n "$MOZ_SHARK"; then
4275     AC_DEFINE(MOZ_SHARK)
4278 dnl ========================================================
4279 dnl callgrind
4280 dnl ========================================================
4281 MOZ_ARG_ENABLE_BOOL(callgrind,
4282 [  --enable-callgrind      Enable callgrind profiling],
4283     MOZ_CALLGRIND=1,
4284     MOZ_CALLGRIND= )
4285 if test -n "$MOZ_CALLGRIND"; then
4286     AC_DEFINE(MOZ_CALLGRIND)
4289 dnl ========================================================
4290 dnl vtune
4291 dnl ========================================================
4292 MOZ_ARG_ENABLE_BOOL(vtune,
4293 [  --enable-vtune          Enable vtune profiling],
4294     MOZ_VTUNE=1,
4295     MOZ_VTUNE= )
4296 if test -n "$MOZ_VTUNE"; then
4297     AC_DEFINE(MOZ_VTUNE)
4300 dnl ========================================================
4301 dnl Zealous GC
4302 dnl ========================================================
4303 MOZ_ARG_ENABLE_BOOL(gczeal,
4304 [  --enable-gczeal          Enable zealous GCing],
4305     JS_GC_ZEAL=1,
4306     JS_GC_ZEAL= )
4307 if test -n "$JS_GC_ZEAL"; then
4308     AC_DEFINE(JS_GC_ZEAL)
4311 dnl ========================================================
4312 dnl = Enable static checking using gcc-dehydra
4313 dnl ========================================================
4315 MOZ_ARG_WITH_STRING(static-checking,
4316 [  --with-static-checking=path/to/gcc_dehydra.so
4317                             Enable static checking of code using GCC-dehydra],
4318     DEHYDRA_PATH=$withval,
4319     DEHYDRA_PATH= )
4321 if test -n "$DEHYDRA_PATH"; then
4322     if test ! -f "$DEHYDRA_PATH"; then
4323         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
4324     fi
4325     AC_DEFINE(NS_STATIC_CHECKING)
4327 AC_SUBST(DEHYDRA_PATH)
4329 dnl ========================================================
4330 dnl = Enable stripping of libs & executables
4331 dnl ========================================================
4332 MOZ_ARG_ENABLE_BOOL(strip,
4333 [  --enable-strip          Enable stripping of libs & executables ],
4334     ENABLE_STRIP=1,
4335     ENABLE_STRIP= )
4337 dnl ========================================================
4338 dnl = Enable stripping of libs & executables when packaging
4339 dnl ========================================================
4340 MOZ_ARG_ENABLE_BOOL(install-strip,
4341 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
4342     PKG_SKIP_STRIP= ,
4343     PKG_SKIP_STRIP=1)
4345 dnl ========================================================
4346 dnl = 
4347 dnl = Profiling and Instrumenting
4348 dnl = 
4349 dnl ========================================================
4350 MOZ_ARG_HEADER(Profiling and Instrumenting)
4352 dnl ========================================================
4353 dnl = Enable timeline service, which provides lightweight
4354 dnl = instrumentation of mozilla for performance measurement.
4355 dnl = Timeline is off by default.
4356 dnl ========================================================
4357 MOZ_ARG_ENABLE_BOOL(timeline,
4358 [  --enable-timeline       Enable timeline services ],
4359     MOZ_TIMELINE=1,
4360     MOZ_TIMELINE= )
4361 if test -n "$MOZ_TIMELINE"; then
4362     AC_DEFINE(MOZ_TIMELINE)
4365 MOZ_ARG_ENABLE_BOOL(insure,
4366 [  --enable-insure         Enable insure++ instrumentation (linux only)],
4367     _ENABLE_INSURE=1,
4368     _ENABLE_INSURE= )
4369 if test -n "$_ENABLE_INSURE"; then
4370     MOZ_INSURE="insure"
4371     MOZ_INSURIFYING=1
4372     MOZ_INSURE_DIRS="."
4373     MOZ_INSURE_EXCLUDE_DIRS="config"
4376 MOZ_ARG_WITH_STRING(insure-dirs,
4377 [  --with-insure-dirs=DIRS
4378                           Dirs to instrument with insure ],
4379     MOZ_INSURE_DIRS=$withval )
4381 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
4382 [  --with-insure-exclude-dirs=DIRS
4383                           Dirs to not instrument with insure ],
4384     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
4386 dnl ========================================================
4387 dnl = Support for Quantify (Windows)
4388 dnl ========================================================
4389 MOZ_ARG_ENABLE_BOOL(quantify,
4390 [  --enable-quantify      Enable Quantify support (Windows only) ],
4391     MOZ_QUANTIFY=1,
4392     MOZ_QUANTIFY= )
4394 dnl ========================================================
4395 dnl = Support for demangling undefined symbols
4396 dnl ========================================================
4397 if test -z "$SKIP_LIBRARY_CHECKS"; then
4398     AC_LANG_SAVE
4399     AC_LANG_CPLUSPLUS
4400     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4401     AC_LANG_RESTORE
4404 # Demangle only for debug or trace-malloc builds
4405 MOZ_DEMANGLE_SYMBOLS=
4406 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
4407     MOZ_DEMANGLE_SYMBOLS=1
4408     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4410 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4412 dnl ========================================================
4413 dnl = Support for gcc stack unwinding (from gcc 3.3)
4414 dnl ========================================================
4415 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
4416     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
4419 dnl ========================================================
4420 dnl =
4421 dnl = Misc. Options
4422 dnl = 
4423 dnl ========================================================
4424 MOZ_ARG_HEADER(Misc. Options)
4426 dnl ========================================================
4427 dnl update xterm title
4428 dnl ========================================================
4429 MOZ_ARG_ENABLE_BOOL(xterm-updates,
4430 [  --enable-xterm-updates  Update XTERM titles with current command.],
4431     MOZ_UPDATE_XTERM=1,
4432     MOZ_UPDATE_XTERM= )
4434 if test -z "$SKIP_COMPILER_CHECKS"; then
4435 dnl ========================================================
4436 dnl =
4437 dnl = Compiler Options
4438 dnl = 
4439 dnl ========================================================
4440 MOZ_ARG_HEADER(Compiler Options)
4442 dnl ========================================================
4443 dnl Check for gcc -pipe support
4444 dnl ========================================================
4445 AC_MSG_CHECKING([for gcc -pipe support])
4446 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
4447     echo '#include <stdio.h>' > dummy-hello.c
4448     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
4449     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
4450     cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
4451     if test $? = 0; then
4452         _res_as_stdin="yes"
4453     else
4454         _res_as_stdin="no"
4455     fi
4456     if test "$_res_as_stdin" = "yes"; then
4457         _SAVE_CFLAGS=$CFLAGS
4458         CFLAGS="$CFLAGS -pipe"
4459         AC_TRY_COMPILE( [ #include <stdio.h> ],
4460             [printf("Hello World\n");],
4461             [_res_gcc_pipe="yes"],
4462             [_res_gcc_pipe="no"] )
4463         CFLAGS=$_SAVE_CFLAGS
4464     fi
4465     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
4466         _res="yes";
4467         CFLAGS="$CFLAGS -pipe"
4468         CXXFLAGS="$CXXFLAGS -pipe"
4469     else
4470         _res="no"
4471     fi
4472     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
4473     AC_MSG_RESULT([$_res])
4474 else
4475     AC_MSG_RESULT([no])
4478 dnl pass -Wno-long-long to the compiler
4479 MOZ_ARG_ENABLE_BOOL(long-long-warning,
4480 [  --enable-long-long-warning 
4481                           Warn about use of non-ANSI long long type],
4482     _IGNORE_LONG_LONG_WARNINGS=,
4483     _IGNORE_LONG_LONG_WARNINGS=1)
4485 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
4486      _SAVE_CFLAGS="$CFLAGS"
4487      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
4488      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
4489      AC_TRY_COMPILE([], [return(0);], 
4490         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
4491           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
4492           result="yes" ], result="no")
4493      AC_MSG_RESULT([$result])
4494      CFLAGS="$_SAVE_CFLAGS"
4497 dnl ========================================================
4498 dnl Profile guided optimization
4499 dnl ========================================================
4500 dnl Test for profiling options
4501 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
4502 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
4504 dnl Provide a switch to disable PGO even when called via profiledbuild.
4505 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
4506 [  --disable-profile-guided-optimization
4507                            Don't build with PGO even if called via make profiledbuild],
4508 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
4509 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
4511 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
4513 _SAVE_CFLAGS="$CFLAGS"
4514 CFLAGS="$CFLAGS -fprofile-generate"
4516 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
4517 AC_TRY_COMPILE([], [return 0;],
4518                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
4519                  result="yes" ], result="no")
4520 AC_MSG_RESULT([$result])
4522 if test $result = "yes"; then
4523   PROFILE_GEN_LDFLAGS="-fprofile-generate"
4524   PROFILE_USE_CFLAGS="-fprofile-use"
4525   PROFILE_USE_LDFLAGS="-fprofile-use"
4526 else
4527   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
4528   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
4529   AC_TRY_COMPILE([], [return 0;],
4530                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
4531                    result="yes" ], result="no")
4532   AC_MSG_RESULT([$result])
4533   if test $result = "yes"; then
4534     PROFILE_USE_CFLAGS="-fbranch-probabilities"
4535   fi
4536   # don't really care, this is an old GCC
4537   PROFILE_GEN_LDFLAGS=
4538   PROFILE_USE_LDFLAGS=
4541 CFLAGS="$_SAVE_CFLAGS"
4543 if test -n "$INTEL_CC"; then
4544   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
4545   PROFILE_GEN_LDFLAGS=
4546   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
4547   PROFILE_USE_LDFLAGS=
4550 dnl Sun Studio on Solaris
4551 if test "$SOLARIS_SUNPRO_CC"; then
4552   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
4553   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
4554   if test "$CPU_ARCH" != "sparc"; then
4555     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
4556     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
4557   else
4558     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
4559     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
4560   fi
4563 AC_SUBST(PROFILE_GEN_CFLAGS)
4564 AC_SUBST(PROFILE_GEN_LDFLAGS)
4565 AC_SUBST(PROFILE_USE_CFLAGS)
4566 AC_SUBST(PROFILE_USE_LDFLAGS)
4568 AC_LANG_CPLUSPLUS
4570 dnl ========================================================
4571 dnl Test for -pedantic bustage
4572 dnl ========================================================
4573 MOZ_ARG_DISABLE_BOOL(pedantic,
4574 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
4575 _PEDANTIC= )
4576 if test "$_PEDANTIC"; then
4577     _SAVE_CXXFLAGS=$CXXFLAGS
4578     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
4579     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
4580     AC_TRY_COMPILE([$configure_static_assert_macros],
4581                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
4582                    result="no", result="yes" )
4583     AC_MSG_RESULT([$result])
4584     CXXFLAGS="$_SAVE_CXXFLAGS"
4586     case "$result" in
4587     no)
4588         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
4589         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
4590         ;;
4591     yes)
4592         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
4593         ;;
4594     esac
4597 dnl ========================================================
4598 dnl Test for correct temporary object destruction order
4599 dnl ========================================================
4600 dnl We want to make sure the compiler follows the C++ spec here as 
4601 dnl xpcom and the string classes depend on it (bug 235381).
4602 AC_MSG_CHECKING([for correct temporary object destruction order])
4603 AC_TRY_RUN([ class A {
4604              public:  A(int& x) : mValue(x) {}
4605                       ~A() { mValue--; }
4606                       operator char**() { return 0; }
4607              private:  int& mValue;
4608              };
4609              void func(char **arg) {}
4610              int m=2;
4611              void test() {
4612                   func(A(m));
4613                   if (m==1) m = 0;
4614              }
4615              int main() {
4616                  test();
4617                  return(m);
4618              }
4619              ],
4620      result="yes", result="no", result="maybe")
4621 AC_MSG_RESULT([$result])
4623 if test "$result" = "no"; then
4624     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
4627 dnl ========================================================
4628 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
4629 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
4630 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
4631 dnl ========================================================
4632 _SAVE_CXXFLAGS=$CXXFLAGS
4633 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
4634 AC_CACHE_CHECK(for correct overload resolution with const and templates,
4635     ac_nscap_nonconst_opeq_bug,
4636     [AC_TRY_COMPILE([
4637                       template <class T>
4638                       class Pointer
4639                         {
4640                         public:
4641                           T* myPtr;
4642                         };
4643                       
4644                       template <class T, class U>
4645                       int operator==(const Pointer<T>& rhs, U* lhs)
4646                         {
4647                           return rhs.myPtr == lhs;
4648                         }
4649                       
4650                       template <class T, class U>
4651                       int operator==(const Pointer<T>& rhs, const U* lhs)
4652                         {
4653                           return rhs.myPtr == lhs;
4654                         }
4655                     ],
4656                     [
4657                       Pointer<int> foo;
4658                       const int* bar;
4659                       return foo == bar;
4660                     ],
4661                     ac_nscap_nonconst_opeq_bug="no",
4662                     ac_nscap_nonconst_opeq_bug="yes")])
4663 CXXFLAGS="$_SAVE_CXXFLAGS"
4665 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
4666     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
4669 dnl ========================================================
4670 dnl Check for tm_zone, tm_gmtoff in struct tm
4671 dnl ========================================================
4672 AC_CACHE_CHECK(for tm_zone tm_gmtoff in struct tm,
4673     ac_cv_struct_tm_zone_tm_gmtoff,
4674     [AC_TRY_COMPILE([#include <time.h>],
4675                     [struct tm tm; tm.tm_zone = 0; tm.tm_gmtoff = 1;],
4676                     [ac_cv_struct_tm_zone_tm_gmtoff="yes"],
4677                     [ac_cv_struct_tm_zone_tm_gmtoff="no"])])
4678 if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then
4679     AC_DEFINE(HAVE_TM_ZONE_TM_GMTOFF)
4682 fi # SKIP_COMPILER_CHECKS
4684 dnl ========================================================
4685 dnl C++ rtti
4686 dnl Should be smarter and check that the compiler does indeed have rtti
4687 dnl ========================================================
4688 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
4689 [  --enable-cpp-rtti       Enable C++ RTTI ],
4690 [ _MOZ_USE_RTTI=1 ],
4691 [ _MOZ_USE_RTTI= ])
4693 if test "$_MOZ_USE_RTTI"; then
4694    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
4695 else
4696    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
4699 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
4701 dnl ========================================================
4702 dnl C++ exceptions (g++/egcs only - for now)
4703 dnl Should be smarter and check that the compiler does indeed have exceptions
4704 dnl ========================================================
4705 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
4706 [  --enable-cpp-exceptions Enable C++ exceptions ],
4707 [ _MOZ_CPP_EXCEPTIONS=1 ],
4708 [ _MOZ_CPP_EXCEPTIONS= ])
4710 if test "$_MOZ_CPP_EXCEPTIONS"; then
4711     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
4712 else
4713     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
4716 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
4718 # Irix & OSF native compilers do not like exception declarations 
4719 # when exceptions are disabled
4720 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
4721     AC_DEFINE(CPP_THROW_NEW, [])
4722 else
4723     AC_DEFINE(CPP_THROW_NEW, [throw()])
4725 AC_LANG_C
4727 dnl ========================================================
4728 dnl =
4729 dnl = Build depencency options
4730 dnl =
4731 dnl ========================================================
4732 MOZ_ARG_HEADER(Build dependencies)
4734 dnl ========================================================
4735 dnl = Do not auto generate dependency info
4736 dnl ========================================================
4737 MOZ_AUTO_DEPS=1
4738 MOZ_ARG_DISABLE_BOOL(auto-deps,
4739 [  --disable-auto-deps     Do not automatically generate dependency info],
4740     MOZ_AUTO_DEPS=,
4741     MOZ_AUTO_DEPS=1)
4743 if test -n "$MOZ_AUTO_DEPS"; then
4744 dnl ========================================================
4745 dnl = Use mkdepend instead of $CC -MD for dependency generation
4746 dnl ========================================================
4747 _cpp_md_flag=
4748 MOZ_ARG_DISABLE_BOOL(md,
4749 [  --disable-md            Do not use compiler-based dependencies ],
4750   [_cpp_md_flag=],
4751   [_cpp_md_flag=1],
4752   [dnl Default is to turn on -MD if using GNU-compatible compilers
4753    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
4754      _cpp_md_flag=1
4755    fi
4756   dnl Default is to use -xM if using Sun Studio on Solaris
4757    if test "$SOLARIS_SUNPRO_CC"; then
4758      _cpp_md_flag=1
4759    fi])
4760 if test "$_cpp_md_flag"; then
4761   COMPILER_DEPEND=1
4762   if test "$OS_ARCH" = "OpenVMS"; then
4763     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
4764   else
4765     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
4766   fi
4767   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
4768   if test "$SOLARIS_SUNPRO_CC"; then
4769     _DEPEND_CFLAGS=
4770   fi
4771 else
4772   COMPILER_DEPEND=
4773   dnl Don't override this for MSVC
4774   if test -z "$_WIN32_MSVC"; then
4775     _USE_CPP_INCLUDE_FLAG=
4776     _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
4777     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
4778   fi
4780 fi # MOZ_AUTO_DEPS
4781 MDDEPDIR='.deps'
4782 AC_SUBST(MOZ_AUTO_DEPS)
4783 AC_SUBST(COMPILER_DEPEND)
4784 AC_SUBST(MDDEPDIR)
4787 dnl ========================================================
4788 dnl =
4789 dnl = Static Build Options
4790 dnl =
4791 dnl ========================================================
4792 MOZ_ARG_HEADER(Static build options)
4794 MOZ_ARG_ENABLE_BOOL(static,
4795 [  --enable-static         Enable building of internal static libs],
4796     BUILD_STATIC_LIBS=1,
4797     BUILD_STATIC_LIBS=)
4799 dnl ========================================================
4800 dnl = Link js shell to system readline
4801 dnl ========================================================
4802 MOZ_ARG_ENABLE_BOOL(readline,
4803 [  --enable-readline  Link js shell to system readline library],
4804     JS_WANT_READLINE=1,
4805     JS_WANT_READLINE= )
4807 JS_NATIVE_EDITLINE=
4808 EDITLINE_LIBS=
4809 JS_DISABLE_SHELL=
4811 case "$target" in
4812 *-wince*|*-winmo*|*-mingw*|*-cygwin*|*-msvc*|*-mks*)
4813     NO_EDITLINE=1
4814     ;;
4815 *-symbian*)
4816     NO_EDITLINE=1
4817     JS_DISABLE_SHELL=1
4818     ;;
4820     ;;
4821 esac
4823 if test -z "$SKIP_LIBRARY_CHECKS" -a -z "$NO_EDITLINE"; then
4824   if test -n "$JS_WANT_READLINE"; then
4825     AC_CHECK_LIB(readline, readline,
4826                  EDITLINE_LIBS="-lreadline",
4827                  AC_MSG_ERROR([No system readline library found.]))
4828   else
4829     dnl By default, we use editline
4830     JS_NATIVE_EDITLINE=1
4831     EDITLINE_LIBS='$(DEPTH)/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
4832   fi
4834   dnl Either way, we want to build with line editing support.
4835   AC_DEFINE(EDITLINE)
4837 AC_SUBST(JS_NATIVE_EDITLINE)
4838 AC_SUBST(JS_DISABLE_SHELL)
4839 AC_SUBST(EDITLINE_LIBS)
4841 dnl ========================================================
4842 dnl =
4843 dnl = Standalone module options
4844 dnl = 
4845 dnl ========================================================
4846 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
4848 dnl ========================================================
4849 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
4850     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4853 MOZ_ARG_WITH_STRING(sync-build-files,
4854 [  --with-sync-build-files=DIR
4855                           Check that files in 'config' and 'build' match
4856                           their originals in 'DIR/config' and 'DIR/build'.
4857                           This helps keep the SpiderMonkey build machinery
4858                           in sync with Mozilla's, on which it is based.],
4859 [MOZ_SYNC_BUILD_FILES=$withval ] )
4860 AC_SUBST(MOZ_SYNC_BUILD_FILES)
4862 dnl ========================================================
4863 dnl =
4864 dnl = Maintainer debug option (no --enable equivalent)
4865 dnl =
4866 dnl ========================================================
4868 AC_SUBST(AR)
4869 AC_SUBST(AR_FLAGS)
4870 AC_SUBST(AR_LIST)
4871 AC_SUBST(AR_EXTRACT)
4872 AC_SUBST(AR_DELETE)
4873 AC_SUBST(AS)
4874 AC_SUBST(ASFLAGS)
4875 AC_SUBST(AS_DASH_C_FLAG)
4876 AC_SUBST(LD)
4877 AC_SUBST(RC)
4878 AC_SUBST(RCFLAGS)
4879 AC_SUBST(WINDRES)
4880 AC_SUBST(IMPLIB)
4881 AC_SUBST(FILTER)
4882 AC_SUBST(BIN_FLAGS)
4883 AC_SUBST(NS_USE_NATIVE)
4884 AC_SUBST(MOZ_JS_LIBS)
4885 AC_SUBST(MOZ_PSM)
4886 AC_SUBST(MOZ_DEBUG)
4887 AC_SUBST(MOZ_DEBUG_MODULES)
4888 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
4889 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
4890 AC_SUBST(MOZ_DEBUG_FLAGS)
4891 AC_SUBST(MOZ_DEBUG_LDFLAGS)
4892 AC_SUBST(WARNINGS_AS_ERRORS)
4893 AC_SUBST(MOZ_DBGRINFO_MODULES)
4894 AC_SUBST(MOZ_LEAKY)
4895 AC_SUBST(MOZ_JPROF)
4896 AC_SUBST(MOZ_SHARK)
4897 AC_SUBST(MOZ_CALLGRIND)
4898 AC_SUBST(MOZ_VTUNE)
4899 AC_SUBST(MOZ_XPCTOOLS)
4900 AC_SUBST(MOZ_JSLOADER)
4901 AC_SUBST(MOZ_INSURE)
4902 AC_SUBST(MOZ_INSURE_DIRS)
4903 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
4904 AC_SUBST(MOZ_QUANTIFY)
4905 AC_SUBST(MOZ_INSURIFYING)
4906 AC_SUBST(LIBICONV)
4908 AC_SUBST(BUILD_STATIC_LIBS)
4909 AC_SUBST(ENABLE_TESTS)
4911 AC_SUBST(ENABLE_STRIP)
4912 AC_SUBST(PKG_SKIP_STRIP)
4913 AC_SUBST(INCREMENTAL_LINKER)
4914 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
4915 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
4917 AC_SUBST(MOZ_FIX_LINK_PATHS)
4919 AC_SUBST(USE_DEPENDENT_LIBS)
4921 AC_SUBST(MOZ_BUILD_ROOT)
4922 AC_SUBST(MOZ_OS2_TOOLS)
4923 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
4925 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
4926 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4927 AC_SUBST(MOZ_TIMELINE)
4928 AC_SUBST(WINCE)
4929 AC_SUBST(WINCE_WINDOWS_MOBILE)
4931 AC_SUBST(MOZ_APP_NAME)
4932 AC_SUBST(MOZ_APP_DISPLAYNAME)
4933 AC_SUBST(MOZ_APP_VERSION)
4935 AC_SUBST(MOZ_PKG_SPECIAL)
4937 AC_SUBST(MOZILLA_OFFICIAL)
4939 dnl win32 options
4940 AC_SUBST(MOZ_DEBUG_SYMBOLS)
4941 AC_SUBST(MOZ_MAPINFO)
4942 AC_SUBST(MOZ_BROWSE_INFO)
4943 AC_SUBST(MOZ_TOOLS_DIR)
4944 AC_SUBST(CYGWIN_WRAPPER)
4945 AC_SUBST(AS_PERL)
4946 AC_SUBST(WIN32_REDIST_DIR)
4947 AC_SUBST(PYTHON)
4949 dnl Echo the CFLAGS to remove extra whitespace.
4950 CFLAGS=`echo \
4951         $_WARNINGS_CFLAGS \
4952         $CFLAGS`
4954 CXXFLAGS=`echo \
4955         $_MOZ_RTTI_FLAGS \
4956         $_MOZ_EXCEPTIONS_FLAGS \
4957         $_WARNINGS_CXXFLAGS \
4958         $CXXFLAGS`
4960 COMPILE_CFLAGS=`echo \
4961     $_DEFINES_CFLAGS \
4962         $_DEPEND_CFLAGS \
4963     $COMPILE_CFLAGS`
4965 COMPILE_CXXFLAGS=`echo \
4966     $_DEFINES_CXXFLAGS \
4967         $_DEPEND_CFLAGS \
4968     $COMPILE_CXXFLAGS`
4970 AC_SUBST(SYSTEM_MAKEDEPEND)
4972 AC_SUBST(NSPR_CFLAGS)
4973 AC_SUBST(NSPR_LIBS)
4974 AC_SUBST(MOZ_NATIVE_NSPR)
4976 AC_SUBST(CFLAGS)
4977 AC_SUBST(CXXFLAGS)
4978 AC_SUBST(CPPFLAGS)
4979 AC_SUBST(COMPILE_CFLAGS)
4980 AC_SUBST(COMPILE_CXXFLAGS)
4981 AC_SUBST(LDFLAGS)
4982 AC_SUBST(LIBS)
4983 AC_SUBST(CROSS_COMPILE)
4985 AC_SUBST(HOST_CC)
4986 AC_SUBST(HOST_CXX)
4987 AC_SUBST(HOST_CFLAGS)
4988 AC_SUBST(HOST_CXXFLAGS)
4989 AC_SUBST(HOST_OPTIMIZE_FLAGS)
4990 AC_SUBST(HOST_AR)
4991 AC_SUBST(HOST_AR_FLAGS)
4992 AC_SUBST(HOST_LD)
4993 AC_SUBST(HOST_RANLIB)
4994 AC_SUBST(HOST_NSPR_MDCPUCFG)
4995 AC_SUBST(HOST_BIN_SUFFIX)
4996 AC_SUBST(HOST_OS_ARCH)
4998 AC_SUBST(TARGET_CPU)
4999 AC_SUBST(TARGET_VENDOR)
5000 AC_SUBST(TARGET_OS)
5001 AC_SUBST(TARGET_NSPR_MDCPUCFG)
5002 AC_SUBST(TARGET_MD_ARCH)
5003 AC_SUBST(TARGET_XPCOM_ABI)
5004 AC_SUBST(OS_TARGET)
5005 AC_SUBST(OS_ARCH)
5006 AC_SUBST(OS_RELEASE)
5007 AC_SUBST(OS_TEST)
5009 AC_SUBST(WRAP_MALLOC_CFLAGS)
5010 AC_SUBST(WRAP_MALLOC_LIB)
5011 AC_SUBST(MKSHLIB)
5012 AC_SUBST(MKCSHLIB)
5013 AC_SUBST(MKSHLIB_FORCE_ALL)
5014 AC_SUBST(MKSHLIB_UNFORCE_ALL)
5015 AC_SUBST(DSO_CFLAGS)
5016 AC_SUBST(DSO_PIC_CFLAGS)
5017 AC_SUBST(DSO_LDOPTS)
5018 AC_SUBST(LIB_PREFIX)
5019 AC_SUBST(DLL_PREFIX)
5020 AC_SUBST(DLL_SUFFIX)
5021 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
5022 AC_SUBST(LIB_SUFFIX)
5023 AC_SUBST(OBJ_SUFFIX)
5024 AC_SUBST(BIN_SUFFIX)
5025 AC_SUBST(ASM_SUFFIX)
5026 AC_SUBST(IMPORT_LIB_SUFFIX)
5027 AC_SUBST(USE_N32)
5028 AC_SUBST(CC_VERSION)
5029 AC_SUBST(CXX_VERSION)
5030 AC_SUBST(MSMANIFEST_TOOL)
5032 if test "$USING_HCC"; then
5033    CC='${topsrcdir}/build/hcc'
5034    CC="$CC '$_OLDCC'"
5035    CXX='${topsrcdir}/build/hcpp'
5036    CXX="$CXX '$_OLDCXX'"
5037    AC_SUBST(CC)
5038    AC_SUBST(CXX)
5041 dnl Check for missing components
5042 if test "$COMPILE_ENVIRONMENT"; then
5043 if test "$MOZ_X11"; then
5044     dnl ====================================================
5045     dnl = Check if X headers exist
5046     dnl ====================================================
5047     _SAVE_CFLAGS=$CFLAGS
5048     CFLAGS="$CFLAGS $XCFLAGS"
5049     AC_TRY_COMPILE([
5050         #include <stdio.h>
5051         #include <stdlib.h>
5052         #include <X11/Xlib.h>
5053         #include <X11/Intrinsic.h>
5054     ],
5055     [
5056         Display *dpy = 0;
5057         if ((dpy = XOpenDisplay(NULL)) == NULL) {
5058             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
5059             exit(1);
5060         }
5061     ], [], 
5062     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
5063     CFLAGS="$_SAVE_CFLAGS"
5065     if test ! -z "$MISSING_X"; then
5066         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
5067     fi
5069 fi # MOZ_X11
5070 fi # COMPILE_ENVIRONMENT
5072 dnl Set various defines and substitutions
5073 dnl ========================================================
5075 if test "$OS_ARCH" = "BeOS"; then
5076   AC_DEFINE(XP_BEOS)
5077   MOZ_MOVEMAIL=1
5078 elif test "$OS_ARCH" = "Darwin"; then
5079   AC_DEFINE(XP_UNIX)
5080   AC_DEFINE(UNIX_ASYNC_DNS)
5081   MOZ_MOVEMAIL=1
5082 elif test "$OS_ARCH" = "OpenVMS"; then
5083   AC_DEFINE(XP_UNIX)
5084 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
5085   AC_DEFINE(XP_UNIX)
5086   AC_DEFINE(UNIX_ASYNC_DNS)
5087   MOZ_MOVEMAIL=1
5089 AC_SUBST(MOZ_MOVEMAIL)
5091 AC_ARG_ENABLE(threadsafe,
5092               [  --enable-threadsafe     Enable support for multiple threads.],
5093               [AC_DEFINE(JS_THREADSAFE)],)
5095 if test "$MOZ_DEBUG"; then
5096     AC_DEFINE(MOZ_REFLOW_PERF)
5097     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
5100 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
5101     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
5102     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
5103     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
5104     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
5105     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
5106     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
5107     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
5108     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
5111 dnl ========================================================
5112 dnl JavaScript shell
5113 dnl ========================================================
5115 AC_HAVE_FUNCS(setlocale)
5117 dnl ========================================================
5118 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
5119 dnl ========================================================
5120 case "$host_os" in
5121 mingw*)
5122     WIN_TOP_SRC=`cd $srcdir; pwd -W`
5123     ;;
5124 cygwin*|msvc*|mks*)
5125     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
5126     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
5127     CC="\$(CYGWIN_WRAPPER) $CC"
5128     CXX="\$(CYGWIN_WRAPPER) $CXX"
5129     CPP="\$(CYGWIN_WRAPPER) $CPP"
5130     LD="\$(CYGWIN_WRAPPER) $LD"
5131     AS="\$(CYGWIN_WRAPPER) $AS"
5132     RC="\$(CYGWIN_WRAPPER) $RC"
5133     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
5134     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
5135     ;;
5136 esac
5138 AC_SUBST(CYGDRIVE_MOUNT)
5139 AC_SUBST(WIN_TOP_SRC)
5141 AC_SUBST(MOZILLA_VERSION)
5143 AC_SUBST(ac_configure_args)
5145 dnl Spit out some output
5146 dnl ========================================================
5148 # Save the defines header file before autoconf removes it.
5149 # (Do not add AC_DEFINE calls after this line.)
5150   _CONFIG_TMP=confdefs-tmp.h
5151   _CONFIG_DEFS_H=js-confdefs.h
5153   cat > $_CONFIG_TMP <<\EOF
5154 /* List of defines generated by configure. Included with preprocessor flag,
5155  * -include, to avoid long list of -D defines on the compile command-line.
5156  * Do not edit.
5157  */
5159 #ifndef _JS_CONFDEFS_H_
5160 #define _JS_CONFDEFS_H_
5163 _EGREP_PATTERN='^#define ('
5164 if test -n "$_NON_GLOBAL_ACDEFINES"; then
5165     for f in $_NON_GLOBAL_ACDEFINES; do
5166         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
5167     done
5169 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
5171   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
5173   cat >> $_CONFIG_TMP <<\EOF
5175 #endif /* _JS_CONFDEFS_H_ */
5179   # Only write js-confdefs.h when something changes (or it doesn't exist)
5180   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
5181     rm $_CONFIG_TMP
5182   else
5183     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
5184     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
5186     echo ==== $_CONFIG_DEFS_H =================================
5187     cat $_CONFIG_DEFS_H
5188   fi
5190 dnl Probably shouldn't call this manually but we always want the output of DEFS
5191 rm -f confdefs.h.save
5192 mv confdefs.h confdefs.h.save
5193 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
5194 AC_OUTPUT_MAKE_DEFS()
5195 MOZ_DEFINES=$DEFS
5196 AC_SUBST(MOZ_DEFINES)
5197 rm -f confdefs.h
5198 mv confdefs.h.save confdefs.h
5200 MAKEFILES="
5201   Makefile
5202   shell/Makefile
5203   lirasm/Makefile
5204   jsapi-tests/Makefile
5205   tests/Makefile
5206   config/Makefile
5207   config/autoconf.mk
5208   config/mkdepend/Makefile
5211 if test -n "$JS_NATIVE_EDITLINE"; then
5212    MAKEFILES="$MAKEFILES
5213 editline/Makefile
5217 dnl 
5218 dnl Run a perl script to quickly create the makefiles.
5219 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
5220 dnl   for the files it cannot handle correctly. This way, config.status
5221 dnl   will handle these files.
5222 dnl If it fails, nothing is set and config.status will run as usual.
5224 dnl This does not change the $MAKEFILES variable.
5226 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
5228 if test -z "${AS_PERL}"; then
5229 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
5230 else
5231 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
5233 . ./conftest.sh
5234 rm conftest.sh
5236 echo $MAKEFILES > unallmakefiles
5238 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
5240 AC_OUTPUT($MAKEFILES)
5242 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
5243 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
5244   echo "config/autoconf.mk is unchanged"
5245   mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
5246 else
5247   rm -f config/autoconf.mk.orig 2> /dev/null
5250 # Produce the js-config script at configure time; see the comments for
5251 # 'js-config' in Makefile.in.
5252 AC_MSG_RESULT(invoking make to create js-config script)
5253 $MAKE js-config