]> gcc.gnu.org Git - gcc.git/blob - libstdc++-v3/aclocal.m4
acinclude.m4 (GLIBCPP_ENABLE_ATOMICITY): Move switch statement contents to...
[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)
1254 CSTDIO_H=config/c_io_libio.h
1255 CSTDIO_CC=config/c_io_libio.cc
1256 AC_MSG_RESULT(libio)
1257
1258 # see if we are on a system with libio native (ie, linux)
1259 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1260
1261 # Need to check and see what version of glibc is being used. If
1262 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1263 # compile most of libio for linux systems.
1264 if test x$has_libio = x"yes"; then
1265 case "$target" in
1266 *-*-linux*)
1267 AC_MSG_CHECKING([for glibc version >= 2.2])
1268 AC_EGREP_CPP([ok], [
1269 #include <features.h>
1270 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1271 ok
1272 #endif
1273 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1274 AC_MSG_RESULT($glibc_satisfactory)
1275 ;;
1276 esac
1277
1278 # XXX at the moment, admit defeat and force the recompilation
1279 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1280 glibc_satisfactory=no
1281
1282 if test x$glibc_satisfactory = x"yes"; then
1283 need_libio=no
1284 need_wlibio=no
1285 else
1286 need_libio=yes
1287 # bkoz XXX need to add checks to enable this
1288 # pme XXX here's a first pass at such a check
1289 if test x$enable_c_mbchar != xno; then
1290 need_wlibio=yes
1291 else
1292 need_wlibio=no
1293 fi
1294 fi
1295
1296 else
1297 # Using libio, but <libio.h> doesn't exist on the target system. . .
1298 need_libio=yes
1299 # bkoz XXX need to add checks to enable this
1300 # pme XXX here's a first pass at such a check
1301 if test x$enable_c_mbchar != xno; then
1302 need_wlibio=yes
1303 else
1304 need_wlibio=no
1305 fi
1306 fi
1307 ;;
1308 xstdio | x | xno | xnone | xyes)
1309 # default
1310 CSTDIO_H=config/c_io_stdio.h
1311 CSTDIO_CC=config/c_io_stdio.cc
1312 AC_MSG_RESULT(stdio)
1313
1314 # We're not using stdio.
1315 need_libio=no
1316 need_wlibio=no
1317 # Wide characters are not supported with this package.
1318 enable_c_mbchar=no
1319 ;;
1320 *)
1321 echo "$enable_cstdio is an unknown io package" 1>&2
1322 exit 1
1323 ;;
1324 esac
1325 AC_LINK_FILES($CSTDIO_H, include/bits/c++io.h)
1326 AC_LINK_FILES($CSTDIO_CC, src/c++io.cc)
1327
1328 # 2000-08-04 bkoz hack
1329 CCODECVT_C=config/c_io_libio_codecvt.c
1330 AC_LINK_FILES($CCODECVT_C, libio/c_codecvt.c)
1331 # 2000-08-04 bkoz hack
1332
1333 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1334 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1335 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1336 libio_la=../libio/libio.la
1337 else
1338 libio_la=
1339 fi
1340 AC_SUBST(libio_la)
1341 ])
1342
1343
1344 dnl
1345 dnl Check for which threading library to use.
1346 dnl
1347 dnl GLIBCPP_ENABLE_THREADS
1348 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1349 dnl
1350 dnl Default is no threads, which also disables _IO_MTSAFE_IO in
1351 dnl libio. Any actual thread package will enable it.
1352 dnl
1353 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1354 dnl Note this comes from the gcc/config.in and libjava/config.in
1355 dnl Efforts should be made to keep this in sync.
1356 AC_MSG_CHECKING([for threads package to use])
1357 AC_ARG_ENABLE(threads,
1358 [ --enable-threads enable thread usage for target GCC.
1359 --enable-threads=LIB use LIB thread package for target GCC.],
1360 if test x$enable_threads = xno; then
1361 enable_threads=''
1362 fi,
1363 enable_threads='')
1364
1365 enable_threads_flag=$enable_threads
1366
1367 dnl Check if a valid thread package
1368 case x${enable_threads_flag} in
1369 x | xno | xnone)
1370 # No threads
1371 target_thread_file='single'
1372 ;;
1373 xyes)
1374 # default
1375 target_thread_file='posix'
1376 ;;
1377 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1378 xsolaris | xwin32 | xdce | xvxworks)
1379 target_thread_file=$enable_threads_flag
1380 ;;
1381 *)
1382 echo "$enable_threads is an unknown thread package" 1>&2
1383 exit 1
1384 ;;
1385 esac
1386
1387 dnl Check for thread package actually supported in libstdc++
1388 THREADH=
1389 case "$target_thread_file" in
1390 no | none | single)
1391 THREADH=threads-no.h
1392 ;;
1393 posix | pthreads)
1394 THREADH=threads-posix.h
1395 ;;
1396 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1397 AC_MSG_ERROR(thread package $THREADS not yet supported)
1398 ;;
1399 *)
1400 AC_MSG_ERROR($THREADS is an unsupported/unknown thread package)
1401 ;;
1402 esac
1403 AC_MSG_RESULT($THREADH)
1404
1405 AC_LINK_FILES(config/$THREADH, include/bits/c++threads.h)
1406 if test $THREADH != threads-no.h; then
1407 AC_DEFINE(_GLIBCPP_USE_THREADS)
1408 fi
1409 ])
1410
1411
1412 dnl Enable atomic locking
1413 dnl GLIBCPP_ENABLE_ATOMICITY
1414 AC_DEFUN(GLIBCPP_ENABLE_ATOMICITY, [
1415 AC_MSG_CHECKING([for atomicity.h])
1416 # We have ATOMICITY already from GLIBCPP_CONFIGURE
1417 if test "$ATOMICITYH" = "config/cpu/generic"; then
1418 AC_MSG_WARN([No ATOMICITY settings found, using generic atomic ops.])
1419 fi
1420 AC_MSG_RESULT($ATOMICITYH/bits/atomicity.h)
1421 AC_LINK_FILES($ATOMICITYH/bits/atomicity.h, include/bits/atomicity.h)
1422 ])
1423
1424
1425 dnl
1426 dnl Check for template specializations for the 'long long' type extension.
1427 dnl
1428 dnl GLIBCPP_ENABLE_LONG_LONG
1429 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1430 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1431 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1432 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1433 dnl defaults to `no'.
1434 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1435 dnl
1436 dnl GLIBCPP_ENABLE_LONG_LONG
1437 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1438 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1439
1440 AC_ARG_ENABLE(long-long,
1441 changequote(<<, >>)dnl
1442 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1443 changequote([, ])dnl
1444 [case "$enableval" in
1445 yes) enable_long_long=yes ;;
1446 no) enable_long_long=no ;;
1447 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1448 esac],
1449 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1450
1451 # Check for the existance of functions used if long long is enabled.
1452 AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1453 AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1454
1455 AC_MSG_CHECKING([for enabled long long])
1456 if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then
1457 enable_long_long=no;
1458 fi;
1459 AC_MSG_RESULT($enable_long_long)
1460
1461 dnl Option parsed, now set things appropriately
1462 if test x"$enable_long_long" = xyes; then
1463 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1464 fi
1465 ])
1466
1467
1468 dnl
1469 dnl Check for whether or not to do shadowed C headers.
1470 dnl
1471 dnl GLIBCPP_ENABLE_SHADOW
1472 dnl --enable-cshadow-headers [does stuff].
1473 dnl --disable-cshadow-headers [does not do stuff].
1474 dnl + This will eventually need to be on by default.
1475 dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1476 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1477 dnl defaults to `no'.
1478 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1479 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
1480 AC_MSG_CHECKING([for enabled cshadow headers])
1481 AC_ARG_ENABLE(cshadow-headers,
1482 changequote(<<, >>)dnl
1483 << --enable-cshadow-headers construct "shadowed" C header files for
1484 g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
1485 changequote([, ])
1486 [case "$enableval" in
1487 yes) enable_cshadow_headers=yes
1488 ;;
1489 no) enable_cshadow_headers=no
1490 ;;
1491 *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers])
1492 ;;
1493 esac],
1494 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)
1495 AC_MSG_RESULT($enable_cshadow_headers)
1496
1497 dnl Option parsed, now set things appropriately
1498 dnl NB: these things may be duplicated in c++config.h as well.
1499 case "$enable_cshadow_headers" in
1500 yes)
1501 CSHADOW_FLAGS="-fno-builtin"
1502 C_INCLUDE_DIR='${top_srcdir}/include/c_std'
1503 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1504 ;;
1505 no)
1506 CSHADOW_FLAGS=""
1507 C_INCLUDE_DIR='${top_srcdir}/include/c'
1508 ;;
1509 esac
1510
1511 AC_SUBST(CSHADOW_FLAGS)
1512 AC_SUBST(C_INCLUDE_DIR)
1513 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
1514 ])
1515
1516
1517 dnl
1518 dnl Check for wide character support. Has the same effect as the option
1519 dnl in gcc's configure, but in a form that autoconf can mess with.
1520 dnl
1521 dnl GLIBCPP_ENABLE_C_MBCHAR
1522 dnl --enable-c-mbchar requests all the wchar_t stuff.
1523 dnl --disable-c-mbchar doesn't.
1524 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1525 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1526 dnl defaults to `no'.
1527 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1528 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1529 AC_ARG_ENABLE(c-mbchar,
1530 changequote(<<, >>)dnl
1531 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1532 changequote([, ])dnl
1533 [case "$enableval" in
1534 yes) enable_c_mbchar=yes ;;
1535 no) enable_c_mbchar=no ;;
1536 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1537 esac],
1538 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1539 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1540 ])
1541
1542
1543 dnl
1544 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1545 dnl
1546 dnl GLIBCPP_INCLUDE_DIR
1547 dnl C_INCLUDE_DIR
1548 dnl TOPLEVEL_INCLUDES
1549 dnl LIBMATH_INCLUDES
1550 dnl LIBSUPCXX_INCLUDES
1551 dnl LIBIO_INCLUDES
1552 dnl CSHADOW_INCLUDES
1553 dnl
1554 dnl GLIBCPP_EXPORT_INCLUDE
1555 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1556 # Root level of the include sources.
1557 GLIBCPP_INCLUDE_DIR='$(top_srcdir)/include'
1558
1559 # Can either use include/c or include/c_std to grab "C" headers. This
1560 # variable is set to the include directory currently in use.
1561 # set with C_INCLUDE_DIR in GLIBCPP_ENABLE_SHADOW
1562
1563 # Passed down for canadian crosses.
1564 if test x"$CANADIAN" = xyes; then
1565 TOPLEVEL_INCLUDES='-I$(includedir)'
1566 fi
1567
1568 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1569
1570 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1571
1572 #if GLIBCPP_NEED_LIBIO
1573 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1574 #else
1575 #LIBIO_INCLUDES='-I$(top_srcdir)/libio'
1576 #endif
1577
1578 #if GLIBCPP_USE_CSHADOW
1579 # CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR) \
1580 # -I$(top_blddir)/cshadow'
1581 #else
1582 CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR)'
1583 #endif
1584
1585 # Now, export this to all the little Makefiles....
1586 AC_SUBST(GLIBCPP_INCLUDE_DIR)
1587 AC_SUBST(TOPLEVEL_INCLUDES)
1588 AC_SUBST(LIBMATH_INCLUDES)
1589 AC_SUBST(LIBSUPCXX_INCLUDES)
1590 AC_SUBST(LIBIO_INCLUDES)
1591 AC_SUBST(CSHADOW_INCLUDES)
1592 ])
1593
1594
1595 dnl
1596 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1597 dnl
1598 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1599 # Optimization flags that are probably a good idea for thrill-seekers. Just
1600 # uncomment the lines below and make, everything else is ready to go...
1601 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1602 OPTIMIZE_CXXFLAGS=
1603 AC_SUBST(OPTIMIZE_CXXFLAGS)
1604
1605 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1606 AC_SUBST(WARN_FLAGS)
1607 ])
1608
1609
1610 # Check whether LC_MESSAGES is available in <locale.h>.
1611 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1612 #
1613 # This file file be copied and used freely without restrictions. It can
1614 # be used in projects which are not available under the GNU Public License
1615 # but which still want to provide support for the GNU gettext functionality.
1616 # Please note that the actual code is *not* freely available.
1617
1618 # serial 1
1619
1620 AC_DEFUN(AC_LC_MESSAGES,
1621 [if test $ac_cv_header_locale_h = yes; then
1622 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1623 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1624 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1625 if test $ac_cv_val_LC_MESSAGES = yes; then
1626 AC_DEFINE(HAVE_LC_MESSAGES)
1627 fi
1628 fi])
1629
1630
1631 # Check for functions in math library.
1632 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1633 #
1634 # This file can be copied and used freely without restrictions. It can
1635 # be used in projects which are not available under the GNU Public License
1636 # but which still want to provide support for the GNU gettext functionality.
1637 # Please note that the actual code is *not* freely available.
1638
1639 # serial 1
1640
1641 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1642 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1643 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1644 AC_SUBST(LIBMATHOBJS)dnl
1645 ])
1646
1647
1648 # Check for string functions.
1649 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1650 #
1651 # This file can be copied and used freely without restrictions. It can
1652 # be used in projects which are not available under the GNU Public License
1653 # but which still want to provide support for the GNU gettext functionality.
1654 # Please note that the actual code is *not* freely available.
1655
1656 # serial 1
1657
1658 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1659 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1660 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1661 AC_SUBST(LIBSTRINGOBJS)dnl
1662 ])
1663
1664
1665 dnl This macro searches for a GNU version of make. If a match is found, the
1666 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1667 dnl set to "#". This is useful for including a special features in a Makefile,
1668 dnl which cannot be handled by other versions of make. The variable
1669 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1670 dnl the empty string otherwise.
1671 dnl
1672 dnl Here is an example of its use:
1673 dnl
1674 dnl Makefile.in might contain:
1675 dnl
1676 dnl # A failsafe way of putting a dependency rule into a makefile
1677 dnl $(DEPEND):
1678 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1679 dnl
1680 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1681 dnl @ifGNUmake@ include $(DEPEND)
1682 dnl @ifGNUmake@ endif
1683 dnl
1684 dnl Then configure.in would normally contain:
1685 dnl
1686 dnl CHECK_GNU_MAKE()
1687 dnl AC_OUTPUT(Makefile)
1688 dnl
1689 dnl Then perhaps to cause gnu make to override any other make, we could do
1690 dnl something like this (note that GNU make always looks for GNUmakefile first):
1691 dnl
1692 dnl if ! test x$_cv_gnu_make_command = x ; then
1693 dnl mv Makefile GNUmakefile
1694 dnl echo .DEFAULT: > Makefile ;
1695 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1696 dnl fi
1697 dnl
1698 dnl Then, if any (well almost any) other make is called, and GNU make also
1699 dnl exists, then the other make wraps the GNU make.
1700 dnl
1701 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1702 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1703 dnl
1704 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1705 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1706 dnl #### conditional's subshell (" --version" is not a command), using a
1707 dnl #### different option to grep(1).
1708 dnl #### -pme
1709 AC_DEFUN(
1710 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1711 _cv_gnu_make_command='' ;
1712 dnl Search all the common names for GNU make
1713 for a in "${MAKE:-make}" make gmake gnumake ; do
1714 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1715 then
1716 _cv_gnu_make_command=$a ;
1717 break;
1718 fi
1719 done ;
1720 ) ;
1721 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1722 dnl string, '#' otherwise
1723 if test "x$_cv_gnu_make_command" != "x" ; then
1724 ifGNUmake='' ;
1725 else
1726 ifGNUmake='#' ;
1727 fi
1728 AC_SUBST(ifGNUmake)
1729 ])
1730
1731 sinclude(../libtool.m4)
1732 dnl The lines below arrange for aclocal not to bring an installed
1733 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1734 dnl add a definition of LIBTOOL to Makefile.in.
1735 ifelse(,,,[AC_SUBST(LIBTOOL)
1736 AC_DEFUN([AM_PROG_LIBTOOL])
1737 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1738 AC_DEFUN([AC_PROG_LD])
1739 ])
1740
1741
1742 # Do all the work for Automake. This macro actually does too much --
1743 # some checks are only needed if your package does certain things.
1744 # But this isn't really a big deal.
1745
1746 # serial 1
1747
1748 dnl Usage:
1749 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1750
1751 AC_DEFUN(AM_INIT_AUTOMAKE,
1752 [AC_REQUIRE([AC_PROG_INSTALL])
1753 PACKAGE=[$1]
1754 AC_SUBST(PACKAGE)
1755 VERSION=[$2]
1756 AC_SUBST(VERSION)
1757 dnl test to see if srcdir already configured
1758 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
1759 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1760 fi
1761 ifelse([$3],,
1762 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1763 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
1764 AC_REQUIRE([AM_SANITY_CHECK])
1765 AC_REQUIRE([AC_ARG_PROGRAM])
1766 dnl FIXME This is truly gross.
1767 missing_dir=`cd $ac_aux_dir && pwd`
1768 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
1769 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1770 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
1771 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1772 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
1773 AC_REQUIRE([AC_PROG_MAKE_SET])])
1774
1775 #
1776 # Check to make sure that the build environment is sane.
1777 #
1778
1779 AC_DEFUN(AM_SANITY_CHECK,
1780 [AC_MSG_CHECKING([whether build environment is sane])
1781 # Just in case
1782 sleep 1
1783 echo timestamp > conftestfile
1784 # Do `set' in a subshell so we don't clobber the current shell's
1785 # arguments. Must try -L first in case configure is actually a
1786 # symlink; some systems play weird games with the mod time of symlinks
1787 # (eg FreeBSD returns the mod time of the symlink's containing
1788 # directory).
1789 if (
1790 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1791 if test "[$]*" = "X"; then
1792 # -L didn't work.
1793 set X `ls -t $srcdir/configure conftestfile`
1794 fi
1795 if test "[$]*" != "X $srcdir/configure conftestfile" \
1796 && test "[$]*" != "X conftestfile $srcdir/configure"; then
1797
1798 # If neither matched, then we have a broken ls. This can happen
1799 # if, for instance, CONFIG_SHELL is bash and it inherits a
1800 # broken ls alias from the environment. This has actually
1801 # happened. Such a system could not be considered "sane".
1802 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
1803 alias in your environment])
1804 fi
1805
1806 test "[$]2" = conftestfile
1807 )
1808 then
1809 # Ok.
1810 :
1811 else
1812 AC_MSG_ERROR([newly created file is older than distributed files!
1813 Check your system clock])
1814 fi
1815 rm -f conftest*
1816 AC_MSG_RESULT(yes)])
1817
1818 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1819 dnl The program must properly implement --version.
1820 AC_DEFUN(AM_MISSING_PROG,
1821 [AC_MSG_CHECKING(for working $2)
1822 # Run test in a subshell; some versions of sh will print an error if
1823 # an executable is not found, even if stderr is redirected.
1824 # Redirect stdin to placate older versions of autoconf. Sigh.
1825 if ($2 --version) < /dev/null > /dev/null 2>&1; then
1826 $1=$2
1827 AC_MSG_RESULT(found)
1828 else
1829 $1="$3/missing $2"
1830 AC_MSG_RESULT(missing)
1831 fi
1832 AC_SUBST($1)])
1833
1834 # Add --enable-maintainer-mode option to configure.
1835 # From Jim Meyering
1836
1837 # serial 1
1838
1839 AC_DEFUN(AM_MAINTAINER_MODE,
1840 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1841 dnl maintainer-mode is disabled by default
1842 AC_ARG_ENABLE(maintainer-mode,
1843 [ --enable-maintainer-mode enable make rules and dependencies not useful
1844 (and sometimes confusing) to the casual installer],
1845 USE_MAINTAINER_MODE=$enableval,
1846 USE_MAINTAINER_MODE=no)
1847 AC_MSG_RESULT($USE_MAINTAINER_MODE)
1848 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1849 MAINT=$MAINTAINER_MODE_TRUE
1850 AC_SUBST(MAINT)dnl
1851 ]
1852 )
1853
1854 # Define a conditional.
1855
1856 AC_DEFUN(AM_CONDITIONAL,
1857 [AC_SUBST($1_TRUE)
1858 AC_SUBST($1_FALSE)
1859 if $2; then
1860 $1_TRUE=
1861 $1_FALSE='#'
1862 else
1863 $1_TRUE='#'
1864 $1_FALSE=
1865 fi])
1866
1867 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1868
1869 AC_DEFUN(AM_CONFIG_HEADER,
1870 [AC_PREREQ([2.12])
1871 AC_CONFIG_HEADER([$1])
1872 dnl When config.status generates a header, we must update the stamp-h file.
1873 dnl This file resides in the same directory as the config header
1874 dnl that is generated. We must strip everything past the first ":",
1875 dnl and everything past the last "/".
1876 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1877 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1878 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1879 <<am_indx=1
1880 for am_file in <<$1>>; do
1881 case " <<$>>CONFIG_HEADERS " in
1882 *" <<$>>am_file "*<<)>>
1883 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1884 ;;
1885 esac
1886 am_indx=`expr "<<$>>am_indx" + 1`
1887 done<<>>dnl>>)
1888 changequote([,]))])
1889
This page took 0.135794 seconds and 6 git commands to generate.