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