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

Contents of /trunk/js/configure.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 460 - (show annotations)
Sat Sep 26 23:15:22 2009 UTC (10 years, 1 month ago) by siliconforks
File size: 174698 byte(s)
Upgrade to SpiderMonkey from Firefox 3.5.3.

1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 dnl
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
10 dnl
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
14 dnl License.
15 dnl
16 dnl The Original Code is this file as it was released upon August 6, 1998.
17 dnl
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
22 dnl
23 dnl Contributor(s):
24 dnl Jamie Zawinski <jwz@jwz.org>
25 dnl gettimeofday args check
26 dnl Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl gnomefe update & enable-pthreads
28 dnl Ramiro Estrugo <ramiro@netscape.com>
29 dnl X11 makedepend support
30 dnl Insure support.
31 dnl Henry Sobotka <sobotka@axess.com>
32 dnl OS/2 support
33 dnl Dan Mosedale <dmose@mozilla.org>
34 dnl LDAP support
35 dnl Seth Spitzer <sspitzer@netscape.com>
36 dnl xpctools support
37 dnl Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl Howard Chu <hyc@symas.com>
39 dnl MSYS support
40 dnl Mark Mentovai <mark@moxienet.com>:
41 dnl Mac OS X 10.4 support
42 dnl Giorgio Maone <g.maone@informaction.com>
43 dnl MSVC l10n compatible version check
44 dnl Ben Turner <mozilla@songbirdnest.com>
45 dnl
46 dnl Alternatively, the contents of this file may be used under the terms of
47 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
48 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
49 dnl in which case the provisions of the GPL or the LGPL are applicable instead
50 dnl of those above. If you wish to allow use of your version of this file only
51 dnl under the terms of either the GPL or the LGPL, and not to allow others to
52 dnl use your version of this file under the terms of the MPL, indicate your
53 dnl decision by deleting the provisions above and replace them with the notice
54 dnl and other provisions required by the GPL or the LGPL. If you do not delete
55 dnl the provisions above, a recipient may use your version of this file under
56 dnl the terms of any one of the MPL, the GPL or the LGPL.
57 dnl
58 dnl ***** END LICENSE BLOCK *****
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 MAKE_VERSION=3.78
112 WINDRES_VERSION=2.14.90
113 W32API_VERSION=3.8
114
115 MSMANIFEST_TOOL=
116
117 dnl Set various checks
118 dnl ========================================================
119 MISSING_X=
120 AC_PROG_AWK
121
122 dnl Initialize the Pthread test variables early so they can be
123 dnl overridden by each platform.
124 dnl ========================================================
125 USE_PTHREADS=
126 _PTHREAD_LDFLAGS=""
127
128 dnl Do not allow a separate objdir build if a srcdir build exists.
129 dnl ==============================================================
130 _topsrcdir=`cd \`dirname $0\`; pwd`
131 _objdir=`pwd`
132
133 if test "$_topsrcdir" != "$_objdir"
134 then
135 # Check for a couple representative files in the source tree
136 _conflict_files=
137 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
138 if test -f $file; then
139 _conflict_files="$_conflict_files $file"
140 fi
141 done
142 if test "$_conflict_files"; then
143 echo "***"
144 echo "* Your source tree contains these files:"
145 for file in $_conflict_files; do
146 echo "* $file"
147 done
148 cat 1>&2 <<-EOF
149 * This indicates that you previously built in the source tree.
150 * A source tree build can confuse the separate objdir build.
151 *
152 * To clean up the source tree:
153 * 1. cd $_topsrcdir
154 * 2. gmake distclean
155 ***
156 EOF
157 exit 1
158 break
159 fi
160 fi
161 MOZ_BUILD_ROOT=`pwd`
162
163 dnl Choose where to put the 'dist' directory.
164 dnl ==============================================================
165
166 MOZ_ARG_WITH_STRING(dist-dir,
167 [ --with-dist-dir=DIR Use DIR as 'dist' staging area. DIR may be
168 relative to the top of SpiderMonkey build tree,
169 or absolute.],
170 TOP_DIST=$withval,
171 TOP_DIST=dist)
172 AC_SUBST(TOP_DIST)
173
174 dnl Default to MSVC for win32
175 dnl ==============================================================
176 if test -z "$CROSS_COMPILE"; then
177 case "$target" in
178 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
179 MAKE_VERSION=3.79
180 if test -z "$CC"; then CC=cl; fi
181 if test -z "$CXX"; then CXX=cl; fi
182 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
183 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
184 if test -z "$LD"; then LD=link; fi
185 if test -z "$AS"; then AS=ml; fi
186 ;;
187 esac
188 fi
189
190 COMPILE_ENVIRONMENT=1
191 MOZ_ARG_ENABLE_BOOL(compile-environment,
192 [ --disable-compile-environment
193 Disable compiler/library checks.],
194 COMPILE_ENVIRONMENT=1,
195 COMPILE_ENVIRONMENT= )
196
197 dnl ========================================================
198 dnl Checks for compilers.
199 dnl ========================================================
200
201 if test "$COMPILE_ENVIRONMENT"; then
202
203 if test "$target" != "$host"; then
204 echo "cross compiling from $host to $target"
205
206 _SAVE_CC="$CC"
207 _SAVE_CFLAGS="$CFLAGS"
208 _SAVE_LDFLAGS="$LDFLAGS"
209
210 AC_MSG_CHECKING([for host c compiler])
211 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
212 if test -z "$HOST_CC"; then
213 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
214 fi
215 AC_MSG_RESULT([$HOST_CC])
216 AC_MSG_CHECKING([for host c++ compiler])
217 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
218 if test -z "$HOST_CXX"; then
219 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
220 fi
221 AC_MSG_RESULT([$HOST_CXX])
222
223 if test -z "$HOST_CFLAGS"; then
224 HOST_CFLAGS="$CFLAGS"
225 fi
226 if test -z "$HOST_CXXFLAGS"; then
227 HOST_CXXFLAGS="$CXXFLAGS"
228 fi
229 if test -z "$HOST_LDFLAGS"; then
230 HOST_LDFLAGS="$LDFLAGS"
231 fi
232 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
233 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
234 CC="$HOST_CC"
235 CFLAGS="$HOST_CFLAGS"
236 LDFLAGS="$HOST_LDFLAGS"
237
238 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
239 AC_TRY_COMPILE([], [return(0);],
240 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
241 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
242
243 CC="$HOST_CXX"
244 CFLAGS="$HOST_CXXFLAGS"
245
246 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
247 AC_TRY_COMPILE([], [return(0);],
248 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
249 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
250
251 CC=$_SAVE_CC
252 CFLAGS=$_SAVE_CFLAGS
253 LDFLAGS=$_SAVE_LDFLAGS
254
255 case "$build:$target" in
256 powerpc-apple-darwin8*:i?86-apple-darwin*)
257 dnl The Darwin cross compiler doesn't necessarily point itself at a
258 dnl root that has libraries for the proper architecture, it defaults
259 dnl to the system root. The libraries in the system root on current
260 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
261 dnl checks will fail. Fake a working SDK in that case.
262 _SAVE_CFLAGS=$CFLAGS
263 _SAVE_CXXFLAGS=$CXXLAGS
264 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
265 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
266 ;;
267 esac
268
269 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
270 unset ac_cv_prog_CC
271 AC_PROG_CC
272 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
273 unset ac_cv_prog_CXX
274 AC_PROG_CXX
275
276 case "$build:$target" in
277 powerpc-apple-darwin8*:i?86-apple-darwin*)
278 dnl Revert the changes made above. From this point on, the target
279 dnl compiler will never be used without applying the SDK to CFLAGS
280 dnl (see --with-macos-sdk below).
281 CFLAGS=$_SAVE_CFLAGS
282 CXXFLAGS=$_SAVE_CXXFLAGS
283 ;;
284 esac
285
286 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
287 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
288 AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
289 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
290 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
291 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
292 AC_DEFINE(CROSS_COMPILE)
293
294 dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
295 dnl have erroneously been set to "no", because the x86 build host is
296 dnl able to run ppc code in a translated environment, making a cross
297 dnl compiler appear native. So we override that here.
298 cross_compiling=yes
299 else
300 AC_PROG_CC
301 AC_PROG_CXX
302 AC_PROG_RANLIB
303 AC_PATH_PROGS(AS, $AS as, $CC)
304 AC_CHECK_PROGS(AR, ar, :)
305 AC_CHECK_PROGS(LD, ld, :)
306 AC_CHECK_PROGS(STRIP, strip, :)
307 AC_CHECK_PROGS(WINDRES, windres, :)
308 if test -z "$HOST_CC"; then
309 HOST_CC="$CC"
310 fi
311 if test -z "$HOST_CFLAGS"; then
312 HOST_CFLAGS="$CFLAGS"
313 fi
314 if test -z "$HOST_CXX"; then
315 HOST_CXX="$CXX"
316 fi
317 if test -z "$HOST_CXXFLAGS"; then
318 HOST_CXXFLAGS="$CXXFLAGS"
319 fi
320 if test -z "$HOST_LDFLAGS"; then
321 HOST_LDFLAGS="$LDFLAGS"
322 fi
323 if test -z "$HOST_RANLIB"; then
324 HOST_RANLIB="$RANLIB"
325 fi
326 if test -z "$HOST_AR"; then
327 HOST_AR="$AR"
328 fi
329 fi
330
331 GNU_AS=
332 GNU_LD=
333 GNU_CC=
334 GNU_CXX=
335 CC_VERSION='N/A'
336 CXX_VERSION='N/A'
337 if test "$GCC" = "yes"; then
338 GNU_CC=1
339 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
340 fi
341 if test "$GXX" = "yes"; then
342 GNU_CXX=1
343 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
344 fi
345 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
346 GNU_AS=1
347 fi
348 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
349 GNU_LD=1
350 fi
351 if test "$GNU_CC"; then
352 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
353 GCC_USE_GNU_LD=1
354 fi
355 fi
356
357 INTEL_CC=
358 INTEL_CXX=
359 if test "$GCC" = yes; then
360 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
361 INTEL_CC=1
362 fi
363 fi
364
365 if test "$GXX" = yes; then
366 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
367 INTEL_CXX=1
368 fi
369 fi
370
371 dnl Special win32 checks
372 dnl ========================================================
373 case "$target" in
374 *-wince)
375 WINVER=500
376 ;;
377 *)
378 if test -n "$GNU_CC"; then
379 WINVER=501
380 else
381 WINVER=500
382 fi
383 ;;
384 esac
385
386 MOZ_ARG_WITH_STRING(windows-version,
387 [ --with-windows-version=WINVER
388 Minimum Windows version (WINVER) to support
389 400: Windows 95
390 500: Windows 2000
391 501: Windows XP],
392 WINVER=$withval)
393
394 case "$WINVER" in
395 400|500|501)
396 ;;
397
398 *)
399 AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
400 ;;
401
402 esac
403
404 case "$target" in
405 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
406 if test "$GCC" != "yes"; then
407 # Check to see if we are really running in a msvc environemnt
408 _WIN32_MSVC=1
409
410 # Make sure compilers are valid
411 CFLAGS="$CFLAGS -TC -nologo"
412 CXXFLAGS="$CXXFLAGS -TP -nologo"
413 AC_LANG_SAVE
414 AC_LANG_C
415 AC_TRY_COMPILE([#include <stdio.h>],
416 [ printf("Hello World\n"); ],,
417 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
418
419 AC_LANG_CPLUSPLUS
420 AC_TRY_COMPILE([#include <new.h>],
421 [ unsigned *test = new unsigned(42); ],,
422 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
423 AC_LANG_RESTORE
424
425 changequote(,)
426 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
427 changequote([,])
428
429 # Determine compiler version
430 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
431 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
432 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
433 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
434 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
435 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
436
437 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
438 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
439
440 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
441 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
442 fi
443 if test "$_CC_MAJOR_VERSION" = "12"; then
444 _CC_SUITE=6
445 elif test "$_CC_MAJOR_VERSION" = "13"; then
446 _CC_SUITE=7
447 elif test "$_CC_MAJOR_VERSION" = "14"; then
448 _CC_SUITE=8
449 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
450 dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
451 dnl so be very specific here!
452 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
453 if test $_CC_RELEASE -gt 50727; then
454 _USE_DYNAMICBASE=1
455 elif test $_CC_BUILD -ge 762; then
456 _USE_DYNAMICBASE=1
457 fi
458 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
459 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
460 elif test "$_CC_MAJOR_VERSION" = "15"; then
461 _CC_SUITE=9
462 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
463 LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
464 _USE_DYNAMICBASE=1
465 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
466 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
467 else
468 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
469 fi
470
471 _MOZ_RTTI_FLAGS_ON='-GR'
472 _MOZ_RTTI_FLAGS_OFF='-GR-'
473 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
474 _MOZ_EXCEPTIONS_FLAGS_OFF=''
475
476 if test -n "$WIN32_REDIST_DIR"; then
477 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
478 fi
479
480 # bug #249782
481 # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
482 if test "$_CC_SUITE" -ge "8"; then
483 changequote(,)
484 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
485 changequote([,])
486
487 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
488 if test -n "$MSMT_TOOL"; then
489 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
490 if test -z "$MSMANIFEST_TOOL_VERSION"; then
491 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
492 fi
493 MSMANIFEST_TOOL=1
494 unset MSMT_TOOL
495 else
496 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
497 fi
498 fi
499
500 # Check linker version
501 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
502 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
503 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
504 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
505 fi
506 INCREMENTAL_LINKER=1
507
508 unset _MSVC_VER_FILTER
509
510 else
511 # Check w32api version
512 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
513 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
514 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
515 AC_TRY_COMPILE([#include <w32api.h>],
516 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
517 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
518 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
519 #error "test failed."
520 #endif
521 , [ res=yes ], [ res=no ])
522 AC_MSG_RESULT([$res])
523 if test "$res" != "yes"; then
524 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
525 fi
526 # Check windres version
527 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
528 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
529 AC_MSG_RESULT([$_WINDRES_VERSION])
530 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
531 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
532 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
533 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
534 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
535 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
536 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
537 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
538 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
539 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
540 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
541 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
542 then
543 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
544 fi
545 fi # !GNU_CC
546
547 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
548 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
549 # Require OS features provided by IE 5.0
550 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
551 ;;
552 esac
553
554 dnl Test breaks icc on OS/2 && MSVC
555 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
556 AC_PROG_CC_C_O
557 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
558 USING_HCC=1
559 _OLDCC=$CC
560 _OLDCXX=$CXX
561 CC="${srcdir}/build/hcc '$CC'"
562 CXX="${srcdir}/build/hcpp '$CXX'"
563 fi
564 fi
565
566 AC_PROG_CPP
567 AC_PROG_CXXCPP
568
569 if test -n "$_WIN32_MSVC"; then
570 SKIP_PATH_CHECKS=1
571 SKIP_COMPILER_CHECKS=1
572 SKIP_LIBRARY_CHECKS=1
573
574 # Since we're skipping compiler and library checks, hard-code
575 # some facts here.
576
577 # Windows lacks <stdint.h>, but has __int8, and so on.
578 AC_DEFINE(JS_HAVE___INTN)
579 # Windows <stddef.h> defines intptr_t and uintptr_t.
580 # VS2005: http://msdn.microsoft.com/en-us/library/323b6b3k(VS.80).aspx
581 # VS2008: http://msdn.microsoft.com/en-us/library/323b6b3k.aspx
582 AC_DEFINE(JS_STDDEF_H_HAS_INTPTR_T)
583 fi
584
585 fi # COMPILE_ENVIRONMENT
586
587 if test "$cross_compiling" = "yes"; then
588 CROSS_COMPILE=1
589 else
590 CROSS_COMPILE=
591 fi
592
593 AC_SUBST(_MSC_VER)
594
595 AC_SUBST(GNU_AS)
596 AC_SUBST(GNU_LD)
597 AC_SUBST(GNU_CC)
598 AC_SUBST(GNU_CXX)
599 AC_SUBST(INTEL_CC)
600 AC_SUBST(INTEL_CXX)
601
602 dnl ========================================================
603 dnl Checks for programs.
604 dnl ========================================================
605 AC_PROG_INSTALL
606 AC_PROG_LN_S
607 AC_PATH_PROGS(PERL, $PERL perl5 perl )
608 if test -z "$PERL" || test "$PERL" = ":"; then
609 AC_MSG_ERROR([perl not found in \$PATH])
610 fi
611
612 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
613 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
614 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
615 _perl_res=$?
616 AC_MSG_RESULT([$_perl_version])
617
618 if test "$_perl_res" != 0; then
619 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
620 fi
621 fi
622
623 AC_MSG_CHECKING([for full perl installation])
624 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
625 _perl_res=$?
626 if test "$_perl_res" != 0; then
627 AC_MSG_RESULT([no])
628 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
629 else
630 AC_MSG_RESULT([yes])
631 fi
632
633 AC_PATH_PROGS(PYTHON, $PYTHON python)
634 if test -z "$PYTHON"; then
635 AC_MSG_ERROR([python was not found in \$PATH])
636 fi
637
638 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
639 if test -z "$COMPILE_ENVIRONMENT"; then
640 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
641 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
642 fi
643 fi
644 AC_SUBST(NSINSTALL_BIN)
645
646 AC_PATH_PROG(DOXYGEN, doxygen, :)
647 AC_PATH_PROG(WHOAMI, whoami, :)
648 AC_PATH_PROG(AUTOCONF, autoconf, :)
649 AC_PATH_PROG(UNZIP, unzip, :)
650 AC_PATH_PROGS(ZIP, zip)
651 if test -z "$ZIP" || test "$ZIP" = ":"; then
652 AC_MSG_ERROR([zip not found in \$PATH])
653 fi
654 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
655 AC_PATH_PROG(XARGS, xargs)
656 if test -z "$XARGS" || test "$XARGS" = ":"; then
657 AC_MSG_ERROR([xargs not found in \$PATH .])
658 fi
659
660 if test "$COMPILE_ENVIRONMENT"; then
661
662 dnl ========================================================
663 dnl = Mac OS X toolchain support
664 dnl ========================================================
665
666 case "$target_os" in
667 darwin*)
668 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
669 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
670 dnl the environment and includedir purposes (when using an SDK, below),
671 dnl but remember the full version number for the libdir (SDK).
672 changequote(,)
673 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
674 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
675 changequote([,])
676 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
677 dnl Bug 280479, but this keeps popping up in bug 292530 too because
678 dnl 4.0.0/4061 is the default compiler in Tiger.
679 changequote(,)
680 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
681 changequote([,])
682 if test "$GCC_BUILD" = "4061" ; then
683 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
684 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
685 from building Mozilla. Upgrade to Xcode 2.1 or later.])
686 fi
687 fi
688
689 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
690 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
691 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
692 AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
693
694 case "$PBBUILD" in
695 *xcodebuild*)
696 changequote(,)
697 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
698 changequote([,])
699 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
700 HAS_XCODE_2_1=1;
701 fi
702 ;;
703 esac
704
705 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
706 dnl it has moved into /usr/bin.
707 AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
708 ;;
709 esac
710
711 AC_SUBST(GCC_VERSION)
712 AC_SUBST(XCODEBUILD_VERSION)
713 AC_SUBST(HAS_XCODE_2_1)
714
715 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
716 dnl that a universal binary is being produced.
717 AC_SUBST(UNIVERSAL_BINARY)
718
719 dnl ========================================================
720 dnl Check for MacOS deployment target version
721 dnl ========================================================
722
723 MOZ_ARG_ENABLE_STRING(macos-target,
724 [ --enable-macos-target=VER (default=10.4)
725 Set the minimum MacOS version needed at runtime],
726 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
727
728 case "$target" in
729 *-darwin*)
730 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
731 dnl Use the specified value
732 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
733 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
734 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
735 dnl No value specified on the command line or in the environment,
736 dnl use the lesser of the application's minimum or the architecture's
737 dnl minimum.
738 export MACOSX_DEPLOYMENT_TARGET=10.4
739 fi
740 ;;
741 esac
742
743 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
744
745 dnl ========================================================
746 dnl = Mac OS X SDK support
747 dnl ========================================================
748 MACOS_SDK_DIR=
749 NEXT_ROOT=
750 MOZ_ARG_WITH_STRING(macos-sdk,
751 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
752 MACOS_SDK_DIR=$withval)
753
754 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
755 dnl NEXT_ROOT will be set and exported only if it's needed.
756 AC_SUBST(MACOS_SDK_DIR)
757 AC_SUBST(NEXT_ROOT)
758
759 if test "$MACOS_SDK_DIR"; then
760 dnl Sync this section with the ones in NSPR and NSS.
761 dnl Changes to the cross environment here need to be accounted for in
762 dnl the libIDL checks (below) and xpidl build.
763
764 if test ! -d "$MACOS_SDK_DIR"; then
765 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
766 specify a valid SDK. SDKs are installed when the optional cross-development
767 tools are selected during the Xcode/Developer Tools installation.])
768 fi
769
770 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
771 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
772 SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include -F${MACOS_SDK_DIR}/System/Library/Frameworks"
773 if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
774 SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
775 fi
776 SDK_CXX_INCLUDE="-I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward"
777
778 CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
779 CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
780
781 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
782 CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
783 CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
784
785 dnl ld support for -syslibroot is compiler-agnostic, but only available
786 dnl on Tiger. Although it's possible to switch on the build host's
787 dnl OS release to use ld -syslibroot when available, ld -syslibroot will
788 dnl cause warnings as long as NEXT_ROOT is set. NEXT_ROOT should be
789 dnl set because both the compiler and linker use it.
790 LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib $LIBS"
791 export NEXT_ROOT=$MACOS_SDK_DIR
792
793 if test -n "$CROSS_COMPILE" ; then
794 dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
795 dnl the build host. HOST_CXX is presently unused.
796 HOST_CC="NEXT_ROOT= $HOST_CC"
797 HOST_CXX="NEXT_ROOT= $HOST_CXX"
798 fi
799 else
800 dnl gcc >= 4.0 uses different paths than above, but knows how to find
801 dnl them itself.
802 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
803 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
804
805 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
806 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
807 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
808
809 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
810 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
811 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
812 dnl be ignored and cause warnings when -syslibroot is specified.
813 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
814 dnl the -isysroot it receives, so this is only needed with 4.0.0.
815 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
816 fi
817 fi
818
819 AC_LANG_SAVE
820 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
821 AC_LANG_CPLUSPLUS
822 AC_TRY_COMPILE([#include <new>
823 int main() { return 0; }],
824 result=yes,
825 result=no)
826 AC_LANG_RESTORE
827 AC_MSG_RESULT($result)
828
829 if test "$result" = "no" ; then
830 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
831 fi
832 fi
833
834 fi # COMPILE_ENVIRONMENT
835
836 dnl Be sure the make we use is GNU make.
837 dnl on win32, gmake.exe is the generally the wrong version
838 case "$host_os" in
839 cygwin*|mingw*|mks*|msvc*)
840 AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
841 ;;
842 *)
843 AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
844 ;;
845 esac
846 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
847 if test ! "$_make_try"
848 then
849 echo
850 echo "*** $MAKE is not GNU Make. You will not be able to build Mozilla without GNU Make."
851 echo
852 exit 1
853 fi
854 dnl Now exit if version if < MAKE_VERSION
855 rm -f dummy.mk
856 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
857 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
858 rm -f dummy.mk
859 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
860 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
861 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
862 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
863 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
864 test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
865 "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
866 AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
867 fi
868 AC_SUBST(MAKE)
869
870 if test "$COMPILE_ENVIRONMENT"; then
871
872 AC_PATH_XTRA
873
874 dnl Check in X11 include directory too.
875 if test "$no_x" != "yes"; then
876 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
877 fi
878
879 XCFLAGS="$X_CFLAGS"
880
881 fi # COMPILE_ENVIRONMENT
882
883 dnl ========================================================
884 dnl set the defaults first
885 dnl ========================================================
886 AS_BIN=$AS
887 AR_FLAGS='cr $@'
888 AR_LIST='$(AR) t'
889 AR_EXTRACT='$(AR) x'
890 AR_DELETE='$(AR) d'
891 AS='$(CC)'
892 AS_DASH_C_FLAG='-c'
893 DLL_PREFIX=lib
894 LIB_PREFIX=lib
895 DLL_SUFFIX=.so
896 OBJ_SUFFIX=o
897 LIB_SUFFIX=a
898 ASM_SUFFIX=s
899 IMPORT_LIB_SUFFIX=
900 TARGET_MD_ARCH=unix
901 DIRENT_INO=d_ino
902 CYGWIN_WRAPPER=
903 WIN_TOP_SRC=
904 MOZ_USER_DIR=".mozilla"
905 HOST_AR='$(AR)'
906 HOST_AR_FLAGS='$(AR_FLAGS)'
907
908 MOZ_JS_LIBS='-L$(libdir) -lmozjs'
909 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(PREFIX)/lib'
910
911 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
912 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
913
914 USE_DEPENDENT_LIBS=1
915
916 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
917 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
918
919 MOZ_ENABLE_POSTSCRIPT=1
920
921 if test -n "$CROSS_COMPILE"; then
922 OS_TARGET="${target_os}"
923 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
924 OS_RELEASE=
925 case "${target_os}" in
926 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
927 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
928 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
929 mingw*) OS_ARCH=WINNT ;;
930 wince*) OS_ARCH=WINCE ;;
931 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
932 esac
933 else
934 OS_TARGET=`uname -s`
935 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
936 OS_RELEASE=`uname -r`
937 fi
938
939 # Before this used `uname -m` when not cross compiling
940 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
941 OS_TEST="${target_cpu}"
942
943 _COMPILER_PREFIX=
944
945 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
946
947 #######################################################################
948 # Master "Core Components" macros for getting the OS target #
949 #######################################################################
950
951 #
952 # Note: OS_TARGET should be specified on the command line for gmake.
953 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
954 # The difference between the Win95 target and the WinNT target is that
955 # the WinNT target uses Windows NT specific features not available
956 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
957 # at lesser performance (the Win95 target uses threads; the WinNT target
958 # uses fibers).
959 #
960 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
961 # cross-compilation.
962 #
963
964 #
965 # The following hack allows one to build on a WIN95 machine (as if
966 # s/he were cross-compiling on a WINNT host for a WIN95 target).
967 # It also accomodates for MKS's uname.exe. If you never intend
968 # to do development on a WIN95 machine, you don't need this hack.
969 #
970 case "$OS_ARCH" in
971 WIN95)
972 OS_ARCH=WINNT
973 OS_TARGET=WIN95
974 ;;
975 Windows_95)
976 OS_ARCH=Windows_NT
977 OS_TARGET=WIN95
978 ;;
979 Windows_98)
980 OS_ARCH=Windows_NT
981 OS_TARGET=WIN95
982 ;;
983 CYGWIN_9*|CYGWIN_ME*)
984 OS_ARCH='CYGWIN_NT-4.0'
985 OS_TARGET=WIN95
986 ;;
987 esac
988
989 #
990 # Define and override various archtecture-specific variables, including
991 # HOST_OS_ARCH
992 # OS_ARCH
993 # OS_TEST
994 # OS_TARGET
995 # OS_RELEASE
996 # OS_MINOR_RELEASE
997 #
998
999 case "$HOST_OS_ARCH" in
1000 cygwin*|mingw*|mks*|msvc*)
1001 HOST_OS_ARCH=WINNT
1002 ;;
1003 linux*)
1004 HOST_OS_ARCH=Linux
1005 ;;
1006 solaris*)
1007 HOST_OS_ARCH=SunOS
1008 SOLARIS_SUNPRO_CC=
1009 SOLARIS_SUNPRO_CXX=
1010 if test -z "$GNU_CC"; then
1011 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1012 SOLARIS_SUNPRO_CC=1
1013 fi
1014 fi
1015
1016 if test -z "$GNU_CXX"; then
1017 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1018 SOLARIS_SUNPRO_CXX=1
1019 fi
1020 fi
1021 AC_SUBST(SOLARIS_SUNPRO_CC)
1022 AC_SUBST(SOLARIS_SUNPRO_CXX)
1023 ;;
1024 BSD_386)
1025 HOST_OS_ARCH=BSD
1026 ;;
1027 dgux)
1028 HOST_OS_ARCH=DGUX
1029 ;;
1030 IRIX64)
1031 HOST_OS_ARCH=IRIX
1032 ;;
1033 UNIX_SV)
1034 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1035 HOST_OS_ARCH=NCR
1036 else
1037 HOST_OS_ARCH=UNIXWARE
1038 fi
1039 ;;
1040 ncr)
1041 HOST_OS_ARCH=NCR
1042 ;;
1043 UNIX_SYSTEM_V)
1044 HOST_OS_ARCH=NEC
1045 ;;
1046 OSF1)
1047 ;;
1048 *OpenVMS*)
1049 HOST_OS_ARCH=OpenVMS
1050 ;;
1051 OS_2)
1052 HOST_OS_ARCH=OS2
1053 ;;
1054 QNX)
1055 ;;
1056 SCO_SV)
1057 HOST_OS_ARCH=SCOOS
1058 ;;
1059 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1060 HOST_OS_ARCH=SINIX
1061 ;;
1062 UnixWare)
1063 HOST_OS_ARCH=UNIXWARE
1064 ;;
1065 esac
1066
1067 case "$OS_ARCH" in
1068 WINNT)
1069 OS_TEST=`uname -p`
1070 ;;
1071 Windows_NT)
1072 #
1073 # If uname -s returns "Windows_NT", we assume that we are using
1074 # the uname.exe in MKS toolkit.
1075 #
1076 # The -r option of MKS uname only returns the major version number.
1077 # So we need to use its -v option to get the minor version number.
1078 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1079 #
1080 OS_ARCH=WINNT
1081 OS_TARGET=WINNT
1082 OS_MINOR_RELEASE=`uname -v`
1083 if test "$OS_MINOR_RELEASE" = "00"; then
1084 OS_MINOR_RELEASE=0
1085 fi
1086 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1087 ;;
1088 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1089 #
1090 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1091 # the uname.exe in the Cygwin tools.
1092 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1093 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1094 # the uname.exe in the GNU-Win32 tools.
1095 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1096 # the uname.exe in the MSYS tools.
1097 #
1098 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1099 OS_ARCH=WINNT
1100 OS_TARGET=WINNT
1101 ;;
1102 AIX)
1103 OS_RELEASE=`uname -v`.`uname -r`
1104 OS_TEST=${target_cpu}
1105 ;;
1106 BSD_386)
1107 OS_ARCH=BSD
1108 ;;
1109 dgux)
1110 OS_ARCH=DGUX
1111 ;;
1112 IRIX64)
1113 OS_ARCH=IRIX
1114 ;;
1115 UNIX_SV)
1116 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1117 OS_ARCH=NCR
1118 else
1119 OS_ARCH=UNIXWARE
1120 OS_RELEASE=`uname -v`
1121 fi
1122 ;;
1123 ncr)
1124 OS_ARCH=NCR
1125 ;;
1126 UNIX_SYSTEM_V)
1127 OS_ARCH=NEC
1128 ;;
1129 OSF1)
1130 case `uname -v` in
1131 148)
1132 OS_RELEASE=V3.2C
1133 ;;
1134 564)
1135 OS_RELEASE=V4.0B
1136 ;;
1137 878)
1138 OS_RELEASE=V4.0D
1139 ;;
1140 esac
1141 ;;
1142 *OpenVMS*)
1143 OS_ARCH=OpenVMS
1144 OS_RELEASE=`uname -v`
1145 OS_TEST=`uname -p`
1146 ;;
1147 OS_2)
1148 OS_ARCH=OS2
1149 OS_TARGET=OS2
1150 OS_RELEASE=`uname -v`
1151 ;;
1152 QNX)
1153 if test "$OS_TARGET" != "NTO"; then
1154 changequote(,)
1155 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1156 changequote([,])
1157 fi
1158 OS_TEST=x86
1159 ;;
1160 SCO_SV)
1161 OS_ARCH=SCOOS
1162 OS_RELEASE=5.0
1163 ;;
1164 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1165 OS_ARCH=SINIX
1166 OS_TEST=`uname -p`
1167 ;;
1168 UnixWare)
1169 OS_ARCH=UNIXWARE
1170 OS_RELEASE=`uname -v`
1171 ;;
1172 WINCE)
1173 WINCE=1
1174 OS_ARCH=WINCE
1175 OS_TARGET=WINCE
1176 ;;
1177 Darwin)
1178 case "${target_cpu}" in
1179 powerpc*)
1180 OS_TEST=ppc
1181 ;;
1182 i*86*)
1183 OS_TEST=i386
1184 ;;
1185 *)
1186 if test -z "$CROSS_COMPILE" ; then
1187 OS_TEST=`uname -p`
1188 fi
1189 ;;
1190 esac
1191 ;;
1192 esac
1193
1194 if test "$OS_ARCH" = "NCR"; then
1195 changequote(,)
1196 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1197 changequote([,])
1198 fi
1199
1200 # Only set CPU_ARCH if we recognize the value of OS_TEST
1201
1202 case "$OS_TEST" in
1203 *86 | i86pc)
1204 CPU_ARCH=x86
1205 ;;
1206
1207 powerpc* | ppc | rs6000)
1208 CPU_ARCH=ppc
1209 ;;
1210
1211 Alpha | alpha | ALPHA)
1212 CPU_ARCH=Alpha
1213 ;;
1214
1215 hppa* | parisc)
1216 CPU_ARCH=hppa
1217 ;;
1218
1219 sun4u | sparc*)
1220 CPU_ARCH=sparc
1221 ;;
1222
1223 x86_64 | ia64)
1224 CPU_ARCH="$OS_TEST"
1225 ;;
1226 esac
1227
1228 if test -z "$OS_TARGET"; then
1229 OS_TARGET=$OS_ARCH
1230 fi
1231 if test "$OS_TARGET" = "WIN95"; then
1232 OS_RELEASE="4.0"
1233 fi
1234 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1235
1236 dnl ========================================================
1237 dnl GNU specific defaults
1238 dnl ========================================================
1239 if test "$GNU_CC"; then
1240 # FIXME: Let us build with strict aliasing. bug 414641.
1241 CFLAGS="$CFLAGS -fno-strict-aliasing"
1242 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1243 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1244 DSO_LDOPTS='-shared'
1245 if test "$GCC_USE_GNU_LD"; then
1246 # Don't allow undefined symbols in libraries
1247 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1248 fi
1249 WARNINGS_AS_ERRORS='-Werror'
1250 DSO_CFLAGS=''
1251 DSO_PIC_CFLAGS='-fPIC'
1252 ASFLAGS="$ASFLAGS -fPIC"
1253 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1254 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1255 _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1256 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1257
1258 # Turn on GNU specific features
1259 # -Wall - turn on all warnings
1260 # -pedantic - make compiler warn about non-ANSI stuff, and
1261 # be a little bit stricter
1262 # Warnings slamm took out for now (these were giving more noise than help):
1263 # -Wbad-function-cast - warns when casting a function to a new return type
1264 # -Wshadow - removed because it generates more noise than help --pete
1265 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1266 if test -z "$INTEL_CC"; then
1267 # Don't use -Wcast-align with ICC
1268 case "$CPU_ARCH" in
1269 # And don't use it on hppa, ia64, sparc, since it's noisy there
1270 hppa | ia64 | sparc)
1271 ;;
1272 *)
1273 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1274 ;;
1275 esac
1276 fi
1277
1278 dnl Turn pedantic on but disable the warnings for long long
1279 _PEDANTIC=1
1280
1281 if test -z "$INTEL_CC"; then
1282 _IGNORE_LONG_LONG_WARNINGS=1
1283 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1284 else
1285 _IGNORE_LONG_LONG_WARNINGS=
1286 fi
1287
1288
1289 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1290 _USE_CPP_INCLUDE_FLAG=1
1291 elif test "$SOLARIS_SUNPRO_CC"; then
1292 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1293 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1294
1295 DSO_LDOPTS='-shared'
1296 if test "$GNU_LD"; then
1297 # Don't allow undefined symbols in libraries
1298 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1299 fi
1300
1301 DSO_CFLAGS=''
1302 if test "$CPU_ARCH" = "sparc"; then
1303 # for Sun Studio on Solaris/SPARC
1304 DSO_PIC_CFLAGS='-xcode=pic32'
1305 else
1306 DSO_PIC_CFLAGS='-KPIC'
1307 fi
1308 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1309 else
1310 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1311 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1312
1313 DSO_LDOPTS='-shared'
1314 if test "$GNU_LD"; then
1315 # Don't allow undefined symbols in libraries
1316 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1317 fi
1318
1319 DSO_CFLAGS=''
1320 DSO_PIC_CFLAGS='-KPIC'
1321 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1322 fi
1323
1324 if test "$GNU_CXX"; then
1325 # FIXME: Let us build with strict aliasing. bug 414641.
1326 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1327 # Turn on GNU specific features
1328 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1329 if test -z "$INTEL_CC"; then
1330 # Don't use -Wcast-align with ICC
1331 case "$CPU_ARCH" in
1332 # And don't use it on hppa, ia64, sparc, since it's noisy there
1333 hppa | ia64 | sparc)
1334 ;;
1335 *)
1336 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1337 ;;
1338 esac
1339 fi
1340
1341 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1342 _USE_CPP_INCLUDE_FLAG=1
1343
1344 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1345 ac_has_wno_invalid_offsetof,
1346 [
1347 AC_LANG_SAVE
1348 AC_LANG_CPLUSPLUS
1349 _SAVE_CXXFLAGS="$CXXFLAGS"
1350 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1351 AC_TRY_COMPILE([],
1352 [return(0);],
1353 ac_has_wno_invalid_offsetof="yes",
1354 ac_has_wno_invalid_offsetof="no")
1355 CXXFLAGS="$_SAVE_CXXFLAGS"
1356 AC_LANG_RESTORE
1357 ])
1358 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1359 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1360 fi
1361 else
1362 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1363 fi
1364
1365 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1366 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1367 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1368 dnl normal behavior.
1369 dnl ========================================================
1370 MKSHLIB_FORCE_ALL=
1371 MKSHLIB_UNFORCE_ALL=
1372
1373 if test "$COMPILE_ENVIRONMENT"; then
1374 if test "$GNU_CC"; then
1375 AC_MSG_CHECKING(whether ld has archive extraction flags)
1376 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1377 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1378 ac_cv_mkshlib_force_and_unforce="no"
1379 exec 3<&0 <<LOOP_INPUT
1380 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1381 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1382 force="-Wl,-all"; unforce="-Wl,-none"
1383 LOOP_INPUT
1384 while read line
1385 do
1386 eval $line
1387 LDFLAGS=$force
1388 LIBS=$unforce
1389 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1390 done
1391 exec 0<&3 3<&-
1392 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1393 ])
1394 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1395 AC_MSG_RESULT(no)
1396 else
1397 AC_MSG_RESULT(yes)
1398 eval $ac_cv_mkshlib_force_and_unforce
1399 MKSHLIB_FORCE_ALL=$force
1400 MKSHLIB_UNFORCE_ALL=$unforce
1401 fi
1402 fi # GNU_CC
1403 fi # COMPILE_ENVIRONMENT
1404
1405 dnl =================================================================
1406 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1407 dnl which is bad when cross compiling.
1408 dnl =================================================================
1409 if test "$COMPILE_ENVIRONMENT"; then
1410 configure_static_assert_macros='
1411 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1412 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1413 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1414 '
1415
1416 dnl test that the macros actually work:
1417 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1418 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1419 [AC_LANG_SAVE
1420 AC_LANG_C
1421 ac_cv_static_assertion_macros_work="yes"
1422 AC_TRY_COMPILE([$configure_static_assert_macros],
1423 [CONFIGURE_STATIC_ASSERT(1)],
1424 ,
1425 ac_cv_static_assertion_macros_work="no")
1426 AC_TRY_COMPILE([$configure_static_assert_macros],
1427 [CONFIGURE_STATIC_ASSERT(0)],
1428 ac_cv_static_assertion_macros_work="no",
1429 )
1430 AC_LANG_CPLUSPLUS
1431 AC_TRY_COMPILE([$configure_static_assert_macros],
1432 [CONFIGURE_STATIC_ASSERT(1)],
1433 ,
1434 ac_cv_static_assertion_macros_work="no")
1435 AC_TRY_COMPILE([$configure_static_assert_macros],
1436 [CONFIGURE_STATIC_ASSERT(0)],
1437 ac_cv_static_assertion_macros_work="no",
1438 )
1439 AC_LANG_RESTORE
1440 ])
1441 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1442 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1443 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1444 fi
1445 fi # COMPILE_ENVIRONMENT
1446
1447 dnl ========================================================
1448 dnl Checking for 64-bit OS
1449 dnl ========================================================
1450 if test "$COMPILE_ENVIRONMENT"; then
1451 AC_LANG_SAVE
1452 AC_LANG_C
1453 AC_MSG_CHECKING(for 64-bit OS)
1454 AC_TRY_COMPILE([$configure_static_assert_macros],
1455 [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1456 result="yes", result="no")
1457 AC_MSG_RESULT("$result")
1458 if test "$result" = "yes"; then
1459 AC_DEFINE(HAVE_64BIT_OS)
1460 HAVE_64BIT_OS=1
1461 fi
1462 AC_SUBST(HAVE_64BIT_OS)
1463 AC_LANG_RESTORE
1464 fi # COMPILE_ENVIRONMENT
1465
1466 dnl ========================================================
1467 dnl Enable high-memory support on OS/2 by default.
1468 dnl ========================================================
1469 MOZ_OS2_HIGH_MEMORY=1
1470 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1471 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1472 MOZ_OS2_HIGH_MEMORY=,
1473 MOZ_OS2_HIGH_MEMORY=1 )
1474 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1475
1476 dnl ========================================================
1477 dnl System overrides of the defaults for host
1478 dnl ========================================================
1479 case "$host" in
1480 *-beos*)
1481 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1482 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1483 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1484 ;;
1485
1486 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1487 if test -n "$_WIN32_MSVC"; then
1488 HOST_AR=lib
1489 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1490 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1491 HOST_RANLIB='echo ranlib'
1492 else
1493 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1494 fi
1495 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1496 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1497 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1498 HOST_BIN_SUFFIX=.exe
1499 case "$host" in
1500 *mingw*)
1501 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1502 ;;
1503 *)
1504 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1505 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1506 _pwd=`pwd`
1507 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1508 fi
1509 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1510 AS_PERL=1
1511 PERL="${CYGWIN_WRAPPER} $PERL"
1512 fi
1513
1514 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1515 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1516 fi
1517 ;;
1518 esac
1519 ;;
1520
1521 *-darwin*)
1522 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1523 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1524 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1525 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1526 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1527 ;;
1528
1529 *-linux*|*-kfreebsd*-gnu)
1530 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1531 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1532 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1533 ;;
1534
1535 *os2*)
1536 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1537 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1538 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1539 HOST_BIN_SUFFIX=.exe
1540 MOZ_FIX_LINK_PATHS=
1541 ;;
1542
1543 *-osf*)
1544 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1545 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1546 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1547 ;;
1548
1549 *)
1550 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1551 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1552 ;;
1553 esac
1554
1555 dnl ========================================================
1556 dnl System overrides of the defaults for target
1557 dnl ========================================================
1558
1559 case "$target" in
1560 *-aix*)
1561 AC_DEFINE(AIX)
1562 if test ! "$GNU_CC"; then
1563 if test ! "$HAVE_64BIT_OS"; then
1564 # Compiling with Visual Age C++ object model compat is the
1565 # default. To compile with object model ibm, add
1566 # AIX_OBJMODEL=ibm to .mozconfig.
1567 if test "$AIX_OBJMODEL" = "ibm"; then
1568 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1569 else
1570 AIX_OBJMODEL=compat
1571 fi
1572 else
1573 AIX_OBJMODEL=compat
1574 fi
1575 AC_SUBST(AIX_OBJMODEL)
1576 DSO_LDOPTS='-qmkshrobj=1'
1577 DSO_CFLAGS='-qflag=w:w'
1578 DSO_PIC_CFLAGS=
1579 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1580 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1581 MOZ_FIX_LINK_PATHS=
1582 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1583 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1584 if test "$COMPILE_ENVIRONMENT"; then
1585 AC_LANG_SAVE
1586 AC_LANG_CPLUSPLUS
1587 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1588 AC_TRY_COMPILE([],
1589 [#if (__IBMCPP__ < 600)
1590 #error "Bad compiler"
1591 #endif],
1592 _BAD_COMPILER=,_BAD_COMPILER=1)
1593 if test -n "$_BAD_COMPILER"; then
1594 AC_MSG_RESULT([no])
1595 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1596 else
1597 AC_MSG_RESULT([yes])
1598 fi
1599 AC_LANG_RESTORE
1600 TARGET_COMPILER_ABI="ibmc"
1601 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1602 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1603 fi
1604 fi
1605 case "${target_os}" in
1606 aix4.1*)
1607 DLL_SUFFIX='_shr.a'
1608 ;;
1609 esac
1610 if test "$COMPILE_ENVIRONMENT"; then
1611 AC_CHECK_HEADERS(sys/inttypes.h)
1612 fi
1613 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1614 ;;
1615
1616 *-beos*)
1617 no_x=yes
1618 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1619 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1620 DSO_LDOPTS='-nostart'
1621 TK_LIBS='-lbe -lroot'
1622 LIBS="$LIBS -lbe"
1623 if test "$COMPILE_ENVIRONMENT"; then
1624 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1625 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1626 fi
1627 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1628 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1629 _MOZ_USE_RTTI=1
1630 USE_DEPENDENT_LIBS=
1631 MOZ_USER_DIR="Mozilla"
1632 ;;
1633
1634 *-bsdi*)
1635 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1636 _PEDANTIC=
1637 _IGNORE_LONG_LONG_WARNINGS=
1638 case $OS_RELEASE in
1639 4.*|5.*)
1640 STRIP="$STRIP -d"
1641 ;;
1642 *)
1643 DSO_CFLAGS=''
1644 DSO_LDOPTS='-r'
1645 _WARNINGS_CFLAGS="-Wall"
1646 _WARNINGS_CXXFLAGS="-Wall"
1647 # The test above doesn't work properly, at least on 3.1.
1648 MKSHLIB_FORCE_ALL=''
1649 MKSHLIB_UNFORCE_ALL=''
1650 ;;
1651 esac
1652 ;;
1653
1654 *-darwin*)
1655 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1656 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1657 MOZ_OPTIMIZE_FLAGS="-O2"
1658 _PEDANTIC=
1659 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1660 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1661 DLL_SUFFIX=".dylib"
1662 DSO_LDOPTS=''
1663 STRIP="$STRIP -x -S"
1664 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1665 MOZ_ENABLE_POSTSCRIPT=
1666 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1667 LDFLAGS="$LDFLAGS -framework Cocoa"
1668 # The ExceptionHandling framework is needed for Objective-C exception
1669 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1670 # builds.
1671 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1672 # set MACOSX to generate lib/mac/MoreFiles/Makefile
1673 MACOSX=1
1674
1675 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1676 dnl ===================================================================
1677 if test "x$enable_dtrace" = "xyes"; then
1678 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1679 else
1680 dnl check for the presence of the -dead_strip linker flag
1681 AC_MSG_CHECKING([for -dead_strip option to ld])
1682 _SAVE_LDFLAGS=$LDFLAGS
1683 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1684 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1685 if test -n "$_HAVE_DEAD_STRIP" ; then
1686 AC_MSG_RESULT([yes])
1687 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1688 else
1689 AC_MSG_RESULT([no])
1690 fi
1691
1692 LDFLAGS=$_SAVE_LDFLAGS
1693 fi
1694 ;;
1695
1696 *-freebsd*)
1697 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1698 DLL_SUFFIX=".so.1.0"
1699 DSO_LDOPTS="-shared"
1700 fi
1701 if test ! "$GNU_CC"; then
1702 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1703 fi
1704 # Can't have force w/o an unforce.
1705 # # Hack for FreeBSD 2.2
1706 # if test -z "$MKSHLIB_FORCE_ALL"; then
1707 # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1708 # MKSHLIB_UNFORCE_ALL=''
1709 # fi
1710 ;;
1711
1712 *-hpux*)
1713 DLL_SUFFIX=".sl"
1714 if test ! "$GNU_CC"; then
1715 DSO_LDOPTS='-b -Wl,+s'
1716 DSO_CFLAGS=""
1717 DSO_PIC_CFLAGS="+Z"
1718 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1719 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1720 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1721 else
1722 DSO_LDOPTS='-b -E +s'
1723 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1724 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1725 fi
1726 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1727 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1728 ;;
1729
1730 *-irix5*)
1731 AC_DEFINE(IRIX)
1732 DSO_LDOPTS='-elf -shared'
1733
1734 if test "$GNU_CC"; then
1735 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1736 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1737 MKSHLIB_FORCE_ALL='-Wl,-all'
1738 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1739 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1740 else
1741 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1742 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1743 MKSHLIB_FORCE_ALL='-all'
1744 MKSHLIB_UNFORCE_ALL='-none'
1745 fi
1746 ;;
1747
1748 *-irix6*)
1749 AC_DEFINE(IRIX)
1750 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
1751 dnl compile and link using -n32
1752 USE_N32=1
1753 TARGET_COMPILER_ABI=n32
1754 DSO_LDOPTS='-elf -shared'
1755 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1756 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1757 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1758 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1759 if test "$GNU_CC"; then
1760 MKSHLIB_FORCE_ALL='-Wl,-all'
1761 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1762 _WARNINGS_CFLAGS="-Wall"
1763 _WARNINGS_CXXFLAGS="-Wall"
1764 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1765 else
1766 MKSHLIB_FORCE_ALL='-all'
1767 MKSHLIB_UNFORCE_ALL='-none'
1768 AR_LIST="$AR t"
1769 AR_EXTRACT="$AR x"
1770 AR_DELETE="$AR d"
1771 AR='$(CXX) -ar'
1772 AR_FLAGS='-o $@'
1773 CFLAGS="$CFLAGS -woff 3262 -G 4"
1774 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1775 if test -n "$USE_N32"; then
1776 ASFLAGS="$ASFLAGS -n32"
1777 CFLAGS="$CFLAGS -n32"
1778 CXXFLAGS="$CXXFLAGS -n32"
1779 LDFLAGS="$LDFLAGS -n32"
1780 fi
1781 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1782 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1783 MOZ_FIX_LINK_PATHS=
1784 fi
1785 if test -z "$GNU_CXX"; then
1786 MIPSPRO_CXX=1
1787 fi
1788 ;;
1789
1790 *-*linux*)
1791 # Note: both GNU_CXX and INTEL_CXX are set when using Intel's C compiler.
1792 if test "$INTEL_CXX"; then
1793 # -Os has been broken on Intel's C/C++ compilers for quite a
1794 # while; Intel recommends against using it.
1795 MOZ_OPTIMIZE_FLAGS="-O2"
1796 MOZ_DEBUG_FLAGS="-g -fno-inline"
1797 elif test "$GNU_CXX"; then
1798 GCC_VERSION=`$CXX -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1799 case $GCC_VERSION in
1800 4.1.*|4.2.*)
1801 # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1802 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1803 esac
1804 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1805 MOZ_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb,
1806 # and that combo is not yet good at
1807 # debugging inlined functions (even
1808 # when using DWARF2 as the debugging
1809 # format)
1810 fi
1811
1812 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1813
1814 case "${target_cpu}" in
1815 alpha*)
1816 CFLAGS="$CFLAGS -mieee"
1817 CXXFLAGS="$CXXFLAGS -mieee"
1818 ;;
1819 i*86)
1820 MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1821 ;;
1822 mips*)
1823 MOZ_DEBUG_FLAGS="-g" # We want inlining
1824 ;;
1825 esac
1826 ;;
1827
1828 *-wince*)
1829
1830 MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1831 AR_LIST="$AR -list"
1832 AR_EXTRACT="$AR -extract"
1833 AR_DELETE="$AR d"
1834 AR_FLAGS='-OUT:"$@"'
1835 AS="$AS_BIN"
1836
1837 DSO_CFLAGS=
1838 DSO_PIC_CFLAGS=
1839 DLL_SUFFIX=.dll
1840 BIN_SUFFIX='.exe'
1841 if test -z "$RC"; then
1842 RC=rc.exe
1843 fi
1844 # certain versions of cygwin's makedepend barf on the
1845 # #include <string> vs -I./dist/include/string issue so don't use it
1846 SYSTEM_MAKEDEPEND=
1847
1848 HOST_CC=cl
1849 HOST_CXX=cl
1850 HOST_LD=link
1851 HOST_AR='lib -OUT:$@'
1852 HOST_RANLIB='echo ranlib'
1853 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1854
1855
1856 WARNINGS_AS_ERRORS='-WX'
1857 MOZ_OPTIMIZE_FLAGS='-O1'
1858 AR_FLAGS='-NOLOGO -OUT:"$@"'
1859 ASM_SUFFIX=asm
1860 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1861 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1862 DLL_PREFIX=
1863 DOXYGEN=:
1864 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1865 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1866 GARBAGE=
1867 IMPORT_LIB_SUFFIX=lib
1868 LIBS="$LIBS"
1869 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1870 LIB_PREFIX=
1871 LIB_SUFFIX=lib
1872 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1873 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1874 MKSHLIB_FORCE_ALL=
1875 MKSHLIB_UNFORCE_ALL=
1876 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1877 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1878 MOZ_DEBUG_FLAGS='-Zi'
1879 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1880 MOZ_FIX_LINK_PATHS=
1881 MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1882 MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1883 OBJ_SUFFIX=obj
1884 RANLIB='echo not_ranlib'
1885 STRIP='echo not_strip'
1886 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1887 UNZIP=unzip
1888 XARGS=xargs
1889 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1890 ZIP=zip
1891
1892 AC_DEFINE(WINCE)
1893 AC_DEFINE(HAVE_SNPRINTF)
1894 AC_DEFINE(_WINDOWS)
1895 AC_DEFINE(_WIN32)
1896 AC_DEFINE(WIN32)
1897 AC_DEFINE(XP_WIN)
1898 AC_DEFINE(XP_WIN32)
1899 AC_DEFINE(HW_THREADS)
1900 AC_DEFINE(STDC_HEADERS)
1901 AC_DEFINE(NEW_H, <new>)
1902 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1903
1904 TARGET_MD_ARCH=win32
1905 _PLATFORM_DEFAULT_TOOLKIT='windows'
1906 BIN_SUFFIX='.exe'
1907 USE_SHORT_LIBNAME=1
1908 MOZ_ENABLE_POSTSCRIPT=
1909 MOZ_USER_DIR="Mozilla"
1910 ;;
1911
1912
1913 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1914 DSO_CFLAGS=
1915 DSO_PIC_CFLAGS=
1916 DLL_SUFFIX=.dll
1917 RC=rc.exe
1918 # certain versions of cygwin's makedepend barf on the
1919 # #include <string> vs -I./dist/include/string issue so don't use it
1920 SYSTEM_MAKEDEPEND=
1921 if test -n "$GNU_CC"; then
1922 CC="$CC -mno-cygwin"
1923 CXX="$CXX -mno-cygwin"
1924 CPP="$CPP -mno-cygwin"
1925 CFLAGS="$CFLAGS -mms-bitfields"
1926 CXXFLAGS="$CXXFLAGS -mms-bitfields"
1927 DSO_LDOPTS='-shared'
1928 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1929 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1930 RC='$(WINDRES)'
1931 # Use temp file for windres (bug 213281)
1932 RCFLAGS='-O coff --use-temp-file'
1933 # mingw doesn't require kernel32, user32, and advapi32 explicitly
1934 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1935 MOZ_JS_LIBS='-L$(libdir) -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1936 MOZ_FIX_LINK_PATHS=
1937 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1938 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1939 DLL_PREFIX=
1940 IMPORT_LIB_SUFFIX=dll.a
1941 else
1942 TARGET_COMPILER_ABI=msvc
1943 HOST_CC='$(CC)'
1944 HOST_CXX='$(CXX)'
1945 HOST_LD='$(LD)'
1946 AR='lib -NOLOGO -OUT:"$@"'
1947 AR_FLAGS=
1948 RANLIB='echo not_ranlib'
1949 STRIP='echo not_strip'
1950 XARGS=xargs
1951 ZIP=zip
1952 UNZIP=unzip
1953 DOXYGEN=:
1954 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1955 OBJ_SUFFIX=obj
1956 LIB_SUFFIX=lib
1957 DLL_PREFIX=
1958 LIB_PREFIX=
1959 IMPORT_LIB_SUFFIX=lib
1960 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1961 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1962 MKSHLIB_FORCE_ALL=
1963 MKSHLIB_UNFORCE_ALL=
1964 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1965 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1966 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1967 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1968 MOZ_DEBUG_FLAGS='-Zi'
1969 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1970 WARNINGS_AS_ERRORS='-WX'
1971 MOZ_OPTIMIZE_FLAGS='-O1'
1972 MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1973 MOZ_FIX_LINK_PATHS=
1974 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1975 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1976 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1977 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1978 MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1979 if test $_MSC_VER -ge 1400; then
1980 LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
1981 dnl For profile-guided optimization
1982 PROFILE_GEN_CFLAGS="-GL"
1983 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1984 dnl XXX: PGO builds can fail with warnings treated as errors,
1985 dnl specifically "no profile data available" appears to be
1986 dnl treated as an error sometimes. This might be a consequence
1987 dnl of using WARNINGS_AS_ERRORS in some modules, combined
1988 dnl with the linker doing most of the work in the whole-program
1989 dnl optimization/PGO case. I think it's probably a compiler bug,
1990 dnl but we work around it here.
1991 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1992 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1993 dnl Probably also a compiler bug, but what can you do?
1994 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1995 if test -n "$_USE_DYNAMICBASE"; then
1996 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1997 fi
1998 fi
1999 fi
2000 AC_DEFINE(HAVE_SNPRINTF)
2001 AC_DEFINE(_WINDOWS)
2002 AC_DEFINE(_WIN32)
2003 AC_DEFINE(WIN32)
2004 AC_DEFINE(XP_WIN)
2005 AC_DEFINE(XP_WIN32)
2006 AC_DEFINE(HW_THREADS)
2007 AC_DEFINE(STDC_HEADERS)
2008 AC_DEFINE(NEW_H, <new>)
2009 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2010 TARGET_MD_ARCH=win32
2011 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2012 BIN_SUFFIX='.exe'
2013 USE_SHORT_LIBNAME=1
2014 MOZ_ENABLE_POSTSCRIPT=
2015 MOZ_USER_DIR="Mozilla"
2016
2017 dnl Hardcode to win95 for now - cls
2018 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2019
2020 dnl set NO_X11 defines here as the general check is skipped on win32
2021 no_x=yes
2022 AC_DEFINE(NO_X11)
2023
2024 dnl MinGW/MSYS doesn't provide or need cygpath
2025 case "$host" in
2026 *-mingw*)
2027 CYGPATH_W=echo
2028 CYGPATH_S=cat
2029 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2030 ;;
2031 *-cygwin*|*-msvc*|*-mks*)
2032 CYGPATH_W="cygpath -a -w"
2033 CYGPATH_S="sed -e s|\\\\|/|g"
2034 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2035 ;;
2036 esac
2037 case "$host" in
2038 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2039
2040 if test -z "$MOZ_TOOLS"; then
2041 AC_MSG_ERROR([MOZ_TOOLS is not set])
2042 fi
2043
2044 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2045 if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2046 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2047 fi
2048 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2049 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2050 fi
2051 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2052 ;;
2053 esac
2054
2055
2056 case "$host_os" in
2057 cygwin*|msvc*|mks*)
2058 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])
2059 ;;
2060
2061 *)
2062 AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2063
2064 AC_LANG_SAVE
2065 AC_LANG_CPLUSPLUS
2066 AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2067 AC_LANG_RESTORE
2068 ;;
2069 esac
2070
2071 case "$target" in
2072 i*86-*)
2073 AC_DEFINE(_X86_)
2074 ;;
2075 alpha-*)
2076 AC_DEFINE(_ALPHA_)
2077 ;;
2078 mips-*)
2079 AC_DEFINE(_MIPS_)
2080 ;;
2081 *)
2082 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2083 ;;
2084 esac
2085 ;;
2086
2087 *-netbsd*)
2088 DSO_CFLAGS=''
2089 CFLAGS="$CFLAGS -Dunix"
2090 CXXFLAGS="$CXXFLAGS -Dunix"
2091 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2092 DLL_SUFFIX=".so"
2093 DSO_PIC_CFLAGS='-fPIC -DPIC'
2094 DSO_LDOPTS='-shared'
2095 BIN_FLAGS='-Wl,--export-dynamic'
2096 else
2097 DSO_PIC_CFLAGS='-fPIC -DPIC'
2098 DLL_SUFFIX=".so.1.0"
2099 DSO_LDOPTS='-shared'
2100 fi
2101 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2102 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2103 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2104 if test "$LIBRUNPATH"; then
2105 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2106 fi
2107 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2108 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2109 ;;
2110
2111 *-nto*)
2112 AC_DEFINE(NTO)
2113 AC_DEFINE(_QNX_SOURCE)
2114 AC_DEFINE(_i386)
2115 OS_TARGET=NTO
2116 WARNINGS_AS_ERRORS=''
2117 MOZ_OPTIMIZE_FLAGS="-O"
2118 MOZ_DEBUG_FLAGS="-gstabs"
2119 USE_PTHREADS=1
2120 _PEDANTIC=
2121 LIBS="$LIBS -lsocket -lstdc++"
2122 _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2123 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2124 if test "$with_x" != "yes"
2125 then
2126 _PLATFORM_DEFAULT_TOOLKIT="photon"
2127 TK_CFLAGS='-I/usr/include/photon'
2128 TK_LIBS='-lph'
2129 fi
2130 case "${target_cpu}" in
2131 ppc*)
2132 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2133 ;;
2134 esac
2135 ;;
2136
2137 *-openbsd*)
2138 DLL_SUFFIX=".so.1.0"
2139 DSO_CFLAGS=''
2140 DSO_PIC_CFLAGS='-fPIC'
2141 DSO_LDOPTS='-shared -fPIC'
2142 if test "$LIBRUNPATH"; then
2143 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2144 fi
2145 ;;
2146
2147 *-openvms*)
2148 AC_DEFINE(NO_PW_GECOS)
2149 AC_DEFINE(NO_UDSOCK)
2150 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2151 USE_PTHREADS=1
2152 MKSHLIB_FORCE_ALL='-all'
2153 MKSHLIB_UNFORCE_ALL='-none'
2154 AS='as'
2155 AS_DASH_C_FLAG='-Wc/names=as_is'
2156 AR_FLAGS='c $@'
2157 DSO_LDOPTS='-shared -auto_symvec'
2158 DSO_PIC_CFLAGS=
2159 MOZ_DEBUG_LDFLAGS='-g'
2160 COMPAQ_CXX=1
2161 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2162 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2163 ;;
2164
2165
2166 *-os2*)
2167 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2168 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2169 AC_DEFINE(OS2)
2170 AC_DEFINE(XP_OS2)
2171 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2172 AC_DEFINE(TCPV40HDRS)
2173 USE_SHORT_LIBNAME=1
2174 DLL_PREFIX=
2175 LIB_PREFIX=
2176 LIB_SUFFIX=lib
2177 BIN_SUFFIX=".exe"
2178 DLL_SUFFIX=".dll"
2179 IMPORT_LIB_SUFFIX=lib
2180 DSO_PIC_CFLAGS=
2181 AR=emxomfar
2182 AR_FLAGS='r $@'
2183 CFLAGS="$CFLAGS -Zomf"
2184 CXXFLAGS="$CXXFLAGS -Zomf"
2185 DSO_LDOPTS='-Zdll'
2186 BIN_FLAGS='-Zlinker /ST:0x100000'
2187 IMPLIB='emximp -o'
2188 FILTER='emxexp -o'
2189 LDFLAGS='-Zmap'
2190 WARNINGS_AS_ERRORS='-Werror'
2191 MOZ_DEBUG_FLAGS="-g -fno-inline"
2192 MOZ_OPTIMIZE_FLAGS="-O2"
2193 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2194 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2195 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2196 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2197 TARGET_MD_ARCH=os2
2198 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2199 MOZ_ENABLE_POSTSCRIPT=
2200 RC=rc.exe
2201 RCFLAGS='-n'
2202 MOZ_USER_DIR="Mozilla"
2203
2204 if test "$MOZTOOLS"; then
2205 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2206 else
2207 AC_MSG_ERROR([MOZTOOLS is not set])
2208 fi
2209 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2210 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2211 LDFLAGS="$LDFLAGS -Zhigh-mem"
2212 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2213 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2214 fi
2215
2216 # GCC for OS/2 currently predefines these, but we don't want them
2217 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2218 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2219
2220 AC_CACHE_CHECK(for __declspec(dllexport),
2221 ac_os2_declspec,
2222 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2223 [return 0;],
2224 ac_os2_declspec="yes",
2225 ac_os2_declspec="no")])
2226 if test "$ac_os2_declspec" = "yes"; then
2227 FILTER='true'
2228 MOZ_OS2_USE_DECLSPEC='1'
2229 fi
2230 ;;
2231
2232 alpha*-*-osf*)
2233 if test "$GNU_CC"; then
2234 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2235 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2236
2237 else
2238 MOZ_DEBUG_FLAGS='-g'
2239 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2240 CFLAGS="$CFLAGS -ieee"
2241 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2242 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2243 DSO_CFLAGS=
2244 DSO_PIC_CFLAGS=
2245 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2246 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2247 MKSHLIB_FORCE_ALL='-all'
2248 MKSHLIB_UNFORCE_ALL='-none'
2249 dnl Might fix the libxpcom.so breakage on this platform as well....
2250 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2251 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2252 fi
2253 if test -z "$GNU_CXX"; then
2254 COMPAQ_CXX=1
2255 fi
2256 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2257 ;;
2258
2259 *-qnx*)
2260 DIRENT_INO=d_stat.st_ino
2261 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2262 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2263 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2264 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2265 AC_DEFINE(STDC_HEADERS)
2266 if test "$no_x" = "yes"; then
2267 _PLATFORM_DEFAULT_TOOLKIT='photon'
2268 TK_CFLAGS='-I/usr/nto/include/photon'
2269 TK_LIBS='-lphoton -lphrender'
2270 fi
2271 ;;
2272
2273 *-sco*)
2274 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2275 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2276 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2277 if test ! "$GNU_CC"; then
2278 DSO_LDOPTS='-G'
2279 fi
2280 ;;
2281
2282 dnl the qsort routine under solaris is faulty
2283 *-solaris*)
2284 AC_DEFINE(SOLARIS)
2285 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2286 SYSTEM_MAKEDEPEND=
2287 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2288 # libraries one level up (e.g. libnspr4.so)
2289 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2290 if test "$SOLARIS_SUNPRO_CC"; then
2291 LIBS="-lCrun -lCstd $LIBS"
2292 NS_USE_NATIVE=1
2293 MOZ_FIX_LINK_PATHS=
2294 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2295 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2296 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2297 LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2298 if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2299 _SAVE_LDFLAGS=$LDFLAGS
2300 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2301 AC_TRY_LINK([#include <stdio.h>],
2302 [printf("Hello World\n");],
2303 ,
2304 [LDFLAGS=$_SAVE_LDFLAGS])
2305 fi
2306 WARNINGS_AS_ERRORS='-Werror'
2307 MOZ_OPTIMIZE_FLAGS="-xO4"
2308 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2309 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2310 MKSHLIB_FORCE_ALL='-z allextract'
2311 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2312 DSO_LDOPTS='-G -z muldefs'
2313 AR_LIST="$AR t"
2314 AR_EXTRACT="$AR x"
2315 AR_DELETE="$AR d"
2316 AR='$(CXX) -xar'
2317 AR_FLAGS='-o $@'
2318 AS='/usr/ccs/bin/as'
2319 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2320 AS_DASH_C_FLAG=''
2321 TARGET_COMPILER_ABI="sunc"
2322 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2323 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2324 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2325 AC_LANG_SAVE
2326 AC_LANG_CPLUSPLUS
2327 AC_TRY_COMPILE([],
2328 [#if (__SUNPRO_CC < 0x590)
2329 #error "Denied"
2330 #endif],
2331 _BAD_COMPILER=,_BAD_COMPILER=1)
2332 if test -n "$_BAD_COMPILER"; then
2333 _res="no"
2334 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2335 else
2336 _res="yes"
2337 fi
2338 AC_MSG_RESULT([$_res])
2339 AC_LANG_RESTORE
2340 else
2341 ASFLAGS="$ASFLAGS -fPIC"
2342 DSO_LDOPTS='-G'
2343 _WARNINGS_CFLAGS=''
2344 _WARNINGS_CXXFLAGS=''
2345 if test "$OS_RELEASE" = "5.3"; then
2346 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2347 fi
2348 fi
2349 if test "$OS_RELEASE" = "5.5.1"; then
2350 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2351 fi
2352 ;;
2353
2354 *-sunos*)
2355 DSO_LDOPTS='-Bdynamic'
2356 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2357 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2358 AC_DEFINE(SUNOS4)
2359 AC_DEFINE(SPRINTF_RETURNS_STRING)
2360 case "$(target_os)" in
2361 sunos4.1*)
2362 DLL_SUFFIX='.so.1.0'
2363 ;;
2364 esac
2365 ;;
2366
2367 *-sysv4.2uw7*)
2368 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2369 ;;
2370
2371 *-os2*)
2372 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2373 ;;
2374
2375 esac
2376
2377 dnl Only one oddball right now (QNX), but this gives us flexibility
2378 dnl if any other platforms need to override this in the future.
2379 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2380
2381 dnl ========================================================
2382 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2383 dnl by now will not have any way to link most binaries (tests
2384 dnl as well as viewer, apprunner, etc.), because some symbols
2385 dnl will be left out of the "composite" .so's by ld as unneeded.
2386 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2387 dnl they can link in the static libs that provide the missing
2388 dnl symbols.
2389 dnl ========================================================
2390 NO_LD_ARCHIVE_FLAGS=
2391 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2392 NO_LD_ARCHIVE_FLAGS=1
2393 fi
2394 case "$target" in
2395 *-os2*)
2396 NO_LD_ARCHIVE_FLAGS=
2397 ;;
2398 *-aix4.3*|*-aix5*)
2399 NO_LD_ARCHIVE_FLAGS=
2400 ;;
2401 *-openvms*)
2402 NO_LD_ARCHIVE_FLAGS=
2403 ;;
2404 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2405 if test -z "$GNU_CC"; then
2406 NO_LD_ARCHIVE_FLAGS=
2407 fi
2408 ;;
2409 esac
2410 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2411
2412 dnl
2413 dnl Indicate that platform requires special thread safe
2414 dnl locking when starting up the OJI JVM
2415 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2416 dnl ========================================================
2417 case "$target" in
2418 *-hpux*)
2419 AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2420 ;;
2421 esac
2422
2423 dnl ========================================================
2424 dnl = Flags to strip unused symbols from .so components
2425 dnl ========================================================
2426 case "$target" in
2427 *-linux*|*-kfreebsd*-gnu)
2428 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2429 ;;
2430 *-solaris*)
2431 if test -z "$GNU_CC"; then
2432 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2433 else
2434 if test -z "$GCC_USE_GNU_LD"; then
2435 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2436 else
2437 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2438 fi
2439 fi
2440 ;;
2441 *-nto*)
2442 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2443 ;;
2444 *-darwin*)
2445 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2446 ;;
2447 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2448 if test -n "$GNU_CC"; then
2449 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2450 fi
2451 ;;
2452 esac
2453
2454 if test -z "$COMPILE_ENVIRONMENT"; then
2455 SKIP_COMPILER_CHECKS=1
2456 SKIP_LIBRARY_CHECKS=1
2457 fi
2458
2459 dnl Configure JIT support
2460
2461 case "$target" in
2462 i?86-*)
2463 ENABLE_JIT=1
2464 NANOJIT_ARCH=i386
2465 ;;
2466 arm*-*)
2467 ENABLE_JIT=1
2468 NANOJIT_ARCH=ARM
2469 ;;
2470 sparc*-*)
2471 ENABLE_JIT=1
2472 NANOJIT_ARCH=Sparc
2473 ;;
2474 esac
2475
2476 MOZ_ARG_DISABLE_BOOL(jit,
2477 [ --disable-jit Disable JIT support],
2478 ENABLE_JIT=)
2479
2480 if test "$ENABLE_JIT"; then
2481
2482 case "$target" in
2483 i?86-*)
2484 AC_DEFINE(AVMPLUS_IA32)
2485 ;;
2486
2487 arm*-*)
2488 AC_DEFINE(AVMPLUS_ARM)
2489 ;;
2490
2491 sparc-*)
2492 AC_DEFINE(AVMPLUS_SPARC)
2493 ;;
2494 esac
2495
2496 case "$target_os" in
2497 linux*)
2498 AC_DEFINE(AVMPLUS_UNIX)
2499 AC_DEFINE(AVMPLUS_LINUX)
2500 ;;
2501 darwin*)
2502 AC_DEFINE(AVMPLUS_UNIX)
2503 ;;
2504 solaris*)
2505 AC_DEFINE(AVMPLUS_UNIX)
2506 ;;
2507 freebsd*|kfreebsd*)
2508 AC_DEFINE(AVMPLUS_UNIX)
2509 ;;
2510 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
2511 AC_DEFINE(AVMPLUS_WIN32)
2512 ;;
2513 *os2*)
2514 AC_DEFINE(AVMPLUS_OS2)
2515 ;;
2516 *)
2517 AC_MSG_ERROR([Unrecognized nanojit platform. Use --disable-jit to build without JIT support.])
2518 ;;
2519 esac
2520
2521 fi # ENABLE_JIT
2522
2523 AC_SUBST(ENABLE_JIT)
2524 AC_SUBST(NANOJIT_ARCH)
2525
2526 if test -z "$SKIP_COMPILER_CHECKS"; then
2527 dnl Checks for typedefs, structures, and compiler characteristics.
2528 dnl ========================================================
2529 AC_LANG_C
2530 AC_HEADER_STDC
2531 AC_C_CONST
2532 AC_TYPE_MODE_T
2533 AC_TYPE_OFF_T
2534 AC_TYPE_PID_T
2535 AC_TYPE_SIZE_T
2536 AC_STRUCT_ST_BLKSIZE
2537 AC_MSG_CHECKING(for siginfo_t)
2538 AC_CACHE_VAL(ac_cv_siginfo_t,
2539 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2540 #include <signal.h>],
2541 [siginfo_t* info;],
2542 [ac_cv_siginfo_t=true],
2543 [ac_cv_siginfo_t=false])])
2544 if test "$ac_cv_siginfo_t" = true ; then
2545 AC_DEFINE(HAVE_SIGINFO_T)
2546 AC_MSG_RESULT(yes)
2547 else
2548 AC_MSG_RESULT(no)
2549 fi
2550
2551 dnl Find exact-width integer types, or figure them out
2552 dnl ourselves.
2553 dnl ========================================================
2554 dnl Once this is working, we can delete the code for int16_t,
2555 dnl etc. below.
2556
2557 AC_CHECK_HEADER(stdint.h)
2558 if test "$ac_cv_header_stdint_h" = yes; then
2559 AC_DEFINE(JS_HAVE_STDINT_H)
2560 else
2561 dnl We'll figure them out for ourselves. List more likely types
2562 dnl earlier. If we ever really encounter a size for which none of
2563 dnl the listed types are appropriate, we'll get a configure-time
2564 dnl error; just add the right answer.
2565 MOZ_N_BYTE_TYPE(JS_INT8_TYPE, 1, [char])
2566 MOZ_N_BYTE_TYPE(JS_INT16_TYPE, 2, [short int long])
2567 MOZ_N_BYTE_TYPE(JS_INT32_TYPE, 4, [int long 'long long' short])
2568 MOZ_N_BYTE_TYPE(JS_INT64_TYPE, 8, [int long 'long long'])
2569 MOZ_N_BYTE_TYPE(JS_INTPTR_TYPE, sizeof (void *),
2570 [int long 'long long' short])
2571 fi
2572
2573 MOZ_SIZE_OF_TYPE(JS_BYTES_PER_WORD, void*, 4 8)
2574 if test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "4"; then
2575 AC_DEFINE(JS_BITS_PER_WORD_LOG2, 5)
2576 elif test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "8"; then
2577 AC_DEFINE(JS_BITS_PER_WORD_LOG2, 6)
2578 else
2579 AC_MSG_ERROR([Unexpected JS_BYTES_PER_WORD])
2580 fi
2581
2582 MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
2583 MOZ_SIZE_OF_TYPE(JS_BYTES_PER_DOUBLE, double, 6 8 10 12 14)
2584
2585 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2586 dnl ========================================================
2587 AC_MSG_CHECKING(for int16_t)
2588 AC_CACHE_VAL(ac_cv_int16_t,
2589 [AC_TRY_COMPILE([#include <stdio.h>
2590 #include <sys/types.h>],
2591 [int16_t foo = 0;],
2592 [ac_cv_int16_t=true],
2593 [ac_cv_int16_t=false])])
2594 if test "$ac_cv_int16_t" = true ; then
2595 AC_DEFINE(HAVE_INT16_T)
2596 AC_MSG_RESULT(yes)
2597 else
2598 AC_MSG_RESULT(no)
2599 fi
2600 AC_MSG_CHECKING(for int32_t)
2601 AC_CACHE_VAL(ac_cv_int32_t,
2602 [AC_TRY_COMPILE([#include <stdio.h>
2603 #include <sys/types.h>],
2604 [int32_t foo = 0;],
2605 [ac_cv_int32_t=true],
2606 [ac_cv_int32_t=false])])
2607 if test "$ac_cv_int32_t" = true ; then
2608 AC_DEFINE(HAVE_INT32_T)
2609 AC_MSG_RESULT(yes)
2610 else
2611 AC_MSG_RESULT(no)
2612 fi
2613 AC_MSG_CHECKING(for int64_t)
2614 AC_CACHE_VAL(ac_cv_int64_t,
2615 [AC_TRY_COMPILE([#include <stdio.h>
2616 #include <sys/types.h>],
2617 [int64_t foo = 0;],
2618 [ac_cv_int64_t=true],
2619 [ac_cv_int64_t=false])])
2620 if test "$ac_cv_int64_t" = true ; then
2621 AC_DEFINE(HAVE_INT64_T)
2622 AC_MSG_RESULT(yes)
2623 else
2624 AC_MSG_RESULT(no)
2625 fi
2626 AC_MSG_CHECKING(for int64)
2627 AC_CACHE_VAL(ac_cv_int64,
2628 [AC_TRY_COMPILE([#include <stdio.h>
2629 #include <sys/types.h>],
2630 [int64 foo = 0;],
2631 [ac_cv_int64=true],
2632 [ac_cv_int64=false])])
2633 if test "$ac_cv_int64" = true ; then
2634 AC_DEFINE(HAVE_INT64)
2635 AC_MSG_RESULT(yes)
2636 else
2637 AC_MSG_RESULT(no)
2638 fi
2639 AC_MSG_CHECKING(for uint)
2640 AC_CACHE_VAL(ac_cv_uint,
2641 [AC_TRY_COMPILE([#include <stdio.h>
2642 #include <sys/types.h>],
2643 [uint foo = 0;],
2644 [ac_cv_uint=true],
2645 [ac_cv_uint=false])])
2646 if test "$ac_cv_uint" = true ; then
2647 AC_DEFINE(HAVE_UINT)
2648 AC_MSG_RESULT(yes)
2649 else
2650 AC_MSG_RESULT(no)
2651 fi
2652 AC_MSG_CHECKING(for uint_t)
2653 AC_CACHE_VAL(ac_cv_uint_t,
2654 [AC_TRY_COMPILE([#include <stdio.h>
2655 #include <sys/types.h>],
2656 [uint_t foo = 0;],
2657 [ac_cv_uint_t=true],
2658 [ac_cv_uint_t=false])])
2659 if test "$ac_cv_uint_t" = true ; then
2660 AC_DEFINE(HAVE_UINT_T)
2661 AC_MSG_RESULT(yes)
2662 else
2663 AC_MSG_RESULT(no)
2664 fi
2665 AC_MSG_CHECKING(for uint16_t)
2666 AC_CACHE_VAL(ac_cv_uint16_t,
2667 [AC_TRY_COMPILE([#include <stdio.h>
2668 #include <sys/types.h>],
2669 [uint16_t foo = 0;],
2670 [ac_cv_uint16_t=true],
2671 [ac_cv_uint16_t=false])])
2672 if test "$ac_cv_uint16_t" = true ; then
2673 AC_DEFINE(HAVE_UINT16_T)
2674 AC_MSG_RESULT(yes)
2675 else
2676 AC_MSG_RESULT(no)
2677 fi
2678
2679 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2680 dnl are defined when compiling C++ but not C. Since the result of this
2681 dnl test is used only in C++, do it in C++.
2682 AC_LANG_CPLUSPLUS
2683
2684 AC_MSG_CHECKING(for uname.domainname)
2685 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2686 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2687 [ struct utsname *res; char *domain;
2688 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2689 [ac_cv_have_uname_domainname_field=true],
2690 [ac_cv_have_uname_domainname_field=false])])
2691
2692 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2693 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2694 AC_MSG_RESULT(yes)
2695 else
2696 AC_MSG_RESULT(no)
2697 fi
2698
2699 AC_MSG_CHECKING(for uname.__domainname)
2700 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2701 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2702 [ struct utsname *res; char *domain;
2703 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2704 [ac_cv_have_uname_us_domainname_field=true],
2705 [ac_cv_have_uname_us_domainname_field=false])])
2706
2707 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2708 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2709 AC_MSG_RESULT(yes)
2710 else
2711 AC_MSG_RESULT(no)
2712 fi
2713
2714 AC_LANG_C
2715
2716 dnl Check for usable wchar_t (2 bytes, unsigned)
2717 dnl (we really don't need the unsignedness check anymore)
2718 dnl ========================================================
2719
2720 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2721 ac_cv_have_usable_wchar_v2,
2722 [AC_TRY_COMPILE([#include <stddef.h>
2723 $configure_static_assert_macros],
2724 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2725 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2726 ac_cv_have_usable_wchar_v2="yes",
2727 ac_cv_have_usable_wchar_v2="no")])
2728 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2729 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2730 HAVE_CPP_2BYTE_WCHAR_T=1
2731 else
2732 dnl This is really gcc-only
2733 dnl Do this test using CXX only since some versions of gcc
2734 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2735 dnl only have short-wchar support for c++.
2736 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2737
2738 AC_LANG_SAVE
2739 AC_LANG_CPLUSPLUS
2740 _SAVE_CXXFLAGS=$CXXFLAGS
2741 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2742
2743 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2744 ac_cv_have_usable_wchar_option_v2,
2745 [AC_TRY_LINK([#include <stddef.h>
2746 $configure_static_assert_macros],
2747 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2748 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2749 ac_cv_have_usable_wchar_option_v2="yes",
2750 ac_cv_have_usable_wchar_option_v2="no")])
2751
2752 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2753 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2754 HAVE_CPP_2BYTE_WCHAR_T=1
2755 WCHAR_CFLAGS="-fshort-wchar"
2756 else
2757 CXXFLAGS=$_SAVE_CXXFLAGS
2758 fi
2759 AC_LANG_RESTORE
2760 fi
2761
2762 dnl Check for .hidden assembler directive and visibility attribute.
2763 dnl Borrowed from glibc configure.in
2764 dnl ===============================================================
2765 if test "$GNU_CC"; then
2766 AC_CACHE_CHECK(for visibility(hidden) attribute,
2767 ac_cv_visibility_hidden,
2768 [cat > conftest.c <<EOF
2769 int foo __attribute__ ((visibility ("hidden"))) = 1;
2770 EOF
2771 ac_cv_visibility_hidden=no
2772 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2773 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2774 ac_cv_visibility_hidden=yes
2775 fi
2776 fi
2777 rm -f conftest.[cs]
2778 ])
2779 if test "$ac_cv_visibility_hidden" = "yes"; then
2780 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2781
2782 AC_CACHE_CHECK(for visibility(default) attribute,
2783 ac_cv_visibility_default,
2784 [cat > conftest.c <<EOF
2785 int foo __attribute__ ((visibility ("default"))) = 1;
2786 EOF
2787 ac_cv_visibility_default=no
2788 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2789 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2790 ac_cv_visibility_default=yes
2791 fi
2792 fi
2793 rm -f conftest.[cs]
2794 ])
2795 if test "$ac_cv_visibility_default" = "yes"; then
2796 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2797
2798 AC_CACHE_CHECK(for visibility pragma support,
2799 ac_cv_visibility_pragma,
2800 [cat > conftest.c <<EOF
2801 #pragma GCC visibility push(hidden)
2802 int foo_hidden = 1;
2803 #pragma GCC visibility push(default)
2804 int foo_default = 1;
2805 EOF
2806 ac_cv_visibility_pragma=no
2807 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2808 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2809 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2810 ac_cv_visibility_pragma=yes
2811 fi
2812 fi
2813 fi
2814 rm -f conftest.[cs]
2815 ])
2816 if test "$ac_cv_visibility_pragma" = "yes"; then
2817 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2818 ac_cv_have_visibility_class_bug,
2819 [cat > conftest.c <<EOF
2820 #pragma GCC visibility push(hidden)
2821 struct __attribute__ ((visibility ("default"))) TestStruct {
2822 static void Init();
2823 };
2824 __attribute__ ((visibility ("default"))) void TestFunc() {
2825 TestStruct::Init();
2826 }
2827 EOF
2828 ac_cv_have_visibility_class_bug=no
2829 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2830 ac_cv_have_visibility_class_bug=yes
2831 else
2832 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2833 ac_cv_have_visibility_class_bug=yes
2834 fi
2835 fi
2836 rm -rf conftest.{c,S}
2837 ])
2838
2839 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2840 ac_cv_have_visibility_builtin_bug,
2841 [cat > conftest.c <<EOF
2842 #pragma GCC visibility push(hidden)
2843 #pragma GCC visibility push(default)
2844 #include <string.h>
2845 #pragma GCC visibility pop
2846
2847 __attribute__ ((visibility ("default"))) void Func() {
2848 char c[[100]];
2849 memset(c, 0, sizeof(c));
2850 }
2851 EOF
2852 ac_cv_have_visibility_builtin_bug=no
2853 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2854 ac_cv_have_visibility_builtin_bug=yes
2855 else
2856 if test `grep -c "@PLT" conftest.S` = 0; then
2857 ac_cv_visibility_builtin_bug=yes
2858 fi
2859 fi
2860 rm -f conftest.{c,S}
2861 ])
2862 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2863 "$ac_cv_have_visibility_class_bug" = "no"; then
2864 VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h'
2865 WRAP_SYSTEM_INCLUDES=1
2866 else
2867 VISIBILITY_FLAGS='-fvisibility=hidden'
2868 fi # have visibility pragma bug
2869 fi # have visibility pragma
2870 fi # have visibility(default) attribute
2871 fi # have visibility(hidden) attribute
2872 fi # GNU_CC
2873
2874 # visibility hidden flag for Sun Studio on Solaris
2875 if test "$SOLARIS_SUNPRO_CC"; then
2876 VISIBILITY_FLAGS='-xldscope=hidden'
2877 fi # Sun Studio on Solaris
2878
2879 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2880 AC_SUBST(VISIBILITY_FLAGS)
2881
2882 dnl Checks for header files.
2883 dnl ========================================================
2884 AC_HEADER_DIRENT
2885 case "$target_os" in
2886 freebsd*)
2887 # for stuff like -lXshm
2888 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2889 ;;
2890 esac
2891 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2892 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2893 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2894 AC_CHECK_HEADERS(malloc.h)
2895 AC_CHECK_HEADERS(X11/XKBlib.h)
2896
2897 dnl These are all the places some variant of statfs can be hiding.
2898 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2899
2900 dnl Try for MMX support
2901 dnl NB - later gcc versions require -mmmx for this header to be successfully
2902 dnl included (or another option which implies it, such as -march=pentium-mmx)
2903 AC_CHECK_HEADERS(mmintrin.h)
2904
2905 dnl Check whether the compiler supports the new-style C++ standard
2906 dnl library headers (i.e. <new>) or needs the old "new.h"
2907 AC_LANG_CPLUSPLUS
2908 NEW_H=new.h
2909 AC_CHECK_HEADER(new, [NEW_H=new])
2910 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2911 AC_LANG_C
2912
2913 AC_ARG_ENABLE(dtrace,
2914 [ --enable-dtrace build with dtrace support if available (default=no)],
2915 [enable_dtrace="yes"],)
2916 if test "x$enable_dtrace" = "xyes"; then
2917 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2918 if test -n "$HAVE_DTRACE"; then
2919 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2920 else
2921 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2922 fi
2923 fi
2924 AC_SUBST(HAVE_DTRACE)
2925
2926 case $target in
2927 *-aix4.3*|*-aix5*)
2928 ;;
2929 *)
2930 AC_CHECK_HEADERS(sys/cdefs.h)
2931 ;;
2932 esac
2933
2934 dnl Checks for libraries.
2935 dnl ========================================================
2936 case $target in
2937 *-hpux11.*)
2938 ;;
2939 *)
2940 AC_CHECK_LIB(c_r, gethostbyname_r)
2941 ;;
2942 esac
2943
2944 dnl We don't want to link with libdl even if it's present on OS X, since
2945 dnl it's not used and not part of the default installation.
2946 dnl The same goes for BeOS.
2947 dnl We don't want to link against libm or libpthread on Darwin since
2948 dnl they both are just symlinks to libSystem and explicitly linking
2949 dnl against libSystem causes issues when debugging (see bug 299601).
2950 case $target in
2951 *-darwin*)
2952 ;;
2953 *-beos*)
2954 ;;
2955 *)
2956 AC_CHECK_LIB(m, atan)
2957 AC_CHECK_LIB(dl, dlopen,
2958 AC_CHECK_HEADER(dlfcn.h,
2959 LIBS="-ldl $LIBS"
2960 AC_DEFINE(HAVE_LIBDL)))
2961 ;;
2962 esac
2963
2964 _SAVE_CFLAGS="$CFLAGS"
2965 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2966 AC_CHECK_FUNCS(dladdr)
2967 CFLAGS="$_SAVE_CFLAGS"
2968
2969 if test ! "$GNU_CXX"; then
2970
2971 case $target in
2972 *-aix*)
2973 AC_CHECK_LIB(C_r, demangle)
2974 ;;
2975 *)
2976 AC_CHECK_LIB(C, demangle)
2977 ;;
2978 esac
2979 fi
2980 AC_CHECK_LIB(socket, socket)
2981
2982 AC_MSG_CHECKING(for ARM SIMD support)
2983 AC_TRY_COMPILE([],
2984 [asm("uqadd8 r1, r1, r2");],
2985 result="yes", result="no")
2986 AC_MSG_RESULT("$result")
2987 if test "$result" = "yes"; then
2988 AC_DEFINE(HAVE_ARM_SIMD)
2989 HAVE_ARM_SIMD=1
2990 fi
2991 AC_SUBST(HAVE_ARM_SIMD)
2992
2993 dnl ========================================================
2994 dnl = pthread support
2995 dnl = Start by checking whether the system support pthreads
2996 dnl ========================================================
2997 case "$target_os" in
2998 darwin*)
2999 USE_PTHREADS=1
3000 ;;
3001 *)
3002 MOZ_CHECK_PTHREADS(pthreads,
3003 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3004 MOZ_CHECK_PTHREADS(pthread,
3005 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3006 MOZ_CHECK_PTHREADS(c_r,
3007 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3008 MOZ_CHECK_PTHREADS(c,
3009 USE_PTHREADS=1
3010 )
3011 )
3012 )
3013 )
3014 ;;
3015 esac
3016
3017 dnl ========================================================
3018 dnl Check the command line for --with-pthreads
3019 dnl ========================================================
3020 MOZ_ARG_WITH_BOOL(pthreads,
3021 [ --with-pthreads Force use of system pthread library with NSPR ],
3022 [ if test "$USE_PTHREADS"x = x; then
3023 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3024 fi],
3025 USE_PTHREADS=
3026 _PTHREAD_LDFLAGS=
3027 )
3028
3029 dnl ========================================================
3030 dnl Do the platform specific pthread hackery
3031 dnl ========================================================
3032 if test "$USE_PTHREADS"x != x
3033 then
3034 dnl
3035 dnl See if -pthread is supported.
3036 dnl
3037 rm -f conftest*
3038 ac_cv_have_dash_pthread=no
3039 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3040 echo 'int main() { return 0; }' | cat > conftest.c
3041 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3042 if test $? -eq 0; then
3043 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3044 ac_cv_have_dash_pthread=yes
3045 case "$target_os" in
3046 freebsd*)
3047 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3048 ;;
3049 *)
3050 CFLAGS="$CFLAGS -pthread"
3051 CXXFLAGS="$CXXFLAGS -pthread"
3052 ;;
3053 esac
3054 fi
3055 fi
3056 rm -f conftest*
3057 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3058
3059 dnl
3060 dnl See if -pthreads is supported.
3061 dnl
3062 ac_cv_have_dash_pthreads=no
3063 if test "$ac_cv_have_dash_pthread" = "no"; then
3064 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3065 echo 'int main() { return 0; }' | cat > conftest.c
3066 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3067 if test $? -eq 0; then
3068 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3069 ac_cv_have_dash_pthreads=yes
3070 CFLAGS="$CFLAGS -pthreads"
3071 CXXFLAGS="$CXXFLAGS -pthreads"
3072 fi
3073 fi
3074 rm -f conftest*
3075 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3076 fi
3077
3078 case "$target" in
3079 *-*-freebsd*)
3080 AC_DEFINE(_REENTRANT)
3081 AC_DEFINE(_THREAD_SAFE)
3082 dnl -pthread links in -lc_r, so don't specify it explicitly.
3083 if test "$ac_cv_have_dash_pthread" = "yes"; then
3084 _PTHREAD_LDFLAGS="-pthread"
3085 else
3086 _PTHREAD_LDFLAGS="-lc_r"
3087 fi
3088 ;;
3089
3090 *-*-openbsd*|*-*-bsdi*)
3091 AC_DEFINE(_REENTRANT)
3092 AC_DEFINE(_THREAD_SAFE)
3093 dnl -pthread links in -lc_r, so don't specify it explicitly.
3094 if test "$ac_cv_have_dash_pthread" = "yes"; then
3095 _PTHREAD_LDFLAGS="-pthread"
3096 fi
3097 ;;
3098
3099 *-*-linux*|*-*-kfreebsd*-gnu)
3100 AC_DEFINE(_REENTRANT)
3101 ;;
3102
3103 *-*-nto*)
3104 AC_DEFINE(_REENTRANT)
3105 ;;
3106
3107 *-aix4.3*|*-aix5*)
3108 AC_DEFINE(_REENTRANT)
3109 ;;
3110
3111 *-hpux11.*)
3112 AC_DEFINE(_REENTRANT)
3113 ;;
3114
3115 alpha*-*-osf*)
3116 AC_DEFINE(_REENTRANT)
3117 ;;
3118
3119 *-*-solaris*)
3120 AC_DEFINE(_REENTRANT)
3121 if test "$SOLARIS_SUNPRO_CC"; then
3122 CFLAGS="$CFLAGS -mt"
3123 CXXFLAGS="$CXXFLAGS -mt"
3124 fi
3125 ;;
3126 esac
3127 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3128 fi
3129
3130 dnl ========================================================
3131 dnl See if mmap sees writes
3132 dnl For cross compiling, just define it as no, which is a safe default
3133 dnl ========================================================
3134 AC_MSG_CHECKING(whether mmap() sees write()s)
3135
3136 changequote(,)
3137 mmap_test_prog='
3138 #include <stdlib.h>
3139 #include <unistd.h>
3140 #include <sys/mman.h>
3141 #include <sys/types.h>
3142 #include <sys/stat.h>
3143 #include <fcntl.h>
3144
3145 char fname[] = "conftest.file";
3146 char zbuff[1024]; /* Fractional page is probably worst case */
3147
3148 int main() {
3149 char *map;
3150 int fd;
3151 int i;
3152 unlink(fname);
3153 fd = open(fname, O_RDWR | O_CREAT, 0660);
3154 if(fd<0) return 1;
3155 unlink(fname);
3156 write(fd, zbuff, sizeof(zbuff));
3157 lseek(fd, 0, SEEK_SET);
3158 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3159 if(map==(char*)-1) return 2;
3160 for(i=0; fname[i]; i++) {
3161 int rc = write(fd, &fname[i], 1);
3162 if(map[i]!=fname[i]) return 4;
3163 }
3164 return 0;
3165 }
3166 '
3167 changequote([,])
3168
3169 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3170
3171 AC_MSG_RESULT("$result")
3172
3173 if test "$result" = "no"; then
3174 AC_DEFINE(MMAP_MISSES_WRITES)
3175 fi
3176
3177
3178 dnl Checks for library functions.
3179 dnl ========================================================
3180 AC_PROG_GCC_TRADITIONAL
3181 AC_FUNC_MEMCMP
3182 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3183 AC_CHECK_FUNCS(flockfile getpagesize)
3184 AC_CHECK_FUNCS(localtime_r strtok_r)
3185
3186 dnl check for wcrtomb/mbrtowc
3187 dnl =======================================================================
3188 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3189 AC_LANG_SAVE
3190 AC_LANG_CPLUSPLUS
3191 AC_CACHE_CHECK(for wcrtomb,
3192 ac_cv_have_wcrtomb,
3193 [AC_TRY_LINK([#include <wchar.h>],
3194 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3195 ac_cv_have_wcrtomb="yes",
3196 ac_cv_have_wcrtomb="no")])
3197 if test "$ac_cv_have_wcrtomb" = "yes"; then
3198 AC_DEFINE(HAVE_WCRTOMB)
3199 fi
3200 AC_CACHE_CHECK(for mbrtowc,
3201 ac_cv_have_mbrtowc,
3202 [AC_TRY_LINK([#include <wchar.h>],
3203 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3204 ac_cv_have_mbrtowc="yes",
3205 ac_cv_have_mbrtowc="no")])
3206 if test "$ac_cv_have_mbrtowc" = "yes"; then
3207 AC_DEFINE(HAVE_MBRTOWC)
3208 fi
3209 AC_LANG_RESTORE
3210 fi
3211
3212 AC_CACHE_CHECK(
3213 [for res_ninit()],
3214 ac_cv_func_res_ninit,
3215 [AC_TRY_LINK([
3216 #ifdef linux
3217 #define _BSD_SOURCE 1
3218 #endif
3219 #include <resolv.h>
3220 ],
3221 [int foo = res_ninit(&_res);],
3222 [ac_cv_func_res_ninit=yes],
3223 [ac_cv_func_res_ninit=no])
3224 ])
3225
3226 if test "$ac_cv_func_res_ninit" = "yes"; then
3227 AC_DEFINE(HAVE_RES_NINIT)
3228 dnl must add the link line we do something as foolish as this... dougt
3229 dnl else
3230 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3231 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3232 fi
3233
3234 AC_LANG_CPLUSPLUS
3235 AC_CACHE_CHECK(
3236 [for gnu_get_libc_version()],
3237 ac_cv_func_gnu_get_libc_version,
3238 [AC_TRY_LINK([
3239 #ifdef HAVE_GNU_LIBC_VERSION_H
3240 #include <gnu/libc-version.h>
3241 #endif
3242 ],
3243 [const char *glibc_version = gnu_get_libc_version();],
3244 [ac_cv_func_gnu_get_libc_version=yes],
3245 [ac_cv_func_gnu_get_libc_version=no]
3246 )]
3247 )
3248
3249 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3250 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3251 fi
3252
3253 case $target_os in
3254 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3255 ;;
3256 *)
3257
3258 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3259 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3260 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3261 _SAVE_LIBS=$LIBS
3262 LIBS="$LIBS $_ICONV_LIBS"
3263 AC_CACHE_CHECK(
3264 [for iconv()],
3265 ac_cv_func_iconv,
3266 [AC_TRY_LINK([
3267 #include <stdlib.h>
3268 #include <iconv.h>
3269 ],
3270 [
3271 iconv_t h = iconv_open("", "");
3272 iconv(h, NULL, NULL, NULL, NULL);
3273 iconv_close(h);
3274 ],
3275 [ac_cv_func_iconv=yes],
3276 [ac_cv_func_iconv=no]
3277 )]
3278 )
3279 if test "$ac_cv_func_iconv" = "yes"; then
3280 AC_DEFINE(HAVE_ICONV)
3281 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3282 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3283 LIBICONV="$_ICONV_LIBS"
3284 AC_CACHE_CHECK(
3285 [for iconv() with const input],
3286 ac_cv_func_const_iconv,
3287 [AC_TRY_COMPILE([
3288 #include <stdlib.h>
3289 #include <iconv.h>
3290 ],
3291 [
3292 const char *input = "testing";
3293 iconv_t h = iconv_open("", "");
3294 iconv(h, &input, NULL, NULL, NULL);
3295 iconv_close(h);
3296 ],
3297 [ac_cv_func_const_iconv=yes],
3298 [ac_cv_func_const_iconv=no]
3299 )]
3300 )
3301 if test "$ac_cv_func_const_iconv" = "yes"; then
3302 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3303 fi
3304 fi
3305 LIBS=$_SAVE_LIBS
3306
3307 ;;
3308 esac
3309
3310 AC_LANG_C
3311
3312 dnl **********************
3313 dnl *** va_copy checks ***
3314 dnl **********************
3315 dnl we currently check for all three va_copy possibilities, so we get
3316 dnl all results in config.log for bug reports.
3317 AC_MSG_CHECKING(for an implementation of va_copy())
3318 AC_CACHE_VAL(ac_cv_va_copy,[
3319 AC_TRY_RUN([
3320 #include <stdarg.h>
3321 void f (int i, ...) {
3322 va_list args1, args2;
3323 va_start (args1, i);
3324 va_copy (args2, args1);
3325 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3326 exit (1);
3327 va_end (args1); va_end (args2);
3328 }
3329 int main() { f (0, 42); return 0; }],
3330 ac_cv_va_copy=yes,
3331 ac_cv_va_copy=no,
3332 ac_cv_va_copy=no
3333 )
3334 ])
3335 AC_MSG_RESULT($ac_cv_va_copy)
3336 AC_MSG_CHECKING(for an implementation of __va_copy())
3337 AC_CACHE_VAL(ac_cv___va_copy,[
3338 AC_TRY_RUN([
3339 #include <stdarg.h>
3340 void f (int i, ...) {
3341 va_list args1, args2;
3342 va_start (args1, i);
3343 __va_copy (args2, args1);
3344 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3345 exit (1);
3346 va_end (args1); va_end (args2);
3347 }
3348 int main() { f (0, 42); return 0; }],
3349 ac_cv___va_copy=yes,
3350 ac_cv___va_copy=no,
3351 ac_cv___va_copy=no
3352 )
3353 ])
3354 AC_MSG_RESULT($ac_cv___va_copy)
3355 AC_MSG_CHECKING(whether va_lists can be copied by value)
3356 AC_CACHE_VAL(ac_cv_va_val_copy,[
3357 AC_TRY_RUN([
3358 #include <stdarg.h>
3359 void f (int i, ...) {
3360 va_list args1, args2;
3361 va_start (args1, i);
3362 args2 = args1;
3363 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3364 exit (1);
3365 va_end (args1); va_end (args2);
3366 }
3367 int main() { f (0, 42); return 0; }],
3368 ac_cv_va_val_copy=yes,
3369 ac_cv_va_val_copy=no,
3370 ac_cv_va_val_copy=yes
3371 )
3372 ])
3373 if test "x$ac_cv_va_copy" = "xyes"; then
3374 AC_DEFINE(VA_COPY, va_copy)
3375 AC_DEFINE(HAVE_VA_COPY)
3376 elif test "x$ac_cv___va_copy" = "xyes"; then
3377 AC_DEFINE(VA_COPY, __va_copy)
3378 AC_DEFINE(HAVE_VA_COPY)
3379 fi
3380
3381 if test "x$ac_cv_va_val_copy" = "xno"; then
3382 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3383 fi
3384 AC_MSG_RESULT($ac_cv_va_val_copy)
3385
3386 dnl Check for dll-challenged libc's.
3387 dnl This check is apparently only needed for Linux.
3388 case "$target" in
3389 *-linux*)
3390 dnl ===================================================================
3391 _curdir=`pwd`
3392 export _curdir
3393 rm -rf conftest* _conftest
3394 mkdir _conftest
3395 cat >> conftest.C <<\EOF
3396 #include <stdio.h>
3397 #include <link.h>
3398 #include <dlfcn.h>
3399 #ifdef _dl_loaded
3400 void __dump_link_map(void) {
3401 struct link_map *map = _dl_loaded;
3402 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3403 }
3404 int main() {
3405 dlopen("./conftest1.so",RTLD_LAZY);
3406 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3407 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3408 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3409 __dump_link_map();
3410 }
3411 #else
3412 /* _dl_loaded isn't defined, so this should be either a libc5 (glibc1) system, or a glibc2 system that doesn't have the multiple load bug (i.e., RH6.0).*/
3413 int main() { printf("./conftest1.so\n"); }
3414 #endif
3415 EOF
3416
3417 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3418
3419 cat >> conftest1.C <<\EOF
3420 #include <stdio.h>
3421 void foo(void) {printf("foo in dll called\n");}
3422 EOF
3423 ${CXX-g++} -fPIC -c -g conftest1.C
3424 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3425 ${CXX-g++} -g conftest.C -o conftest -ldl
3426 cp -f conftest1.so conftest _conftest
3427 cd _conftest
3428 if test `./conftest | grep conftest1.so | wc -l` -gt 1
3429 then
3430 echo
3431 echo "*** Your libc has a bug that can result in loading the same dynamic"
3432 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
3433 echo "*** or later. However, if you choose not to upgrade, the only effect"
3434 echo "*** will be excessive memory usage at runtime."
3435 echo
3436 fi
3437 cd ${_curdir}
3438 rm -rf conftest* _conftest
3439 dnl ===================================================================
3440 ;;
3441 esac
3442
3443 dnl ===================================================================
3444 dnl ========================================================
3445 dnl By default, turn rtti and exceptions off on g++/egcs
3446 dnl ========================================================
3447 if test "$GNU_CXX"; then
3448
3449 AC_MSG_CHECKING(for C++ exceptions flag)
3450
3451 dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3452 AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3453 [echo "int main() { return 0; }" | cat > conftest.C
3454
3455 ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3456
3457 if egrep "warning.*renamed" conftest.out >/dev/null; then
3458 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3459 else
3460 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3461 fi
3462
3463 rm -f conftest*])
3464
3465 AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3466 _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3467 _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3468 fi
3469
3470 dnl ========================================================
3471 dnl Put your C++ language/feature checks below
3472 dnl ========================================================
3473 AC_LANG_CPLUSPLUS
3474
3475 HAVE_GCC3_ABI=
3476 if test "$GNU_CC"; then
3477 AC_CACHE_CHECK(for gcc 3.0 ABI,
3478 ac_cv_gcc_three_abi,
3479 [AC_TRY_COMPILE([],
3480 [
3481 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3482 return 0;
3483 #else
3484 #error Not gcc3.
3485 #endif
3486 ],
3487 ac_cv_gcc_three_abi="yes",
3488 ac_cv_gcc_three_abi="no")])
3489 if test "$ac_cv_gcc_three_abi" = "yes"; then
3490 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3491 HAVE_GCC3_ABI=1
3492 else
3493 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3494 fi
3495 fi
3496 AC_SUBST(HAVE_GCC3_ABI)
3497
3498
3499 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3500 ac_cv_cpp_explicit,
3501 [AC_TRY_COMPILE(class X {
3502 public: explicit X(int i) : i_(i) {}
3503 private: int i_;
3504 };,
3505 X x(3);,
3506 ac_cv_cpp_explicit=yes,
3507 ac_cv_cpp_explicit=no)])
3508 if test "$ac_cv_cpp_explicit" = yes ; then
3509 AC_DEFINE(HAVE_CPP_EXPLICIT)
3510 fi
3511
3512 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3513 ac_cv_cpp_typename,
3514 [AC_TRY_COMPILE(class param {
3515 public:
3516 typedef unsigned long num_type;
3517 };
3518
3519 template <class T> class tplt {
3520 public:
3521 typedef typename T::num_type t_num_type;
3522 t_num_type foo(typename T::num_type num) {
3523 return num;
3524 }
3525 };,
3526 tplt<param> A;
3527 A.foo(0);,
3528 ac_cv_cpp_typename=yes,
3529 ac_cv_cpp_typename=no)])
3530 if test "$ac_cv_cpp_typename" = yes ; then
3531 AC_DEFINE(HAVE_CPP_TYPENAME)
3532 fi
3533
3534 dnl Check for support of modern template specialization syntax
3535 dnl Test code and requirement from scc@netscape.com.
3536 dnl Autoconf cut-and-paste job by waterson@netscape.com
3537 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3538 ac_cv_cpp_modern_specialize_template_syntax,
3539 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3540 class Y {};
3541 template <> struct X<Y> { double a; };,
3542 X<int> int_x;
3543 X<Y> y_x;,
3544 ac_cv_cpp_modern_specialize_template_syntax=yes,
3545 ac_cv_cpp_modern_specialize_template_syntax=no)])
3546 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3547 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3548 fi
3549
3550
3551 dnl Some compilers support only full specialization, and some don't.
3552 AC_CACHE_CHECK(whether partial template specialization works,
3553 ac_cv_cpp_partial_specialization,
3554 [AC_TRY_COMPILE(template <class T> class Foo {};
3555 template <class T> class Foo<T*> {};,
3556 return 0;,
3557 ac_cv_cpp_partial_specialization=yes,
3558 ac_cv_cpp_partial_specialization=no)])
3559 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3560 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3561 fi
3562
3563 dnl Some compilers have limited support for operators with templates;
3564 dnl specifically, it is necessary to define derived operators when a base
3565 dnl class's operator declaration should suffice.
3566 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3567 ac_cv_need_derived_template_operators,
3568 [AC_TRY_COMPILE([template <class T> class Base { };
3569 template <class T>
3570 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3571 template <class T> class Derived : public Base<T> { };],
3572 [Derived<char> a, b;
3573 Base<char> c = a + b;
3574 return 0;],
3575 ac_cv_need_derived_template_operators=no,
3576 ac_cv_need_derived_template_operators=yes)])
3577 if test "$ac_cv_need_derived_template_operators" = yes ; then
3578 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3579 fi
3580
3581
3582 dnl Some compilers have trouble detecting that a template class
3583 dnl that derives from another template is actually an instance
3584 dnl of the base class. This test checks for that.
3585 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3586 ac_cv_need_cpp_template_cast_to_base,
3587 [AC_TRY_COMPILE([template <class T> class Base { };
3588 template <class T> class Derived : public Base<T> { };
3589 template <class T> int foo(const Base<T>&) { return 0; }],
3590 [Derived<char> bar; return foo(bar);],
3591 ac_cv_need_cpp_template_cast_to_base=no,
3592 ac_cv_need_cpp_template_cast_to_base=yes)])
3593 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3594 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3595 fi
3596
3597 dnl Some compilers have trouble resolving the ambiguity between two
3598 dnl functions whose arguments differ only by cv-qualifications.
3599 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3600 ac_cv_can_resolve_const_ambiguity,
3601 [AC_TRY_COMPILE([
3602 template <class T> class ptrClass {
3603 public: T* ptr;
3604 };
3605
3606 template <class T> T* a(ptrClass<T> *arg) {
3607 return arg->ptr;
3608 }
3609
3610 template <class T>
3611 const T* a(const ptrClass<T> *arg) {
3612 return arg->ptr;
3613 }
3614 ],
3615 [ ptrClass<int> i;
3616 a(&i); ],
3617 ac_cv_can_resolve_const_ambiguity=yes,
3618 ac_cv_can_resolve_const_ambiguity=no)])
3619 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3620 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3621 fi
3622
3623 dnl
3624 dnl We don't do exceptions on unix. The only reason this used to be here
3625 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
3626 dnl exceptions. But, we turn exceptions off by default and this test breaks.
3627 dnl So im commenting this out until someone writes some artificial
3628 dnl intelligence to detect not only if the compiler has exceptions, but if
3629 dnl they are enabled as well.
3630 dnl
3631 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3632 dnl ac_cv_cpp_exceptions,
3633 dnl [AC_TRY_COMPILE(class X { public: X() {} };
3634 dnl static void F() { throw X(); },
3635 dnl try { F(); } catch(X & e) { },
3636 dnl ac_cv_cpp_exceptions=yes,
3637 dnl ac_cv_cpp_exceptions=no)])
3638 dnl if test $ac_cv_cpp_exceptions = yes ; then
3639 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3640 dnl fi
3641
3642 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3643 dnl supports it well enough to allow us to use it to change access, but not
3644 dnl to resolve ambiguity. The next two tests determine how well the |using|
3645 dnl keyword is supported.
3646 dnl
3647 dnl Check to see if we can change access with |using|. Test both a
3648 dnl legal and an illegal example.
3649 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3650 ac_cv_cpp_access_changing_using2,
3651 [AC_TRY_COMPILE(
3652 class A { protected: int foo() { return 0; } };
3653 class B : public A { public: using A::foo; };,
3654 B b; return b.foo();,
3655 [AC_TRY_COMPILE(
3656 class A { public: int foo() { return 1; } };
3657 class B : public A { private: using A::foo; };,
3658 B b; return b.foo();,
3659 ac_cv_cpp_access_changing_using2=no,
3660 ac_cv_cpp_access_changing_using2=yes)],
3661 ac_cv_cpp_access_changing_using2=no)])
3662 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3663 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3664 fi
3665
3666 dnl Check to see if we can resolve ambiguity with |using|.
3667 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3668 ac_cv_cpp_ambiguity_resolving_using,
3669 [AC_TRY_COMPILE(class X {
3670 public: int go(const X&) {return 3;}
3671 int jo(const X&) {return 3;}
3672 };
3673 class Y : public X {
3674 public: int go(int) {return 2;}
3675 int jo(int) {return 2;}
3676 using X::jo;
3677 private: using X::go;
3678 };,
3679 X x; Y y; y.jo(x);,
3680 ac_cv_cpp_ambiguity_resolving_using=yes,
3681 ac_cv_cpp_ambiguity_resolving_using=no)])
3682 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3683 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3684 fi
3685
3686 dnl Check to see if the |std| namespace is supported. If so, we'll want
3687 dnl to qualify any standard library calls with "std::" to ensure that
3688 dnl those functions can be resolved.
3689 AC_CACHE_CHECK(for \"std::\" namespace,
3690 ac_cv_cpp_namespace_std,
3691 [AC_TRY_COMPILE([#include <algorithm>],
3692 [return std::min(0, 1);],
3693 ac_cv_cpp_namespace_std=yes,
3694 ac_cv_cpp_namespace_std=no)])
3695 if test "$ac_cv_cpp_namespace_std" = yes ; then
3696 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3697 fi
3698
3699 dnl Older compilers are overly ambitious with respect to using the standard
3700 dnl template library's |operator!=()| when |operator==()| is defined. In
3701 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3702 dnl ambiguity at compile-time. This test checks for that case.
3703 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3704 ac_cv_cpp_unambiguous_std_notequal,
3705 [AC_TRY_COMPILE([#include <algorithm>
3706 struct T1 {};
3707 int operator==(const T1&, const T1&) { return 0; }
3708 int operator!=(const T1&, const T1&) { return 0; }],
3709 [T1 a,b; return a != b;],
3710 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3711 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3712 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3713 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3714 fi
3715
3716
3717 AC_CACHE_CHECK(for C++ reinterpret_cast,
3718 ac_cv_cpp_reinterpret_cast,
3719 [AC_TRY_COMPILE(struct X { int i; };
3720 struct Y { int i; };,
3721 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3722 ac_cv_cpp_reinterpret_cast=yes,
3723 ac_cv_cpp_reinterpret_cast=no)])
3724 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3725 AC_DEFINE(HAVE_CPP_NEW_CASTS)
3726 fi
3727
3728 dnl See if a dynamic_cast to void* gives the most derived object.
3729 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3730 ac_cv_cpp_dynamic_cast_void_ptr,
3731 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3732 class Y { int j; public: virtual ~Y() { } };
3733 class Z : public X, public Y { int k; };
3734
3735 int main() {
3736 Z mdo;
3737 X *subx = (X*)&mdo;
3738 Y *suby = (Y*)&mdo;
3739 return !((((void*)&mdo != (void*)subx) &&
3740 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3741 (((void*)&mdo != (void*)suby) &&
3742 ((void*)&mdo == dynamic_cast<void*>(suby))));
3743 }],
3744 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3745 ac_cv_cpp_dynamic_cast_void_ptr=no,
3746 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3747 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3748 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3749 fi
3750
3751
3752 dnl note that this one is reversed - if the test fails, then
3753 dnl we require implementations of unused virtual methods. Which
3754 dnl really blows because it means we'll have useless vtable
3755 dnl bloat.
3756 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3757 ac_cv_cpp_unused_required,
3758 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3759 X x;,
3760 ac_cv_cpp_unused_required=no,
3761 ac_cv_cpp_unused_required=yes)])
3762 if test "$ac_cv_cpp_unused_required" = yes ; then
3763 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3764 fi
3765
3766
3767 dnl Some compilers have trouble comparing a constant reference to a templatized
3768 dnl class to zero, and require an explicit operator==() to be defined that takes
3769 dnl an int. This test separates the strong from the weak.
3770
3771 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3772 ac_cv_trouble_comparing_to_zero,
3773 [AC_TRY_COMPILE([#include <algorithm>
3774 template <class T> class Foo {};
3775 class T2;
3776 template <class T> int operator==(const T2*, const T&) { return 0; }
3777 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3778 [Foo<int> f; return (0 != f);],
3779 ac_cv_trouble_comparing_to_zero=no,
3780 ac_cv_trouble_comparing_to_zero=yes)])
3781 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3782 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3783 fi
3784
3785
3786
3787