]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/aclocal.m4
re PR libstdc++/8399 (sync_with_stdio(false) breaks unformatted input)
[thirdparty/gcc.git] / libstdc++-v3 / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p6
2
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 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 basic configure bits, set toplevel_srcdir for Makefiles.
15 dnl
16 dnl GLIBCPP_TOPREL_CONFIGURE
17 AC_DEFUN(GLIBCPP_TOPREL_CONFIGURE, [
18 dnl Default to --enable-multilib (this is also passed by default
19 dnl from the ubercommon-top-level configure)
20 AC_ARG_ENABLE(multilib,
21 [ --enable-multilib build hella library versions (default)],
22 [case "${enableval}" in
23 yes) multilib=yes ;;
24 no) multilib=no ;;
25 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
26 esac], [multilib=yes])dnl
27
28 # When building with srcdir == objdir, links to the source files will
29 # be created in directories within the target_subdir. We have to
30 # adjust toplevel_srcdir accordingly, so that configure finds
31 # install-sh and other auxiliary files that live in the top-level
32 # source directory.
33 if test "${srcdir}" = "."; then
34 if test -z "${with_target_subdir}"; then
35 toprel=".."
36 else
37 if test "${with_target_subdir}" != "."; then
38 toprel="${with_multisrctop}../.."
39 else
40 toprel="${with_multisrctop}.."
41 fi
42 fi
43 else
44 toprel=".."
45 fi
46 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
47 toplevel_srcdir=\${top_srcdir}/$toprel
48 AC_SUBST(toplevel_srcdir)
49 ])
50
51 dnl
52 dnl Initialize the rest of the library configury.
53 dnl
54 dnl GLIBCPP_CONFIGURE
55 AC_DEFUN(GLIBCPP_CONFIGURE, [
56 # Export build and source directories.
57 # These need to be absolute paths, yet at the same time need to
58 # canonicalize only relative paths, because then amd will not unmount
59 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
60 glibcpp_builddir=`${PWDCMD-pwd}`
61 case $srcdir in
62 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
63 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
64 esac
65 AC_SUBST(glibcpp_builddir)
66 AC_SUBST(glibcpp_srcdir)
67
68 dnl This is here just to satisfy automake.
69 ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
70
71 AC_PROG_AWK
72 # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.5x, can also
73 # be 'cp -p' if linking isn't available. Uncomment the next line to
74 # force a particular method.
75 #ac_cv_prog_LN_S='cp -p'
76 AC_PROG_LN_S
77
78 # We use these options to decide which functions to include.
79 AC_ARG_WITH(target-subdir,
80 [ --with-target-subdir=SUBDIR
81 configuring in a subdirectory])
82 AC_ARG_WITH(cross-host,
83 [ --with-cross-host=HOST configuring with a cross compiler])
84
85 glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3
86 AC_SUBST(glibcpp_basedir)
87
88 # Never versions of autoconf add an underscore to these functions.
89 # Prevent future problems ...
90 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
91 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
92 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
93 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
94
95 # AC_PROG_CC
96 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
97 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
98 # are probably using a cross compiler, which will not be able to fully
99 # link an executable. This is addressed in later versions of autoconf.
100
101 AC_DEFUN(LIB_AC_PROG_CC,
102 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
103 dnl Fool anybody using AC_PROG_CC.
104 AC_PROVIDE([AC_PROG_CC])
105 AC_CHECK_PROG(CC, gcc, gcc)
106 if test -z "$CC"; then
107 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
108 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
109 fi
110
111 AC_PROG_CC_GNU
112
113 if test $ac_cv_prog_gcc = yes; then
114 GCC=yes
115 dnl Check whether -g works, even if CFLAGS is set, in case the package
116 dnl plays around with CFLAGS (such as to build both debugging and
117 dnl normal versions of a library), tasteless as that idea is.
118 ac_test_CFLAGS="${CFLAGS+set}"
119 ac_save_CFLAGS="$CFLAGS"
120 CFLAGS=
121 AC_PROG_CC_G
122 if test "$ac_test_CFLAGS" = set; then
123 CFLAGS="$ac_save_CFLAGS"
124 elif test $ac_cv_prog_cc_g = yes; then
125 CFLAGS="-g -O2"
126 else
127 CFLAGS="-O2"
128 fi
129 else
130 GCC=
131 test "${CFLAGS+set}" = set || CFLAGS="-g"
132 fi
133 ])
134
135 LIB_AC_PROG_CC
136
137 # Likewise for AC_PROG_CXX. We can't just call it directly because g++
138 # will try to link in libstdc++.
139 AC_DEFUN(LIB_AC_PROG_CXX,
140 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
141 dnl Fool anybody using AC_PROG_CXX.
142 AC_PROVIDE([AC_PROG_CXX])
143 # Use glibcpp_CXX so that we do not cause CXX to be cached with the
144 # flags that come in CXX while configuring libstdc++. They're different
145 # from those used for all other target libraries. If CXX is set in
146 # the environment, respect that here.
147 glibcpp_CXX=$CXX
148 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
149 AC_SUBST(glibcpp_CXX)
150 CXX=$glibcpp_CXX
151 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
152
153 AC_PROG_CXX_GNU
154
155 if test $ac_cv_prog_gxx = yes; then
156 GXX=yes
157 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
158 dnl plays around with CXXFLAGS (such as to build both debugging and
159 dnl normal versions of a library), tasteless as that idea is.
160 ac_test_CXXFLAGS="${CXXFLAGS+set}"
161 ac_save_CXXFLAGS="$CXXFLAGS"
162 CXXFLAGS=
163 AC_PROG_CXX_G
164 if test "$ac_test_CXXFLAGS" = set; then
165 CXXFLAGS="$ac_save_CXXFLAGS"
166 elif test $ac_cv_prog_cxx_g = yes; then
167 CXXFLAGS="-g -O2"
168 else
169 CXXFLAGS="-O2"
170 fi
171 else
172 GXX=
173 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
174 fi
175 ])
176
177 LIB_AC_PROG_CXX
178
179 # For directory versioning (e.g., headers) and other variables.
180 AC_MSG_CHECKING([for GCC version number])
181 gcc_version=`$glibcpp_CXX -dumpversion`
182 AC_MSG_RESULT($gcc_version)
183
184 # For some reason, gettext needs this.
185 AC_ISC_POSIX
186
187 AC_CHECK_TOOL(AS, as)
188 AC_CHECK_TOOL(AR, ar)
189 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
190 AC_PROG_INSTALL
191
192 AM_MAINTAINER_MODE
193
194 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
195 # at least currently, we never actually build a program, so we never
196 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
197 # fails, because we are probably configuring with a cross compiler
198 # which can't create executables. So we include AC_EXEEXT to keep
199 # automake happy, but we don't execute it, since we don't care about
200 # the result.
201 if false; then
202 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
203 # to nothing, so nothing would remain between `then' and `fi' if it
204 # were not for the `:' below.
205 :
206 AC_EXEEXT
207 fi
208
209 case [$]{glibcpp_basedir} in
210 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
211 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
212 esac
213
214 # Find platform-specific directories containing configuration info. In
215 # addition to possibly modifying the same flags, it also sets up symlinks.
216 GLIBCPP_CHECK_TARGET
217 ])
218
219
220 dnl
221 dnl Check to see if g++ can compile this library, and if so, if any version-
222 dnl specific precautions need to be taken.
223 dnl
224 dnl GLIBCPP_CHECK_COMPILER_VERSION
225 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
226 if test ! -f stamp-sanity-compiler; then
227 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
228 AC_LANG_SAVE
229 AC_LANG_CPLUSPLUS
230 AC_TRY_COMPILE(, [
231 #if __GNUC__ < 3
232 not_ok
233 #endif
234 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
235 AC_LANG_RESTORE
236 AC_MSG_RESULT($gpp_satisfactory)
237 touch stamp-sanity-compiler
238 fi
239 ])
240
241
242 dnl
243 dnl Tests for newer compiler features, or features that are present in newer
244 dnl compiler versions but not older compiler versions still in use, should
245 dnl be placed here.
246 dnl
247 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
248 dnl new inlining code or the new system_header pragma will die on -Werror.
249 dnl Leave it out by default and use maint-mode to use it.
250 dnl
251 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
252 dnl compiler supports it and the user has not requested debug mode.
253 dnl
254 dnl GLIBCPP_CHECK_COMPILER_FEATURES
255 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
256 # All these tests are for C++; save the language and the compiler flags.
257 # The CXXFLAGS thing is suspicious, but based on similar bits previously
258 # found in GLIBCPP_CONFIGURE.
259 AC_LANG_SAVE
260 AC_LANG_CPLUSPLUS
261 ac_test_CXXFLAGS="${CXXFLAGS+set}"
262 ac_save_CXXFLAGS="$CXXFLAGS"
263
264 # Check for maintainer-mode bits.
265 if test x"$USE_MAINTAINER_MODE" = xno; then
266 WERROR=''
267 else
268 WERROR='-Werror'
269 fi
270
271 # Check for -ffunction-sections -fdata-sections
272 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
273 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
274 AC_TRY_COMPILE(, [int foo;
275 ], [ac_fdsections=yes], [ac_fdsections=no])
276 if test "$ac_test_CXXFLAGS" = set; then
277 CXXFLAGS="$ac_save_CXXFLAGS"
278 else
279 # this is the suspicious part
280 CXXFLAGS=''
281 fi
282 if test x"$ac_fdsections" = x"yes" &&
283 test x"$enable_debug" = x"no"; then
284 SECTION_FLAGS='-ffunction-sections -fdata-sections'
285 fi
286 AC_MSG_RESULT($ac_fdsections)
287
288 AC_LANG_RESTORE
289 AC_SUBST(WERROR)
290 AC_SUBST(SECTION_FLAGS)
291 ])
292
293
294 dnl
295 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
296 dnl the native linker is in use, all variables will be defined to something
297 dnl safe (like an empty string).
298 dnl
299 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
300 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
301 dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as
302 dnl side-effects of testing.
303 dnl
304 dnl GLIBCPP_CHECK_LINKER_FEATURES
305 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
306 # If we're not using GNU ld, then there's no point in even trying these
307 # tests. Check for that first. We should have already tested for gld
308 # by now (in libtool), but require it now just to be safe...
309 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
310 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
311 AC_REQUIRE([AC_PROG_LD])
312
313 # The name set by libtool depends on the version of libtool. Shame on us
314 # for depending on an impl detail, but c'est la vie. Older versions used
315 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
316 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
317 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
318 # set (hence we're using an older libtool), then set it.
319 if test x${with_gnu_ld+set} != xset; then
320 if test x${ac_cv_prog_gnu_ld+set} != xset; then
321 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
322 with_gnu_ld=no
323 else
324 with_gnu_ld=$ac_cv_prog_gnu_ld
325 fi
326 fi
327
328 # Start by getting the version number. I think the libtool test already
329 # does some of this, but throws away the result.
330 changequote(,)
331 ldver=`$LD --version 2>/dev/null | head -1 | \
332 sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
333 changequote([,])
334 glibcpp_gnu_ld_version=`echo $ldver | \
335 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
336
337 # Set --gc-sections.
338 if test "$with_gnu_ld" = "notbroken"; then
339 # GNU ld it is! Joy and bunny rabbits!
340
341 # All these tests are for C++; save the language and the compiler flags.
342 # Need to do this so that g++ won't try to link in libstdc++
343 ac_test_CFLAGS="${CFLAGS+set}"
344 ac_save_CFLAGS="$CFLAGS"
345 CFLAGS='-x c++ -Wl,--gc-sections'
346
347 # Check for -Wl,--gc-sections
348 # XXX This test is broken at the moment, as symbols required for
349 # linking are now in libsupc++ (not built yet.....). In addition,
350 # this test has cored on solaris in the past. In addition,
351 # --gc-sections doesn't really work at the moment (keeps on discarding
352 # used sections, first .eh_frame and now some of the glibc sections for
353 # iconv). Bzzzzt. Thanks for playing, maybe next time.
354 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
355 AC_TRY_RUN([
356 int main(void)
357 {
358 try { throw 1; }
359 catch (...) { };
360 return 0;
361 }
362 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
363 if test "$ac_test_CFLAGS" = set; then
364 CFLAGS="$ac_save_CFLAGS"
365 else
366 # this is the suspicious part
367 CFLAGS=''
368 fi
369 if test "$ac_sectionLDflags" = "yes"; then
370 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
371 fi
372 AC_MSG_RESULT($ac_sectionLDflags)
373 fi
374
375 # Set linker optimization flags.
376 if test x"$with_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
377 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
378 fi
379
380 AC_SUBST(SECTION_LDFLAGS)
381 AC_SUBST(OPT_LDFLAGS)
382 ])
383
384
385 dnl
386 dnl Check to see if the (math function) argument passed is
387 dnl declared when using the c++ compiler
388 dnl ASSUMES argument is a math function with ONE parameter
389 dnl
390 dnl GLIBCPP_CHECK_MATH_DECL_1
391 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
392 AC_MSG_CHECKING([for $1 declaration])
393 if test x${glibcpp_cv_func_$1_use+set} != xset; then
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 #ifdef HAVE_IEEEFP_H
399 #include <ieeefp.h>
400 #endif
401 ],
402 [ $1(0);],
403 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
404 AC_LANG_RESTORE
405 ])
406 fi
407 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
408 ])
409
410 dnl
411 dnl Check to see if the (math function) argument passed is
412 dnl 1) declared when using the c++ compiler
413 dnl 2) has "C" linkage
414 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
415 dnl
416 dnl Define HAVE_CARGF etc if "cargf" is declared and links
417 dnl
418 dnl argument 1 is name of function to check
419 dnl
420 dnl ASSUMES argument is a math function with ONE parameter
421 dnl
422 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
423 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
424 GLIBCPP_CHECK_MATH_DECL_1($1)
425 if test x$glibcpp_cv_func_$1_use = x"yes"; then
426 AC_CHECK_FUNCS($1)
427 else
428 GLIBCPP_CHECK_MATH_DECL_1(_$1)
429 if test x$glibcpp_cv_func__$1_use = x"yes"; then
430 AC_CHECK_FUNCS(_$1)
431 fi
432 fi
433 ])
434
435
436 dnl
437 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
438 dnl of functions at once. It's an all-or-nothing check -- either
439 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
440 dnl Doing it this way saves significant configure time.
441 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
442 AC_MSG_CHECKING([for $1 functions])
443 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
444 AC_LANG_SAVE
445 AC_LANG_CPLUSPLUS
446 AC_TRY_COMPILE([#include <math.h>],
447 [ `for x in $3; do echo "$x (0);"; done` ],
448 [glibcpp_cv_func_$2_use=yes],
449 [glibcpp_cv_func_$2_use=no])
450 AC_LANG_RESTORE])
451 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
452 if test x$glibcpp_cv_func_$2_use = x"yes"; then
453 AC_CHECK_FUNCS($3)
454 fi
455 ])
456
457 dnl
458 dnl Check to see if the (math function) argument passed is
459 dnl declared when using the c++ compiler
460 dnl ASSUMES argument is a math function with TWO parameters
461 dnl
462 dnl GLIBCPP_CHECK_MATH_DECL_2
463 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
464 AC_MSG_CHECKING([for $1 declaration])
465 if test x${glibcpp_cv_func_$1_use+set} != xset; then
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, 0);],
471 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
472 AC_LANG_RESTORE
473 ])
474 fi
475 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
476 ])
477
478 dnl
479 dnl Check to see if the (math function) argument passed is
480 dnl 1) declared when using the c++ compiler
481 dnl 2) has "C" linkage
482 dnl
483 dnl Define HAVE_CARGF etc if "cargf" is declared and links
484 dnl
485 dnl argument 1 is name of function to check
486 dnl
487 dnl ASSUMES argument is a math function with TWO parameters
488 dnl
489 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
490 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
491 GLIBCPP_CHECK_MATH_DECL_2($1)
492 if test x$glibcpp_cv_func_$1_use = x"yes"; then
493 AC_CHECK_FUNCS($1)
494 else
495 GLIBCPP_CHECK_MATH_DECL_2(_$1)
496 if test x$glibcpp_cv_func__$1_use = x"yes"; then
497 AC_CHECK_FUNCS(_$1)
498 fi
499 fi
500 ])
501
502
503 dnl
504 dnl Check to see if the (math function) argument passed is
505 dnl declared when using the c++ compiler
506 dnl ASSUMES argument is a math function with THREE parameters
507 dnl
508 dnl GLIBCPP_CHECK_MATH_DECL_3
509 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
510 AC_MSG_CHECKING([for $1 declaration])
511 if test x${glibcpp_cv_func_$1_use+set} != xset; then
512 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
513 AC_LANG_SAVE
514 AC_LANG_CPLUSPLUS
515 AC_TRY_COMPILE([#include <math.h>],
516 [ $1(0, 0, 0);],
517 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
518 AC_LANG_RESTORE
519 ])
520 fi
521 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
522 ])
523
524 dnl
525 dnl Check to see if the (math function) argument passed is
526 dnl 1) declared when using the c++ compiler
527 dnl 2) has "C" linkage
528 dnl
529 dnl Define HAVE_CARGF etc if "cargf" is declared and links
530 dnl
531 dnl argument 1 is name of function to check
532 dnl
533 dnl ASSUMES argument is a math function with THREE parameters
534 dnl
535 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
536 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
537 GLIBCPP_CHECK_MATH_DECL_3($1)
538 if test x$glibcpp_cv_func_$1_use = x"yes"; then
539 AC_CHECK_FUNCS($1)
540 else
541 GLIBCPP_CHECK_MATH_DECL_3(_$1)
542 if test x$glibcpp_cv_func__$1_use = x"yes"; then
543 AC_CHECK_FUNCS(_$1)
544 fi
545 fi
546 ])
547
548
549 dnl
550 dnl Check to see if the (stdlib function) argument passed is
551 dnl 1) declared when using the c++ compiler
552 dnl 2) has "C" linkage
553 dnl
554 dnl argument 1 is name of function to check
555 dnl
556 dnl ASSUMES argument is a math function with TWO parameters
557 dnl
558 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
559 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
560 AC_MSG_CHECKING([for $1 declaration])
561 if test x${glibcpp_cv_func_$1_use+set} != xset; then
562 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
563 AC_LANG_SAVE
564 AC_LANG_CPLUSPLUS
565 AC_TRY_COMPILE([#include <stdlib.h>],
566 [ $1(0, 0);],
567 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
568 AC_LANG_RESTORE
569 ])
570 fi
571 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
572 if test x$glibcpp_cv_func_$1_use = x"yes"; then
573 AC_CHECK_FUNCS($1)
574 fi
575 ])
576
577
578 dnl
579 dnl Check to see if the (stdlib function) argument passed is
580 dnl 1) declared when using the c++ compiler
581 dnl 2) has "C" linkage
582 dnl
583 dnl argument 1 is name of function to check
584 dnl
585 dnl ASSUMES argument is a function with THREE parameters
586 dnl
587 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3
588 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
589 AC_MSG_CHECKING([for $1 declaration])
590 if test x${glibcpp_cv_func_$1_use+set} != xset; then
591 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
592 AC_LANG_SAVE
593 AC_LANG_CPLUSPLUS
594 AC_TRY_COMPILE([#include <stdlib.h>],
595 [ $1(0, 0, 0);],
596 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
597 AC_LANG_RESTORE
598 ])
599 fi
600 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
601 if test x$glibcpp_cv_func_$1_use = x"yes"; then
602 AC_CHECK_FUNCS($1)
603 fi
604 ])
605
606 dnl
607 dnl Check to see if the (unistd function) argument passed is
608 dnl 1) declared when using the c++ compiler
609 dnl 2) has "C" linkage
610 dnl
611 dnl argument 1 is name of function to check
612 dnl
613 dnl ASSUMES argument is a function with ONE parameter
614 dnl
615 dnl GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1
616 AC_DEFUN(GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1, [
617 AC_MSG_CHECKING([for $1 declaration])
618 if test x${glibcpp_cv_func_$1_use+set} != xset; then
619 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
620 AC_LANG_SAVE
621 AC_LANG_CPLUSPLUS
622 AC_TRY_COMPILE([#include <unistd.h>],
623 [ $1(0);],
624 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
625 AC_LANG_RESTORE
626 ])
627 fi
628 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
629 if test x$glibcpp_cv_func_$1_use = x"yes"; then
630 AC_CHECK_FUNCS($1)
631 fi
632 ])
633
634 dnl
635 dnl Because the builtins are picky picky picky about the arguments they take,
636 dnl do an explict linkage tests here.
637 dnl Check to see if the (math function) argument passed is
638 dnl 1) declared when using the c++ compiler
639 dnl 2) has "C" linkage
640 dnl
641 dnl Define HAVE_CARGF etc if "cargf" is declared and links
642 dnl
643 dnl argument 1 is name of function to check
644 dnl
645 dnl ASSUMES argument is a math function with ONE parameter
646 dnl
647 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
648 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
649 AC_MSG_CHECKING([for $1 declaration])
650 if test x${glibcpp_cv_func_$1_use+set} != xset; then
651 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
652 AC_LANG_SAVE
653 AC_LANG_CPLUSPLUS
654 AC_TRY_COMPILE([#include <math.h>],
655 [ $1(0);],
656 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
657 AC_LANG_RESTORE
658 ])
659 fi
660 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
661 if test x$glibcpp_cv_func_$1_use = x"yes"; then
662 AC_MSG_CHECKING([for $1 linkage])
663 if test x${glibcpp_cv_func_$1_link+set} != xset; then
664 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
665 AC_TRY_LINK([#include <math.h>],
666 [ $1(0);],
667 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
668 ])
669 fi
670 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
671 if test x$glibcpp_cv_func_$1_link = x"yes"; then
672 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
673 AC_DEFINE_UNQUOTED(${ac_tr_func})
674 fi
675 fi
676 ])
677
678
679 dnl
680 dnl Check to see what builtin math functions are supported
681 dnl
682 dnl check for __builtin_abs
683 dnl check for __builtin_fabsf
684 dnl check for __builtin_fabs
685 dnl check for __builtin_fabl
686 dnl check for __builtin_labs
687 dnl check for __builtin_sqrtf
688 dnl check for __builtin_sqrtl
689 dnl check for __builtin_sqrt
690 dnl check for __builtin_sinf
691 dnl check for __builtin_sin
692 dnl check for __builtin_sinl
693 dnl check for __builtin_cosf
694 dnl check for __builtin_cos
695 dnl check for __builtin_cosl
696 dnl
697 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
698 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
699 dnl Test for builtin math functions.
700 dnl These are made in gcc/c-common.c
701 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
702 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
703 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
704 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
705 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
706
707 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
708 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
709 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
710
711 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
712 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
713 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
714
715 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
716 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
717 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
718
719 dnl There is, without a doubt, a more elegant way to have these
720 dnl names exported so that they won't be stripped out of acconfig.h by
721 dnl autoheader. I leave this as an exercise to somebody less frustrated
722 dnl than I.... please email the libstdc++ list if you can figure out a
723 dnl more elegant approach (see autoconf/acgen.m4 and specifically
724 dnl AC_CHECK_FUNC for things to steal.)
725 dummyvar=no
726 if test x$dummyvar = x"yes"; then
727 AC_DEFINE(HAVE___BUILTIN_ABS)
728 AC_DEFINE(HAVE___BUILTIN_LABS)
729 AC_DEFINE(HAVE___BUILTIN_COS)
730 AC_DEFINE(HAVE___BUILTIN_COSF)
731 AC_DEFINE(HAVE___BUILTIN_COSL)
732 AC_DEFINE(HAVE___BUILTIN_FABS)
733 AC_DEFINE(HAVE___BUILTIN_FABSF)
734 AC_DEFINE(HAVE___BUILTIN_FABSL)
735 AC_DEFINE(HAVE___BUILTIN_SIN)
736 AC_DEFINE(HAVE___BUILTIN_SINF)
737 AC_DEFINE(HAVE___BUILTIN_SINL)
738 AC_DEFINE(HAVE___BUILTIN_SQRT)
739 AC_DEFINE(HAVE___BUILTIN_SQRTF)
740 AC_DEFINE(HAVE___BUILTIN_SQRTL)
741 fi
742 ])
743
744 dnl
745 dnl Check to see what the underlying c library is like
746 dnl These checks need to do two things:
747 dnl 1) make sure the name is declared when using the c++ compiler
748 dnl 2) make sure the name has "C" linkage
749 dnl This might seem like overkill but experience has shown that it's not...
750 dnl
751 dnl Define HAVE_STRTOLD if "strtold" is declared and links
752 dnl Define HAVE_STRTOF if "strtof" is declared and links
753 dnl Define HAVE_DRAND48 if "drand48" is declared and links
754 dnl
755 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
756 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
757 ac_test_CXXFLAGS="${CXXFLAGS+set}"
758 ac_save_CXXFLAGS="$CXXFLAGS"
759 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
760
761 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
762 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
763 AC_CHECK_FUNCS(drand48)
764
765 CXXFLAGS="$ac_save_CXXFLAGS"
766 ])
767
768 dnl
769 dnl Check to see what the underlying c library is like
770 dnl These checks need to do two things:
771 dnl 1) make sure the name is declared when using the c++ compiler
772 dnl 2) make sure the name has "C" linkage
773 dnl This might seem like overkill but experience has shown that it's not...
774 dnl
775 dnl Define HAVE_ISATTY if "isatty" is declared and links
776 dnl
777 dnl GLIBCPP_CHECK_UNISTD_SUPPORT
778 AC_DEFUN(GLIBCPP_CHECK_UNISTD_SUPPORT, [
779 ac_test_CXXFLAGS="${CXXFLAGS+set}"
780 ac_save_CXXFLAGS="$CXXFLAGS"
781 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
782
783 GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1(isatty)
784
785 CXXFLAGS="$ac_save_CXXFLAGS"
786 ])
787
788 dnl
789 dnl Check to see what the underlying c library or math library is like.
790 dnl These checks need to do two things:
791 dnl 1) make sure the name is declared when using the c++ compiler
792 dnl 2) make sure the name has "C" linkage
793 dnl This might seem like overkill but experience has shown that it's not...
794 dnl
795 dnl Define HAVE_CARGF etc if "cargf" is found.
796 dnl
797 dnl GLIBCPP_CHECK_MATH_SUPPORT
798 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
799 ac_test_CXXFLAGS="${CXXFLAGS+set}"
800 ac_save_CXXFLAGS="$CXXFLAGS"
801 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
802
803 dnl Check libm
804 AC_CHECK_LIB(m, sin, libm="-lm")
805 ac_save_LIBS="$LIBS"
806 LIBS="$LIBS $libm"
807
808 dnl Check to see if certain C math functions exist.
809 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
810 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
811 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
812 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
813 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
814 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
815 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
816 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
817
818 dnl Check to see if basic C math functions have float versions.
819 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
820 float_trig,
821 acosf asinf atanf \
822 cosf sinf tanf \
823 coshf sinhf tanhf)
824 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
825 float_round,
826 ceilf floorf)
827 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
828 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
829 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
830 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
831 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
832 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
833 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
834 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
835 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
836 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
837 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
838 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
839 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
840 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
841 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
842 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
843
844 dnl Check to see if basic C math functions have long double versions.
845 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
846 long_double_trig,
847 acosl asinl atanl \
848 cosl sinl tanl \
849 coshl sinhl tanhl)
850 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
851 long_double_round,
852 ceill floorl)
853 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
854 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
855 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
856 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
857 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
858 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
859 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
860 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
861 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
862 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
863 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
864 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
865 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
866 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
867 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
868 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
869 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
870
871 dnl Some runtimes have these functions with a preceding underscore. Please
872 dnl keep this sync'd with the one above. And if you add any new symbol,
873 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
874 dnl Check to see if certain C math functions exist.
875
876 dnl Check to see if basic C math functions have float versions.
877 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
878 _float_trig,
879 _acosf _asinf _atanf \
880 _cosf _sinf _tanf \
881 _coshf _sinhf _tanhf)
882 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
883 _float_round,
884 _ceilf _floorf)
885
886 dnl Check to see if basic C math functions have long double versions.
887 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
888 _long_double_trig,
889 _acosl _asinl _atanl \
890 _cosl _sinl _tanl \
891 _coshl _sinhl _tanhl)
892 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
893 _long_double_round,
894 _ceill _floorl)
895
896 LIBS="$ac_save_LIBS"
897 CXXFLAGS="$ac_save_CXXFLAGS"
898 ])
899
900
901 dnl
902 dnl Check to see if there is native support for complex
903 dnl
904 dnl Don't compile bits in math/* if native support exits.
905 dnl
906 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
907 dnl
908 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
909 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
910 dnl Check for complex versions of math functions of platform.
911 AC_CHECK_LIB(m, main)
912 AC_REPLACE_MATHFUNCS(nan copysignf)
913
914 dnl For __signbit to signbit conversions.
915 AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"])
916 AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"])
917
918 dnl Compile the long double complex functions only if the function
919 dnl provides the non-complex long double functions that are needed.
920 dnl Currently this includes copysignl, which should be
921 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
922 if test x$ac_cv_func_copysignl = x"yes"; then
923 AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"])
924 fi
925
926 AC_SUBST(LIBMATHOBJS)
927 ])
928
929
930 dnl Check to see what architecture and operating system we are compiling
931 dnl for. Also, if architecture- or OS-specific flags are required for
932 dnl compilation, pick them up here.
933 dnl
934 dnl GLIBCPP_CHECK_TARGET
935 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
936 . [$]{glibcpp_basedir}/configure.target
937 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
938 AC_MSG_RESULT(OS config directory is $os_include_dir)
939 ])
940
941
942 dnl
943 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
944 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
945 dnl must have been previously checked.)
946 dnl
947 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
948 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
949 dnl
950 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
951 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
952
953 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
954 dnl others even if wchar_t support is not on.
955 AC_MSG_CHECKING([for mbstate_t])
956 AC_TRY_COMPILE([#include <wchar.h>],
957 [mbstate_t teststate;],
958 have_mbstate_t=yes, have_mbstate_t=no)
959 AC_MSG_RESULT($have_mbstate_t)
960 if test x"$have_mbstate_t" = xyes; then
961 AC_DEFINE(HAVE_MBSTATE_T)
962 fi
963
964 dnl Sanity check for existence of ISO C99 headers for extended encoding.
965 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
966 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
967
968 dnl Only continue checking if the ISO C99 headers exist and support is on.
969 if test x"$ac_has_wchar_h" = xyes &&
970 test x"$ac_has_wctype_h" = xyes &&
971 test x"$enable_c_mbchar" != xno; then
972
973 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
974 dnl numeric_limits can instantiate type_traits<wchar_t>
975 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
976 AC_TRY_COMPILE([#include <wchar.h>],
977 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
978 has_wchar_minmax=yes, has_wchar_minmax=no)
979 AC_MSG_RESULT($has_wchar_minmax)
980
981 dnl Test wchar.h for WEOF, which is what we use to determine whether
982 dnl to specialize for char_traits<wchar_t> or not.
983 AC_MSG_CHECKING([for WEOF])
984 AC_TRY_COMPILE([
985 #include <wchar.h>
986 #include <stddef.h>],
987 [wint_t i = WEOF;],
988 has_weof=yes, has_weof=no)
989 AC_MSG_RESULT($has_weof)
990
991 dnl Tests for wide character functions used in char_traits<wchar_t>.
992 ac_wfuncs=yes
993 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
994 ac_wfuncs=no)
995
996 dnl Checks for names injected into std:: by the c_std headers.
997 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
998 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
999 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
1000 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
1001 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
1002 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
1003 ac_wfuncs=no)
1004
1005 AC_MSG_CHECKING([for ISO C99 wchar_t support])
1006 if test x"$has_weof" = xyes &&
1007 test x"$has_wchar_minmax" = xyes &&
1008 test x"$ac_wfuncs" = xyes; then
1009 ac_isoC99_wchar_t=yes
1010 else
1011 ac_isoC99_wchar_t=no
1012 fi
1013 AC_MSG_RESULT($ac_isoC99_wchar_t)
1014
1015 dnl Use iconv for wchar_t to char conversions. As such, check for
1016 dnl X/Open Portability Guide, version 2 features (XPG2).
1017 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
1018 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
1019
1020 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
1021 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
1022 ac_save_LIBS="$LIBS"
1023 LIBS="$LIBS $libiconv"
1024
1025 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
1026 ac_XPG2funcs=yes, ac_XPG2funcs=no)
1027
1028 LIBS="$ac_save_LIBS"
1029
1030 AC_MSG_CHECKING([for XPG2 wchar_t support])
1031 if test x"$ac_has_iconv_h" = xyes &&
1032 test x"$ac_has_langinfo_h" = xyes &&
1033 test x"$ac_XPG2funcs" = xyes; then
1034 ac_XPG2_wchar_t=yes
1035 else
1036 ac_XPG2_wchar_t=no
1037 fi
1038 AC_MSG_RESULT($ac_XPG2_wchar_t)
1039
1040 dnl At the moment, only enable wchar_t specializations if all the
1041 dnl above support is present.
1042 AC_MSG_CHECKING([for enabled wchar_t specializations])
1043 if test x"$ac_isoC99_wchar_t" = xyes &&
1044 test x"$ac_XPG2_wchar_t" = xyes; then
1045 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
1046 AC_MSG_RESULT("yes")
1047 else
1048 AC_MSG_RESULT("no")
1049 fi
1050 else
1051 dnl Wide characters disabled by the user.
1052 AC_MSG_WARN([wchar_t support disabled.])
1053 fi
1054 ])
1055
1056
1057 dnl
1058 dnl Check for special debugging mode; not for production use.
1059 dnl
1060 dnl GLIBCPP_ENABLE_DEBUG
1061 dnl --enable-debug sets '-ggdb3 -O0'.
1062 dnl --disable-debug sets '-g' and whatever optimization options the
1063 dnl compiler can handle.
1064 dnl + --enable-maintainer-mode automatically defaults this to on.
1065 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1066 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1067 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1068 dnl defaults to `no'.
1069 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1070 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1071 AC_ARG_ENABLE(debug,
1072 changequote(<<, >>)dnl
1073 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1074 changequote([, ])dnl
1075 [case "${enableval}" in
1076 yes) enable_debug=yes ;;
1077 no) enable_debug=no ;;
1078 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1079 esac],
1080 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1081
1082 dnl Option parsed, now set things appropriately
1083 case "${enable_debug}" in
1084 yes)
1085 DEBUG_FLAGS='-O0 -ggdb3'
1086 ;;
1087 no)
1088 DEBUG_FLAGS='-g'
1089 ;;
1090 esac
1091 AC_SUBST(DEBUG_FLAGS)
1092 ])
1093
1094
1095 dnl
1096 dnl Check for "unusual" flags to pass to the compiler while building.
1097 dnl
1098 dnl GLIBCPP_ENABLE_CXX_FLAGS
1099 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1100 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1101 dnl Somehow this same set of flags must be passed when [re]building
1102 dnl libgcc.
1103 dnl --disable-cxx-flags passes nothing.
1104 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1105 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1106 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1107 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1108 dnl If "default flags" is an empty string (or "none"), the effect is
1109 dnl the same as --disable or --enable=no.
1110 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1111 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1112 AC_ARG_ENABLE(cxx-flags,
1113 changequote(<<, >>)dnl
1114 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1115 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1116 changequote([, ])dnl
1117 [case "x$enableval" in
1118 xyes)
1119 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1120 xno|x)
1121 enable_cxx_flags='' ;;
1122 *)
1123 enable_cxx_flags="$enableval" ;;
1124 esac],
1125 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1126
1127 dnl Thinko on my part during design. This kludge is the workaround.
1128 if test "$enable_cxx_flags" = "none"; then
1129 enable_cxx_flags='';
1130 fi
1131
1132 dnl Run through flags (either default or command-line) and set anything
1133 dnl extra (e.g., #defines) that must accompany particular g++ options.
1134 if test -n "$enable_cxx_flags"; then
1135 for f in $enable_cxx_flags; do
1136 case "$f" in
1137 -fhonor-std) ;;
1138 -*) ;;
1139 *) # and we're trying to pass /what/ exactly?
1140 AC_MSG_ERROR([compiler flags start with a -]) ;;
1141 esac
1142 done
1143 fi
1144 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1145 AC_SUBST(EXTRA_CXX_FLAGS)
1146 ])
1147
1148
1149 dnl
1150 dnl Check for which locale library to use: gnu or generic.
1151 dnl
1152 dnl GLIBCPP_ENABLE_CLOCALE
1153 dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1154 dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
1155 dnl
1156 dnl default is generic
1157 dnl
1158 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1159 AC_MSG_CHECKING([for clocale to use])
1160 AC_ARG_ENABLE(clocale,
1161 [ --enable-clocale enable model for target locale package.
1162 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1163 ],
1164 if test x$enable_clocale = xno; then
1165 enable_clocale=no
1166 fi,
1167 enable_clocale=no)
1168
1169 enable_clocale_flag=$enable_clocale
1170
1171 dnl Probe for locale support if no specific model is specified.
1172 dnl Default to "generic"
1173 if test x$enable_clocale_flag = xno; then
1174 case x${target_os} in
1175 xlinux* | xgnu*)
1176 AC_EGREP_CPP([_GLIBCPP_ok], [
1177 #include <features.h>
1178 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1179 _GLIBCPP_ok
1180 #endif
1181 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1182
1183 # Test for bugs early in glibc-2.2.x series
1184 if test x$enable_clocale_flag = xgnu; then
1185 AC_TRY_RUN([
1186 #define _GNU_SOURCE 1
1187 #include <locale.h>
1188 #include <string.h>
1189 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
1190 extern __typeof(newlocale) __newlocale;
1191 extern __typeof(duplocale) __duplocale;
1192 extern __typeof(strcoll_l) __strcoll_l;
1193 #endif
1194 int main()
1195 {
1196 const char __one[] = "Äuglein Augmen";
1197 const char __two[] = "Äuglein";
1198 int i;
1199 int j;
1200 __locale_t loc;
1201 __locale_t loc_dup;
1202 loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1203 loc_dup = __duplocale(loc);
1204 i = __strcoll_l(__one, __two, loc);
1205 j = __strcoll_l(__one, __two, loc_dup);
1206 return 0;
1207 }
1208 ],
1209 [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1210 [enable_clocale_flag=generic])
1211 fi
1212
1213 # ... at some point put __strxfrm_l tests in as well.
1214 ;;
1215 *)
1216 enable_clocale_flag=generic
1217 ;;
1218 esac
1219 fi
1220
1221 dnl Deal with gettext issues.
1222 AC_ARG_ENABLE(nls,
1223 [ --enable-nls use Native Language Support (default)],
1224 , enable_nls=yes)
1225 USE_NLS=no
1226
1227 dnl Set configure bits for specified locale package
1228 case x${enable_clocale_flag} in
1229 xgeneric)
1230 AC_MSG_RESULT(generic)
1231
1232 CLOCALE_H=config/locale/generic/c_locale.h
1233 CLOCALE_CC=config/locale/generic/c_locale.cc
1234 CCODECVT_H=config/locale/generic/codecvt_specializations.h
1235 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1236 CCOLLATE_CC=config/locale/generic/collate_members.cc
1237 CCTYPE_CC=config/locale/generic/ctype_members.cc
1238 CMESSAGES_H=config/locale/generic/messages_members.h
1239 CMESSAGES_CC=config/locale/generic/messages_members.cc
1240 CMONEY_CC=config/locale/generic/monetary_members.cc
1241 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1242 CTIME_CC=config/locale/generic/time_members.cc
1243 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1244 ;;
1245 xgnu)
1246 AC_MSG_RESULT(gnu)
1247
1248 # Declare intention to use gettext, and add support for specific
1249 # languages.
1250 # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
1251 ALL_LINGUAS="de fr"
1252
1253 # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
1254 AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
1255 if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
1256 USE_NLS=yes
1257 fi
1258 # Export the build objects.
1259 for ling in $ALL_LINGUAS; do \
1260 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
1261 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
1262 done
1263 AC_SUBST(glibcpp_MOFILES)
1264 AC_SUBST(glibcpp_POFILES)
1265
1266 CLOCALE_H=config/locale/gnu/c_locale.h
1267 CLOCALE_CC=config/locale/gnu/c_locale.cc
1268 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1269 CCODECVT_CC=config/locale/gnu/codecvt_members.cc
1270 CCOLLATE_CC=config/locale/gnu/collate_members.cc
1271 CCTYPE_CC=config/locale/gnu/ctype_members.cc
1272 CMESSAGES_H=config/locale/gnu/messages_members.h
1273 CMESSAGES_CC=config/locale/gnu/messages_members.cc
1274 CMONEY_CC=config/locale/gnu/monetary_members.cc
1275 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1276 CTIME_CC=config/locale/gnu/time_members.cc
1277 CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
1278 ;;
1279 xieee_1003.1-2001)
1280 AC_MSG_RESULT(generic)
1281
1282 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1283 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
1284 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1285 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1286 CCOLLATE_CC=config/locale/generic/collate_members.cc
1287 CCTYPE_CC=config/locale/generic/ctype_members.cc
1288 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1289 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1290 CMONEY_CC=config/locale/generic/monetary_members.cc
1291 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1292 CTIME_CC=config/locale/generic/time_members.cc
1293 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1294 ;;
1295 *)
1296 echo "$enable_clocale is an unknown locale package" 1>&2
1297 exit 1
1298 ;;
1299 esac
1300
1301 # This is where the testsuite looks for locale catalogs, using the
1302 # -DLOCALEDIR define during testsuite compilation.
1303 glibcpp_localedir=${glibcpp_builddir}/po/share/locale
1304 AC_SUBST(glibcpp_localedir)
1305
1306 # For the time being, transform ctype_noninline.h to ctype_members_char.cc
1307 # CCTYPE_CHAR_CC=config/${os_include_dir}/ctype_noninline.h
1308
1309 AC_SUBST(USE_NLS)
1310 AC_SUBST(CLOCALE_H)
1311 AC_SUBST(CCODECVT_H)
1312 AC_SUBST(CMESSAGES_H)
1313 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1314 AC_LINK_FILES($CCODECVT_CC, src/codecvt_members.cc)
1315 AC_LINK_FILES($CCOLLATE_CC, src/collate_members.cc)
1316 # AC_LINK_FILES($CCTYPE_CHAR_CC, src/ctype_members_char.cc)
1317 AC_LINK_FILES($CCTYPE_CC, src/ctype_members.cc)
1318 AC_LINK_FILES($CMESSAGES_CC, src/messages_members.cc)
1319 AC_LINK_FILES($CMONEY_CC, src/monetary_members.cc)
1320 AC_LINK_FILES($CNUMERIC_CC, src/numeric_members.cc)
1321 AC_LINK_FILES($CTIME_CC, src/time_members.cc)
1322 AC_LINK_FILES($CLOCALE_INTERNAL_H, src/c++locale_internal.h)
1323 ])
1324
1325
1326 dnl
1327 dnl Check for which I/O library to use: libio, or something specific.
1328 dnl
1329 dnl GLIBCPP_ENABLE_CSTDIO
1330 dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
1331 dnl
1332 dnl default is stdio
1333 dnl
1334 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1335 AC_MSG_CHECKING([for cstdio to use])
1336 AC_ARG_ENABLE(cstdio,
1337 [ --enable-cstdio enable stdio for target io package.
1338 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1339 ],
1340 if test x$enable_cstdio = xno; then
1341 enable_cstdio=stdio
1342 fi,
1343 enable_cstdio=stdio)
1344
1345 enable_cstdio_flag=$enable_cstdio
1346
1347 dnl Check if a valid I/O package
1348 case x${enable_cstdio_flag} in
1349 xlibio)
1350 CSTDIO_H=config/io/c_io_libio.h
1351 BASIC_FILE_H=config/io/basic_file_libio.h
1352 BASIC_FILE_CC=config/io/basic_file_libio.cc
1353 AC_MSG_RESULT(libio)
1354
1355 # see if we are on a system with libio native (ie, linux)
1356 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1357
1358 # Need to check and see what version of glibc is being used. If
1359 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1360 # compile most of libio for linux systems.
1361 if test x$has_libio = x"yes"; then
1362 case "$target" in
1363 *-*-linux*)
1364 AC_MSG_CHECKING([for glibc version >= 2.2])
1365 AC_EGREP_CPP([ok], [
1366 #include <features.h>
1367 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1368 ok
1369 #endif
1370 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1371 AC_MSG_RESULT($glibc_satisfactory)
1372 ;;
1373 esac
1374
1375 # XXX at the moment, admit defeat and force the recompilation
1376 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1377 glibc_satisfactory=no
1378
1379 if test x$glibc_satisfactory = x"yes"; then
1380 need_libio=no
1381 need_wlibio=no
1382 else
1383 need_libio=yes
1384 # bkoz XXX need to add checks to enable this
1385 # pme XXX here's a first pass at such a check
1386 if test x$enable_c_mbchar != xno; then
1387 need_wlibio=yes
1388 else
1389 need_wlibio=no
1390 fi
1391 fi
1392
1393 else
1394 # Using libio, but <libio.h> doesn't exist on the target system. . .
1395 need_libio=yes
1396 # bkoz XXX need to add checks to enable this
1397 # pme XXX here's a first pass at such a check
1398 if test x$enable_c_mbchar != xno; then
1399 need_wlibio=yes
1400 else
1401 need_wlibio=no
1402 fi
1403 fi
1404 ;;
1405 xstdio | x | xno | xnone | xyes)
1406 # default
1407 CSTDIO_H=config/io/c_io_stdio.h
1408 BASIC_FILE_H=config/io/basic_file_stdio.h
1409 BASIC_FILE_CC=config/io/basic_file_stdio.cc
1410 AC_MSG_RESULT(stdio)
1411
1412 # We're not using stdio.
1413 need_libio=no
1414 need_wlibio=no
1415 ;;
1416 *)
1417 echo "$enable_cstdio is an unknown io package" 1>&2
1418 exit 1
1419 ;;
1420 esac
1421 AC_SUBST(CSTDIO_H)
1422 AC_SUBST(BASIC_FILE_H)
1423 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1424
1425 # 2000-08-04 bkoz hack
1426 CCODECVT_C=config/io/c_io_libio_codecvt.c
1427 AC_SUBST(CCODECVT_C)
1428 # 2000-08-04 bkoz hack
1429
1430 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1431 test "$need_libio" = yes || test "$need_wlibio" = yes)
1432 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1433 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1434 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1435 libio_la=../libio/libio.la
1436 else
1437 libio_la=
1438 fi
1439 AC_SUBST(libio_la)
1440 ])
1441
1442
1443 dnl
1444 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1445 dnl We must stage the required headers so that they will be installed
1446 dnl with the library (unlike libgcc, the STL implementation is provided
1447 dnl solely within headers). Since we must not inject random user-space
1448 dnl macro names into user-provided C++ code, we first stage into <file>-in
1449 dnl and process to <file> with an output command. The reason for a two-
1450 dnl stage process here is to correctly handle $srcdir!=$objdir without
1451 dnl having to write complex code (the sed commands to clean the macro
1452 dnl namespace are complex and fragile enough as it is). We must also
1453 dnl add a relative path so that -I- is supported properly.
1454 dnl
1455 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1456 AC_MSG_CHECKING([for thread model used by GCC])
1457 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1458 AC_MSG_RESULT([$target_thread_file])
1459
1460 if test $target_thread_file != single; then
1461 AC_DEFINE(HAVE_GTHR_DEFAULT)
1462 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
1463 fi
1464
1465 glibcpp_thread_h=gthr-$target_thread_file.h
1466 AC_SUBST(glibcpp_thread_h)
1467 ])
1468
1469
1470 dnl
1471 dnl Check for exception handling support. If an explicit enable/disable
1472 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1473 dnl target may or may not support call frame exceptions.
1474 dnl
1475 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1476 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1477 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1478 dnl
1479 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1480 dnl
1481 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1482 AC_MSG_CHECKING([for exception model to use])
1483 AC_LANG_SAVE
1484 AC_LANG_CPLUSPLUS
1485 AC_ARG_ENABLE(sjlj-exceptions,
1486 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1487 [:],
1488 [dnl Botheration. Now we've got to detect the exception model.
1489 dnl Link tests against libgcc.a are problematic since -- at least
1490 dnl as of this writing -- we've not been given proper -L bits for
1491 dnl single-tree newlib and libgloss.
1492 dnl
1493 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1494 dnl conftest files before we got a change to grep them first.
1495 cat > conftest.$ac_ext << EOF
1496 [#]line __oline__ "configure"
1497 struct S { ~S(); };
1498 void bar();
1499 void foo()
1500 {
1501 S s;
1502 bar();
1503 }
1504 EOF
1505 old_CXXFLAGS="$CXXFLAGS"
1506 CXXFLAGS=-S
1507 if AC_TRY_EVAL(ac_compile); then
1508 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1509 enable_sjlj_exceptions=yes
1510 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1511 enable_sjlj_exceptions=no
1512 fi
1513 fi
1514 CXXFLAGS="$old_CXXFLAGS"
1515 rm -f conftest*])
1516 if test x$enable_sjlj_exceptions = xyes; then
1517 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1518 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1519 ac_exception_model_name=sjlj
1520 elif test x$enable_sjlj_exceptions = xno; then
1521 ac_exception_model_name="call frame"
1522 else
1523 AC_MSG_ERROR([unable to detect exception model])
1524 fi
1525 AC_LANG_RESTORE
1526 AC_MSG_RESULT($ac_exception_model_name)
1527 ])
1528
1529
1530 dnl
1531 dnl Check for libunwind exception handling support. If enabled then
1532 dnl we assume that the _Unwind_* functions that make up the Unwind ABI
1533 dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by
1534 dnl libunwind instead of libgcc and that libstdc++ has a dependency
1535 dnl on libunwind as well as libgcc.
1536 dnl
1537 dnl GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
1538 dnl --enable-libunwind-exceptions forces the use of libunwind.
1539 dnl --disable-libunwind-exceptions assumes there is no libunwind.
1540 dnl
1541 dnl Define _GLIBCPP_LIBUNWIND_EXCEPTIONS if requested.
1542 dnl
1543 AC_DEFUN(GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS, [
1544 AC_MSG_CHECKING([for use of libunwind])
1545 AC_ARG_ENABLE(libunwind-exceptions,
1546 [ --enable-libunwind-exceptions force use of libunwind for exceptions],
1547 use_libunwind_exceptions=$enableval,
1548 use_libunwind_exceptions=no)
1549 AC_MSG_RESULT($use_libunwind_exceptions)
1550 dnl Option parsed, now set things appropriately
1551 if test x"$use_libunwind_exceptions" = xyes; then
1552 LIBUNWIND_FLAG="-lunwind"
1553 else
1554 LIBUNWIND_FLAG=""
1555 fi
1556 AC_SUBST(LIBUNWIND_FLAG)
1557 ])
1558
1559 dnl
1560 dnl Check for ISO/IEC 9899:1999 "C99" support.
1561 dnl
1562 dnl GLIBCPP_ENABLE_C99
1563 dnl --enable-c99 defines _GLIBCPP_USE_C99
1564 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1565 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1566 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1567 dnl defaults to `no'.
1568 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1569 dnl
1570 dnl GLIBCPP_ENABLE_C99
1571 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1572 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1573
1574 AC_ARG_ENABLE(c99,
1575 changequote(<<, >>)dnl
1576 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1577 changequote([, ])dnl
1578 [case "$enableval" in
1579 yes) enable_c99=yes ;;
1580 no) enable_c99=no ;;
1581 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1582 esac],
1583 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1584
1585 AC_LANG_SAVE
1586 AC_LANG_CPLUSPLUS
1587
1588 # Check for the existence of <math.h> functions used if C99 is enabled.
1589 ac_c99_math=yes;
1590 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1591 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1592 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1593 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1594 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1595 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1596 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1597 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1598 AC_TRY_COMPILE([#include <math.h>],
1599 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1600 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1601 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1602 AC_TRY_COMPILE([#include <math.h>],
1603 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1604 AC_TRY_COMPILE([#include <math.h>],
1605 [isunordered(0.0,0.0);],, [ac_c99_math=no])
1606 AC_MSG_RESULT($ac_c99_math)
1607
1608 # Check for the existence in <stdio.h> of vscanf, et. al.
1609 ac_c99_stdio=yes;
1610 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1611 AC_TRY_COMPILE([#include <stdio.h>],
1612 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1613 AC_TRY_COMPILE([#include <stdio.h>
1614 #include <stdarg.h>
1615 void foo(char* fmt, ...)
1616 {va_list args; va_start(args, fmt);
1617 vfscanf(stderr, "%i", args);}],
1618 [],, [ac_c99_stdio=no])
1619 AC_TRY_COMPILE([#include <stdio.h>
1620 #include <stdarg.h>
1621 void foo(char* fmt, ...)
1622 {va_list args; va_start(args, fmt);
1623 vscanf("%i", args);}],
1624 [],, [ac_c99_stdio=no])
1625 AC_TRY_COMPILE([#include <stdio.h>
1626 #include <stdarg.h>
1627 void foo(char* fmt, ...)
1628 {va_list args; va_start(args, fmt);
1629 vsnprintf(fmt, 0, "%i", args);}],
1630 [],, [ac_c99_stdio=no])
1631 AC_TRY_COMPILE([#include <stdio.h>
1632 #include <stdarg.h>
1633 void foo(char* fmt, ...)
1634 {va_list args; va_start(args, fmt);
1635 vsscanf(fmt, "%i", args);}],
1636 [],, [ac_c99_stdio=no])
1637 AC_MSG_RESULT($ac_c99_stdio)
1638
1639 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1640 ac_c99_stdlib=yes;
1641 AC_MSG_CHECKING([for lldiv_t declaration])
1642 AC_CACHE_VAL(ac_c99_lldiv_t, [
1643 AC_TRY_COMPILE([#include <stdlib.h>],
1644 [ lldiv_t mydivt;],
1645 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1646 ])
1647 AC_MSG_RESULT($ac_c99_lldiv_t)
1648
1649 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1650 AC_TRY_COMPILE([#include <stdlib.h>],
1651 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1652 AC_TRY_COMPILE([#include <stdlib.h>],
1653 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1654 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1655 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1656 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1657 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1658 if test x"$ac_c99_lldiv_t" = x"no"; then
1659 ac_c99_stdlib=no;
1660 fi;
1661 AC_MSG_RESULT($ac_c99_stdlib)
1662
1663 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1664 # XXX the wchar.h checks should be rolled into the general C99 bits.
1665 ac_c99_wchar=yes;
1666 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1667 AC_TRY_COMPILE([#include <wchar.h>],
1668 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1669 AC_TRY_COMPILE([#include <wchar.h>],
1670 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1671 AC_TRY_COMPILE([#include <wchar.h>],
1672 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1673 AC_MSG_RESULT($ac_c99_wchar)
1674
1675 AC_MSG_CHECKING([for enabled ISO C99 support])
1676 if test x"$ac_c99_math" = x"no" ||
1677 test x"$ac_c99_stdio" = x"no" ||
1678 test x"$ac_c99_stdlib" = x"no" ||
1679 test x"$ac_c99_wchar" = x"no"; then
1680 enable_c99=no;
1681 fi;
1682 AC_MSG_RESULT($enable_c99)
1683
1684 # Option parsed, now set things appropriately
1685 if test x"$enable_c99" = x"yes"; then
1686 AC_DEFINE(_GLIBCPP_USE_C99)
1687 fi
1688
1689 AC_LANG_RESTORE
1690 ])
1691
1692
1693 dnl
1694 dnl Check for template specializations for the 'long long' type extension.
1695 dnl The result determines only whether 'long long' I/O is enabled; things
1696 dnl like numeric_limits<> specializations are always available.
1697 dnl
1698 dnl GLIBCPP_ENABLE_LONG_LONG
1699 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1700 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1701 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1702 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1703 dnl defaults to `no'.
1704 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1705 dnl
1706 dnl GLIBCPP_ENABLE_LONG_LONG
1707 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1708 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1709
1710 AC_ARG_ENABLE(long-long,
1711 changequote(<<, >>)dnl
1712 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1713 changequote([, ])dnl
1714 [case "$enableval" in
1715 yes) enable_long_long=yes ;;
1716 no) enable_long_long=no ;;
1717 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1718 esac],
1719 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1720
1721 AC_LANG_SAVE
1722 AC_LANG_CPLUSPLUS
1723
1724 AC_MSG_CHECKING([for enabled long long I/O support])
1725 # iostreams require strtoll, strtoull to compile
1726 AC_TRY_COMPILE([#include <stdlib.h>],
1727 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1728 AC_TRY_COMPILE([#include <stdlib.h>],
1729 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1730
1731 # Option parsed, now set things appropriately
1732 if test x"$enable_long_long" = xyes; then
1733 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1734 fi
1735 AC_MSG_RESULT($enable_long_long)
1736
1737 AC_LANG_RESTORE
1738 ])
1739
1740
1741 dnl
1742 dnl Check for what kind of C headers to use.
1743 dnl
1744 dnl GLIBCPP_ENABLE_CHEADERS
1745 dnl --enable-cheaders= [does stuff].
1746 dnl --disable-cheaders [does not do anything, really].
1747 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1748 dnl Where DEFAULT is either `c' or `c_std'.
1749 dnl If ommitted, it defaults to `c_std'.
1750 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1751 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1752 AC_MSG_CHECKING([for c header strategy to use])
1753 AC_ARG_ENABLE(cheaders,
1754 changequote(<<, >>)dnl
1755 << --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1756 changequote([, ])
1757 [case "$enableval" in
1758 c)
1759 enable_cheaders=c
1760 ;;
1761 c_std)
1762 enable_cheaders=c_std
1763 ;;
1764 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1765 ;;
1766 esac],
1767 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1768 AC_MSG_RESULT($enable_cheaders)
1769
1770 dnl Option parsed, now set things appropriately
1771 case "$enable_cheaders" in
1772 c_std)
1773 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
1774 ;;
1775 c)
1776 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
1777 ;;
1778 esac
1779
1780 AC_SUBST(C_INCLUDE_DIR)
1781 AM_CONDITIONAL(GLIBCPP_C_HEADERS_C, test "$enable_cheaders" = c)
1782 AM_CONDITIONAL(GLIBCPP_C_HEADERS_C_STD, test "$enable_cheaders" = c_std)
1783 AM_CONDITIONAL(GLIBCPP_C_HEADERS_COMPATIBILITY, test "$c_compatibility" = yes)
1784 ])
1785
1786
1787 dnl
1788 dnl Check for wide character support. Has the same effect as the option
1789 dnl in gcc's configure, but in a form that autoconf can mess with.
1790 dnl
1791 dnl GLIBCPP_ENABLE_C_MBCHAR
1792 dnl --enable-c-mbchar requests all the wchar_t stuff.
1793 dnl --disable-c-mbchar doesn't.
1794 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1795 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1796 dnl defaults to `no'.
1797 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1798 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1799 AC_ARG_ENABLE(c-mbchar,
1800 changequote(<<, >>)dnl
1801 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1802 changequote([, ])dnl
1803 [case "$enableval" in
1804 yes) enable_c_mbchar=yes ;;
1805 no) enable_c_mbchar=no ;;
1806 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1807 esac],
1808 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1809 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1810 ])
1811
1812
1813 dnl
1814 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1815 dnl
1816 dnl TOPLEVEL_INCLUDES
1817 dnl LIBMATH_INCLUDES
1818 dnl LIBSUPCXX_INCLUDES
1819 dnl LIBIO_INCLUDES
1820 dnl
1821 dnl GLIBCPP_EXPORT_INCLUDES
1822 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1823 # Root level of the build directory include sources.
1824 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
1825
1826 # Passed down for canadian crosses.
1827 if test x"$CANADIAN" = xyes; then
1828 TOPLEVEL_INCLUDES='-I$(includedir)'
1829 fi
1830
1831 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1832
1833 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1834
1835 if test x"$need_libio" = xyes; then
1836 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1837 AC_SUBST(LIBIO_INCLUDES)
1838 fi
1839
1840 # Now, export this to all the little Makefiles....
1841 AC_SUBST(GLIBCPP_INCLUDES)
1842 AC_SUBST(TOPLEVEL_INCLUDES)
1843 AC_SUBST(LIBMATH_INCLUDES)
1844 AC_SUBST(LIBSUPCXX_INCLUDES)
1845 ])
1846
1847
1848 dnl
1849 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1850 dnl
1851 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1852 # Optimization flags that are probably a good idea for thrill-seekers. Just
1853 # uncomment the lines below and make, everything else is ready to go...
1854 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1855 OPTIMIZE_CXXFLAGS=
1856 AC_SUBST(OPTIMIZE_CXXFLAGS)
1857
1858 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1859 AC_SUBST(WARN_FLAGS)
1860 ])
1861
1862 dnl
1863 dnl GLIBCPP_EXPORT_INSTALL_INFO
1864 dnl calculates gxx_install_dir
1865 dnl exports glibcpp_toolexecdir
1866 dnl exports glibcpp_toolexeclibdir
1867 dnl exports glibcpp_prefixdir
1868 dnl
1869 dnl Assumes cross_compiling bits already done, and with_cross_host in
1870 dnl particular
1871 dnl
1872 dnl GLIBCPP_EXPORT_INSTALL_INFO
1873 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1874 # Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
1875 # exported correctly in GLIBCPP_CONFIGURE.
1876 glibcpp_toolexecdir=no
1877 glibcpp_toolexeclibdir=no
1878 glibcpp_prefixdir=${prefix}
1879
1880 # Process the option --with-gxx-include-dir=<path to include-files directory>
1881 AC_MSG_CHECKING([for --with-gxx-include-dir])
1882 AC_ARG_WITH(gxx-include-dir,
1883 [ --with-gxx-include-dir the installation directory for include files],
1884 [case "${withval}" in
1885 yes)
1886 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1887 gxx_include_dir=no
1888 ;;
1889 no)
1890 gxx_include_dir=no
1891 ;;
1892 *)
1893 gxx_include_dir=${withval}
1894 ;;
1895 esac], [gxx_include_dir=no])
1896 AC_MSG_RESULT($gxx_include_dir)
1897
1898 # Process the option "--enable-version-specific-runtime-libs"
1899 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1900 AC_ARG_ENABLE(version-specific-runtime-libs,
1901 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1902 [case "$enableval" in
1903 yes) version_specific_libs=yes ;;
1904 no) version_specific_libs=no ;;
1905 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1906 esac],
1907 version_specific_libs=no)dnl
1908 # Option set, now we can test it.
1909 AC_MSG_RESULT($version_specific_libs)
1910
1911 # Default case for install directory for include files.
1912 if test $version_specific_libs = no && test $gxx_include_dir = no; then
1913 gxx_include_dir='$(prefix)'/include/c++/${gcc_version}
1914 fi
1915
1916 # Version-specific runtime libs processing.
1917 if test $version_specific_libs = yes; then
1918 # Need the gcc compiler version to know where to install libraries
1919 # and header files if --enable-version-specific-runtime-libs option
1920 # is selected.
1921 if test x"$gxx_include_dir" = x"no"; then
1922 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/c++
1923 fi
1924 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1925 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1926 fi
1927
1928 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1929 # Install a library built with a cross compiler in tooldir, not libdir.
1930 if test x"$glibcpp_toolexecdir" = x"no"; then
1931 if test -n "$with_cross_host" &&
1932 test x"$with_cross_host" != x"no"; then
1933 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1934 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1935 else
1936 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1937 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1938 fi
1939 fi
1940
1941 AC_MSG_CHECKING([for install location])
1942 AC_MSG_RESULT($gxx_include_dir)
1943
1944 AC_SUBST(glibcpp_prefixdir)
1945 AC_SUBST(gxx_include_dir)
1946 AC_SUBST(glibcpp_toolexecdir)
1947 AC_SUBST(glibcpp_toolexeclibdir)
1948 ])
1949
1950
1951 # Check for functions in math library.
1952 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1953 #
1954 # This file can be copied and used freely without restrictions. It can
1955 # be used in projects which are not available under the GNU Public License
1956 # but which still want to provide support for the GNU gettext functionality.
1957 # Please note that the actual code is *not* freely available.
1958
1959 # serial 1
1960
1961 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1962 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1963 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])])
1964
1965
1966 dnl This macro searches for a GNU version of make. If a match is found, the
1967 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1968 dnl set to "#". This is useful for including a special features in a Makefile,
1969 dnl which cannot be handled by other versions of make. The variable
1970 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1971 dnl the empty string otherwise.
1972 dnl
1973 dnl Here is an example of its use:
1974 dnl
1975 dnl Makefile.in might contain:
1976 dnl
1977 dnl # A failsafe way of putting a dependency rule into a makefile
1978 dnl $(DEPEND):
1979 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1980 dnl
1981 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1982 dnl @ifGNUmake@ include $(DEPEND)
1983 dnl @ifGNUmake@ endif
1984 dnl
1985 dnl Then configure.in would normally contain:
1986 dnl
1987 dnl CHECK_GNU_MAKE()
1988 dnl AC_OUTPUT(Makefile)
1989 dnl
1990 dnl Then perhaps to cause gnu make to override any other make, we could do
1991 dnl something like this (note that GNU make always looks for GNUmakefile first):
1992 dnl
1993 dnl if ! test x$_cv_gnu_make_command = x ; then
1994 dnl mv Makefile GNUmakefile
1995 dnl echo .DEFAULT: > Makefile ;
1996 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1997 dnl fi
1998 dnl
1999 dnl Then, if any (well almost any) other make is called, and GNU make also
2000 dnl exists, then the other make wraps the GNU make.
2001 dnl
2002 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
2003 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
2004 dnl
2005 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
2006 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
2007 dnl #### conditional's subshell (" --version" is not a command), using a
2008 dnl #### different option to grep(1).
2009 dnl #### -pme
2010 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
2011 dnl #### ${MAKE:-make}).
2012 dnl #### -msokolov
2013 AC_DEFUN(
2014 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
2015 _cv_gnu_make_command='' ;
2016 dnl Search all the common names for GNU make
2017 for a in "${MAKE-make}" make gmake gnumake ; do
2018 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
2019 then
2020 _cv_gnu_make_command=$a ;
2021 break;
2022 fi
2023 done ;
2024 ) ;
2025 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
2026 dnl string, '#' otherwise
2027 if test "x$_cv_gnu_make_command" != "x" ; then
2028 ifGNUmake='' ;
2029 else
2030 ifGNUmake='#' ;
2031 fi
2032 AC_SUBST(ifGNUmake)
2033 ])
2034
2035
2036 dnl Check for headers for, and arguments to, the setrlimit() function.
2037 dnl Used only in testsuite_hooks.h.
2038 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
2039 AC_TRY_COMPILE([#include <unistd.h>
2040 #include <sys/time.h>
2041 #include <sys/resource.h>
2042 ], [ int f = RLIMIT_$1 ; ],
2043 [glibcpp_mresult=1], [glibcpp_mresult=0])
2044 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
2045 [Only used in build directory testsuite_hooks.h.])
2046 ])
2047 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
2048 setrlimit_have_headers=yes
2049 AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
2050 [],
2051 setrlimit_have_headers=no)
2052 # If don't have the headers, then we can't run the tests now, and we
2053 # won't be seeing any of these during testsuite compilation.
2054 if test $setrlimit_have_headers = yes; then
2055 # Can't do these in a loop, else the resulting syntax is wrong.
2056 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
2057 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
2058 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
2059 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
2060
2061 # Check for rlimit, setrlimit.
2062 AC_CACHE_VAL(ac_setrlimit, [
2063 AC_TRY_COMPILE([#include <unistd.h>
2064 #include <sys/time.h>
2065 #include <sys/resource.h>
2066 ],
2067 [ struct rlimit r; setrlimit(0, &r);],
2068 [ac_setrlimit=yes], [ac_setrlimit=no])
2069 ])
2070 fi
2071
2072 AC_MSG_CHECKING([for testsuite memory limit support])
2073 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
2074 ac_mem_limits=yes
2075 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
2076 else
2077 ac_mem_limits=no
2078 fi
2079 AC_MSG_RESULT($ac_mem_limits)
2080 ])
2081
2082
2083 dnl
2084 dnl Does any necessary configuration of the testsuite directory. Generates
2085 dnl the testsuite_hooks.h header.
2086 dnl
2087 dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
2088 AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
2089 GLIBCPP_CHECK_SETRLIMIT
2090
2091 # Look for setenv, so that extended locale tests can be performed.
2092 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
2093
2094 # Export file names for ABI checking.
2095 baseline_file="${glibcpp_srcdir}/config/abi/${abi_baseline_triplet}/baseline_symbols.txt"
2096 AC_SUBST(baseline_file)
2097
2098 # Don't do ABI checking unless native.
2099 AM_CONDITIONAL(GLIBCPP_BUILD_ABI_CHECK,
2100 test x"$build" = x"$host" && test -z "$with_cross_host")
2101 ])
2102
2103
2104 sinclude(../libtool.m4)
2105 dnl The lines below arrange for aclocal not to bring an installed
2106 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
2107 dnl add a definition of LIBTOOL to Makefile.in.
2108 ifelse(,,,[AC_SUBST(LIBTOOL)
2109 AC_DEFUN([AM_PROG_LIBTOOL])
2110 AC_DEFUN([AC_LIBTOOL_DLOPEN])
2111 AC_DEFUN([AC_PROG_LD])
2112 ])
2113
2114
2115 # Check whether LC_MESSAGES is available in <locale.h>.
2116 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2117 #
2118 # This file file be copied and used freely without restrictions. It can
2119 # be used in projects which are not available under the GNU Public License
2120 # but which still want to provide support for the GNU gettext functionality.
2121 # Please note that the actual code is *not* freely available.
2122
2123 # serial 1
2124
2125 AC_DEFUN(AC_LC_MESSAGES, [
2126 AC_CHECK_HEADER(locale.h, [
2127 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
2128 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2129 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
2130 if test $ac_cv_val_LC_MESSAGES = yes; then
2131 AC_DEFINE(HAVE_LC_MESSAGES)
2132 fi
2133 ])
2134 ])
2135
2136
2137 dnl
2138 dnl Check for whether the Boost-derived checks should be turned on.
2139 dnl
2140 dnl GLIBCPP_ENABLE_CONCEPT_CHECKS
2141 dnl --enable-concept-checks turns them on.
2142 dnl --disable-concept-checks leaves them off.
2143 dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2144 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2145 dnl defaults to `no'.
2146 AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl
2147 define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl
2148 AC_ARG_ENABLE(concept-checks,
2149 changequote(<<, >>)dnl
2150 << --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT],
2151 changequote([, ])dnl
2152 [case "$enableval" in
2153 yes) enable_concept_checks=yes ;;
2154 no) enable_concept_checks=no ;;
2155 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;;
2156 esac],
2157 enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl
2158 dnl Option parsed, now set things appropriately
2159 if test x"$enable_concept_checks" = xyes; then
2160 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS)
2161 fi
2162 ])
2163
2164
2165 dnl
2166 dnl Add version tags to symbols in shared library (or not), additionally
2167 dnl marking other symbols as private/local (or not).
2168 dnl
2169 dnl GLIBCPP_ENABLE_SYMVERS
2170 dnl --enable-symvers=style adds a version script to the linker call when
2171 dnl creating the shared library. The choice of version script is
2172 dnl controlled by 'style'.
2173 dnl --disable-symvers does not.
2174 dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)]
2175 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2176 dnl defaults to `no'. Passing `yes' tries to choose a default style
2177 dnl based on linker characteristics. Passing 'no' disables versioning.
2178 AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl
2179 define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
2180 AC_ARG_ENABLE(symvers,
2181 changequote(<<, >>)dnl
2182 << --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT],
2183 changequote([, ])dnl
2184 [case "$enableval" in
2185 yes) enable_symvers=yes ;;
2186 no) enable_symvers=no ;;
2187 # other names here, just as sanity checks
2188 #gnu|sun|etcetera) enable_symvers=$enableval ;;
2189 gnu) enable_symvers=$enableval ;;
2190 *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;;
2191 esac],
2192 enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
2193
2194 # If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
2195 # don't know enough about $LD to do tricks...
2196 if test x$enable_shared = xno ||
2197 test "x$LD" = x ||
2198 test x$glibcpp_gnu_ld_version = x; then
2199 enable_symvers=no
2200 fi
2201
2202 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2203 if test $enable_symvers != no; then
2204 AC_MSG_CHECKING([for shared libgcc])
2205 ac_save_CFLAGS="$CFLAGS"
2206 CFLAGS=' -lgcc_s'
2207 AC_TRY_LINK(, [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
2208 CFLAGS="$ac_save_CFLAGS"
2209 AC_MSG_RESULT($glibcpp_shared_libgcc)
2210 fi
2211
2212 # For GNU ld, we need at least this version. It's 2.12 in the same format
2213 # as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more.
2214 glibcpp_min_gnu_ld_version=21200
2215
2216 # Check to see if unspecified "yes" value can win, given results
2217 # above.
2218 if test $enable_symvers = yes ; then
2219 if test $with_gnu_ld = yes &&
2220 test $glibcpp_shared_libgcc = yes ;
2221 then
2222 if test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ; then
2223 enable_symvers=gnu
2224 else
2225 ac_test_CFLAGS="${CFLAGS+set}"
2226 ac_save_CFLAGS="$CFLAGS"
2227 CFLAGS='-shared -Wl,--version-script,conftest.map'
2228 enable_symvers=no
2229 changequote(,)
2230 echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map
2231 changequote([,])
2232 AC_TRY_LINK([int foo;],, enable_symvers=gnu)
2233 if test "$ac_test_CFLAGS" = set; then
2234 CFLAGS="$ac_save_CFLAGS"
2235 else
2236 # this is the suspicious part
2237 CFLAGS=''
2238 fi
2239 rm -f conftest.map
2240 fi
2241 else
2242 # just fail for now
2243 enable_symvers=no
2244 fi
2245 fi
2246
2247 dnl Everything parsed; figure out what file to use.
2248 case $enable_symvers in
2249 no)
2250 LINKER_MAP=config/linker-map.dummy
2251 ;;
2252 gnu)
2253 LINKER_MAP=config/linker-map.gnu
2254 AC_DEFINE(_GLIBCPP_SYMVER)
2255 ;;
2256 esac
2257
2258 AC_LINK_FILES($LINKER_MAP, src/linker.map)
2259 AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
2260 AC_MSG_CHECKING([versioning on shared library symbols])
2261 AC_MSG_RESULT($enable_symvers)
2262 ])
2263
2264
2265 # Add --enable-maintainer-mode option to configure.
2266 # From Jim Meyering
2267
2268 # serial 1
2269
2270 AC_DEFUN([AM_MAINTAINER_MODE],
2271 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2272 dnl maintainer-mode is disabled by default
2273 AC_ARG_ENABLE(maintainer-mode,
2274 [ --enable-maintainer-mode enable make rules and dependencies not useful
2275 (and sometimes confusing) to the casual installer],
2276 USE_MAINTAINER_MODE=$enableval,
2277 USE_MAINTAINER_MODE=no)
2278 AC_MSG_RESULT($USE_MAINTAINER_MODE)
2279 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
2280 MAINT=$MAINTAINER_MODE_TRUE
2281 AC_SUBST(MAINT)dnl
2282 ]
2283 )
2284
2285 # Define a conditional.
2286
2287 AC_DEFUN([AM_CONDITIONAL],
2288 [AC_SUBST($1_TRUE)
2289 AC_SUBST($1_FALSE)
2290 if $2; then
2291 $1_TRUE=
2292 $1_FALSE='#'
2293 else
2294 $1_TRUE='#'
2295 $1_FALSE=
2296 fi])
2297
2298 # Do all the work for Automake. This macro actually does too much --
2299 # some checks are only needed if your package does certain things.
2300 # But this isn't really a big deal.
2301
2302 # serial 1
2303
2304 dnl Usage:
2305 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
2306
2307 AC_DEFUN([AM_INIT_AUTOMAKE],
2308 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2309 AC_REQUIRE([AC_PROG_INSTALL])
2310 PACKAGE=[$1]
2311 AC_SUBST(PACKAGE)
2312 VERSION=[$2]
2313 AC_SUBST(VERSION)
2314 dnl test to see if srcdir already configured
2315 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
2316 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2317 fi
2318 ifelse([$3],,
2319 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
2320 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
2321 AC_REQUIRE([AM_SANITY_CHECK])
2322 AC_REQUIRE([AC_ARG_PROGRAM])
2323 dnl FIXME This is truly gross.
2324 missing_dir=`cd $ac_aux_dir && pwd`
2325 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
2326 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
2327 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
2328 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
2329 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
2330 AC_REQUIRE([AC_PROG_MAKE_SET])])
2331
2332 # Copyright 2002 Free Software Foundation, Inc.
2333
2334 # This program is free software; you can redistribute it and/or modify
2335 # it under the terms of the GNU General Public License as published by
2336 # the Free Software Foundation; either version 2, or (at your option)
2337 # any later version.
2338
2339 # This program is distributed in the hope that it will be useful,
2340 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2341 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2342 # GNU General Public License for more details.
2343
2344 # You should have received a copy of the GNU General Public License
2345 # along with this program; if not, write to the Free Software
2346 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2347
2348 # AM_AUTOMAKE_VERSION(VERSION)
2349 # ----------------------------
2350 # Automake X.Y traces this macro to ensure aclocal.m4 has been
2351 # generated from the m4 files accompanying Automake X.Y.
2352 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
2353
2354 # AM_SET_CURRENT_AUTOMAKE_VERSION
2355 # -------------------------------
2356 # Call AM_AUTOMAKE_VERSION so it can be traced.
2357 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
2358 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2359 [AM_AUTOMAKE_VERSION([1.4-p6])])
2360
2361 #
2362 # Check to make sure that the build environment is sane.
2363 #
2364
2365 AC_DEFUN([AM_SANITY_CHECK],
2366 [AC_MSG_CHECKING([whether build environment is sane])
2367 # Just in case
2368 sleep 1
2369 echo timestamp > conftestfile
2370 # Do `set' in a subshell so we don't clobber the current shell's
2371 # arguments. Must try -L first in case configure is actually a
2372 # symlink; some systems play weird games with the mod time of symlinks
2373 # (eg FreeBSD returns the mod time of the symlink's containing
2374 # directory).
2375 if (
2376 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
2377 if test "[$]*" = "X"; then
2378 # -L didn't work.
2379 set X `ls -t $srcdir/configure conftestfile`
2380 fi
2381 if test "[$]*" != "X $srcdir/configure conftestfile" \
2382 && test "[$]*" != "X conftestfile $srcdir/configure"; then
2383
2384 # If neither matched, then we have a broken ls. This can happen
2385 # if, for instance, CONFIG_SHELL is bash and it inherits a
2386 # broken ls alias from the environment. This has actually
2387 # happened. Such a system could not be considered "sane".
2388 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
2389 alias in your environment])
2390 fi
2391
2392 test "[$]2" = conftestfile
2393 )
2394 then
2395 # Ok.
2396 :
2397 else
2398 AC_MSG_ERROR([newly created file is older than distributed files!
2399 Check your system clock])
2400 fi
2401 rm -f conftest*
2402 AC_MSG_RESULT(yes)])
2403
2404 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
2405 dnl The program must properly implement --version.
2406 AC_DEFUN([AM_MISSING_PROG],
2407 [AC_MSG_CHECKING(for working $2)
2408 # Run test in a subshell; some versions of sh will print an error if
2409 # an executable is not found, even if stderr is redirected.
2410 # Redirect stdin to placate older versions of autoconf. Sigh.
2411 if ($2 --version) < /dev/null > /dev/null 2>&1; then
2412 $1=$2
2413 AC_MSG_RESULT(found)
2414 else
2415 $1="$3/missing $2"
2416 AC_MSG_RESULT(missing)
2417 fi
2418 AC_SUBST($1)])
2419
2420 # Like AC_CONFIG_HEADER, but automatically create stamp file.
2421
2422 AC_DEFUN([AM_CONFIG_HEADER],
2423 [AC_PREREQ([2.12])
2424 AC_CONFIG_HEADER([$1])
2425 dnl When config.status generates a header, we must update the stamp-h file.
2426 dnl This file resides in the same directory as the config header
2427 dnl that is generated. We must strip everything past the first ":",
2428 dnl and everything past the last "/".
2429 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
2430 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
2431 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
2432 <<am_indx=1
2433 for am_file in <<$1>>; do
2434 case " <<$>>CONFIG_HEADERS " in
2435 *" <<$>>am_file "*<<)>>
2436 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
2437 ;;
2438 esac
2439 am_indx=`expr "<<$>>am_indx" + 1`
2440 done<<>>dnl>>)
2441 changequote([,]))])
2442