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