/[jscoverage]/trunk/js/configure.in
ViewVC logotype

Annotation of /trunk/js/configure.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 535 - (hide annotations)
Fri Apr 2 16:18:55 2010 UTC (10 years, 6 months ago) by siliconforks
File size: 172187 byte(s)
Update SpiderMonkey from Firefox 3.6.2.

1 siliconforks 460 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 *****
59    
60     dnl Process this file with autoconf to produce a configure script.
61     dnl ========================================================
62    
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}"
71    
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=}"
86    
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"
103    
104     dnl Set the version number of the libs included with mozilla
105     dnl ========================================================
106     NSPR_VERSION=4
107    
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
113    
114     MSMANIFEST_TOOL=
115    
116     dnl Set various checks
117     dnl ========================================================
118     MISSING_X=
119     AC_PROG_AWK
120    
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=""
126    
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`
131    
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
159     fi
160     MOZ_BUILD_ROOT=`pwd`
161    
162     dnl Choose where to put the 'dist' directory.
163     dnl ==============================================================
164    
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)
172    
173     dnl Default to MSVC for win32
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 AS=ml; fi
184     ;;
185     esac
186     fi
187    
188     COMPILE_ENVIRONMENT=1
189     MOZ_ARG_ENABLE_BOOL(compile-environment,
190     [ --disable-compile-environment
191     Disable compiler/library checks.],
192     COMPILE_ENVIRONMENT=1,
193     COMPILE_ENVIRONMENT= )
194    
195     dnl ========================================================
196     dnl Checks for compilers.
197     dnl ========================================================
198    
199     if test "$COMPILE_ENVIRONMENT"; then
200    
201     if test "$target" != "$host"; then
202     echo "cross compiling from $host to $target"
203    
204     _SAVE_CC="$CC"
205     _SAVE_CFLAGS="$CFLAGS"
206     _SAVE_LDFLAGS="$LDFLAGS"
207    
208     AC_MSG_CHECKING([for host c compiler])
209     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
210     if test -z "$HOST_CC"; then
211     AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
212     fi
213     AC_MSG_RESULT([$HOST_CC])
214     AC_MSG_CHECKING([for host c++ compiler])
215     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
216     if test -z "$HOST_CXX"; then
217     AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
218     fi
219     AC_MSG_RESULT([$HOST_CXX])
220    
221     if test -z "$HOST_CFLAGS"; then
222     HOST_CFLAGS="$CFLAGS"
223     fi
224     if test -z "$HOST_CXXFLAGS"; then
225     HOST_CXXFLAGS="$CXXFLAGS"
226     fi
227     if test -z "$HOST_LDFLAGS"; then
228     HOST_LDFLAGS="$LDFLAGS"
229     fi
230     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
231     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
232     CC="$HOST_CC"
233     CFLAGS="$HOST_CFLAGS"
234     LDFLAGS="$HOST_LDFLAGS"
235    
236     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
237     AC_TRY_COMPILE([], [return(0);],
238     [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
239     AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
240    
241     CC="$HOST_CXX"
242     CFLAGS="$HOST_CXXFLAGS"
243    
244     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
245     AC_TRY_COMPILE([], [return(0);],
246     [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
247     AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
248    
249     CC=$_SAVE_CC
250     CFLAGS=$_SAVE_CFLAGS
251     LDFLAGS=$_SAVE_LDFLAGS
252    
253     case "$build:$target" in
254     powerpc-apple-darwin8*:i?86-apple-darwin*)
255     dnl The Darwin cross compiler doesn't necessarily point itself at a
256     dnl root that has libraries for the proper architecture, it defaults
257     dnl to the system root. The libraries in the system root on current
258     dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
259     dnl checks will fail. Fake a working SDK in that case.
260     _SAVE_CFLAGS=$CFLAGS
261     _SAVE_CXXFLAGS=$CXXLAGS
262     CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
263     CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
264     ;;
265     esac
266    
267 siliconforks 507 case "$target" in
268     *symbian*)
269     AC_ARG_WITH(symbian-sdk,
270     [ --with-symbian-sdk=SYMBIAN_SDK_DIR
271     The path to the Symbian SDK],
272     SYMBIAN_SDK_DIR=$withval)
273    
274     OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
275     CFLAGS="-MD -nostdinc"
276     SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
277    
278     case "$target" in
279     *-symbianelf)
280     OS_TARGET=GCCE
281     CC=arm-none-symbianelf-gcc.exe
282     CXX=arm-none-symbianelf-g++.exe
283     LD=arm-none-symbianelf-ld.exe
284     AR=arm-none-symbianelf-ar.exe
285     CPP=arm-none-symbianelf-cpp.exe
286     CFLAGS="$CFLAGS -c -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -msoft-float"
287     CXXFLAGS="$CFLAGS -Wno-ctor-dtor-privacy"
288     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"
289     CFLAGS="$CFLAGS ${GCCE_INCLUDE} -x c"
290     CXXFLAGS="$CXXFLAGS ${GCCE_INCLUDE} -x c++"
291     CPPFLAGS="$CPPFLAGS ${SYMBIAN_SYS_INCLUDE}"
292     ;;
293     *-symbianwinscw)
294     dnl TODO: add emulator build code
295     OS_TARGET=WINSCW
296     ;;
297     esac
298     ;;
299     esac
300    
301 siliconforks 460 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
302     unset ac_cv_prog_CC
303     AC_PROG_CC
304     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
305     unset ac_cv_prog_CXX
306     AC_PROG_CXX
307    
308     case "$build:$target" in
309     powerpc-apple-darwin8*:i?86-apple-darwin*)
310     dnl Revert the changes made above. From this point on, the target
311     dnl compiler will never be used without applying the SDK to CFLAGS
312     dnl (see --with-macos-sdk below).
313     CFLAGS=$_SAVE_CFLAGS
314     CXXFLAGS=$_SAVE_CXXFLAGS
315     ;;
316     esac
317    
318     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
319     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
320 siliconforks 507 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
321 siliconforks 460 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
322     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
323     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
324     AC_DEFINE(CROSS_COMPILE)
325    
326     dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
327     dnl have erroneously been set to "no", because the x86 build host is
328     dnl able to run ppc code in a translated environment, making a cross
329     dnl compiler appear native. So we override that here.
330     cross_compiling=yes
331     else
332     AC_PROG_CC
333     AC_PROG_CXX
334     AC_PROG_RANLIB
335 siliconforks 507 MOZ_PATH_PROGS(AS, $AS as, $CC)
336 siliconforks 460 AC_CHECK_PROGS(AR, ar, :)
337     AC_CHECK_PROGS(LD, ld, :)
338     AC_CHECK_PROGS(STRIP, strip, :)
339     AC_CHECK_PROGS(WINDRES, windres, :)
340     if test -z "$HOST_CC"; then
341     HOST_CC="$CC"
342     fi
343     if test -z "$HOST_CFLAGS"; then
344     HOST_CFLAGS="$CFLAGS"
345     fi
346     if test -z "$HOST_CXX"; then
347     HOST_CXX="$CXX"
348     fi
349     if test -z "$HOST_CXXFLAGS"; then
350     HOST_CXXFLAGS="$CXXFLAGS"
351     fi
352     if test -z "$HOST_LDFLAGS"; then
353     HOST_LDFLAGS="$LDFLAGS"
354     fi
355     if test -z "$HOST_RANLIB"; then
356     HOST_RANLIB="$RANLIB"
357     fi
358     if test -z "$HOST_AR"; then
359     HOST_AR="$AR"
360     fi
361     fi
362    
363     GNU_AS=
364     GNU_LD=
365     GNU_CC=
366     GNU_CXX=
367     CC_VERSION='N/A'
368     CXX_VERSION='N/A'
369     if test "$GCC" = "yes"; then
370     GNU_CC=1
371     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
372     fi
373     if test "$GXX" = "yes"; then
374     GNU_CXX=1
375     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
376     fi
377     if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
378     GNU_AS=1
379     fi
380     if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
381     GNU_LD=1
382     fi
383     if test "$GNU_CC"; then
384     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
385     GCC_USE_GNU_LD=1
386     fi
387     fi
388    
389     INTEL_CC=
390     INTEL_CXX=
391     if test "$GCC" = yes; then
392     if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
393     INTEL_CC=1
394     fi
395     fi
396    
397     if test "$GXX" = yes; then
398     if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
399     INTEL_CXX=1
400     fi
401     fi
402    
403     dnl Special win32 checks
404     dnl ========================================================
405     case "$target" in
406     *-wince)
407     WINVER=500
408     ;;
409     *)
410     if test -n "$GNU_CC"; then
411     WINVER=501
412     else
413     WINVER=500
414     fi
415     ;;
416     esac
417    
418     case "$target" in
419     *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
420     if test "$GCC" != "yes"; then
421     # Check to see if we are really running in a msvc environemnt
422     _WIN32_MSVC=1
423    
424     # Make sure compilers are valid
425     CFLAGS="$CFLAGS -TC -nologo"
426     CXXFLAGS="$CXXFLAGS -TP -nologo"
427     AC_LANG_SAVE
428     AC_LANG_C
429     AC_TRY_COMPILE([#include <stdio.h>],
430     [ printf("Hello World\n"); ],,
431     AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
432    
433     AC_LANG_CPLUSPLUS
434     AC_TRY_COMPILE([#include <new.h>],
435     [ unsigned *test = new unsigned(42); ],,
436     AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
437     AC_LANG_RESTORE
438    
439     changequote(,)
440     _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
441     changequote([,])
442    
443     # Determine compiler version
444     CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
445     _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
446     _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
447     _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
448     _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
449     _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
450    
451     CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
452     _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
453    
454     if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
455     AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
456     fi
457 siliconforks 507 if test "$_CC_MAJOR_VERSION" = "13"; then
458 siliconforks 460 _CC_SUITE=7
459     elif test "$_CC_MAJOR_VERSION" = "14"; then
460     _CC_SUITE=8
461     CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
462     dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
463     dnl so be very specific here!
464     dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
465     if test $_CC_RELEASE -gt 50727; then
466     _USE_DYNAMICBASE=1
467     elif test $_CC_BUILD -ge 762; then
468     _USE_DYNAMICBASE=1
469     fi
470     AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
471     AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
472     elif test "$_CC_MAJOR_VERSION" = "15"; then
473     _CC_SUITE=9
474     CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
475     LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
476     _USE_DYNAMICBASE=1
477     AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
478     AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
479     else
480     AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
481     fi
482    
483     _MOZ_RTTI_FLAGS_ON='-GR'
484     _MOZ_RTTI_FLAGS_OFF='-GR-'
485     _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
486     _MOZ_EXCEPTIONS_FLAGS_OFF=''
487    
488     if test -n "$WIN32_REDIST_DIR"; then
489     WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
490     fi
491    
492     # bug #249782
493     # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
494     if test "$_CC_SUITE" -ge "8"; then
495     changequote(,)
496     _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
497     changequote([,])
498    
499     MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
500     if test -n "$MSMT_TOOL"; then
501     MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
502     if test -z "$MSMANIFEST_TOOL_VERSION"; then
503     AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
504     fi
505     MSMANIFEST_TOOL=1
506     unset MSMT_TOOL
507     else
508     AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
509     fi
510     fi
511    
512     # Check linker version
513     _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
514     _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
515     if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
516     AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
517     fi
518     INCREMENTAL_LINKER=1
519    
520     unset _MSVC_VER_FILTER
521    
522     else
523     # Check w32api version
524     _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
525     _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
526     AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
527     AC_TRY_COMPILE([#include <w32api.h>],
528     #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
529     (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
530     __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
531     #error "test failed."
532     #endif
533     , [ res=yes ], [ res=no ])
534     AC_MSG_RESULT([$res])
535     if test "$res" != "yes"; then
536     AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
537     fi
538     # Check windres version
539     AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
540     _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
541     AC_MSG_RESULT([$_WINDRES_VERSION])
542     _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
543     _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
544     _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
545     WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
546     WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
547     WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
548     if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
549     "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
550     "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
551     "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
552     "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
553     "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
554     then
555     AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
556     fi
557     fi # !GNU_CC
558    
559     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
560     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
561     # Require OS features provided by IE 5.0
562     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
563     ;;
564     esac
565    
566     dnl Test breaks icc on OS/2 && MSVC
567     if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
568     AC_PROG_CC_C_O
569     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
570     USING_HCC=1
571     _OLDCC=$CC
572     _OLDCXX=$CXX
573     CC="${srcdir}/build/hcc '$CC'"
574     CXX="${srcdir}/build/hcpp '$CXX'"
575     fi
576     fi
577    
578     AC_PROG_CPP
579     AC_PROG_CXXCPP
580    
581     if test -n "$_WIN32_MSVC"; then
582     SKIP_PATH_CHECKS=1
583     SKIP_COMPILER_CHECKS=1
584     SKIP_LIBRARY_CHECKS=1
585    
586     # Since we're skipping compiler and library checks, hard-code
587     # some facts here.
588    
589 siliconforks 507 # Common to all MSVC environments:
590 siliconforks 460 # Windows lacks <stdint.h>, but has __int8, and so on.
591     AC_DEFINE(JS_HAVE___INTN)
592 siliconforks 507
593     case "$target" in
594     *-wince)
595     AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
596     AC_DEFINE(JS_CRTDEFS_H_HAS_INTPTR_T)
597     ;;
598     *)
599     AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
600     AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
601     # Windows <stddef.h> defines intptr_t and uintptr_t.
602     # VS2005: http://msdn.microsoft.com/en-us/library/323b6b3k(VS.80).aspx
603     # VS2008: http://msdn.microsoft.com/en-us/library/323b6b3k.aspx
604     AC_DEFINE(JS_STDDEF_H_HAS_INTPTR_T)
605     ;;
606     esac
607 siliconforks 460 fi
608    
609     fi # COMPILE_ENVIRONMENT
610    
611     if test "$cross_compiling" = "yes"; then
612     CROSS_COMPILE=1
613     else
614     CROSS_COMPILE=
615     fi
616    
617     AC_SUBST(_MSC_VER)
618    
619     AC_SUBST(GNU_AS)
620     AC_SUBST(GNU_LD)
621     AC_SUBST(GNU_CC)
622     AC_SUBST(GNU_CXX)
623     AC_SUBST(INTEL_CC)
624     AC_SUBST(INTEL_CXX)
625    
626     dnl ========================================================
627     dnl Checks for programs.
628     dnl ========================================================
629     AC_PROG_INSTALL
630     AC_PROG_LN_S
631 siliconforks 507 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
632 siliconforks 460 if test -z "$PERL" || test "$PERL" = ":"; then
633     AC_MSG_ERROR([perl not found in \$PATH])
634     fi
635    
636     if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
637     AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
638     _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
639     _perl_res=$?
640     AC_MSG_RESULT([$_perl_version])
641    
642     if test "$_perl_res" != 0; then
643     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
644     fi
645     fi
646    
647     AC_MSG_CHECKING([for full perl installation])
648     _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
649     _perl_res=$?
650     if test "$_perl_res" != 0; then
651     AC_MSG_RESULT([no])
652     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
653     else
654     AC_MSG_RESULT([yes])
655     fi
656    
657 siliconforks 507 MOZ_PATH_PROGS(PYTHON, $PYTHON python)
658 siliconforks 460 if test -z "$PYTHON"; then
659     AC_MSG_ERROR([python was not found in \$PATH])
660     fi
661    
662     if test -z "$COMPILE_ENVIRONMENT"; then
663     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
664     fi
665     AC_SUBST(NSINSTALL_BIN)
666    
667 siliconforks 507 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
668     MOZ_PATH_PROG(WHOAMI, whoami, :)
669     MOZ_PATH_PROG(AUTOCONF, autoconf, :)
670     MOZ_PATH_PROG(UNZIP, unzip, :)
671     MOZ_PATH_PROGS(ZIP, zip)
672 siliconforks 460 if test -z "$ZIP" || test "$ZIP" = ":"; then
673     AC_MSG_ERROR([zip not found in \$PATH])
674     fi
675 siliconforks 507 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
676     MOZ_PATH_PROG(XARGS, xargs)
677 siliconforks 460 if test -z "$XARGS" || test "$XARGS" = ":"; then
678     AC_MSG_ERROR([xargs not found in \$PATH .])
679     fi
680    
681     if test "$COMPILE_ENVIRONMENT"; then
682    
683     dnl ========================================================
684     dnl = Mac OS X toolchain support
685     dnl ========================================================
686    
687     case "$target_os" in
688     darwin*)
689     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
690     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
691     dnl the environment and includedir purposes (when using an SDK, below),
692     dnl but remember the full version number for the libdir (SDK).
693     changequote(,)
694     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
695     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
696     changequote([,])
697     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
698     dnl Bug 280479, but this keeps popping up in bug 292530 too because
699     dnl 4.0.0/4061 is the default compiler in Tiger.
700     changequote(,)
701     GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
702     changequote([,])
703     if test "$GCC_BUILD" = "4061" ; then
704     AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
705     This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
706     from building Mozilla. Upgrade to Xcode 2.1 or later.])
707     fi
708     fi
709    
710     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
711     dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
712     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
713 siliconforks 507 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
714 siliconforks 460
715     case "$PBBUILD" in
716     *xcodebuild*)
717     changequote(,)
718     XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
719     changequote([,])
720     if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
721     HAS_XCODE_2_1=1;
722     fi
723     ;;
724     esac
725    
726     dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
727     dnl it has moved into /usr/bin.
728 siliconforks 507 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
729 siliconforks 460 ;;
730     esac
731    
732     AC_SUBST(GCC_VERSION)
733     AC_SUBST(XCODEBUILD_VERSION)
734     AC_SUBST(HAS_XCODE_2_1)
735    
736     dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
737     dnl that a universal binary is being produced.
738     AC_SUBST(UNIVERSAL_BINARY)
739    
740     dnl ========================================================
741     dnl Check for MacOS deployment target version
742     dnl ========================================================
743    
744     MOZ_ARG_ENABLE_STRING(macos-target,
745     [ --enable-macos-target=VER (default=10.4)
746     Set the minimum MacOS version needed at runtime],
747     [_MACOSX_DEPLOYMENT_TARGET=$enableval])
748    
749     case "$target" in
750     *-darwin*)
751     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
752     dnl Use the specified value
753     export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
754     AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
755     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
756     dnl No value specified on the command line or in the environment,
757     dnl use the lesser of the application's minimum or the architecture's
758     dnl minimum.
759     export MACOSX_DEPLOYMENT_TARGET=10.4
760     fi
761     ;;
762     esac
763    
764     AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
765    
766     dnl ========================================================
767     dnl = Mac OS X SDK support
768     dnl ========================================================
769     MACOS_SDK_DIR=
770     NEXT_ROOT=
771     MOZ_ARG_WITH_STRING(macos-sdk,
772     [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
773     MACOS_SDK_DIR=$withval)
774    
775     dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
776     dnl NEXT_ROOT will be set and exported only if it's needed.
777     AC_SUBST(MACOS_SDK_DIR)
778     AC_SUBST(NEXT_ROOT)
779    
780     if test "$MACOS_SDK_DIR"; then
781     dnl Sync this section with the ones in NSPR and NSS.
782     dnl Changes to the cross environment here need to be accounted for in
783     dnl the libIDL checks (below) and xpidl build.
784    
785     if test ! -d "$MACOS_SDK_DIR"; then
786     AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
787     specify a valid SDK. SDKs are installed when the optional cross-development
788     tools are selected during the Xcode/Developer Tools installation.])
789     fi
790    
791     GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
792     if test "$GCC_VERSION_MAJOR" -lt "4" ; then
793 siliconforks 507 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
794 siliconforks 460 else
795     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
796     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
797    
798     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
799     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
800     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
801    
802     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
803     dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
804     dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
805     dnl be ignored and cause warnings when -syslibroot is specified.
806     dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
807     dnl the -isysroot it receives, so this is only needed with 4.0.0.
808     LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
809     fi
810     fi
811    
812     AC_LANG_SAVE
813     AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
814     AC_LANG_CPLUSPLUS
815     AC_TRY_COMPILE([#include <new>
816     int main() { return 0; }],
817     result=yes,
818     result=no)
819     AC_LANG_RESTORE
820     AC_MSG_RESULT($result)
821    
822     if test "$result" = "no" ; then
823     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
824     fi
825     fi
826    
827     fi # COMPILE_ENVIRONMENT
828    
829     case "$host_os" in
830     cygwin*|mingw*|mks*|msvc*)
831 siliconforks 510 AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
832 siliconforks 460 ;;
833     *)
834 siliconforks 507 MOZ_PATH_PROGS(MAKE, $MAKE gmake make, :)
835 siliconforks 460 ;;
836     esac
837    
838     if test "$COMPILE_ENVIRONMENT"; then
839    
840     AC_PATH_XTRA
841    
842     dnl Check in X11 include directory too.
843     if test "$no_x" != "yes"; then
844     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
845     fi
846    
847     XCFLAGS="$X_CFLAGS"
848    
849     fi # COMPILE_ENVIRONMENT
850    
851     dnl ========================================================
852     dnl set the defaults first
853     dnl ========================================================
854     AS_BIN=$AS
855     AR_FLAGS='cr $@'
856     AR_LIST='$(AR) t'
857     AR_EXTRACT='$(AR) x'
858     AR_DELETE='$(AR) d'
859     AS='$(CC)'
860     AS_DASH_C_FLAG='-c'
861     DLL_PREFIX=lib
862     LIB_PREFIX=lib
863     DLL_SUFFIX=.so
864     OBJ_SUFFIX=o
865     LIB_SUFFIX=a
866     ASM_SUFFIX=s
867     IMPORT_LIB_SUFFIX=
868     TARGET_MD_ARCH=unix
869     DIRENT_INO=d_ino
870     CYGWIN_WRAPPER=
871     WIN_TOP_SRC=
872     MOZ_USER_DIR=".mozilla"
873     HOST_AR='$(AR)'
874     HOST_AR_FLAGS='$(AR_FLAGS)'
875    
876     MOZ_JS_LIBS='-L$(libdir) -lmozjs'
877     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(PREFIX)/lib'
878    
879     MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
880     MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
881    
882     USE_DEPENDENT_LIBS=1
883    
884     _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
885     MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
886    
887     MOZ_ENABLE_POSTSCRIPT=1
888    
889     if test -n "$CROSS_COMPILE"; then
890     OS_TARGET="${target_os}"
891     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
892     OS_RELEASE=
893     case "${target_os}" in
894     linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
895     kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
896     solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
897     mingw*) OS_ARCH=WINNT ;;
898     wince*) OS_ARCH=WINCE ;;
899     darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
900     esac
901     else
902     OS_TARGET=`uname -s`
903     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
904     OS_RELEASE=`uname -r`
905     fi
906    
907     # Before this used `uname -m` when not cross compiling
908     # but that breaks when you have a 64 bit kernel with a 32 bit userland.
909     OS_TEST="${target_cpu}"
910    
911     _COMPILER_PREFIX=
912    
913     HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
914    
915     #######################################################################
916     # Master "Core Components" macros for getting the OS target #
917     #######################################################################
918    
919     #
920     # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
921     # cross-compilation.
922     #
923    
924     #
925     # Define and override various archtecture-specific variables, including
926     # HOST_OS_ARCH
927     # OS_ARCH
928     # OS_TEST
929     # OS_TARGET
930     # OS_RELEASE
931     # OS_MINOR_RELEASE
932     #
933    
934     case "$HOST_OS_ARCH" in
935     cygwin*|mingw*|mks*|msvc*)
936     HOST_OS_ARCH=WINNT
937     ;;
938     linux*)
939     HOST_OS_ARCH=Linux
940     ;;
941     solaris*)
942     HOST_OS_ARCH=SunOS
943     SOLARIS_SUNPRO_CC=
944     SOLARIS_SUNPRO_CXX=
945     if test -z "$GNU_CC"; then
946     if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
947     SOLARIS_SUNPRO_CC=1
948     fi
949     fi
950    
951     if test -z "$GNU_CXX"; then
952     if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
953     SOLARIS_SUNPRO_CXX=1
954     fi
955     fi
956     AC_SUBST(SOLARIS_SUNPRO_CC)
957     AC_SUBST(SOLARIS_SUNPRO_CXX)
958     ;;
959     BSD_386)
960     HOST_OS_ARCH=BSD
961     ;;
962     dgux)
963     HOST_OS_ARCH=DGUX
964     ;;
965     IRIX64)
966     HOST_OS_ARCH=IRIX
967     ;;
968     UNIX_SV)
969     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
970     HOST_OS_ARCH=NCR
971     else
972     HOST_OS_ARCH=UNIXWARE
973     fi
974     ;;
975     ncr)
976     HOST_OS_ARCH=NCR
977     ;;
978     UNIX_SYSTEM_V)
979     HOST_OS_ARCH=NEC
980     ;;
981     OSF1)
982     ;;
983     *OpenVMS*)
984     HOST_OS_ARCH=OpenVMS
985     ;;
986     OS_2)
987     HOST_OS_ARCH=OS2
988     ;;
989     QNX)
990     ;;
991     SCO_SV)
992     HOST_OS_ARCH=SCOOS
993     ;;
994     SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
995     HOST_OS_ARCH=SINIX
996     ;;
997     UnixWare)
998     HOST_OS_ARCH=UNIXWARE
999     ;;
1000     esac
1001    
1002     case "$OS_ARCH" in
1003     WINNT)
1004     OS_TEST=`uname -p`
1005     ;;
1006     Windows_NT)
1007     #
1008     # If uname -s returns "Windows_NT", we assume that we are using
1009     # the uname.exe in MKS toolkit.
1010     #
1011     # The -r option of MKS uname only returns the major version number.
1012     # So we need to use its -v option to get the minor version number.
1013     # Moreover, it doesn't have the -p option, so we need to use uname -m.
1014     #
1015     OS_ARCH=WINNT
1016     OS_TARGET=WINNT
1017     OS_MINOR_RELEASE=`uname -v`
1018     if test "$OS_MINOR_RELEASE" = "00"; then
1019     OS_MINOR_RELEASE=0
1020     fi
1021     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1022     ;;
1023     CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1024     #
1025     # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1026     # the uname.exe in the Cygwin tools.
1027     # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1028     # If uname -s returns "CYGWIN32/NT", we assume that we are using
1029     # the uname.exe in the GNU-Win32 tools.
1030     # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1031     # the uname.exe in the MSYS tools.
1032     #
1033     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1034     OS_ARCH=WINNT
1035     OS_TARGET=WINNT
1036     ;;
1037     AIX)
1038     OS_RELEASE=`uname -v`.`uname -r`
1039     OS_TEST=${target_cpu}
1040     ;;
1041     BSD_386)
1042     OS_ARCH=BSD
1043     ;;
1044     dgux)
1045     OS_ARCH=DGUX
1046     ;;
1047     IRIX64)
1048     OS_ARCH=IRIX
1049     ;;
1050     UNIX_SV)
1051     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1052     OS_ARCH=NCR
1053     else
1054     OS_ARCH=UNIXWARE
1055     OS_RELEASE=`uname -v`
1056     fi
1057     ;;
1058     ncr)
1059     OS_ARCH=NCR
1060     ;;
1061     UNIX_SYSTEM_V)
1062     OS_ARCH=NEC
1063     ;;
1064     OSF1)
1065     case `uname -v` in
1066     148)
1067     OS_RELEASE=V3.2C
1068     ;;
1069     564)
1070     OS_RELEASE=V4.0B
1071     ;;
1072     878)
1073     OS_RELEASE=V4.0D
1074     ;;
1075     esac
1076     ;;
1077     *OpenVMS*)
1078     OS_ARCH=OpenVMS
1079     OS_RELEASE=`uname -v`
1080     OS_TEST=`uname -p`
1081     ;;
1082     OS_2)
1083     OS_ARCH=OS2
1084     OS_TARGET=OS2
1085     OS_RELEASE=`uname -v`
1086     ;;
1087     QNX)
1088     if test "$OS_TARGET" != "NTO"; then
1089     changequote(,)
1090     OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1091     changequote([,])
1092     fi
1093     OS_TEST=x86
1094     ;;
1095     SCO_SV)
1096     OS_ARCH=SCOOS
1097     OS_RELEASE=5.0
1098     ;;
1099     SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1100     OS_ARCH=SINIX
1101     OS_TEST=`uname -p`
1102     ;;
1103     UnixWare)
1104     OS_ARCH=UNIXWARE
1105     OS_RELEASE=`uname -v`
1106     ;;
1107     WINCE)
1108     WINCE=1
1109     OS_ARCH=WINCE
1110     OS_TARGET=WINCE
1111     ;;
1112     Darwin)
1113     case "${target_cpu}" in
1114     powerpc*)
1115     OS_TEST=ppc
1116     ;;
1117     i*86*)
1118     OS_TEST=i386
1119     ;;
1120 siliconforks 507 x86_64)
1121     OS_TEST=x86_64
1122     ;;
1123 siliconforks 460 *)
1124     if test -z "$CROSS_COMPILE" ; then
1125     OS_TEST=`uname -p`
1126     fi
1127     ;;
1128     esac
1129     ;;
1130     esac
1131    
1132     if test "$OS_ARCH" = "NCR"; then
1133     changequote(,)
1134     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1135     changequote([,])
1136     fi
1137    
1138     # Only set CPU_ARCH if we recognize the value of OS_TEST
1139    
1140     case "$OS_TEST" in
1141     *86 | i86pc)
1142     CPU_ARCH=x86
1143     ;;
1144    
1145     powerpc* | ppc | rs6000)
1146     CPU_ARCH=ppc
1147     ;;
1148    
1149     Alpha | alpha | ALPHA)
1150     CPU_ARCH=Alpha
1151     ;;
1152    
1153     hppa* | parisc)
1154     CPU_ARCH=hppa
1155     ;;
1156    
1157     sun4u | sparc*)
1158     CPU_ARCH=sparc
1159     ;;
1160    
1161     x86_64 | ia64)
1162     CPU_ARCH="$OS_TEST"
1163     ;;
1164 siliconforks 507
1165     arm)
1166     if test "$OS_TARGET" = "WINCE"; then
1167     CPU_ARCH="$OS_TEST"
1168     fi
1169     ;;
1170 siliconforks 460 esac
1171    
1172     if test -z "$OS_TARGET"; then
1173     OS_TARGET=$OS_ARCH
1174     fi
1175     OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1176    
1177     dnl ========================================================
1178     dnl GNU specific defaults
1179     dnl ========================================================
1180     if test "$GNU_CC"; then
1181     # FIXME: Let us build with strict aliasing. bug 414641.
1182     CFLAGS="$CFLAGS -fno-strict-aliasing"
1183     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1184     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1185     DSO_LDOPTS='-shared'
1186     if test "$GCC_USE_GNU_LD"; then
1187     # Don't allow undefined symbols in libraries
1188     DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1189     fi
1190     WARNINGS_AS_ERRORS='-Werror'
1191     DSO_CFLAGS=''
1192     DSO_PIC_CFLAGS='-fPIC'
1193     ASFLAGS="$ASFLAGS -fPIC"
1194     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1195     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1196     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1197     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1198    
1199     # Turn on GNU specific features
1200     # -Wall - turn on all warnings
1201     # -pedantic - make compiler warn about non-ANSI stuff, and
1202     # be a little bit stricter
1203     # Warnings slamm took out for now (these were giving more noise than help):
1204     # -Wbad-function-cast - warns when casting a function to a new return type
1205     # -Wshadow - removed because it generates more noise than help --pete
1206     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1207     if test -z "$INTEL_CC"; then
1208     # Don't use -Wcast-align with ICC
1209     case "$CPU_ARCH" in
1210     # And don't use it on hppa, ia64, sparc, since it's noisy there
1211     hppa | ia64 | sparc)
1212     ;;
1213     *)
1214     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1215     ;;
1216     esac
1217     fi
1218    
1219     dnl Turn pedantic on but disable the warnings for long long
1220     _PEDANTIC=1
1221    
1222     if test -z "$INTEL_CC"; then
1223     _IGNORE_LONG_LONG_WARNINGS=1
1224     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1225     else
1226     _IGNORE_LONG_LONG_WARNINGS=
1227     fi
1228    
1229    
1230 siliconforks 507 _DEFINES_CFLAGS='-include $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
1231 siliconforks 460 _USE_CPP_INCLUDE_FLAG=1
1232     elif test "$SOLARIS_SUNPRO_CC"; then
1233     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1234     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1235    
1236     DSO_LDOPTS='-shared'
1237     if test "$GNU_LD"; then
1238     # Don't allow undefined symbols in libraries
1239     DSO_LDOPTS="$DSO_LDOPTS -z defs"
1240     fi
1241    
1242     DSO_CFLAGS=''
1243     if test "$CPU_ARCH" = "sparc"; then
1244     # for Sun Studio on Solaris/SPARC
1245     DSO_PIC_CFLAGS='-xcode=pic32'
1246     else
1247     DSO_PIC_CFLAGS='-KPIC'
1248     fi
1249 siliconforks 507 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1250 siliconforks 460 else
1251     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1252     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1253    
1254     DSO_LDOPTS='-shared'
1255     if test "$GNU_LD"; then
1256     # Don't allow undefined symbols in libraries
1257     DSO_LDOPTS="$DSO_LDOPTS -z defs"
1258     fi
1259    
1260     DSO_CFLAGS=''
1261     DSO_PIC_CFLAGS='-KPIC'
1262 siliconforks 507 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1263 siliconforks 460 fi
1264    
1265     if test "$GNU_CXX"; then
1266     # FIXME: Let us build with strict aliasing. bug 414641.
1267     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1268     # Turn on GNU specific features
1269     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1270     if test -z "$INTEL_CC"; then
1271     # Don't use -Wcast-align with ICC
1272     case "$CPU_ARCH" in
1273     # And don't use it on hppa, ia64, sparc, since it's noisy there
1274     hppa | ia64 | sparc)
1275     ;;
1276     *)
1277     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1278     ;;
1279     esac
1280     fi
1281    
1282 siliconforks 507 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js-confdefs.h'
1283 siliconforks 460 _USE_CPP_INCLUDE_FLAG=1
1284    
1285     AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1286     ac_has_wno_invalid_offsetof,
1287     [
1288     AC_LANG_SAVE
1289     AC_LANG_CPLUSPLUS
1290     _SAVE_CXXFLAGS="$CXXFLAGS"
1291     CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1292     AC_TRY_COMPILE([],
1293     [return(0);],
1294     ac_has_wno_invalid_offsetof="yes",
1295     ac_has_wno_invalid_offsetof="no")
1296     CXXFLAGS="$_SAVE_CXXFLAGS"
1297     AC_LANG_RESTORE
1298     ])
1299     if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1300     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1301     fi
1302 siliconforks 507
1303     AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1304     ac_has_wno_variadic_macros,
1305     [
1306     AC_LANG_SAVE
1307     AC_LANG_CPLUSPLUS
1308     _SAVE_CXXFLAGS="$CXXFLAGS"
1309     CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1310     AC_TRY_COMPILE([],
1311     [return(0);],
1312     ac_has_wno_variadic_macros="yes",
1313     ac_has_wno_variadic_macros="no")
1314     CXXFLAGS="$_SAVE_CXXFLAGS"
1315     AC_LANG_RESTORE
1316     ])
1317     if test "$ac_has_wno_variadic_macros" = "yes"; then
1318     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1319     fi
1320 siliconforks 460 else
1321 siliconforks 507 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)'
1322 siliconforks 460 fi
1323    
1324     dnl gcc can come with its own linker so it is better to use the pass-thru calls
1325     dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1326     dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1327     dnl normal behavior.
1328     dnl ========================================================
1329     MKSHLIB_FORCE_ALL=
1330     MKSHLIB_UNFORCE_ALL=
1331    
1332     if test "$COMPILE_ENVIRONMENT"; then
1333     if test "$GNU_CC"; then
1334     AC_MSG_CHECKING(whether ld has archive extraction flags)
1335     AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1336     [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1337     ac_cv_mkshlib_force_and_unforce="no"
1338     exec 3<&0 <<LOOP_INPUT
1339     force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1340     force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1341     force="-Wl,-all"; unforce="-Wl,-none"
1342     LOOP_INPUT
1343     while read line
1344     do
1345     eval $line
1346     LDFLAGS=$force
1347     LIBS=$unforce
1348     AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1349     done
1350     exec 0<&3 3<&-
1351     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1352     ])
1353     if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1354     AC_MSG_RESULT(no)
1355     else
1356     AC_MSG_RESULT(yes)
1357     eval $ac_cv_mkshlib_force_and_unforce
1358     MKSHLIB_FORCE_ALL=$force
1359     MKSHLIB_UNFORCE_ALL=$unforce
1360     fi
1361     fi # GNU_CC
1362     fi # COMPILE_ENVIRONMENT
1363    
1364     dnl =================================================================
1365     dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1366     dnl which is bad when cross compiling.
1367     dnl =================================================================
1368     if test "$COMPILE_ENVIRONMENT"; then
1369     configure_static_assert_macros='
1370     #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1371     #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1372     #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1373     '
1374    
1375     dnl test that the macros actually work:
1376     AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1377     AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1378     [AC_LANG_SAVE
1379     AC_LANG_C
1380     ac_cv_static_assertion_macros_work="yes"
1381     AC_TRY_COMPILE([$configure_static_assert_macros],
1382     [CONFIGURE_STATIC_ASSERT(1)],
1383     ,
1384     ac_cv_static_assertion_macros_work="no")
1385     AC_TRY_COMPILE([$configure_static_assert_macros],
1386     [CONFIGURE_STATIC_ASSERT(0)],
1387     ac_cv_static_assertion_macros_work="no",
1388     )
1389     AC_LANG_CPLUSPLUS
1390     AC_TRY_COMPILE([$configure_static_assert_macros],
1391     [CONFIGURE_STATIC_ASSERT(1)],
1392     ,
1393     ac_cv_static_assertion_macros_work="no")
1394     AC_TRY_COMPILE([$configure_static_assert_macros],
1395     [CONFIGURE_STATIC_ASSERT(0)],
1396     ac_cv_static_assertion_macros_work="no",
1397     )
1398     AC_LANG_RESTORE
1399     ])
1400     AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1401     if test "$ac_cv_static_assertion_macros_work" = "no"; then
1402     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1403     fi
1404     fi # COMPILE_ENVIRONMENT
1405    
1406     dnl ========================================================
1407     dnl Checking for 64-bit OS
1408     dnl ========================================================
1409     if test "$COMPILE_ENVIRONMENT"; then
1410     AC_LANG_SAVE
1411     AC_LANG_C
1412     AC_MSG_CHECKING(for 64-bit OS)
1413     AC_TRY_COMPILE([$configure_static_assert_macros],
1414     [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1415     result="yes", result="no")
1416     AC_MSG_RESULT("$result")
1417     if test "$result" = "yes"; then
1418     AC_DEFINE(HAVE_64BIT_OS)
1419     HAVE_64BIT_OS=1
1420     fi
1421     AC_SUBST(HAVE_64BIT_OS)
1422     AC_LANG_RESTORE
1423     fi # COMPILE_ENVIRONMENT
1424    
1425     dnl ========================================================
1426     dnl Enable high-memory support on OS/2 by default.
1427     dnl ========================================================
1428     MOZ_OS2_HIGH_MEMORY=1
1429     MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1430     [ --disable-os2-high-mem Disable high-memory support on OS/2],
1431     MOZ_OS2_HIGH_MEMORY=,
1432     MOZ_OS2_HIGH_MEMORY=1 )
1433     AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1434    
1435     dnl ========================================================
1436     dnl System overrides of the defaults for host
1437     dnl ========================================================
1438     case "$host" in
1439     *-beos*)
1440     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1441     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1442     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1443     ;;
1444    
1445     *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1446     if test -n "$_WIN32_MSVC"; then
1447     HOST_AR=lib
1448     HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1449     HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1450     HOST_RANLIB='echo ranlib'
1451     else
1452     HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1453     fi
1454     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1455     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1456     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1457     HOST_BIN_SUFFIX=.exe
1458     case "$host" in
1459     *mingw*)
1460     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1461     ;;
1462     *)
1463     CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1464     if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1465     _pwd=`pwd`
1466     CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1467     fi
1468     if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1469     AS_PERL=1
1470     PERL="${CYGWIN_WRAPPER} $PERL"
1471     fi
1472    
1473     if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1474     PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1475     fi
1476     ;;
1477     esac
1478     ;;
1479    
1480     *-darwin*)
1481     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1482     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1483     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1484     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1485     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1486     ;;
1487    
1488     *-linux*|*-kfreebsd*-gnu)
1489     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1490     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1491     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1492     ;;
1493    
1494     *os2*)
1495     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1496     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1497     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1498     HOST_BIN_SUFFIX=.exe
1499     MOZ_FIX_LINK_PATHS=
1500     ;;
1501    
1502     *-osf*)
1503     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1504     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1505     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1506     ;;
1507    
1508     *)
1509     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1510     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1511     ;;
1512     esac
1513    
1514     dnl ========================================================
1515     dnl System overrides of the defaults for target
1516     dnl ========================================================
1517    
1518     case "$target" in
1519     *-aix*)
1520     AC_DEFINE(AIX)
1521     if test ! "$GNU_CC"; then
1522     if test ! "$HAVE_64BIT_OS"; then
1523     # Compiling with Visual Age C++ object model compat is the
1524     # default. To compile with object model ibm, add
1525     # AIX_OBJMODEL=ibm to .mozconfig.
1526     if test "$AIX_OBJMODEL" = "ibm"; then
1527     CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1528     else
1529     AIX_OBJMODEL=compat
1530     fi
1531     else
1532     AIX_OBJMODEL=compat
1533     fi
1534     AC_SUBST(AIX_OBJMODEL)
1535     DSO_LDOPTS='-qmkshrobj=1'
1536     DSO_CFLAGS='-qflag=w:w'
1537     DSO_PIC_CFLAGS=
1538     LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1539     AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1540     MOZ_FIX_LINK_PATHS=
1541     MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1542     MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1543     if test "$COMPILE_ENVIRONMENT"; then
1544     AC_LANG_SAVE
1545     AC_LANG_CPLUSPLUS
1546     AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1547     AC_TRY_COMPILE([],
1548     [#if (__IBMCPP__ < 600)
1549     #error "Bad compiler"
1550     #endif],
1551     _BAD_COMPILER=,_BAD_COMPILER=1)
1552     if test -n "$_BAD_COMPILER"; then
1553     AC_MSG_RESULT([no])
1554     AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1555     else
1556     AC_MSG_RESULT([yes])
1557     fi
1558     AC_LANG_RESTORE
1559     TARGET_COMPILER_ABI="ibmc"
1560     CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1561     CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1562     fi
1563     fi
1564     case "${target_os}" in
1565     aix4.1*)
1566     DLL_SUFFIX='_shr.a'
1567     ;;
1568     esac
1569     if test "$COMPILE_ENVIRONMENT"; then
1570     AC_CHECK_HEADERS(sys/inttypes.h)
1571     fi
1572 siliconforks 535 AC_DEFINE(JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES)
1573 siliconforks 460 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1574     ;;
1575    
1576     *-beos*)
1577     no_x=yes
1578     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1579     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1580     DSO_LDOPTS='-nostart'
1581     TK_LIBS='-lbe -lroot'
1582     LIBS="$LIBS -lbe"
1583     if test "$COMPILE_ENVIRONMENT"; then
1584     AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1585     AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1586     fi
1587     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1588     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1589     _MOZ_USE_RTTI=1
1590     USE_DEPENDENT_LIBS=
1591     MOZ_USER_DIR="Mozilla"
1592     ;;
1593    
1594     *-bsdi*)
1595     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1596     _PEDANTIC=
1597     _IGNORE_LONG_LONG_WARNINGS=
1598     case $OS_RELEASE in
1599     4.*|5.*)
1600     STRIP="$STRIP -d"
1601     ;;
1602     *)
1603     DSO_CFLAGS=''
1604     DSO_LDOPTS='-r'
1605     _WARNINGS_CFLAGS="-Wall"
1606     _WARNINGS_CXXFLAGS="-Wall"
1607     # The test above doesn't work properly, at least on 3.1.
1608     MKSHLIB_FORCE_ALL=''
1609     MKSHLIB_UNFORCE_ALL=''
1610     ;;
1611     esac
1612     ;;
1613    
1614     *-darwin*)
1615     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1616     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1617 siliconforks 507 MOZ_OPTIMIZE_FLAGS="-O3"
1618 siliconforks 460 _PEDANTIC=
1619     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1620     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1621     DLL_SUFFIX=".dylib"
1622     DSO_LDOPTS=''
1623     STRIP="$STRIP -x -S"
1624     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1625     MOZ_ENABLE_POSTSCRIPT=
1626     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1627     LDFLAGS="$LDFLAGS -framework Cocoa"
1628     # The ExceptionHandling framework is needed for Objective-C exception
1629     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1630     # builds.
1631     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1632     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1633     MACOSX=1
1634    
1635     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1636     dnl ===================================================================
1637     if test "x$enable_dtrace" = "xyes"; then
1638     echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1639     else
1640     dnl check for the presence of the -dead_strip linker flag
1641     AC_MSG_CHECKING([for -dead_strip option to ld])
1642     _SAVE_LDFLAGS=$LDFLAGS
1643     LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1644     AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1645     if test -n "$_HAVE_DEAD_STRIP" ; then
1646     AC_MSG_RESULT([yes])
1647     MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1648     else
1649     AC_MSG_RESULT([no])
1650     fi
1651    
1652     LDFLAGS=$_SAVE_LDFLAGS
1653     fi
1654     ;;
1655    
1656     *-freebsd*)
1657     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1658     DLL_SUFFIX=".so.1.0"
1659     DSO_LDOPTS="-shared"
1660     fi
1661     if test ! "$GNU_CC"; then
1662     DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1663     fi
1664     # Can't have force w/o an unforce.
1665     # # Hack for FreeBSD 2.2
1666     # if test -z "$MKSHLIB_FORCE_ALL"; then
1667     # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1668     # MKSHLIB_UNFORCE_ALL=''
1669     # fi
1670     ;;
1671    
1672     *-hpux*)
1673     DLL_SUFFIX=".sl"
1674     if test ! "$GNU_CC"; then
1675     DSO_LDOPTS='-b -Wl,+s'
1676     DSO_CFLAGS=""
1677     DSO_PIC_CFLAGS="+Z"
1678     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1679     MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1680     CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1681     else
1682     DSO_LDOPTS='-b -E +s'
1683     MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1684     MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1685     fi
1686     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1687     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1688     ;;
1689    
1690     *-irix5*)
1691     AC_DEFINE(IRIX)
1692     DSO_LDOPTS='-elf -shared'
1693    
1694     if test "$GNU_CC"; then
1695     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1696     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1697     MKSHLIB_FORCE_ALL='-Wl,-all'
1698     MKSHLIB_UNFORCE_ALL='-Wl,-none'
1699     CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1700     else
1701     MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1702     MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1703     MKSHLIB_FORCE_ALL='-all'
1704     MKSHLIB_UNFORCE_ALL='-none'
1705     fi
1706     ;;
1707    
1708     *-irix6*)
1709     AC_DEFINE(IRIX)
1710     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
1711     dnl compile and link using -n32
1712     USE_N32=1
1713     TARGET_COMPILER_ABI=n32
1714     DSO_LDOPTS='-elf -shared'
1715     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1716     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1717     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1718     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1719     if test "$GNU_CC"; then
1720     MKSHLIB_FORCE_ALL='-Wl,-all'
1721     MKSHLIB_UNFORCE_ALL='-Wl,-none'
1722     _WARNINGS_CFLAGS="-Wall"
1723     _WARNINGS_CXXFLAGS="-Wall"
1724     CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1725     else
1726     MKSHLIB_FORCE_ALL='-all'
1727     MKSHLIB_UNFORCE_ALL='-none'
1728     AR_LIST="$AR t"
1729     AR_EXTRACT="$AR x"
1730     AR_DELETE="$AR d"
1731     AR='$(CXX) -ar'
1732     AR_FLAGS='-o $@'
1733     CFLAGS="$CFLAGS -woff 3262 -G 4"
1734     CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1735     if test -n "$USE_N32"; then
1736     ASFLAGS="$ASFLAGS -n32"
1737     CFLAGS="$CFLAGS -n32"
1738     CXXFLAGS="$CXXFLAGS -n32"
1739     LDFLAGS="$LDFLAGS -n32"
1740     fi
1741     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1742     AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1743     MOZ_FIX_LINK_PATHS=
1744     fi
1745     if test -z "$GNU_CXX"; then
1746     MIPSPRO_CXX=1
1747     fi
1748     ;;
1749    
1750     *-*linux*)
1751     # Note: both GNU_CXX and INTEL_CXX are set when using Intel's C compiler.
1752     if test "$INTEL_CXX"; then
1753     # -Os has been broken on Intel's C/C++ compilers for quite a
1754     # while; Intel recommends against using it.
1755     MOZ_OPTIMIZE_FLAGS="-O2"
1756     MOZ_DEBUG_FLAGS="-g -fno-inline"
1757     elif test "$GNU_CXX"; then
1758     GCC_VERSION=`$CXX -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1759     case $GCC_VERSION in
1760     4.1.*|4.2.*)
1761     # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1762     MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1763     esac
1764     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1765     MOZ_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb,
1766     # and that combo is not yet good at
1767     # debugging inlined functions (even
1768     # when using DWARF2 as the debugging
1769     # format)
1770     fi
1771    
1772     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1773    
1774     case "${target_cpu}" in
1775     alpha*)
1776     CFLAGS="$CFLAGS -mieee"
1777     CXXFLAGS="$CXXFLAGS -mieee"
1778     ;;
1779     i*86)
1780     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1781     ;;
1782     mips*)
1783     MOZ_DEBUG_FLAGS="-g" # We want inlining
1784     ;;
1785     esac
1786     ;;
1787    
1788     *-wince*)
1789 siliconforks 507 TARGET_COMPILER_ABI=msvc
1790 siliconforks 460 MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1791     AR_LIST="$AR -list"
1792     AR_EXTRACT="$AR -extract"
1793     AR_DELETE="$AR d"
1794     AR_FLAGS='-OUT:"$@"'
1795     AS="$AS_BIN"
1796    
1797     DSO_CFLAGS=
1798     DSO_PIC_CFLAGS=
1799     DLL_SUFFIX=.dll
1800     BIN_SUFFIX='.exe'
1801     if test -z "$RC"; then
1802     RC=rc.exe
1803     fi
1804     # certain versions of cygwin's makedepend barf on the
1805     # #include <string> vs -I./dist/include/string issue so don't use it
1806     SYSTEM_MAKEDEPEND=
1807    
1808     HOST_CC=cl
1809     HOST_CXX=cl
1810     HOST_LD=link
1811     HOST_AR='lib -OUT:$@'
1812     HOST_RANLIB='echo ranlib'
1813     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1814    
1815    
1816     WARNINGS_AS_ERRORS='-WX'
1817     MOZ_OPTIMIZE_FLAGS='-O1'
1818     AR_FLAGS='-NOLOGO -OUT:"$@"'
1819     ASM_SUFFIX=asm
1820     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1821     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1822     DLL_PREFIX=
1823     DOXYGEN=:
1824     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1825     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1826     GARBAGE=
1827     IMPORT_LIB_SUFFIX=lib
1828     LIBS="$LIBS"
1829     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1830     LIB_PREFIX=
1831     LIB_SUFFIX=lib
1832     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1833     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1834     MKSHLIB_FORCE_ALL=
1835     MKSHLIB_UNFORCE_ALL=
1836     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1837     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1838     MOZ_DEBUG_FLAGS='-Zi'
1839     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1840     MOZ_FIX_LINK_PATHS=
1841     MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1842     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1843     OBJ_SUFFIX=obj
1844     RANLIB='echo not_ranlib'
1845     STRIP='echo not_strip'
1846     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1847     UNZIP=unzip
1848     XARGS=xargs
1849     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1850     ZIP=zip
1851    
1852     AC_DEFINE(WINCE)
1853     AC_DEFINE(HAVE_SNPRINTF)
1854     AC_DEFINE(_WINDOWS)
1855     AC_DEFINE(WIN32)
1856     AC_DEFINE(XP_WIN)
1857     AC_DEFINE(XP_WIN32)
1858     AC_DEFINE(HW_THREADS)
1859     AC_DEFINE(STDC_HEADERS)
1860     AC_DEFINE(NEW_H, <new>)
1861     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1862    
1863     TARGET_MD_ARCH=win32
1864     _PLATFORM_DEFAULT_TOOLKIT='windows'
1865     BIN_SUFFIX='.exe'
1866     USE_SHORT_LIBNAME=1
1867     MOZ_ENABLE_POSTSCRIPT=
1868     MOZ_USER_DIR="Mozilla"
1869 siliconforks 507
1870     dnl Default to Windows Mobile components enabled
1871     WINCE_WINDOWS_MOBILE=1
1872    
1873     MOZ_ARG_DISABLE_BOOL(windows-mobile-components,
1874     [ --disable-windows-mobile-components
1875     Disable Windows Mobile specific components from CE build],
1876     WINCE_WINDOWS_MOBILE=,
1877     WINCE_WINDOWS_MOBILE=1)
1878    
1879     if test "$WINCE_WINDOWS_MOBILE"; then
1880     AC_DEFINE(WINCE_WINDOWS_MOBILE)
1881     fi
1882 siliconforks 460 ;;
1883    
1884 siliconforks 507 *-symbian*)
1885 siliconforks 460
1886 siliconforks 507 AC_DEFINE(XP_UNIX)
1887     AC_DEFINE(SYMBIAN)
1888     AC_DEFINE(__arm__)
1889     AC_DEFINE(__SYMBIAN32__)
1890     AC_DEFINE(_UNICODE)
1891     AC_DEFINE(NDEBUG)
1892     AC_DEFINE(__SUPPORT_CPP_EXCEPTIONS__)
1893     AC_DEFINE(MOZ_STDERR_TO_STDOUT)
1894     AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1895     AC_DEFINE(HAVE_SOCKLEN_T)
1896     AC_DEFINE(__GCCE__)
1897    
1898     CPU_ARCH=ARM
1899     OS_RELEASE=9.2
1900     OS_ARCH=SYMBIAN
1901     USE_PTHREADS=1
1902     LIB_SUFFIX=lib
1903     DLL_SUFFIX=dll
1904     MKSHLIB=
1905     DSO_LDOPTS=
1906     DSO_CFLAGS=
1907     VISIBILITY_FLAGS=
1908     TARGET_NSPR_MDCPUCFG='\"md/_symbian.cfg\"'
1909     RANLIB='echo no ranlib '
1910     ;;
1911    
1912 siliconforks 460 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1913     DSO_CFLAGS=
1914     DSO_PIC_CFLAGS=
1915     DLL_SUFFIX=.dll
1916     RC=rc.exe
1917     # certain versions of cygwin's makedepend barf on the
1918     # #include <string> vs -I./dist/include/string issue so don't use it
1919     SYSTEM_MAKEDEPEND=
1920     if test -n "$GNU_CC"; then
1921     CC="$CC -mno-cygwin"
1922     CXX="$CXX -mno-cygwin"
1923     CPP="$CPP -mno-cygwin"
1924     CFLAGS="$CFLAGS -mms-bitfields"
1925     CXXFLAGS="$CXXFLAGS -mms-bitfields"
1926     DSO_LDOPTS='-shared'
1927     MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1928     MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1929     RC='$(WINDRES)'
1930     # Use temp file for windres (bug 213281)
1931     RCFLAGS='-O coff --use-temp-file'
1932     # mingw doesn't require kernel32, user32, and advapi32 explicitly
1933     LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1934     MOZ_JS_LIBS='-L$(libdir) -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1935     MOZ_FIX_LINK_PATHS=
1936     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1937     XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1938     DLL_PREFIX=
1939     IMPORT_LIB_SUFFIX=dll.a
1940     else
1941     TARGET_COMPILER_ABI=msvc
1942     HOST_CC='$(CC)'
1943     HOST_CXX='$(CXX)'
1944     HOST_LD='$(LD)'
1945     AR='lib -NOLOGO -OUT:"$@"'
1946     AR_FLAGS=
1947     RANLIB='echo not_ranlib'
1948     STRIP='echo not_strip'
1949     XARGS=xargs
1950     ZIP=zip
1951     UNZIP=unzip
1952     DOXYGEN=:
1953     GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1954     OBJ_SUFFIX=obj
1955     LIB_SUFFIX=lib
1956     DLL_PREFIX=
1957     LIB_PREFIX=
1958     IMPORT_LIB_SUFFIX=lib
1959     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1960     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1961     MKSHLIB_FORCE_ALL=
1962     MKSHLIB_UNFORCE_ALL=
1963     DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1964     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1965     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1966     LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1967     MOZ_DEBUG_FLAGS='-Zi'
1968     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1969     WARNINGS_AS_ERRORS='-WX'
1970     MOZ_OPTIMIZE_FLAGS='-O1'
1971     MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1972     MOZ_FIX_LINK_PATHS=
1973     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1974     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1975     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1976     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1977     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1978     if test $_MSC_VER -ge 1400; then
1979     LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
1980     dnl For profile-guided optimization
1981     PROFILE_GEN_CFLAGS="-GL"
1982     PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1983     dnl XXX: PGO builds can fail with warnings treated as errors,
1984     dnl specifically "no profile data available" appears to be
1985     dnl treated as an error sometimes. This might be a consequence
1986     dnl of using WARNINGS_AS_ERRORS in some modules, combined
1987     dnl with the linker doing most of the work in the whole-program
1988     dnl optimization/PGO case. I think it's probably a compiler bug,
1989     dnl but we work around it here.
1990     PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1991     dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1992     dnl Probably also a compiler bug, but what can you do?
1993     PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1994     if test -n "$_USE_DYNAMICBASE"; then
1995     LDFLAGS="$LDFLAGS -DYNAMICBASE"
1996     fi
1997     fi
1998     fi
1999     AC_DEFINE(HAVE_SNPRINTF)
2000     AC_DEFINE(_WINDOWS)
2001     AC_DEFINE(WIN32)
2002     AC_DEFINE(XP_WIN)
2003     AC_DEFINE(XP_WIN32)
2004     AC_DEFINE(HW_THREADS)
2005     AC_DEFINE(STDC_HEADERS)
2006     AC_DEFINE(NEW_H, <new>)
2007     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2008     TARGET_MD_ARCH=win32
2009     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2010     BIN_SUFFIX='.exe'
2011     USE_SHORT_LIBNAME=1
2012     MOZ_ENABLE_POSTSCRIPT=
2013     MOZ_USER_DIR="Mozilla"
2014    
2015     dnl Hardcode to win95 for now - cls
2016     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2017    
2018     dnl set NO_X11 defines here as the general check is skipped on win32
2019     no_x=yes
2020     AC_DEFINE(NO_X11)
2021    
2022     dnl MinGW/MSYS doesn't provide or need cygpath
2023     case "$host" in
2024     *-mingw*)
2025     CYGPATH_W=echo
2026     CYGPATH_S=cat
2027     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2028     ;;
2029     *-cygwin*|*-msvc*|*-mks*)
2030     CYGPATH_W="cygpath -a -w"
2031     CYGPATH_S="sed -e s|\\\\|/|g"
2032     MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2033     ;;
2034     esac
2035     case "$host" in
2036     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2037    
2038     if test -z "$MOZ_TOOLS"; then
2039     AC_MSG_ERROR([MOZ_TOOLS is not set])
2040     fi
2041    
2042     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2043     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2044     AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2045     fi
2046     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2047     AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2048     fi
2049     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2050     ;;
2051     esac
2052    
2053    
2054     case "$host_os" in
2055     cygwin*|msvc*|mks*)
2056     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])
2057     ;;
2058    
2059     *)
2060     AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2061    
2062     AC_LANG_SAVE
2063     AC_LANG_CPLUSPLUS
2064     AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2065     AC_LANG_RESTORE
2066     ;;
2067     esac
2068    
2069     case "$target" in
2070     i*86-*)
2071     AC_DEFINE(_X86_)
2072     ;;
2073     alpha-*)
2074     AC_DEFINE(_ALPHA_)
2075     ;;
2076     mips-*)
2077     AC_DEFINE(_MIPS_)
2078     ;;
2079     *)
2080     AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2081     ;;
2082     esac
2083     ;;
2084    
2085     *-netbsd*)
2086     DSO_CFLAGS=''
2087     CFLAGS="$CFLAGS -Dunix"
2088     CXXFLAGS="$CXXFLAGS -Dunix"
2089     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2090     DLL_SUFFIX=".so"
2091     DSO_PIC_CFLAGS='-fPIC -DPIC'
2092     DSO_LDOPTS='-shared'
2093     BIN_FLAGS='-Wl,--export-dynamic'
2094     else
2095     DSO_PIC_CFLAGS='-fPIC -DPIC'
2096     DLL_SUFFIX=".so.1.0"
2097     DSO_LDOPTS='-shared'
2098     fi
2099     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2100     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2101     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2102     if test "$LIBRUNPATH"; then
2103     DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2104     fi
2105     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2106     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2107     ;;
2108    
2109     *-nto*)
2110     AC_DEFINE(NTO)
2111     AC_DEFINE(_QNX_SOURCE)
2112     AC_DEFINE(_i386)
2113     OS_TARGET=NTO
2114     WARNINGS_AS_ERRORS=''
2115     MOZ_OPTIMIZE_FLAGS="-O"
2116     MOZ_DEBUG_FLAGS="-gstabs"
2117     USE_PTHREADS=1
2118     _PEDANTIC=
2119     LIBS="$LIBS -lsocket -lstdc++"
2120 siliconforks 507 _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2121     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/js-confdefs.h -D_POSIX_C_SOURCE=199506'
2122 siliconforks 460 if test "$with_x" != "yes"
2123     then
2124     _PLATFORM_DEFAULT_TOOLKIT="photon"
2125     TK_CFLAGS='-I/usr/include/photon'
2126     TK_LIBS='-lph'
2127     fi
2128     case "${target_cpu}" in
2129     ppc*)
2130     AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2131     ;;
2132     esac
2133     ;;
2134    
2135     *-openbsd*)
2136     DLL_SUFFIX=".so.1.0"
2137     DSO_CFLAGS=''
2138     DSO_PIC_CFLAGS='-fPIC'
2139     DSO_LDOPTS='-shared -fPIC'
2140     if test "$LIBRUNPATH"; then
2141     DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2142     fi
2143     ;;
2144    
2145     *-openvms*)
2146     AC_DEFINE(NO_PW_GECOS)
2147     AC_DEFINE(NO_UDSOCK)
2148     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2149     USE_PTHREADS=1
2150     MKSHLIB_FORCE_ALL='-all'
2151     MKSHLIB_UNFORCE_ALL='-none'
2152     AS='as'
2153     AS_DASH_C_FLAG='-Wc/names=as_is'
2154     AR_FLAGS='c $@'
2155     DSO_LDOPTS='-shared -auto_symvec'
2156     DSO_PIC_CFLAGS=
2157     MOZ_DEBUG_LDFLAGS='-g'
2158     COMPAQ_CXX=1
2159     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2160     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2161     ;;
2162    
2163    
2164     *-os2*)
2165     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2166     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2167     AC_DEFINE(OS2)
2168     AC_DEFINE(XP_OS2)
2169     AC_DEFINE(OS2EMX_PLAIN_CHAR)
2170     AC_DEFINE(TCPV40HDRS)
2171     USE_SHORT_LIBNAME=1
2172     DLL_PREFIX=
2173     LIB_PREFIX=
2174     LIB_SUFFIX=lib
2175     BIN_SUFFIX=".exe"
2176     DLL_SUFFIX=".dll"
2177     IMPORT_LIB_SUFFIX=lib
2178     DSO_PIC_CFLAGS=
2179     AR=emxomfar
2180     AR_FLAGS='r $@'
2181     CFLAGS="$CFLAGS -Zomf"
2182     CXXFLAGS="$CXXFLAGS -Zomf"
2183     DSO_LDOPTS='-Zdll'
2184     BIN_FLAGS='-Zlinker /ST:0x100000'
2185     IMPLIB='emximp -o'
2186     FILTER='emxexp -o'
2187     LDFLAGS='-Zmap'
2188     WARNINGS_AS_ERRORS='-Werror'
2189     MOZ_DEBUG_FLAGS="-g -fno-inline"
2190     MOZ_OPTIMIZE_FLAGS="-O2"
2191     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2192     MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2193     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2194     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2195     TARGET_MD_ARCH=os2
2196     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2197     MOZ_ENABLE_POSTSCRIPT=
2198     RC=rc.exe
2199     RCFLAGS='-n'
2200     MOZ_USER_DIR="Mozilla"
2201    
2202     if test "$MOZTOOLS"; then
2203     MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2204     else
2205     AC_MSG_ERROR([MOZTOOLS is not set])
2206     fi
2207     if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2208     DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2209     LDFLAGS="$LDFLAGS -Zhigh-mem"
2210     MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2211     AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2212     fi
2213    
2214     # GCC for OS/2 currently predefines these, but we don't want them
2215     _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2216     _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2217    
2218     AC_CACHE_CHECK(for __declspec(dllexport),
2219     ac_os2_declspec,
2220     [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2221     [return 0;],
2222     ac_os2_declspec="yes",
2223     ac_os2_declspec="no")])
2224     if test "$ac_os2_declspec" = "yes"; then
2225     FILTER='true'
2226     MOZ_OS2_USE_DECLSPEC='1'
2227     fi
2228     ;;
2229    
2230     alpha*-*-osf*)
2231     if test "$GNU_CC"; then
2232     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2233     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2234    
2235     else
2236     MOZ_DEBUG_FLAGS='-g'
2237     ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2238     CFLAGS="$CFLAGS -ieee"
2239     CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2240     DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2241     DSO_CFLAGS=
2242     DSO_PIC_CFLAGS=
2243     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2244     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2245     MKSHLIB_FORCE_ALL='-all'
2246     MKSHLIB_UNFORCE_ALL='-none'
2247     dnl Might fix the libxpcom.so breakage on this platform as well....
2248     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2249     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2250     fi
2251     if test -z "$GNU_CXX"; then
2252     COMPAQ_CXX=1
2253     fi
2254     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2255     ;;
2256    
2257     *-qnx*)
2258     DIRENT_INO=d_stat.st_ino
2259     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2260     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2261     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2262     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2263     AC_DEFINE(STDC_HEADERS)
2264     if test "$no_x" = "yes"; then
2265     _PLATFORM_DEFAULT_TOOLKIT='photon'
2266     TK_CFLAGS='-I/usr/nto/include/photon'
2267     TK_LIBS='-lphoton -lphrender'
2268     fi
2269     ;;
2270    
2271     *-sco*)
2272     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2273     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2274     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2275     if test ! "$GNU_CC"; then
2276     DSO_LDOPTS='-G'
2277     fi
2278     ;;
2279    
2280     dnl the qsort routine under solaris is faulty
2281     *-solaris*)
2282     AC_DEFINE(SOLARIS)
2283     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2284 siliconforks 507 if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then
2285     NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4"
2286     NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps"
2287     NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"]
2288     fi
2289 siliconforks 460 SYSTEM_MAKEDEPEND=
2290     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2291     # libraries one level up (e.g. libnspr4.so)
2292     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2293     if test "$SOLARIS_SUNPRO_CC"; then
2294     LIBS="-lCrun -lCstd $LIBS"
2295     NS_USE_NATIVE=1
2296     MOZ_FIX_LINK_PATHS=
2297     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2298     CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2299     CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2300     LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2301     if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2302     _SAVE_LDFLAGS=$LDFLAGS
2303     LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2304     AC_TRY_LINK([#include <stdio.h>],
2305     [printf("Hello World\n");],
2306     ,
2307     [LDFLAGS=$_SAVE_LDFLAGS])
2308     fi
2309     WARNINGS_AS_ERRORS='-Werror'
2310     MOZ_OPTIMIZE_FLAGS="-xO4"
2311     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2312     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2313     MKSHLIB_FORCE_ALL='-z allextract'
2314     MKSHLIB_UNFORCE_ALL='-z defaultextract'
2315     DSO_LDOPTS='-G -z muldefs'
2316     AR_LIST="$AR t"
2317     AR_EXTRACT="$AR x"
2318     AR_DELETE="$AR d"
2319     AR='$(CXX) -xar'
2320     AR_FLAGS='-o $@'
2321     AS='/usr/ccs/bin/as'
2322     ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2323     AS_DASH_C_FLAG=''
2324     TARGET_COMPILER_ABI="sunc"
2325     CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2326     CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2327     AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2328     AC_LANG_SAVE
2329     AC_LANG_CPLUSPLUS
2330     AC_TRY_COMPILE([],
2331     [#if (__SUNPRO_CC < 0x590)
2332     #error "Denied"
2333     #endif],
2334     _BAD_COMPILER=,_BAD_COMPILER=1)
2335     if test -n "$_BAD_COMPILER"; then
2336     _res="no"
2337     AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2338     else
2339     _res="yes"
2340     fi
2341     AC_MSG_RESULT([$_res])
2342     AC_LANG_RESTORE
2343     else
2344     ASFLAGS="$ASFLAGS -fPIC"
2345     DSO_LDOPTS='-G'
2346     _WARNINGS_CFLAGS=''
2347     _WARNINGS_CXXFLAGS=''
2348     if test "$OS_RELEASE" = "5.3"; then
2349     AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2350     fi
2351     fi
2352     if test "$OS_RELEASE" = "5.5.1"; then
2353     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2354     fi
2355     ;;
2356    
2357     *-sunos*)
2358     DSO_LDOPTS='-Bdynamic'
2359     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2360     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2361     AC_DEFINE(SUNOS4)
2362     AC_DEFINE(SPRINTF_RETURNS_STRING)
2363     case "$(target_os)" in
2364     sunos4.1*)
2365     DLL_SUFFIX='.so.1.0'
2366     ;;
2367     esac
2368     ;;
2369    
2370     *-sysv4.2uw7*)
2371     NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2372     ;;
2373    
2374     *-os2*)
2375     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2376     ;;
2377    
2378     esac
2379    
2380     dnl Only one oddball right now (QNX), but this gives us flexibility
2381     dnl if any other platforms need to override this in the future.
2382     AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2383    
2384     dnl ========================================================
2385     dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2386     dnl by now will not have any way to link most binaries (tests
2387     dnl as well as viewer, apprunner, etc.), because some symbols
2388     dnl will be left out of the "composite" .so's by ld as unneeded.
2389     dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2390     dnl they can link in the static libs that provide the missing
2391     dnl symbols.
2392     dnl ========================================================
2393     NO_LD_ARCHIVE_FLAGS=
2394     if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2395     NO_LD_ARCHIVE_FLAGS=1
2396     fi
2397     case "$target" in
2398     *-os2*)
2399     NO_LD_ARCHIVE_FLAGS=
2400     ;;
2401     *-aix4.3*|*-aix5*)
2402     NO_LD_ARCHIVE_FLAGS=
2403     ;;
2404     *-openvms*)
2405     NO_LD_ARCHIVE_FLAGS=
2406     ;;
2407     *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2408     if test -z "$GNU_CC"; then
2409     NO_LD_ARCHIVE_FLAGS=
2410     fi
2411     ;;
2412     esac
2413     AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2414    
2415     dnl
2416     dnl Indicate that platform requires special thread safe
2417     dnl locking when starting up the OJI JVM
2418     dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2419     dnl ========================================================
2420     case "$target" in
2421     *-hpux*)
2422     AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2423     ;;
2424     esac
2425    
2426     dnl ========================================================
2427     dnl = Flags to strip unused symbols from .so components
2428     dnl ========================================================
2429     case "$target" in
2430     *-linux*|*-kfreebsd*-gnu)
2431     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2432     ;;
2433     *-solaris*)
2434     if test -z "$GNU_CC"; then
2435     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2436     else
2437     if test -z "$GCC_USE_GNU_LD"; then
2438     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2439     else
2440     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2441     fi
2442     fi
2443     ;;
2444     *-nto*)
2445     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2446     ;;
2447     *-darwin*)
2448     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2449     ;;
2450     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2451     if test -n "$GNU_CC"; then
2452     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2453     fi
2454     ;;
2455     esac
2456    
2457     if test -z "$COMPILE_ENVIRONMENT"; then
2458     SKIP_COMPILER_CHECKS=1
2459     SKIP_LIBRARY_CHECKS=1
2460     fi
2461    
2462     dnl Configure JIT support
2463    
2464     case "$target" in
2465     i?86-*)
2466     ENABLE_JIT=1
2467     NANOJIT_ARCH=i386
2468     ;;
2469     arm*-*)
2470     ENABLE_JIT=1
2471     NANOJIT_ARCH=ARM
2472     ;;
2473     sparc*-*)
2474     ENABLE_JIT=1
2475     NANOJIT_ARCH=Sparc
2476     ;;
2477     esac
2478    
2479     MOZ_ARG_DISABLE_BOOL(jit,
2480     [ --disable-jit Disable JIT support],
2481     ENABLE_JIT=)
2482    
2483     if test "$ENABLE_JIT"; then
2484    
2485 siliconforks 507 AC_DEFINE(FEATURE_NANOJIT)
2486     AC_DEFINE(JS_TRACER)
2487    
2488 siliconforks 460 case "$target" in
2489     i?86-*)
2490     AC_DEFINE(AVMPLUS_IA32)
2491     ;;
2492    
2493     arm*-*)
2494     AC_DEFINE(AVMPLUS_ARM)
2495     ;;
2496     sparc-*)
2497     AC_DEFINE(AVMPLUS_SPARC)
2498     ;;
2499     esac
2500    
2501     case "$target_os" in
2502     linux*)
2503     AC_DEFINE(AVMPLUS_UNIX)
2504     AC_DEFINE(AVMPLUS_LINUX)
2505     ;;
2506     darwin*)
2507     AC_DEFINE(AVMPLUS_UNIX)
2508     ;;
2509     solaris*)
2510     AC_DEFINE(AVMPLUS_UNIX)
2511     ;;
2512     freebsd*|kfreebsd*)
2513     AC_DEFINE(AVMPLUS_UNIX)
2514     ;;
2515     *cygwin*|*mingw*|*mks*|*msvc*|*wince)
2516     AC_DEFINE(AVMPLUS_WIN32)
2517     ;;
2518     *os2*)
2519     AC_DEFINE(AVMPLUS_OS2)
2520     ;;
2521     *)
2522     AC_MSG_ERROR([Unrecognized nanojit platform. Use --disable-jit to build without JIT support.])
2523     esac
2524    
2525     fi # ENABLE_JIT
2526    
2527     AC_SUBST(ENABLE_JIT)
2528     AC_SUBST(NANOJIT_ARCH)
2529    
2530     if test -z "$SKIP_COMPILER_CHECKS"; then
2531     dnl Checks for typedefs, structures, and compiler characteristics.
2532     dnl ========================================================
2533     AC_LANG_C
2534     AC_HEADER_STDC
2535     AC_C_CONST
2536     AC_TYPE_MODE_T
2537     AC_TYPE_OFF_T
2538     AC_TYPE_PID_T
2539     AC_TYPE_SIZE_T
2540     AC_STRUCT_ST_BLKSIZE
2541     AC_MSG_CHECKING(for siginfo_t)
2542     AC_CACHE_VAL(ac_cv_siginfo_t,
2543     [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2544     #include <signal.h>],
2545     [siginfo_t* info;],
2546     [ac_cv_siginfo_t=true],
2547     [ac_cv_siginfo_t=false])])
2548     if test "$ac_cv_siginfo_t" = true ; then
2549     AC_DEFINE(HAVE_SIGINFO_T)
2550     AC_MSG_RESULT(yes)
2551     else
2552     AC_MSG_RESULT(no)
2553     fi
2554    
2555     dnl Find exact-width integer types, or figure them out
2556     dnl ourselves.
2557     dnl ========================================================
2558     dnl Once this is working, we can delete the code for int16_t,
2559     dnl etc. below.
2560    
2561     AC_CHECK_HEADER(stdint.h)
2562     if test "$ac_cv_header_stdint_h" = yes; then
2563     AC_DEFINE(JS_HAVE_STDINT_H)
2564     else
2565     dnl We'll figure them out for ourselves. List more likely types
2566     dnl earlier. If we ever really encounter a size for which none of
2567     dnl the listed types are appropriate, we'll get a configure-time
2568     dnl error; just add the right answer.
2569     MOZ_N_BYTE_TYPE(JS_INT8_TYPE, 1, [char])
2570     MOZ_N_BYTE_TYPE(JS_INT16_TYPE, 2, [short int long])
2571     MOZ_N_BYTE_TYPE(JS_INT32_TYPE, 4, [int long 'long long' short])
2572     MOZ_N_BYTE_TYPE(JS_INT64_TYPE, 8, [int long 'long long'])
2573     MOZ_N_BYTE_TYPE(JS_INTPTR_TYPE, sizeof (void *),
2574     [int long 'long long' short])
2575     fi
2576    
2577     MOZ_SIZE_OF_TYPE(JS_BYTES_PER_WORD, void*, 4 8)
2578     if test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "4"; then
2579     AC_DEFINE(JS_BITS_PER_WORD_LOG2, 5)
2580     elif test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "8"; then
2581     AC_DEFINE(JS_BITS_PER_WORD_LOG2, 6)
2582     else
2583     AC_MSG_ERROR([Unexpected JS_BYTES_PER_WORD])
2584     fi
2585    
2586     MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
2587     MOZ_SIZE_OF_TYPE(JS_BYTES_PER_DOUBLE, double, 6 8 10 12 14)
2588    
2589     dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2590     dnl ========================================================
2591     AC_MSG_CHECKING(for int16_t)
2592     AC_CACHE_VAL(ac_cv_int16_t,
2593     [AC_TRY_COMPILE([#include <stdio.h>
2594     #include <sys/types.h>],
2595     [int16_t foo = 0;],
2596     [ac_cv_int16_t=true],
2597     [ac_cv_int16_t=false])])
2598     if test "$ac_cv_int16_t" = true ; then
2599     AC_DEFINE(HAVE_INT16_T)
2600     AC_MSG_RESULT(yes)
2601     else
2602     AC_MSG_RESULT(no)
2603     fi
2604     AC_MSG_CHECKING(for int32_t)
2605     AC_CACHE_VAL(ac_cv_int32_t,
2606     [AC_TRY_COMPILE([#include <stdio.h>
2607     #include <sys/types.h>],
2608     [int32_t foo = 0;],
2609     [ac_cv_int32_t=true],
2610     [ac_cv_int32_t=false])])
2611     if test "$ac_cv_int32_t" = true ; then
2612     AC_DEFINE(HAVE_INT32_T)
2613     AC_MSG_RESULT(yes)
2614     else
2615     AC_MSG_RESULT(no)
2616     fi
2617     AC_MSG_CHECKING(for int64_t)
2618     AC_CACHE_VAL(ac_cv_int64_t,
2619     [AC_TRY_COMPILE([#include <stdio.h>
2620     #include <sys/types.h>],
2621     [int64_t foo = 0;],
2622     [ac_cv_int64_t=true],
2623     [ac_cv_int64_t=false])])
2624     if test "$ac_cv_int64_t" = true ; then
2625     AC_DEFINE(HAVE_INT64_T)
2626     AC_MSG_RESULT(yes)
2627     else
2628     AC_MSG_RESULT(no)
2629     fi
2630     AC_MSG_CHECKING(for int64)
2631     AC_CACHE_VAL(ac_cv_int64,
2632     [AC_TRY_COMPILE([#include <stdio.h>
2633     #include <sys/types.h>],
2634     [int64 foo = 0;],
2635     [ac_cv_int64=true],
2636     [ac_cv_int64=false])])
2637     if test "$ac_cv_int64" = true ; then
2638     AC_DEFINE(HAVE_INT64)
2639     AC_MSG_RESULT(yes)
2640     else
2641     AC_MSG_RESULT(no)
2642     fi
2643     AC_MSG_CHECKING(for uint)
2644     AC_CACHE_VAL(ac_cv_uint,
2645     [AC_TRY_COMPILE([#include <stdio.h>
2646     #include <sys/types.h>],
2647     [uint foo = 0;],
2648     [ac_cv_uint=true],
2649     [ac_cv_uint=false])])
2650     if test "$ac_cv_uint" = true ; then
2651     AC_DEFINE(HAVE_UINT)
2652     AC_MSG_RESULT(yes)
2653     else
2654     AC_MSG_RESULT(no)
2655     fi
2656     AC_MSG_CHECKING(for uint_t)
2657     AC_CACHE_VAL(ac_cv_uint_t,
2658     [AC_TRY_COMPILE([#include <stdio.h>
2659     #include <sys/types.h>],
2660     [uint_t foo = 0;],
2661     [ac_cv_uint_t=true],
2662     [ac_cv_uint_t=false])])
2663     if test "$ac_cv_uint_t" = true ; then
2664     AC_DEFINE(HAVE_UINT_T)
2665     AC_MSG_RESULT(yes)
2666     else
2667     AC_MSG_RESULT(no)
2668     fi
2669     AC_MSG_CHECKING(for uint16_t)
2670     AC_CACHE_VAL(ac_cv_uint16_t,
2671     [AC_TRY_COMPILE([#include <stdio.h>
2672     #include <sys/types.h>],
2673     [uint16_t foo = 0;],
2674     [ac_cv_uint16_t=true],
2675     [ac_cv_uint16_t=false])])
2676     if test "$ac_cv_uint16_t" = true ; then
2677     AC_DEFINE(HAVE_UINT16_T)
2678     AC_MSG_RESULT(yes)
2679     else
2680     AC_MSG_RESULT(no)
2681     fi
2682    
2683     dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2684     dnl are defined when compiling C++ but not C. Since the result of this
2685     dnl test is used only in C++, do it in C++.
2686     AC_LANG_CPLUSPLUS
2687    
2688     AC_MSG_CHECKING(for uname.domainname)
2689     AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2690     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2691     [ struct utsname *res; char *domain;
2692     (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2693     [ac_cv_have_uname_domainname_field=true],
2694     [ac_cv_have_uname_domainname_field=false])])
2695    
2696     if test "$ac_cv_have_uname_domainname_field" = "true"; then
2697     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2698     AC_MSG_RESULT(yes)
2699     else
2700     AC_MSG_RESULT(no)
2701     fi
2702    
2703     AC_MSG_CHECKING(for uname.__domainname)
2704     AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2705     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2706     [ struct utsname *res; char *domain;
2707     (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2708     [ac_cv_have_uname_us_domainname_field=true],
2709     [ac_cv_have_uname_us_domainname_field=false])])
2710    
2711     if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2712     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2713     AC_MSG_RESULT(yes)
2714     else
2715     AC_MSG_RESULT(no)
2716     fi
2717    
2718     AC_LANG_C
2719    
2720     dnl Check for .hidden assembler directive and visibility attribute.
2721     dnl Borrowed from glibc configure.in
2722     dnl ===============================================================
2723     if test "$GNU_CC"; then
2724     AC_CACHE_CHECK(for visibility(hidden) attribute,
2725     ac_cv_visibility_hidden,
2726     [cat > conftest.c <<EOF
2727     int foo __attribute__ ((visibility ("hidden"))) = 1;
2728     EOF
2729     ac_cv_visibility_hidden=no
2730     if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2731     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2732     ac_cv_visibility_hidden=yes
2733     fi
2734     fi
2735     rm -f conftest.[cs]
2736     ])
2737     if test "$ac_cv_visibility_hidden" = "yes"; then
2738     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2739    
2740     AC_CACHE_CHECK(for visibility(default) attribute,
2741     ac_cv_visibility_default,
2742     [cat > conftest.c <<EOF
2743     int foo __attribute__ ((visibility ("default"))) = 1;
2744     EOF
2745     ac_cv_visibility_default=no
2746     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2747     if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2748     ac_cv_visibility_default=yes
2749     fi
2750     fi
2751     rm -f conftest.[cs]
2752     ])
2753     if test "$ac_cv_visibility_default" = "yes"; then
2754     AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2755    
2756     AC_CACHE_CHECK(for visibility pragma support,
2757     ac_cv_visibility_pragma,
2758     [cat > conftest.c <<EOF
2759     #pragma GCC visibility push(hidden)
2760     int foo_hidden = 1;
2761     #pragma GCC visibility push(default)
2762     int foo_default = 1;
2763     EOF
2764     ac_cv_visibility_pragma=no
2765     if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2766     if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2767     if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2768     ac_cv_visibility_pragma=yes
2769     fi
2770     fi
2771     fi
2772     rm -f conftest.[cs]
2773     ])
2774     if test "$ac_cv_visibility_pragma" = "yes"; then
2775     AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2776     ac_cv_have_visibility_class_bug,
2777     [cat > conftest.c <<EOF
2778     #pragma GCC visibility push(hidden)
2779     struct __attribute__ ((visibility ("default"))) TestStruct {
2780     static void Init();
2781     };
2782     __attribute__ ((visibility ("default"))) void TestFunc() {
2783     TestStruct::Init();
2784     }
2785     EOF
2786     ac_cv_have_visibility_class_bug=no
2787     if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2788     ac_cv_have_visibility_class_bug=yes
2789     else
2790     if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2791     ac_cv_have_visibility_class_bug=yes
2792     fi
2793     fi
2794     rm -rf conftest.{c,S}
2795     ])
2796    
2797     AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2798     ac_cv_have_visibility_builtin_bug,
2799     [cat > conftest.c <<EOF
2800     #pragma GCC visibility push(hidden)
2801     #pragma GCC visibility push(default)
2802     #include <string.h>
2803     #pragma GCC visibility pop
2804    
2805     __attribute__ ((visibility ("default"))) void Func() {
2806     char c[[100]];
2807     memset(c, 0, sizeof(c));
2808     }
2809     EOF
2810     ac_cv_have_visibility_builtin_bug=no
2811     if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2812     ac_cv_have_visibility_builtin_bug=yes
2813     else
2814     if test `grep -c "@PLT" conftest.S` = 0; then
2815     ac_cv_visibility_builtin_bug=yes
2816     fi
2817     fi
2818     rm -f conftest.{c,S}
2819     ])
2820     if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2821     "$ac_cv_have_visibility_class_bug" = "no"; then
2822 siliconforks 507 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h'
2823 siliconforks 460 WRAP_SYSTEM_INCLUDES=1
2824     else
2825     VISIBILITY_FLAGS='-fvisibility=hidden'
2826     fi # have visibility pragma bug
2827     fi # have visibility pragma
2828     fi # have visibility(default) attribute
2829     fi # have visibility(hidden) attribute
2830     fi # GNU_CC
2831    
2832     # visibility hidden flag for Sun Studio on Solaris
2833     if test "$SOLARIS_SUNPRO_CC"; then
2834     VISIBILITY_FLAGS='-xldscope=hidden'
2835     fi # Sun Studio on Solaris
2836    
2837     AC_SUBST(WRAP_SYSTEM_INCLUDES)
2838     AC_SUBST(VISIBILITY_FLAGS)
2839    
2840     dnl Checks for header files.
2841     dnl ========================================================
2842     AC_HEADER_DIRENT
2843     case "$target_os" in
2844     freebsd*)
2845     # for stuff like -lXshm
2846     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2847     ;;
2848     esac
2849     AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2850     AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2851     AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2852     AC_CHECK_HEADERS(malloc.h)
2853     AC_CHECK_HEADERS(X11/XKBlib.h)
2854    
2855     dnl These are all the places some variant of statfs can be hiding.
2856     AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2857    
2858     dnl Try for MMX support
2859     dnl NB - later gcc versions require -mmmx for this header to be successfully
2860     dnl included (or another option which implies it, such as -march=pentium-mmx)
2861     AC_CHECK_HEADERS(mmintrin.h)
2862    
2863     dnl Check whether the compiler supports the new-style C++ standard
2864     dnl library headers (i.e. <new>) or needs the old "new.h"
2865     AC_LANG_CPLUSPLUS
2866     NEW_H=new.h
2867     AC_CHECK_HEADER(new, [NEW_H=new])
2868     AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2869     AC_LANG_C
2870    
2871     AC_ARG_ENABLE(dtrace,
2872     [ --enable-dtrace build with dtrace support if available (default=no)],