acinclude.m4 (GLIBCPP_CHECK_WCHAR_T_SUPPOR): Set LIBS back to initial value.
[gcc.git] / libstdc++-v3 / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl
14 dnl Initialize configure bits.
15 dnl
16 dnl Define OPTLEVEL='-O2' if new inlining code present.
17 dnl
18 dnl GLIBCPP_CONFIGURE
19 AC_DEFUN(GLIBCPP_CONFIGURE, [
20 dnl Default to --enable-multilib
21 AC_ARG_ENABLE(multilib,
22 [ --enable-multilib build hella library versions (default)],
23 [case "${enableval}" in
24 yes) multilib=yes ;;
25 no) multilib=no ;;
26 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
27 esac], [multilib=yes])dnl
28
29 dnl We may get other options which we dont document:
30 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
31 if test "[$]{srcdir}" = "."; then
32 if test "[$]{with_target_subdir}" != "."; then
33 glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
34 else
35 glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
36 fi
37 else
38 glibcpp_basedir="[$]{srcdir}/$1"
39 fi
40 AC_SUBST(glibcpp_basedir)
41
42 AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
43
44 # Never versions of autoconf add an underscore to these functions.
45 # Prevent future problems ...
46 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
47 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
48 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
49 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
50
51 # AC_PROG_CC
52
53 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
54 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
55 # are probably using a cross compiler, which will not be able to fully
56 # link an executable. This should really be fixed in autoconf
57 # itself.
58
59 AC_DEFUN(LIB_AC_PROG_CC,
60 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
61 dnl Fool anybody using AC_PROG_CC.
62 AC_PROVIDE([AC_PROG_CC])
63 AC_CHECK_PROG(CC, gcc, gcc)
64 if test -z "$CC"; then
65 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
66 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
67 fi
68
69 AC_PROG_CC_GNU
70
71 if test $ac_cv_prog_gcc = yes; then
72 GCC=yes
73 dnl Check whether -g works, even if CFLAGS is set, in case the package
74 dnl plays around with CFLAGS (such as to build both debugging and
75 dnl normal versions of a library), tasteless as that idea is.
76 ac_test_CFLAGS="${CFLAGS+set}"
77 ac_save_CFLAGS="$CFLAGS"
78 CFLAGS=
79 AC_PROG_CC_G
80 if test "$ac_test_CFLAGS" = set; then
81 CFLAGS="$ac_save_CFLAGS"
82 elif test $ac_cv_prog_cc_g = yes; then
83 CFLAGS="-g -O2"
84 else
85 CFLAGS="-O2"
86 fi
87 else
88 GCC=
89 test "${CFLAGS+set}" = set || CFLAGS="-g"
90 fi
91 ])
92
93 LIB_AC_PROG_CC
94
95 # Can't just call these here as g++ requires libstc++ to be built....
96 # AC_PROG_CXX
97
98 # Likewise for AC_PROG_CXX.
99 AC_DEFUN(LIB_AC_PROG_CXX,
100 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
101 dnl Fool anybody using AC_PROG_CXX.
102 AC_PROVIDE([AC_PROG_CXX])
103 # Use CXX_libstdcxx so that we do not cause CXX to be cached with the
104 # flags that come in CXX while configuring libstdc++. They're different
105 # from those used for all other target libraries. If CXX is set in
106 # the environment, respect that here.
107 CXX_libstdcxx=$CXX
108 AC_CHECK_PROGS(CXX_libstdcxx, $CCC c++ g++ gcc CC cxx cc++, gcc)
109 CXX=$CXX_libstdcxx
110 AC_SUBST(CXX)
111 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
112
113 AC_PROG_CXX_GNU
114
115 if test $ac_cv_prog_gxx = yes; then
116 GXX=yes
117 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
118 dnl plays around with CXXFLAGS (such as to build both debugging and
119 dnl normal versions of a library), tasteless as that idea is.
120 ac_test_CXXFLAGS="${CXXFLAGS+set}"
121 ac_save_CXXFLAGS="$CXXFLAGS"
122 CXXFLAGS=
123 AC_PROG_CXX_G
124 if test "$ac_test_CXXFLAGS" = set; then
125 CXXFLAGS="$ac_save_CXXFLAGS"
126 elif test $ac_cv_prog_cxx_g = yes; then
127 CXXFLAGS="-g -O2"
128 else
129 CXXFLAGS="-O2"
130 fi
131 else
132 GXX=
133 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
134 fi
135 ])
136
137 LIB_AC_PROG_CXX
138
139 AC_CHECK_TOOL(AS, as)
140 AC_CHECK_TOOL(AR, ar)
141 AC_CHECK_TOOL(RANLIB, ranlib, :)
142
143 AC_PROG_INSTALL
144
145 AM_MAINTAINER_MODE
146
147 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
148 # at least currently, we never actually build a program, so we never
149 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
150 # fails, because we are probably configuring with a cross compiler
151 # which cant create executables. So we include AC_EXEEXT to keep
152 # automake happy, but we dont execute it, since we dont care about
153 # the result.
154 if false; then
155 AC_EXEEXT
156 fi
157
158 # configure.host sets the following important variables
159 # glibcpp_cflags - host specific C compiler flags
160 # glibcpp_cxxflags - host specific C++ compiler flags
161 glibcpp_cflags=
162 glibcpp_cxxflags=
163
164 . [$]{glibcpp_basedir}/configure.host
165
166 case [$]{glibcpp_basedir} in
167 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
168 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
169 esac
170
171 # This does for the target what configure.host does for the host. In
172 # addition to modifying the same flags, it also sets up symlinks.
173 GLIBCPP_CHECK_TARGET
174
175 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
176 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
177 AC_SUBST(GLIBCPP_CFLAGS)
178 AC_SUBST(GLIBCPP_CXXFLAGS)
179 ])
180
181
182 dnl
183 dnl Check to see if g++ can compile this library, and if so, if any version-
184 dnl specific precautions need to be taken.
185 dnl
186 dnl GLIBCPP_CHECK_COMPILER_VERSION
187 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
188 # Sanity check that g++ is capable of dealing with v-3.
189 AC_MSG_CHECKING([for g++ that will successfully compile this code])
190 AC_EGREP_CPP([ok], [
191 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
192 ok
193 #endif
194 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to gcc-2.95 or above]))
195 AC_MSG_RESULT($gpp_satisfactory)
196 ])
197
198
199 dnl
200 dnl Test for newer compiler features, or features that are present in newer
201 dnl compiler version but not older compiler versions should be placed
202 dnl here.
203 dnl
204 dnl Define WFMT_FLAGS='-fdiagnostics-show-location=once' if possible
205 dnl
206 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
207 dnl new inlining code or the new system_header pragma will die on -Werror.
208 dnl Leave it out by default and use maint-mode to use it.
209 dnl
210 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
211 dnl compiler supports it.
212 dnl GLIBCPP_CHECK_COMPILER_FEATURES
213 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
214 # All these tests are for C++; save the language and the compiler flags.
215 # The CXXFLAGS thing is suspicious, but based on similar bits
216 # found in GLIBCPP_CONFIGURE.
217 AC_LANG_SAVE
218 AC_LANG_CPLUSPLUS
219 ac_test_CXXFLAGS="${CXXFLAGS+set}"
220 ac_save_CXXFLAGS="$CXXFLAGS"
221
222 # Check for maintainer-mode bits.
223 if test x"$USE_MAINTAINER_MODE" = xno; then
224 WERROR=''
225 else
226 WERROR='-Werror'
227 fi
228
229 # Check for more sophisticated diagnostic control.
230 AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
231 CXXFLAGS='-Werror -fdiagnostics-show-location=once'
232 AC_TRY_COMPILE(, [int foo;
233 ], [ac_gabydiags=yes], [ac_gabydiags=no])
234 if test "$ac_test_CXXFLAGS" = set; then
235 CXXFLAGS="$ac_save_CXXFLAGS"
236 else
237 # this is the suspicious part
238 CXXFLAGS=''
239 fi
240 if test "$ac_gabydiags" = "yes"; then
241 WFMT_FLAGS='-fdiagnostics-show-location=once'
242 fi
243 AC_MSG_RESULT($ac_gabydiags)
244
245 # Check for -ffunction-sections -fdata-sections
246 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
247 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
248 AC_TRY_COMPILE(, [int foo;
249 ], [ac_fdsections=yes], [ac_fdsections=no])
250 if test "$ac_test_CXXFLAGS" = set; then
251 CXXFLAGS="$ac_save_CXXFLAGS"
252 else
253 # this is the suspicious part
254 CXXFLAGS=''
255 fi
256 if test "$ac_fdsections" = "yes"; then
257 SECTION_FLAGS='-ffunction-sections -fdata-sections'
258 fi
259 AC_MSG_RESULT($ac_fdsections)
260
261 AC_LANG_RESTORE
262 AC_SUBST(WERROR)
263 AC_SUBST(WFMT_FLAGS)
264 AC_SUBST(SECTION_FLAGS)
265 ])
266
267
268 dnl
269 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
270 dnl the native linker is in use, all variables will be defined to something
271 dnl safe (like an empty string).
272 dnl
273 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
274 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
275 dnl
276 dnl GLIBCPP_CHECK_LINKER_FEATURES
277 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
278 # If we're not using GNU ld, then there's no point in even trying these
279 # tests. Check for that first. We should have already tested for gld
280 # by now (in libtool), but require it now just to be safe...
281 SECTION_LDFLAGS=''
282 OPT_LDFLAGS=''
283 AC_REQUIRE([AC_PROG_LD])
284
285 # Set --gc-sections.
286 if test "$ac_cv_prog_gnu_ld" = "broken"; then
287 # GNU ld it is! Joy and bunny rabbits!
288
289 # All these tests are for C++; save the language and the compiler flags.
290 # Need to do this so that g++ won't try to link in libstdc++
291 ac_test_CFLAGS="${CFLAGS+set}"
292 ac_save_CFLAGS="$CFLAGS"
293 CFLAGS='-x c++ -Wl,--gc-sections'
294
295 # Check for -Wl,--gc-sections
296 # XXX This test is broken at the moment, as symbols required for
297 # linking are now in libsupc++ (not built yet.....). In addition,
298 # this test has cored on solaris in the past. In addition,
299 # --gc-sections doesn't really work at the moment (keeps on discarding
300 # used sections, first .eh_frame and now some of the glibc sections for
301 # iconv). Bzzzzt. Thanks for playing, maybe next time.
302 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
303 AC_TRY_RUN([
304 int main(void)
305 {
306 try { throw 1; }
307 catch (...) { };
308 return 0;
309 }
310 ], [ac_sectionLDflags=yes],[ac_sectionLFflags=no], [ac_sectionLDflags=yes])
311 if test "$ac_test_CFLAGS" = set; then
312 CFLAGS="$ac_save_CFLAGS"
313 else
314 # this is the suspicious part
315 CFLAGS=''
316 fi
317 if test "$ac_sectionLDflags" = "yes"; then
318 SECTION_LDFLAGS='-Wl,--gc-sections'
319 fi
320 AC_MSG_RESULT($ac_sectionLDflags)
321 fi
322
323 # Set linker optimization flags.
324 if test "$ac_cv_prog_gnu_ld" = "yes"; then
325 OPT_LDFLAGS='-Wl,-O1'
326 fi
327
328 AC_SUBST(SECTION_LDFLAGS)
329 AC_SUBST(OPT_LDFLAGS)
330 ])
331
332
333 dnl
334 dnl Check to see if the (math function) argument passed is
335 dnl 1) declared when using the c++ compiler
336 dnl 2) has "C" linkage
337 dnl
338 dnl Define HAVE_CARGF etc if "cargf" is declared and links
339 dnl
340 dnl argument 1 is name of function to check
341 dnl
342 dnl ASSUMES argument is a math function with ONE parameter
343 dnl
344 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
345 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
346 AC_MSG_CHECKING([for $1 declaration])
347 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
348 AC_LANG_SAVE
349 AC_LANG_CPLUSPLUS
350 AC_TRY_COMPILE([#include <math.h>],
351 [ $1(0);],
352 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
353 AC_LANG_RESTORE
354 ])
355 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
356 if test x$glibcpp_cv_func_$1_use = x"yes"; then
357 AC_CHECK_FUNCS($1)
358 fi
359 ])
360
361
362 dnl
363 dnl Check to see if the (math function) argument passed is
364 dnl 1) declared when using the c++ compiler
365 dnl 2) has "C" linkage
366 dnl
367 dnl Define HAVE_CARGF etc if "cargf" is declared and links
368 dnl
369 dnl argument 1 is name of function to check
370 dnl
371 dnl ASSUMES argument is a math function with TWO parameters
372 dnl
373 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
374 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
375 AC_MSG_CHECKING([for $1 declaration])
376 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
377 AC_LANG_SAVE
378 AC_LANG_CPLUSPLUS
379 AC_TRY_COMPILE([#include <math.h>],
380 [ $1(0, 0);],
381 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
382 AC_LANG_RESTORE
383 ])
384 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
385 if test x$glibcpp_cv_func_$1_use = x"yes"; then
386 AC_CHECK_FUNCS($1)
387 fi
388 ])
389
390
391 dnl
392 dnl Check to see if the (math function) argument passed is
393 dnl 1) declared when using the c++ compiler
394 dnl 2) has "C" linkage
395 dnl
396 dnl Define HAVE_CARGF etc if "cargf" is declared and links
397 dnl
398 dnl argument 1 is name of function to check
399 dnl
400 dnl ASSUMES argument is a math function with THREE parameters
401 dnl
402 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
403 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
404 AC_MSG_CHECKING([for $1 declaration])
405 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
406 AC_LANG_SAVE
407 AC_LANG_CPLUSPLUS
408 AC_TRY_COMPILE([#include <math.h>],
409 [ $1(0, 0, 0);],
410 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
411 AC_LANG_RESTORE
412 ])
413 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
414 if test x$glibcpp_cv_func_$1_use = x"yes"; then
415 AC_CHECK_FUNCS($1)
416 fi
417 ])
418
419
420 dnl
421 dnl Check to see if the (stdlib function) argument passed is
422 dnl 1) declared when using the c++ compiler
423 dnl 2) has "C" linkage
424 dnl
425 dnl Define HAVE_STRTOLD if "strtold" is declared and links
426 dnl Define HAVE_STRTOF if "strtof" is declared and links
427 dnl
428 dnl argument 1 is name of function to check
429 dnl
430 dnl ASSUMES argument is a math function with TWO parameters
431 dnl
432 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
433 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
434 AC_MSG_CHECKING([for $1 declaration])
435 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
436 AC_LANG_SAVE
437 AC_LANG_CPLUSPLUS
438 AC_TRY_COMPILE([#include <stdlib.h>],
439 [ $1(0, 0);],
440 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
441 AC_LANG_RESTORE
442 ])
443 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
444 if test x$glibcpp_cv_func_$1_use = x"yes"; then
445 AC_CHECK_FUNCS($1)
446 fi
447 ])
448
449
450 dnl
451 dnl Because the builtins are picky picky picky about the arguments they take,
452 dnl do an explict linkage tests here.
453 dnl Check to see if the (math function) argument passed is
454 dnl 1) declared when using the c++ compiler
455 dnl 2) has "C" linkage
456 dnl
457 dnl Define HAVE_CARGF etc if "cargf" is declared and links
458 dnl
459 dnl argument 1 is name of function to check
460 dnl
461 dnl ASSUMES argument is a math function with ONE parameter
462 dnl
463 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
464 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
465 AC_MSG_CHECKING([for $1 declaration])
466 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
467 AC_LANG_SAVE
468 AC_LANG_CPLUSPLUS
469 AC_TRY_COMPILE([#include <math.h>],
470 [ $1(0);],
471 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
472 AC_LANG_RESTORE
473 ])
474 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
475 if test x$glibcpp_cv_func_$1_use = x"yes"; then
476 AC_MSG_CHECKING([for $1 linkage])
477 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
478 AC_TRY_LINK([#include <math.h>],
479 [ $1(0);],
480 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
481 ])
482 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
483 if test x$glibcpp_cv_func_$1_link = x"yes"; then
484 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
485 AC_DEFINE_UNQUOTED(${ac_tr_func})
486 fi
487 fi
488 ])
489
490
491 dnl
492 dnl Check to see what builtin math functions are supported
493 dnl
494 dnl check for __builtin_abs
495 dnl check for __builtin_fabsf
496 dnl check for __builtin_fabs
497 dnl check for __builtin_fabl
498 dnl check for __builtin_labs
499 dnl check for __builtin_sqrtf
500 dnl check for __builtin_sqrtl
501 dnl check for __builtin_fsqrt
502 dnl check for __builtin_sinf
503 dnl check for __builtin_sin
504 dnl check for __builtin_sinl
505 dnl check for __builtin_cosf
506 dnl check for __builtin_cos
507 dnl check for __builtin_cosl
508 dnl
509 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
510 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
511 dnl Test for builtin math functions.
512 dnl These are made in gcc/c-common.c
513 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
514 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
515 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
516 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
517 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
518
519 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
520 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
521 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
522
523 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
524 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
525 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
526
527 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
528 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
529 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
530
531 dnl There is, without a doubt, a more elegant way to have these
532 dnl names exported so that they won't be stripped out of acconfig.h by
533 dnl autoheader. I leave this as an exercise to somebody less frustrated
534 dnl than I.... please email the libstdc++ list if you can figure out a
535 dnl more elegant approach (see autoconf/acgen.m4 and specifically
536 dnl AC_CHECK_FUNC for things to steal.)
537 dummyvar=no
538 if test x$dummyvar = x"yes"; then
539 AC_DEFINE(HAVE___BUILTIN_ABS)
540 AC_DEFINE(HAVE___BUILTIN_LABS)
541 AC_DEFINE(HAVE___BUILTIN_COS)
542 AC_DEFINE(HAVE___BUILTIN_COSF)
543 AC_DEFINE(HAVE___BUILTIN_COSL)
544 AC_DEFINE(HAVE___BUILTIN_FABS)
545 AC_DEFINE(HAVE___BUILTIN_FABSF)
546 AC_DEFINE(HAVE___BUILTIN_FABSL)
547 AC_DEFINE(HAVE___BUILTIN_SIN)
548 AC_DEFINE(HAVE___BUILTIN_SINF)
549 AC_DEFINE(HAVE___BUILTIN_SINL)
550 AC_DEFINE(HAVE___BUILTIN_FSQRT)
551 AC_DEFINE(HAVE___BUILTIN_SQRTF)
552 AC_DEFINE(HAVE___BUILTIN_SQRTL)
553 fi
554 ])
555
556
557 dnl
558 dnl Check to see what the underlying c library
559 dnl These checks need to do two things:
560 dnl 1) make sure the name is declared when using the c++ compiler
561 dnl 2) make sure the name has "C" linkage
562 dnl This might seem like overkill but experience has shown that it's not...
563 dnl
564 dnl Define HAVE_STRTOF etc if "strtof" is found.
565 dnl Define HAVE_STRTOLD etc if "strtold" is found.
566 dnl
567 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
568 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
569 ac_test_CXXFLAGS="${CXXFLAGS+set}"
570 ac_save_CXXFLAGS="$CXXFLAGS"
571 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
572
573 AC_CHECK_FUNCS(strtof)
574 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
575
576 CXXFLAGS="$ac_save_CXXFLAGS"
577 ])
578
579
580 dnl
581 dnl Check to see what the underlying c library or math library is like.
582 dnl These checks need to do two things:
583 dnl 1) make sure the name is declared when using the c++ compiler
584 dnl 2) make sure the name has "C" linkage
585 dnl This might seem like overkill but experience has shown that it's not...
586 dnl
587 dnl Define HAVE_CARGF etc if "cargf" is found.
588 dnl
589 dnl GLIBCPP_CHECK_MATH_SUPPORT
590 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
591 ac_test_CXXFLAGS="${CXXFLAGS+set}"
592 ac_save_CXXFLAGS="$CXXFLAGS"
593 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
594
595 dnl Check libm
596 AC_CHECK_LIB(m, sin, libm="-lm")
597 ac_save_LIBS="$LIBS"
598 LIBS="$LIBS $libm"
599
600 dnl Check to see if certain C math functions exist.
601 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
602 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
603 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
604 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
605 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
606 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
607 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
608
609 dnl Check to see if basic C math functions have float versions.
610 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
611 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
612 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosf)
613 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinf)
614 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanf)
615 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
616 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceilf)
617 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosf)
618 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshf)
619 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
620 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
621 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorf)
622 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
623 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
624 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
625 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
626 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
627 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
628 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
629 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinf)
630 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhf)
631 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
632 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanf)
633 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhf)
634 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
635 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
636
637 dnl Check to see if basic C math functions have long double versions.
638 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
639 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
640 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
641 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosl)
642 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinl)
643 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanl)
644 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
645 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceill)
646 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosl)
647 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshl)
648 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
649 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
650 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorl)
651 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
652 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
653 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
654 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
655 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
656 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
657 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
658 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinl)
659 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhl)
660 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
661 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanl)
662 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhl)
663 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
664 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
665
666 dnl Some runtimes have these functions with a preceding underscore. Please
667 dnl keep this sync'd with the one above. And if you add any new symbol,
668 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
669 dnl Check to see if certain C math functions exist.
670 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinf)
671 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnan)
672 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finite)
673 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysign)
674 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincos)
675 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fpclass)
676 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_qfpclass)
677
678 dnl Check to see if basic C math functions have float versions.
679 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanf)
680 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinff)
681 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosf)
682 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinf)
683 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanf)
684 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2f)
685 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceilf)
686 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosf)
687 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshf)
688 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expf)
689 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsf)
690 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorf)
691 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodf)
692 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpf)
693 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpf)
694 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logf)
695 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10f)
696 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modff)
697 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powf)
698 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinf)
699 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhf)
700 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtf)
701 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanf)
702 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhf)
703 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosf)
704 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitef)
705
706 dnl Check to see if basic C math functions have long double versions.
707 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanl)
708 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinfl)
709 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysignl)
710 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosl)
711 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinl)
712 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanl)
713 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2l)
714 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceill)
715 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosl)
716 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshl)
717 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expl)
718 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsl)
719 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorl)
720 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodl)
721 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpl)
722 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpl)
723 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logl)
724 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10l)
725 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modfl)
726 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powl)
727 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinl)
728 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhl)
729 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtl)
730 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanl)
731 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhl)
732 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosl)
733 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitel)
734
735 LIBS="$ac_save_LIBS"
736 CXXFLAGS="$ac_save_CXXFLAGS"
737 ])
738
739
740 dnl
741 dnl Check to see if there is native support for complex
742 dnl
743 dnl Don't compile bits in math/* if native support exits.
744 dnl
745 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "atan2l/copysignl" is found.
746 dnl
747 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
748 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
749 dnl Check for complex versions of math functions of platform.
750 AC_CHECK_HEADERS([complex.h])
751 AC_CHECK_LIB(m, main)
752 AC_REPLACE_MATHFUNCS(cabs cabsf ccos ccosf ccosh ccoshf cexp cexpf \
753 c_log c_logf clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt \
754 csqrtf ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf \
755 copysignf)
756
757 dnl Compile the long double complex functions only if the function
758 dnl provides the non-complex long double functions that are needed.
759 dnl Currently this includes copysignl and atan2l, which should be
760 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
761 USE_COMPLEX_LONG_DOUBLE=no
762 if test x$ac_cv_func_atan2l = x"yes" \
763 && test x$ac_cv_func_copysignl = x"yes"; then
764 USE_COMPLEX_LONG_DOUBLE=yes
765 AC_REPLACE_MATHFUNCS(cabsl ccoshl ccosl cexpl cpowl csinhl csinl \
766 csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l)
767 fi
768
769 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
770 ])
771
772
773 dnl Check to see what architecture and operating system we are compiling
774 dnl for. Also, if architecture- or OS-specific flags are required for
775 dnl compilation, pick them up here.
776 dnl
777 dnl GLIBCPP_CHECK_TARGET
778 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
779 . [$]{glibcpp_basedir}/configure.target
780 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
781 AC_MSG_RESULT(OS config directory is $os_include_dir)
782 AC_LINK_FILES($os_include_dir/bits/os_defines.h, include/bits/os_defines.h)
783 ])
784
785
786 dnl
787 dnl Check to see what the underlying c library's interface to ctype looks
788 dnl like. Bits of locale rely on things like isspace, toupper, etc. This
789 dnl stuff makes sure the right bits from the clibrary get called.
790 dnl
791 dnl Depending on what is found, select various configure/*/bits/ctype_base.h
792 dnl Depending on what is found, select various configure/*/ctype.cc
793 dnl
794 dnl GLIBCPP_CHECK_CTYPE_SUPPORT
795 AC_DEFUN(GLIBCPP_CHECK_CTYPE_SUPPORT, [
796 AC_CHECK_HEADER(ctype.h, [
797
798 dnl If doesn't match any specified, go with defaults.
799 ctype_default=yes
800
801 dnl Test for <ctype> functionality -- GNU/Linux
802 AC_MSG_CHECKING([<ctype> for GNU/Linux])
803 AC_TRY_COMPILE([#include <ctype.h>],
804 [int
805 foo (int a)
806 { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
807 + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
808 + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
809 ctype_linux=yes, ctype_linux=no)
810 AC_MSG_RESULT($ctype_linux)
811 if test $ctype_linux = "yes"; then
812 ctype_include_dir="config/os/gnu-linux"
813 ctype_default=no
814 fi
815
816 dnl Test for <ctype> functionality -- FreeBSD 4.0
817 if test $ctype_default = "yes"; then
818 AC_MSG_CHECKING([<ctype> for FreeBSD 4.0])
819 AC_TRY_COMPILE([#include <ctype.h>],
820 [int
821 foo (int a)
822 { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
823 + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
824 ctype_bsd=yes, ctype_bsd=no)
825 AC_MSG_RESULT($ctype_bsd)
826 if test $ctype_bsd = "yes"; then
827 ctype_include_dir="config/os/bsd"
828 ctype_default=no
829 fi
830 fi
831
832 dnl Test for <ctype> functionality -- FreeBSD 3.4
833 if test $ctype_default = "yes"; then
834 AC_MSG_CHECKING([<ctype> for FreeBSD 3.4])
835 AC_TRY_COMPILE([#include <ctype.h>],
836 [int
837 foo (int a)
838 { return _S + _R + _C + _U + _L + _A \
839 + _D + _P + _X + _G + __istype (a, 0);}], \
840 ctype_freebsd34=yes, ctype_freebsd34=no)
841 AC_MSG_RESULT($ctype_freebsd34)
842 if test $ctype_freebsd34 = "yes"; then
843 ctype_include_dir="config/os/bsd"
844 ctype_default=no
845 fi
846 fi
847
848 dnl Test for <ctype> functionality -- Solaris 2.6 and up
849 if test $ctype_default = "yes"; then
850 AC_MSG_CHECKING([<ctype> for Solaris 2.6,7,8])
851 AC_TRY_COMPILE([#include <ctype.h>],
852 [int
853 foo (int a)
854 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
855 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
856 + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
857 ctype_solaris=yes, ctype_solaris=no)
858 AC_MSG_RESULT($ctype_solaris)
859
860 if test $ctype_solaris = "yes"; then
861 AC_MSG_CHECKING([ for version])
862 AC_LANG_CPLUSPLUS
863 AC_TRY_COMPILE([#include <ctype.h>],
864 [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
865 ctype_solaris26=yes, ctype_solaris26=no)
866 AC_LANG_C
867 if test $ctype_solaris26 = "yes"; then
868 ctype_include_dir="config/os/solaris/solaris2.6"
869 AC_MSG_RESULT([Solaris 2.6])
870 ctype_default=no
871 else
872 ctype_include_dir="config/os/solaris/solaris2.7"
873 AC_MSG_RESULT([Solaris 7,8])
874 ctype_default=no
875 fi
876 fi
877 fi
878
879 dnl Test for <ctype> functionality -- Solaris 2.5.1
880 if test $ctype_default = "yes"; then
881 AC_MSG_CHECKING([<ctype> for Solaris 2.5.1])
882 AC_TRY_COMPILE([#include <ctype.h>],
883 [int
884 foo (int a)
885 { return _U + _L + _N + _S + _P + _C + _X + _B \
886 + __ctype[a];}], \
887 ctype_solaris25=yes, ctype_solaris25=no)
888 AC_MSG_RESULT($ctype_solaris25)
889 if test $ctype_solaris25 = "yes"; then
890 ctype_include_dir="config/os/solaris/solaris2.5"
891 ctype_default=no
892 fi
893 fi
894
895 dnl Test for <ctype> functionality -- AIX
896 if test $ctype_default = "yes"; then
897 AC_MSG_CHECKING([<ctype> for AIX])
898 AC_TRY_COMPILE([#include <ctype.h>],
899 [int
900 foo (int a)
901 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
902 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
903 + _VALC('a') + _IS('c', 0);}], \
904 ctype_aix=yes, ctype_aix=no)
905 AC_MSG_RESULT($ctype_aix)
906 if test $ctype_aix = "yes"; then
907 ctype_include_dir="config/os/aix"
908 ctype_default=no
909 fi
910 fi
911
912 dnl Test for <ctype> functionality -- IRIX
913 if test $ctype_default = "yes"; then
914 AC_MSG_CHECKING([<ctype> for IRIX])
915 AC_TRY_COMPILE([#include <ctype.h>],
916 [int
917 foo (int a)
918 { return _U + _L + _N + _S + _P + _C + _B + _X + \
919 _A + _PR + _G + _BL;}], \
920 ctype_irix=yes, ctype_irix=no)
921 AC_MSG_RESULT($ctype_irix)
922 if test $ctype_irix = "yes"; then
923 ctype_include_dir="config/os/irix"
924 ctype_default=no
925 fi
926 fi
927
928 dnl Test for <ctype> functionality -- newlib
929 if test $ctype_default = "yes"; then
930 AC_MSG_CHECKING([<ctype> for newlib])
931 AC_TRY_COMPILE([#include <ctype.h>],
932 [int
933 foo (int a)
934 { return _U + _L + _N + _S + _P + _C + _X + _B \
935 + _ctype_[a];}], \
936 ctype_newlib=yes, ctype_newlib=no)
937 AC_MSG_RESULT($ctype_newlib)
938 if test $ctype_newlib = "yes"; then
939 ctype_include_dir="config/newlib"
940 ctype_default=no
941 fi
942 fi
943
944 if test $ctype_default = "yes"; then
945 ctype_include_dir="config/os/generic"
946 AC_MSG_WARN("Using default ctype headers.")
947 fi
948
949 AC_LINK_FILES($ctype_include_dir/bits/ctype_base.h,
950 include/bits/ctype_base.h)
951 AC_LINK_FILES($ctype_include_dir/bits/ctype_inline.h,
952 include/bits/ctype_inline.h)
953 AC_LINK_FILES($ctype_include_dir/bits/ctype_noninline.h, \
954 include/bits/ctype_noninline.h)
955 ])
956 ])
957
958
959 dnl
960 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
961 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
962 dnl must have been previously checked.)
963 dnl
964 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
965 dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
966 dnl
967 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
968 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
969 if test x$enable_c_mbchar != xno; then
970
971 dnl Sanity check for existence of ISO C9X headers for extended encoding.
972 AC_CHECK_HEADER(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
973 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
974
975 dnl Only continue checking if the ISO C9X headers exist.
976 if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes; then
977
978 dnl Test wchar.h for mbstate_t, which is needed for char_traits
979 dnl and others.
980 AC_MSG_CHECKING([for mbstate_t])
981 AC_TRY_COMPILE([#include <wchar.h>],
982 [mbstate_t teststate;],
983 use_native_mbstatet=yes, use_native_mbstatet=no)
984 AC_MSG_RESULT($use_native_mbstatet)
985 if test x"$use_native_mbstatet" = xno; then
986 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
987 fi
988
989 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
990 dnl numeric_limits can instantiate type_traits<wchar_t>
991 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
992 AC_TRY_COMPILE([#include <wchar.h>],
993 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
994 has_wchar_minmax=yes, has_wchar_minmax=no)
995 AC_MSG_RESULT($has_wchar_minmax)
996
997 dnl Test wchar.h for WEOF, which is what we use to determine whether
998 dnl to specialize for char_traits<wchar_t> or not.
999 AC_MSG_CHECKING([for WEOF])
1000 AC_TRY_COMPILE([
1001 #include <wchar.h>
1002 #include <stddef.h>],
1003 [wint_t i = WEOF;],
1004 has_weof=yes, has_weof=no)
1005 AC_MSG_RESULT($has_weof)
1006
1007 dnl Tests for wide character functions used in char_traits<wchar_t>.
1008 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset \
1009 wcsrtombs mbsrtowcs, ac_wfuncs=yes, ac_wfuncs=no)
1010
1011 AC_MSG_CHECKING([for ISO C9X wchar_t support])
1012 if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes \
1013 && test x"$ac_wfuncs" = xyes; then
1014 ac_isoC9X_wchar_t=yes
1015 else
1016 ac_isoC9X_wchar_t=no
1017 fi
1018 AC_MSG_RESULT($ac_isoC9X_wchar_t)
1019
1020 dnl Use iconv for wchar_t to char conversions. As such, check for
1021 dnl X/Open Portability Guide, version 2 features (XPG2).
1022 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
1023 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
1024
1025 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
1026 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
1027 ac_save_LIBS="$LIBS"
1028 LIBS="$LIBS $libiconv"
1029
1030 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
1031 ac_XPG2funcs=yes, ac_XPG2funcs=no)
1032
1033 LIBS="$ac_save_LIBS"
1034
1035 AC_MSG_CHECKING([for XPG2 wchar_t support])
1036 if test x"$ac_has_iconv_h" = xyes && test x"$ac_has_langinfo_h" = xyes \
1037 && test x"$ac_XPG2funcs" = xyes; then
1038 ac_XPG2_wchar_t=yes
1039 else
1040 ac_XPG2_wchar_t=no
1041 fi
1042 AC_MSG_RESULT($ac_XPG2_wchar_t)
1043
1044 dnl At the moment, only enable wchar_t specializations if all the
1045 dnl above support is present.
1046 AC_MSG_CHECKING([for enabled wchar_t specializations])
1047 if test x"$ac_isoC9X_wchar_t" = xyes \
1048 && test x"$ac_XPG2_wchar_t" = xyes; then
1049 libinst_wstring_la="libinst-wstring.la"
1050 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
1051 AC_MSG_RESULT("yes")
1052 else
1053 libinst_wstring_la=""
1054 AC_MSG_RESULT("no")
1055 fi
1056 AC_SUBST(libinst_wstring_la)
1057
1058 else
1059 AC_MSG_WARN([<wchar.h> not found])
1060 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
1061 fi
1062
1063 else
1064 dnl Wide characters disabled by the user. Maybe print a warning?
1065 :
1066 fi
1067 ])
1068
1069
1070 dnl
1071 dnl Check to see if this version of GNU C++ is afflicted by bugs in
1072 dnl __complex__ float support.
1073 dnl
1074 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
1075 dnl
1076 dnl Check to see if this version of GNU C++ is afflicted by bugs in
1077 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
1078 dnl gcc-2.95.x when using the library, unless we define the default copy
1079 dnl ctor in the specializations of complex<>.
1080 dnl
1081 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
1082 dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
1083 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
1084 AC_REQUIRE([AC_PROG_CXX])
1085
1086 AC_MSG_CHECKING([for GNU C++ __complex__ support])
1087 AC_CACHE_VAL(glibcpp_cv_complex, [
1088 AC_LANG_SAVE
1089 AC_LANG_CPLUSPLUS
1090 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
1091 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
1092 [ dcomplex x; f(x); ],
1093 glibcpp_cv_complex=ok,
1094 glibcpp_cv_complex=buggy
1095 )
1096 AC_LANG_RESTORE
1097 ])
1098 AC_MSG_RESULT($glibcpp_cv_complex)
1099 if test $glibcpp_cv_complex = buggy; then
1100 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
1101 fi
1102
1103 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
1104 AC_CACHE_VAL(glibcpp_cv_float_complex, [
1105 AC_LANG_SAVE
1106 AC_LANG_CPLUSPLUS
1107 rm -f conftest.h
1108 cat > conftest.h <<EOB
1109 //
1110 // Check for buggy __complex__ that causes ICE in most versions of egcs
1111 // and gcc-2.95.x on certain platforms (eg., x86-win32).
1112 //
1113 // See http://gcc.gnu.org/ml/gcc-bugs/1999-07n/msg00845.html for
1114 // more info on the bug itself.
1115 //
1116 struct
1117 float_complex
1118 {
1119 __complex__ float m_value;
1120 float_complex (float = 0.0f, float = 0.0f);
1121 float_complex (__complex__ float val) : m_value (val) {}
1122 float_complex foo (const float_complex &val)
1123 { return float_complex (~val.m_value); }
1124 };
1125 EOB
1126 AC_TRY_COMPILE([#include "conftest.h"], ,
1127 glibcpp_cv_float_complex=ok,
1128 glibcpp_cv_float_complex=buggy
1129 )
1130 AC_LANG_RESTORE
1131 ])
1132 AC_MSG_RESULT($glibcpp_cv_float_complex)
1133 if test $glibcpp_cv_float_complex = buggy; then
1134 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
1135 fi
1136 ])
1137
1138
1139 dnl
1140 dnl Check for special debugging mode; not for production use.
1141 dnl
1142 dnl GLIBCPP_ENABLE_DEBUG
1143 dnl --enable-debug sets '-ggdb3 -O0'.
1144 dnl --disable-debug sets '-g' and whatever optimization options the
1145 dnl compiler can handle.
1146 dnl + --enable-maintainer-mode automatically defaults this to on.
1147 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1148 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1149 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1150 dnl defaults to `no'.
1151 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1152 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1153 AC_ARG_ENABLE(debug,
1154 changequote(<<, >>)dnl
1155 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1156 changequote([, ])dnl
1157 [case "${enableval}" in
1158 yes) enable_debug=yes ;;
1159 no) enable_debug=no ;;
1160 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1161 esac],
1162 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1163
1164 dnl Option parsed, now set things appropriately
1165 case "${enable_debug}" in
1166 yes)
1167 DEBUG_FLAGS='-O0 -ggdb3'
1168 ;;
1169 no)
1170 DEBUG_FLAGS='-g'
1171 ;;
1172 esac
1173 AC_SUBST(DEBUG_FLAGS)
1174 ])
1175
1176
1177 dnl
1178 dnl Check for "unusual" flags to pass to the compiler while building.
1179 dnl
1180 dnl GLIBCPP_ENABLE_CXX_FLAGS
1181 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1182 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1183 dnl Somehow this same set of flags must be passed when [re]building
1184 dnl libgcc.
1185 dnl --disable-cxx-flags passes nothing.
1186 dnl + See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
1187 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
1188 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
1189 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1190 dnl If "default flags" is an empty string (or "none"), the effect is
1191 dnl the same as --disable or --enable=no.
1192 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1193 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1194 AC_ARG_ENABLE(cxx-flags,
1195 changequote(<<, >>)dnl
1196 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1197 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1198 changequote([, ])dnl
1199 [case "x$enableval" in
1200 xyes)
1201 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1202 xno|x)
1203 enable_cxx_flags='' ;;
1204 *)
1205 enable_cxx_flags="$enableval" ;;
1206 esac],
1207 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1208
1209 dnl Thinko on my part during design. This kludge is the workaround.
1210 if test "$enable_cxx_flags" = "none"; then
1211 enable_cxx_flags='';
1212 fi
1213
1214 dnl Run through flags (either default or command-line) and set anything
1215 dnl extra (e.g., #defines) that must accompany particular g++ options.
1216 if test -n "$enable_cxx_flags"; then
1217 for f in $enable_cxx_flags; do
1218 case "$f" in
1219 -fhonor-std) ;;
1220 -*) ;;
1221 *) # and we're trying to pass /what/ exactly?
1222 AC_MSG_ERROR([compiler flags start with a -]) ;;
1223 esac
1224 done
1225 fi
1226 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1227 AC_SUBST(EXTRA_CXX_FLAGS)
1228 ])
1229
1230
1231 dnl
1232 dnl Check for which I/O library to use: libio, or something specific.
1233 dnl
1234 dnl GLIBCPP_ENABLE_CSTDIO
1235 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1236 dnl
1237 dnl default is libio
1238 dnl
1239 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1240 AC_MSG_CHECKING([for cstdio to use])
1241 AC_ARG_ENABLE(cstdio,
1242 [ --enable-cstdio enable GNU libio for target io package. (default)
1243 --enable-cstdio=LIB use LIB target-speific io package.],
1244 if test x$enable_cstdio = xno; then
1245 enable_cstdio=libio
1246 fi,
1247 enable_cstdio=libio)
1248
1249 enable_cstdio_flag=$enable_cstdio
1250
1251 dnl Check if a valid I/O package
1252 case x${enable_cstdio_flag} in
1253 xlibio | x | xno | xnone | xyes)
1254 # default
1255 CSTDIO_H=config/c_io_libio.h
1256 CSTDIO_CC=config/c_io_libio.cc
1257 AC_MSG_RESULT(libio)
1258
1259 # see if we are on a system with libio native (ie, linux)
1260 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1261
1262 # Need to check and see what version of glibc is being used. If
1263 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1264 # compile most of libio for linux systems.
1265 if test x$has_libio = x"yes"; then
1266 case "$target" in
1267 *-*-linux*)
1268 AC_MSG_CHECKING([for glibc version >= 2.2])
1269 AC_EGREP_CPP([ok], [
1270 #include <features.h>
1271 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1272 ok
1273 #endif
1274 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1275 AC_MSG_RESULT($glibc_satisfactory)
1276 ;;
1277 esac
1278
1279 # XXX at the moment, admit defeat and force the recompilation
1280 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1281 glibc_satisfactory=no
1282
1283 if test x$glibc_satisfactory = x"yes"; then
1284 need_libio=no
1285 need_wlibio=no
1286 else
1287 need_libio=yes
1288 # bkoz XXX need to add checks to enable this
1289 # pme XXX here's a first pass at such a check
1290 if test x$enable_c_mbchar != xno; then
1291 need_wlibio=yes
1292 else
1293 need_wlibio=no
1294 fi
1295 fi
1296
1297 else
1298 # Using libio, but <libio.h> doesn't exist on the target system. . .
1299 need_libio=yes
1300 # bkoz XXX need to add checks to enable this
1301 # pme XXX here's a first pass at such a check
1302 if test x$enable_c_mbchar != xno; then
1303 need_wlibio=yes
1304 else
1305 need_wlibio=no
1306 fi
1307 fi
1308 ;;
1309 xstdio)
1310 CSTDIO_H=config/c_io_stdio.h
1311 CSTDIO_CC=config/c_io_stdio.cc
1312 AC_MSG_RESULT(stdio)
1313
1314 need_libio=no
1315 ;;
1316 *)
1317 echo "$enable_cstdio is an unknown io package" 1>&2
1318 exit 1
1319 ;;
1320 esac
1321 AC_LINK_FILES($CSTDIO_H, include/bits/c++io.h)
1322 AC_LINK_FILES($CSTDIO_CC, src/c++io.cc)
1323
1324 # 2000-08-04 bkoz hack
1325 CCODECVT_C=config/c_io_libio_codecvt.c
1326 AC_LINK_FILES($CCODECVT_C, libio/c_codecvt.c)
1327 # 2000-08-04 bkoz hack
1328
1329 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1330 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1331 ])
1332
1333
1334 dnl
1335 dnl Check for which threading library to use.
1336 dnl
1337 dnl GLIBCPP_ENABLE_THREADS
1338 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1339 dnl
1340 dnl Default is no threads, which also disables _IO_MTSAFE_IO in
1341 dnl libio. Any actual thread package will enable it.
1342 dnl
1343 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1344 dnl Note this comes from the gcc/config.in and libjava/config.in
1345 dnl Efforts should be made to keep this in sync.
1346 AC_MSG_CHECKING([for threads package to use])
1347 AC_ARG_ENABLE(threads,
1348 [ --enable-threads enable thread usage for target GCC.
1349 --enable-threads=LIB use LIB thread package for target GCC.],
1350 if test x$enable_threads = xno; then
1351 enable_threads=''
1352 fi,
1353 enable_threads='')
1354
1355 enable_threads_flag=$enable_threads
1356
1357 dnl Check if a valid thread package
1358 case x${enable_threads_flag} in
1359 x | xno | xnone)
1360 # No threads
1361 target_thread_file='single'
1362 ;;
1363 xyes)
1364 # default
1365 target_thread_file='posix'
1366 ;;
1367 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1368 xsolaris | xwin32 | xdce | xvxworks)
1369 target_thread_file=$enable_threads_flag
1370 ;;
1371 *)
1372 echo "$enable_threads is an unknown thread package" 1>&2
1373 exit 1
1374 ;;
1375 esac
1376
1377 dnl Check for thread package actually supported in libstdc++
1378 THREADH=
1379 case "$target_thread_file" in
1380 no | none | single)
1381 THREADH=threads-no.h
1382 ;;
1383 posix | pthreads)
1384 THREADH=threads-posix.h
1385 ;;
1386 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1387 AC_MSG_ERROR(thread package $THREADS not yet supported)
1388 ;;
1389 *)
1390 AC_MSG_ERROR($THREADS is an unsupported/unknown thread package)
1391 ;;
1392 esac
1393 AC_MSG_RESULT($THREADH)
1394
1395 AC_LINK_FILES(config/$THREADH, include/bits/c++threads.h)
1396 if test $THREADH != threads-no.h; then
1397 AC_DEFINE(_GLIBCPP_USE_THREADS)
1398 fi
1399 ])
1400
1401
1402 dnl Enable atomic locking
1403 dnl GLIBCPP_ENABLE_ATOMICITY
1404 AC_DEFUN(GLIBCPP_ENABLE_ATOMICITY, [
1405 AC_MSG_CHECKING([for atomicity.h])
1406 case "$target" in
1407 *-*-linux* | sparc*-*-* | *-*-freebsd*)
1408 ATOMICITYH=$cpu_include_dir
1409 ;;
1410 *-*-aix* | *-*-irix*)
1411 ATOMICITYH=$os_include_dir
1412 ;;
1413 *)
1414 # bit of overkill on this text...
1415 AC_MSG_ERROR([Atomic locking requested, but $enable_threads is an unknown thread package and atomic operations are not present in the CPU])
1416 ;;
1417 esac
1418 AC_MSG_RESULT($ATOMICITYH/bits/atomicity.h)
1419 AC_LINK_FILES($ATOMICITYH/bits/atomicity.h, include/bits/atomicity.h)
1420 ])
1421
1422
1423 dnl
1424 dnl Check for template specializations for the 'long long' type extension.
1425 dnl
1426 dnl GLIBCPP_ENABLE_LONG_LONG
1427 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1428 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1429 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1430 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1431 dnl defaults to `no'.
1432 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1433 dnl
1434 dnl GLIBCPP_ENABLE_LONG_LONG
1435 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1436 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1437
1438 AC_ARG_ENABLE(long-long,
1439 changequote(<<, >>)dnl
1440 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1441 changequote([, ])dnl
1442 [case "$enableval" in
1443 yes) enable_long_long=yes ;;
1444 no) enable_long_long=no ;;
1445 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1446 esac],
1447 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1448
1449 # Check for the existance of functions used if long long is enabled.
1450 AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1451 AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1452
1453 AC_MSG_CHECKING([for enabled long long])
1454 if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then
1455 enable_long_long=no;
1456 fi;
1457 AC_MSG_RESULT($enable_long_long)
1458
1459 dnl Option parsed, now set things appropriately
1460 if test x"$enable_long_long" = xyes; then
1461 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1462 fi
1463 ])
1464
1465
1466 dnl
1467 dnl Check for whether or not to do shadowed C headers.
1468 dnl
1469 dnl GLIBCPP_ENABLE_SHADOW
1470 dnl --enable-cshadow-headers [does stuff].
1471 dnl --disable-cshadow-headers [does not do stuff].
1472 dnl + This will eventually need to be on by default.
1473 dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1474 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1475 dnl defaults to `no'.
1476 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1477 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
1478 AC_MSG_CHECKING([for enabled cshadow headers])
1479 AC_ARG_ENABLE(cshadow-headers,
1480 changequote(<<, >>)dnl
1481 << --enable-cshadow-headers construct "shadowed" C header files for
1482 g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
1483 changequote([, ])
1484 [case "$enableval" in
1485 yes) enable_cshadow_headers=yes
1486 ;;
1487 no) enable_cshadow_headers=no
1488 ;;
1489 *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers])
1490 ;;
1491 esac],
1492 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)
1493 AC_MSG_RESULT($enable_cshadow_headers)
1494
1495 dnl Option parsed, now set things appropriately
1496 dnl NB: these things may be duplicated in c++config.h as well.
1497 case "$enable_cshadow_headers" in
1498 yes)
1499 CSHADOW_FLAGS="-fno-builtin"
1500 C_INCLUDE_DIR='${top_srcdir}/include/c_std'
1501 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1502 ;;
1503 no)
1504 CSHADOW_FLAGS=""
1505 C_INCLUDE_DIR='${top_srcdir}/include/c'
1506 ;;
1507 esac
1508
1509 AC_SUBST(CSHADOW_FLAGS)
1510 AC_SUBST(C_INCLUDE_DIR)
1511 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
1512 ])
1513
1514
1515 dnl
1516 dnl Check for wide character support. Has the same effect as the option
1517 dnl in gcc's configure, but in a form that autoconf can mess with.
1518 dnl
1519 dnl GLIBCPP_ENABLE_C_MBCHAR
1520 dnl --enable-c-mbchar requests all the wchar_t stuff.
1521 dnl --disable-c-mbchar doesn't.
1522 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1523 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1524 dnl defaults to `no'.
1525 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1526 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1527 AC_ARG_ENABLE(c-mbchar,
1528 changequote(<<, >>)dnl
1529 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1530 changequote([, ])dnl
1531 [case "$enableval" in
1532 yes) enable_c_mbchar=yes ;;
1533 no) enable_c_mbchar=no ;;
1534 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1535 esac],
1536 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1537 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1538 ])
1539
1540
1541 dnl
1542 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1543 dnl
1544 dnl GLIBCPP_INCLUDE_DIR
1545 dnl C_INCLUDE_DIR
1546 dnl TOPLEVEL_INCLUDES
1547 dnl LIBMATH_INCLUDES
1548 dnl LIBSUPCXX_INCLUDES
1549 dnl LIBIO_INCLUDES
1550 dnl CSHADOW_INCLUDES
1551 dnl
1552 dnl GLIBCPP_EXPORT_INCLUDE
1553 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1554 # Root level of the include sources.
1555 GLIBCPP_INCLUDE_DIR='$(top_srcdir)/include'
1556
1557 # Can either use include/c or include/c_std to grab "C" headers. This
1558 # variable is set to the include directory currently in use.
1559 # set with C_INCLUDE_DIR in GLIBCPP_ENABLE_SHADOW
1560
1561 # Passed down for canadian crosses.
1562 if test x"$CANADIAN" = xyes; then
1563 TOPLEVEL_INCLUDES='-I$(includedir)'
1564 fi
1565
1566 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1567
1568 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1569
1570 #if GLIBCPP_NEED_LIBIO
1571 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1572 #else
1573 #LIBIO_INCLUDES='-I$(top_srcdir)/libio'
1574 #endif
1575
1576 #if GLIBCPP_USE_CSHADOW
1577 # CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR) \
1578 # -I$(top_blddir)/cshadow'
1579 #else
1580 CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR)'
1581 #endif
1582
1583 # Now, export this to all the little Makefiles....
1584 AC_SUBST(GLIBCPP_INCLUDE_DIR)
1585 AC_SUBST(TOPLEVEL_INCLUDES)
1586 AC_SUBST(LIBMATH_INCLUDES)
1587 AC_SUBST(LIBSUPCXX_INCLUDES)
1588 AC_SUBST(LIBIO_INCLUDES)
1589 AC_SUBST(CSHADOW_INCLUDES)
1590 ])
1591
1592
1593 dnl
1594 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1595 dnl
1596 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1597 # Optimization flags that are probably a good idea for thrill-seekers. Just
1598 # uncomment the lines below and make, everything else is ready to go...
1599 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1600 OPTIMIZE_CXXFLAGS=
1601 AC_SUBST(OPTIMIZE_CXXFLAGS)
1602
1603 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1604 AC_SUBST(WARN_FLAGS)
1605 ])
1606
1607
1608 # Check whether LC_MESSAGES is available in <locale.h>.
1609 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1610 #
1611 # This file file be copied and used freely without restrictions. It can
1612 # be used in projects which are not available under the GNU Public License
1613 # but which still want to provide support for the GNU gettext functionality.
1614 # Please note that the actual code is *not* freely available.
1615
1616 # serial 1
1617
1618 AC_DEFUN(AC_LC_MESSAGES,
1619 [if test $ac_cv_header_locale_h = yes; then
1620 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1621 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1622 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1623 if test $ac_cv_val_LC_MESSAGES = yes; then
1624 AC_DEFINE(HAVE_LC_MESSAGES)
1625 fi
1626 fi])
1627
1628
1629 # Check for functions in math library.
1630 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1631 #
1632 # This file can be copied and used freely without restrictions. It can
1633 # be used in projects which are not available under the GNU Public License
1634 # but which still want to provide support for the GNU gettext functionality.
1635 # Please note that the actual code is *not* freely available.
1636
1637 # serial 1
1638
1639 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1640 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1641 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1642 AC_SUBST(LIBMATHOBJS)dnl
1643 ])
1644
1645
1646 # Check for string functions.
1647 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1648 #
1649 # This file can be copied and used freely without restrictions. It can
1650 # be used in projects which are not available under the GNU Public License
1651 # but which still want to provide support for the GNU gettext functionality.
1652 # Please note that the actual code is *not* freely available.
1653
1654 # serial 1
1655
1656 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1657 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1658 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1659 AC_SUBST(LIBSTRINGOBJS)dnl
1660 ])
1661
1662
1663 dnl This macro searches for a GNU version of make. If a match is found, the
1664 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1665 dnl set to "#". This is useful for including a special features in a Makefile,
1666 dnl which cannot be handled by other versions of make. The variable
1667 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1668 dnl the empty string otherwise.
1669 dnl
1670 dnl Here is an example of its use:
1671 dnl
1672 dnl Makefile.in might contain:
1673 dnl
1674 dnl # A failsafe way of putting a dependency rule into a makefile
1675 dnl $(DEPEND):
1676 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1677 dnl
1678 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1679 dnl @ifGNUmake@ include $(DEPEND)
1680 dnl @ifGNUmake@ endif
1681 dnl
1682 dnl Then configure.in would normally contain:
1683 dnl
1684 dnl CHECK_GNU_MAKE()
1685 dnl AC_OUTPUT(Makefile)
1686 dnl
1687 dnl Then perhaps to cause gnu make to override any other make, we could do
1688 dnl something like this (note that GNU make always looks for GNUmakefile first):
1689 dnl
1690 dnl if ! test x$_cv_gnu_make_command = x ; then
1691 dnl mv Makefile GNUmakefile
1692 dnl echo .DEFAULT: > Makefile ;
1693 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1694 dnl fi
1695 dnl
1696 dnl Then, if any (well almost any) other make is called, and GNU make also
1697 dnl exists, then the other make wraps the GNU make.
1698 dnl
1699 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1700 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1701 dnl
1702 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1703 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1704 dnl #### conditional's subshell (" --version" is not a command), using a
1705 dnl #### different option to grep(1).
1706 dnl #### -pme
1707 AC_DEFUN(
1708 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1709 _cv_gnu_make_command='' ;
1710 dnl Search all the common names for GNU make
1711 for a in "${MAKE:-make}" make gmake gnumake ; do
1712 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1713 then
1714 _cv_gnu_make_command=$a ;
1715 break;
1716 fi
1717 done ;
1718 ) ;
1719 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1720 dnl string, '#' otherwise
1721 if test "x$_cv_gnu_make_command" != "x" ; then
1722 ifGNUmake='' ;
1723 else
1724 ifGNUmake='#' ;
1725 fi
1726 AC_SUBST(ifGNUmake)
1727 ])
1728
1729 sinclude(../libtool.m4)
1730 dnl The lines below arrange for aclocal not to bring an installed
1731 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1732 dnl add a definition of LIBTOOL to Makefile.in.
1733 ifelse(,,,[AC_SUBST(LIBTOOL)
1734 AC_DEFUN([AM_PROG_LIBTOOL])
1735 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1736 AC_DEFUN([AC_PROG_LD])
1737 ])
1738
1739
1740 # Do all the work for Automake. This macro actually does too much --
1741 # some checks are only needed if your package does certain things.
1742 # But this isn't really a big deal.
1743
1744 # serial 1
1745
1746 dnl Usage:
1747 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1748
1749 AC_DEFUN(AM_INIT_AUTOMAKE,
1750 [AC_REQUIRE([AC_PROG_INSTALL])
1751 PACKAGE=[$1]
1752 AC_SUBST(PACKAGE)
1753 VERSION=[$2]
1754 AC_SUBST(VERSION)
1755 dnl test to see if srcdir already configured
1756 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
1757 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1758 fi
1759 ifelse([$3],,
1760 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1761 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
1762 AC_REQUIRE([AM_SANITY_CHECK])
1763 AC_REQUIRE([AC_ARG_PROGRAM])
1764 dnl FIXME This is truly gross.
1765 missing_dir=`cd $ac_aux_dir && pwd`
1766 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
1767 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1768 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
1769 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1770 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
1771 AC_REQUIRE([AC_PROG_MAKE_SET])])
1772
1773 #
1774 # Check to make sure that the build environment is sane.
1775 #
1776
1777 AC_DEFUN(AM_SANITY_CHECK,
1778 [AC_MSG_CHECKING([whether build environment is sane])
1779 # Just in case
1780 sleep 1
1781 echo timestamp > conftestfile
1782 # Do `set' in a subshell so we don't clobber the current shell's
1783 # arguments. Must try -L first in case configure is actually a
1784 # symlink; some systems play weird games with the mod time of symlinks
1785 # (eg FreeBSD returns the mod time of the symlink's containing
1786 # directory).
1787 if (
1788 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1789 if test "[$]*" = "X"; then
1790 # -L didn't work.
1791 set X `ls -t $srcdir/configure conftestfile`
1792 fi
1793 if test "[$]*" != "X $srcdir/configure conftestfile" \
1794 && test "[$]*" != "X conftestfile $srcdir/configure"; then
1795
1796 # If neither matched, then we have a broken ls. This can happen
1797 # if, for instance, CONFIG_SHELL is bash and it inherits a
1798 # broken ls alias from the environment. This has actually
1799 # happened. Such a system could not be considered "sane".
1800 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
1801 alias in your environment])
1802 fi
1803
1804 test "[$]2" = conftestfile
1805 )
1806 then
1807 # Ok.
1808 :
1809 else
1810 AC_MSG_ERROR([newly created file is older than distributed files!
1811 Check your system clock])
1812 fi
1813 rm -f conftest*
1814 AC_MSG_RESULT(yes)])
1815
1816 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1817 dnl The program must properly implement --version.
1818 AC_DEFUN(AM_MISSING_PROG,
1819 [AC_MSG_CHECKING(for working $2)
1820 # Run test in a subshell; some versions of sh will print an error if
1821 # an executable is not found, even if stderr is redirected.
1822 # Redirect stdin to placate older versions of autoconf. Sigh.
1823 if ($2 --version) < /dev/null > /dev/null 2>&1; then
1824 $1=$2
1825 AC_MSG_RESULT(found)
1826 else
1827 $1="$3/missing $2"
1828 AC_MSG_RESULT(missing)
1829 fi
1830 AC_SUBST($1)])
1831
1832 # Add --enable-maintainer-mode option to configure.
1833 # From Jim Meyering
1834
1835 # serial 1
1836
1837 AC_DEFUN(AM_MAINTAINER_MODE,
1838 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1839 dnl maintainer-mode is disabled by default
1840 AC_ARG_ENABLE(maintainer-mode,
1841 [ --enable-maintainer-mode enable make rules and dependencies not useful
1842 (and sometimes confusing) to the casual installer],
1843 USE_MAINTAINER_MODE=$enableval,
1844 USE_MAINTAINER_MODE=no)
1845 AC_MSG_RESULT($USE_MAINTAINER_MODE)
1846 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1847 MAINT=$MAINTAINER_MODE_TRUE
1848 AC_SUBST(MAINT)dnl
1849 ]
1850 )
1851
1852 # Define a conditional.
1853
1854 AC_DEFUN(AM_CONDITIONAL,
1855 [AC_SUBST($1_TRUE)
1856 AC_SUBST($1_FALSE)
1857 if $2; then
1858 $1_TRUE=
1859 $1_FALSE='#'
1860 else
1861 $1_TRUE='#'
1862 $1_FALSE=
1863 fi])
1864
1865 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1866
1867 AC_DEFUN(AM_CONFIG_HEADER,
1868 [AC_PREREQ([2.12])
1869 AC_CONFIG_HEADER([$1])
1870 dnl When config.status generates a header, we must update the stamp-h file.
1871 dnl This file resides in the same directory as the config header
1872 dnl that is generated. We must strip everything past the first ":",
1873 dnl and everything past the last "/".
1874 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1875 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1876 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1877 <<am_indx=1
1878 for am_file in <<$1>>; do
1879 case " <<$>>CONFIG_HEADERS " in
1880 *" <<$>>am_file "*<<)>>
1881 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1882 ;;
1883 esac
1884 am_indx=`expr "<<$>>am_indx" + 1`
1885 done<<>>dnl>>)
1886 changequote([,]))])
1887