]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/aclocal.m4
genattrtab.c: Don't handle MATCH_INSN.
[thirdparty/gcc.git] / libstdc++-v3 / aclocal.m4
CommitLineData
2c5d0ae8 1# generated automatically by aclocal 1.7.8 -*- Autoconf -*-
b2dad0e3 2
ff66d28f
PE
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4# Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
b2dad0e3 8
ff66d28f
PE
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14
92eabea2
PE
15dnl
16dnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST)
17dnl
18dnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the
19dnl end of configure. This lets tested variables be reassigned, and the
20dnl conditional will depend on the final state of the variable. For a simple
21dnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED.
22dnl
23m4_define([_m4_divert(glibcxx_diversion)], 8000)dnl
f214923c 24AC_DEFUN([GLIBCXX_CONDITIONAL], [dnl
92eabea2
PE
25 m4_divert_text([glibcxx_diversion],dnl
26 AM_CONDITIONAL([$1],[$2])
27 )dnl
28])dnl
f214923c 29AC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl
92eabea2
PE
30
31
ff66d28f
PE
32dnl
33dnl Check to see what architecture and operating system we are compiling
34dnl for. Also, if architecture- or OS-specific flags are required for
35dnl compilation, pick them up here.
36dnl
f214923c 37AC_DEFUN([GLIBCXX_CHECK_HOST], [
ff66d28f 38 . $glibcxx_srcdir/configure.host
f214923c
BK
39 AC_MSG_NOTICE([CPU config directory is $cpu_include_dir])
40 AC_MSG_NOTICE([OS config directory is $os_include_dir])
ff66d28f 41])
b2dad0e3 42
ff66d28f
PE
43
44dnl
45dnl Initialize basic configure bits.
b2dad0e3 46dnl
ff66d28f
PE
47dnl Substs:
48dnl multi_basedir
b2dad0e3 49dnl
f214923c 50AC_DEFUN([GLIBCXX_TOPREL_CONFIGURE], [
ff66d28f
PE
51 # Sets up multi_basedir, which is srcdir/.. plus the usual
52 # "multi_source_toprel_bottom_adjust" lunacy as needed.
53 AM_ENABLE_MULTILIB(, ..)
54
55 # The generated code is exactly the same, except that automake's looks in
56 # ".. $srcdir/.." and autoconf's looks in multi_basedir. Apparently other
57 # things are triggered on the presence of the two ...AUX_DIR[S], but I don't
58 # know what they are or what the other differences might be (and they keep
59 # changing anyhow).
60 #
61 # Looking in multi_basedir seems smarter, so actually execute that branch.
62 if false; then
63 # this is for automake
64 AC_CONFIG_AUX_DIR(..)
d2caef2e 65 else
ff66d28f
PE
66 # this is for autoconf
67 AC_CONFIG_AUX_DIRS(${multi_basedir})
33590f13 68 fi
ff66d28f
PE
69
70 dnl XXX Turn this on.
71 dnl AC_LANG_CPLUSPLUS
aebb8c22
DD
72])
73
ff66d28f 74
aebb8c22 75dnl
ff66d28f
PE
76dnl Initialize the rest of the library configury. At this point we have
77dnl variables like $host.
78dnl
79dnl Sets:
80dnl gcc_version (x.y.z format)
82ba99d5 81dnl SUBDIRS
ff66d28f
PE
82dnl Substs:
83dnl glibcxx_builddir (absolute path)
84dnl glibcxx_srcdir (absolute path)
85dnl toplevel_srcdir (absolute path)
86dnl with_cross_host
87dnl with_newlib
88dnl with_target_subdir
89dnl plus
90dnl - the variables in GLIBCXX_CHECK_HOST / configure.host
91dnl - default settings for all AM_CONFITIONAL test variables
92dnl - lots of tools, like CC and CXX
aebb8c22 93dnl
f214923c 94AC_DEFUN([GLIBCXX_CONFIGURE], [
82ba99d5
PE
95 # Keep these sync'd with the list in Makefile.am. The first provides an
96 # expandable list at autoconf time; the second provides an expandable list
97 # (i.e., shell variable) at configure time.
98 m4_define([glibcxx_SUBDIRS],[include libmath libsupc++ src po testsuite])
99 SUBDIRS='glibcxx_SUBDIRS'
100
d2caef2e
PE
101 # These need to be absolute paths, yet at the same time need to
102 # canonicalize only relative paths, because then amd will not unmount
103 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
3d7c150e 104 glibcxx_builddir=`${PWDCMD-pwd}`
d2caef2e 105 case $srcdir in
ff66d28f
PE
106 [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;;
107 *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
d2caef2e 108 esac
ff66d28f 109 toplevel_srcdir=${glibcxx_srcdir}/..
3d7c150e
BK
110 AC_SUBST(glibcxx_builddir)
111 AC_SUBST(glibcxx_srcdir)
ff66d28f 112 AC_SUBST(toplevel_srcdir)
33590f13 113
ff66d28f
PE
114 # We use these options to decide which functions to include. They are
115 # set from the top level.
116 AC_ARG_WITH([target-subdir],
117 AC_HELP_STRING([--with-target-subdir=SUBDIR],
118 [configuring in a subdirectory]))
119
120 AC_ARG_WITH([cross-host],
121 AC_HELP_STRING([--with-cross-host=HOST],
122 [configuring with a cross compiler]))
123
124 AC_ARG_WITH([newlib],
125 AC_HELP_STRING([--with-newlib],
126 [assume newlib as a system C library]))
127
ff66d28f
PE
128 # We're almost certainly being configured before anything else which uses
129 # C++, so all of our AC_PROG_* discoveries will be cached. It's vital that
130 # we not cache the value of CXX that we "discover" here, because it's set
131 # to something unique for us and libjava. Other target libraries need to
132 # find CXX for themselves. We yank the rug out from under the normal AC_*
133 # process by sneakily renaming the cache variable. This also lets us debug
134 # the value of "our" CXX in postmortems.
135 #
136 # We must also force CXX to /not/ be a precious variable, otherwise the
137 # wrong (non-multilib-adjusted) value will be used in multilibs. This
138 # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side
139 # effect, CXXFLAGS is no longer automagically subst'd, so we have to do
f6dda651 140 # that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
ff66d28f
PE
141 #
142 # -fno-builtin must be present here so that a non-conflicting form of
143 # std::exit can be guessed by AC_PROG_CXX, and used in later tests.
fbe057bb 144
ff66d28f
PE
145 m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
146 m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
147 m4_define([_AC_ARG_VAR_PRECIOUS],[])
148 save_CXXFLAGS="$CXXFLAGS"
149 CXXFLAGS="$CXXFLAGS -fno-builtin"
f6dda651 150 AC_PROG_CC
ff66d28f
PE
151 AC_PROG_CXX
152 CXXFLAGS="$save_CXXFLAGS"
153 m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
f6dda651 154 AC_SUBST(CFLAGS)
ff66d28f 155 AC_SUBST(CXXFLAGS)
b2dad0e3 156
2f235b6d
PE
157 # For directory versioning (e.g., headers) and other variables.
158 AC_MSG_CHECKING([for GCC version number])
ff66d28f 159 gcc_version=`$CXX -dumpversion`
2f235b6d
PE
160 AC_MSG_RESULT($gcc_version)
161
ff66d28f
PE
162 # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
163 # available). Uncomment the next line to force a particular method.
164 AC_PROG_LN_S
165 #LN_S='cp -p'
166
5780a46b
BK
167 AC_CHECK_TOOL(AS, as)
168 AC_CHECK_TOOL(AR, ar)
46840bcd 169 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
b2dad0e3 170
5780a46b 171 AM_MAINTAINER_MODE
b2dad0e3 172
92eabea2
PE
173 # Set up safe default values for all subsequent AM_CONDITIONAL tests
174 # which are themselves conditionally expanded.
175 ## (Right now, this only matters for enable_wchar_t, but nothing prevents
176 ## other macros from doing the same. This should be automated.) -pme
16da539b
PE
177 need_libmath=no
178 enable_wchar_t=no
ff66d28f
PE
179 #enable_libstdcxx_debug=no
180 #enable_libstdcxx_pch=no
16da539b
PE
181 #enable_cheaders=c
182 #c_compatibility=no
c4c064e7 183 #enable_abi_check=no
16da539b 184 #enable_symvers=no
92eabea2 185 #enable_hosted_libstdcxx=yes
16da539b 186
ff66d28f
PE
187 # Find platform-specific directories containing configuration info.
188 # Also possibly modify flags used elsewhere, as needed by the platform.
3d7c150e 189 GLIBCXX_CHECK_HOST
b2dad0e3
BK
190])
191
192
ff66d28f 193m4_include([linkage.m4])
72730fdb 194m4_include([../config/no-executables.m4])
c470c17d
BK
195
196
197dnl
52b55e7d
PE
198dnl Tests for newer compiler features, or features that are present in newer
199dnl compiler versions but not older compiler versions still in use, should
200dnl be placed here.
b2dad0e3 201dnl
ff66d28f
PE
202dnl Defines:
203dnl WERROR='-Werror' if requested and possible; g++'s that lack the
204dnl new inlining code or the new system_header pragma will die on -Werror.
205dnl Leave it out by default and use maint-mode to use it.
206dnl SECTION_FLAGS='-ffunction-sections -fdata-sections' if
207dnl compiler supports it and the user has not requested debug mode.
b2dad0e3 208dnl
f214923c 209AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [
a4e99046 210 # All these tests are for C++; save the language and the compiler flags.
52b55e7d 211 # The CXXFLAGS thing is suspicious, but based on similar bits previously
3d7c150e 212 # found in GLIBCXX_CONFIGURE.
a4e99046
PE
213 AC_LANG_SAVE
214 AC_LANG_CPLUSPLUS
215 ac_test_CXXFLAGS="${CXXFLAGS+set}"
216 ac_save_CXXFLAGS="$CXXFLAGS"
a4e99046 217
7f586614
BK
218 # Check for maintainer-mode bits.
219 if test x"$USE_MAINTAINER_MODE" = xno; then
220 WERROR=''
8bd636c5 221 else
7f586614 222 WERROR='-Werror'
8bd636c5
PE
223 fi
224
c470c17d
BK
225 # Check for -ffunction-sections -fdata-sections
226 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
0517cb99 227 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
ff66d28f 228 AC_TRY_COMPILE(, [int foo;], [ac_fdsections=yes], [ac_fdsections=no])
c470c17d
BK
229 if test "$ac_test_CXXFLAGS" = set; then
230 CXXFLAGS="$ac_save_CXXFLAGS"
231 else
232 # this is the suspicious part
233 CXXFLAGS=''
234 fi
6aa43d99 235 if test x"$ac_fdsections" = x"yes"; then
c470c17d
BK
236 SECTION_FLAGS='-ffunction-sections -fdata-sections'
237 fi
238 AC_MSG_RESULT($ac_fdsections)
239
a4e99046 240 AC_LANG_RESTORE
8bd636c5 241 AC_SUBST(WERROR)
c470c17d 242 AC_SUBST(SECTION_FLAGS)
b2dad0e3
BK
243])
244
c470c17d
BK
245
246dnl
421173e6
PE
247dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
248dnl the native linker is in use, all variables will be defined to something
249dnl safe (like an empty string).
250dnl
ff66d28f
PE
251dnl Defines:
252dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
253dnl OPT_LDFLAGS='-Wl,-O1' if possible
254dnl LD (as a side effect of testing)
255dnl Sets:
256dnl with_gnu_ld
257dnl glibcxx_gnu_ld_version (possibly)
258dnl
259dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
260dnl set glibcxx_gnu_ld_version to 12345. Zeros cause problems.
c470c17d 261dnl
f214923c 262AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [
421173e6
PE
263 # If we're not using GNU ld, then there's no point in even trying these
264 # tests. Check for that first. We should have already tested for gld
265 # by now (in libtool), but require it now just to be safe...
654421eb
DE
266 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
267 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
421173e6 268 AC_REQUIRE([AC_PROG_LD])
ff66d28f 269 AC_REQUIRE([AC_PROG_AWK])
e7140677 270
c98b201b
PE
271 # The name set by libtool depends on the version of libtool. Shame on us
272 # for depending on an impl detail, but c'est la vie. Older versions used
273 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
274 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
275 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
276 # set (hence we're using an older libtool), then set it.
277 if test x${with_gnu_ld+set} != xset; then
278 if test x${ac_cv_prog_gnu_ld+set} != xset; then
279 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
280 with_gnu_ld=no
281 else
282 with_gnu_ld=$ac_cv_prog_gnu_ld
283 fi
284 fi
285
286 # Start by getting the version number. I think the libtool test already
287 # does some of this, but throws away the result.
288 changequote(,)
289 ldver=`$LD --version 2>/dev/null | head -1 | \
290 sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
291 changequote([,])
3d7c150e 292 glibcxx_gnu_ld_version=`echo $ldver | \
c98b201b
PE
293 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
294
e7140677 295 # Set --gc-sections.
c98b201b 296 if test "$with_gnu_ld" = "notbroken"; then
a9117427 297 # GNU ld it is! Joy and bunny rabbits!
421173e6
PE
298
299 # All these tests are for C++; save the language and the compiler flags.
300 # Need to do this so that g++ won't try to link in libstdc++
301 ac_test_CFLAGS="${CFLAGS+set}"
302 ac_save_CFLAGS="$CFLAGS"
e7140677 303 CFLAGS='-x c++ -Wl,--gc-sections'
421173e6
PE
304
305 # Check for -Wl,--gc-sections
ff66d28f
PE
306 # XXX This test is broken at the moment, as symbols required for linking
307 # are now in libsupc++ (not built yet). In addition, this test has
308 # cored on solaris in the past. In addition, --gc-sections doesn't
309 # really work at the moment (keeps on discarding used sections, first
310 # .eh_frame and now some of the glibc sections for iconv).
311 # Bzzzzt. Thanks for playing, maybe next time.
421173e6
PE
312 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
313 AC_TRY_RUN([
37bc6ca2 314 int main(void)
421173e6 315 {
a9117427
BK
316 try { throw 1; }
317 catch (...) { };
421173e6
PE
318 return 0;
319 }
c0abb59e 320 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
421173e6
PE
321 if test "$ac_test_CFLAGS" = set; then
322 CFLAGS="$ac_save_CFLAGS"
323 else
324 # this is the suspicious part
325 CFLAGS=''
326 fi
327 if test "$ac_sectionLDflags" = "yes"; then
654421eb 328 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
421173e6
PE
329 fi
330 AC_MSG_RESULT($ac_sectionLDflags)
e7140677 331 fi
a9117427 332
e7140677 333 # Set linker optimization flags.
6aa43d99 334 if test x"$with_gnu_ld" = x"yes"; then
654421eb 335 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
421173e6 336 fi
e7140677 337
c470c17d 338 AC_SUBST(SECTION_LDFLAGS)
421173e6 339 AC_SUBST(OPT_LDFLAGS)
c470c17d
BK
340])
341
342
b2dad0e3 343dnl
ff66d28f 344dnl Check to see if this target can enable the wchar_t parts.
8b8ab21c 345dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
ff66d28f
PE
346dnl must have been previously checked.) By default, wide characters are
347dnl disabled.
b2dad0e3 348dnl
ff66d28f
PE
349dnl Defines:
350dnl HAVE_MBSTATE_T if mbstate_t is not in wchar.h
351dnl _GLIBCXX_USE_WCHAR_T if all the bits are found.
b2dad0e3 352dnl
f214923c 353AC_DEFUN([GLIBCXX_CHECK_WCHAR_T_SUPPORT], [
ff66d28f
PE
354 # Test wchar.h for mbstate_t, which is needed for char_traits and
355 # others even if wchar_t support is not on.
7b331228
BK
356 AC_MSG_CHECKING([for mbstate_t])
357 AC_TRY_COMPILE([#include <wchar.h>],
37bc6ca2 358 [mbstate_t teststate;],
7b331228
BK
359 have_mbstate_t=yes, have_mbstate_t=no)
360 AC_MSG_RESULT($have_mbstate_t)
361 if test x"$have_mbstate_t" = xyes; then
362 AC_DEFINE(HAVE_MBSTATE_T)
363 fi
364
ff66d28f 365 # Sanity check for existence of ISO C99 headers for extended encoding.
7b331228 366 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
31f93f90 367 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
37bc6ca2 368
ff66d28f 369 # Only continue checking if the ISO C99 headers exist and support is on.
a0cb1aa7
PE
370 if test x"$ac_has_wchar_h" = xyes &&
371 test x"$ac_has_wctype_h" = xyes &&
372 test x"$enable_c_mbchar" != xno; then
37bc6ca2 373
ff66d28f
PE
374 # Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
375 # numeric_limits can instantiate type_traits<wchar_t>
7b331228
BK
376 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
377 AC_TRY_COMPILE([#include <wchar.h>],
37bc6ca2 378 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
7b331228
BK
379 has_wchar_minmax=yes, has_wchar_minmax=no)
380 AC_MSG_RESULT($has_wchar_minmax)
37bc6ca2 381
ff66d28f
PE
382 # Test wchar.h for WEOF, which is what we use to determine whether
383 # to specialize for char_traits<wchar_t> or not.
7b331228
BK
384 AC_MSG_CHECKING([for WEOF])
385 AC_TRY_COMPILE([
386 #include <wchar.h>
387 #include <stddef.h>],
388 [wint_t i = WEOF;],
389 has_weof=yes, has_weof=no)
390 AC_MSG_RESULT($has_weof)
37bc6ca2 391
ff66d28f 392 # Tests for wide character functions used in char_traits<wchar_t>.
68fe6226 393 ac_wfuncs=yes
ff66d28f
PE
394 AC_CHECK_FUNCS([wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset],
395 [],[ac_wfuncs=no])
37bc6ca2 396
ff66d28f
PE
397 # Checks for names injected into std:: by the c_std headers.
398 AC_CHECK_FUNCS([btowc wctob fgetwc fgetws fputwc fputws fwide \
2b1be54b
BS
399 fwprintf fwscanf swprintf swscanf vfwprintf vswprintf \
400 vwprintf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
401 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstol \
68fe6226 402 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
ff66d28f
PE
403 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr],
404 [],[ac_wfuncs=no])
df7b1359 405
2b1be54b
BS
406 # Checks for wide character functions that are not required
407 # for basic wchar_t support. Don't disable support if they are missing.
408 # Injection of these is wrapped with guard macros.
409 AC_CHECK_FUNCS([vfwscanf vswscanf vwscanf wcstof iswblank],[],[])
410
7b331228 411 AC_MSG_CHECKING([for ISO C99 wchar_t support])
a0cb1aa7
PE
412 if test x"$has_weof" = xyes &&
413 test x"$has_wchar_minmax" = xyes &&
ff66d28f
PE
414 test x"$ac_wfuncs" = xyes;
415 then
7b331228
BK
416 ac_isoC99_wchar_t=yes
417 else
418 ac_isoC99_wchar_t=no
419 fi
420 AC_MSG_RESULT($ac_isoC99_wchar_t)
37bc6ca2 421
ff66d28f
PE
422 # Use iconv for wchar_t to char conversions. As such, check for
423 # X/Open Portability Guide, version 2 features (XPG2).
7b331228
BK
424 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
425 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
426
ff66d28f 427 # Check for existence of libiconv.a providing XPG2 wchar_t support.
7b331228
BK
428 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
429 ac_save_LIBS="$LIBS"
430 LIBS="$LIBS $libiconv"
431
ff66d28f
PE
432 AC_CHECK_FUNCS([iconv_open iconv_close iconv nl_langinfo],
433 [ac_XPG2funcs=yes], [ac_XPG2funcs=no])
37bc6ca2 434
7b331228 435 LIBS="$ac_save_LIBS"
5b20f7a0 436
7b331228 437 AC_MSG_CHECKING([for XPG2 wchar_t support])
a0cb1aa7
PE
438 if test x"$ac_has_iconv_h" = xyes &&
439 test x"$ac_has_langinfo_h" = xyes &&
ff66d28f
PE
440 test x"$ac_XPG2funcs" = xyes;
441 then
7b331228
BK
442 ac_XPG2_wchar_t=yes
443 else
444 ac_XPG2_wchar_t=no
445 fi
446 AC_MSG_RESULT($ac_XPG2_wchar_t)
37bc6ca2 447
ff66d28f
PE
448 # At the moment, only enable wchar_t specializations if all the
449 # above support is present.
450 if test x"$ac_isoC99_wchar_t" = xyes &&
451 test x"$ac_XPG2_wchar_t" = xyes;
452 then
3d7c150e 453 AC_DEFINE(_GLIBCXX_USE_WCHAR_T)
6b543e86 454 enable_wchar_t=yes
3840fa2a 455 fi
b2dad0e3 456 fi
6b543e86 457 AC_MSG_CHECKING([for enabled wchar_t specializations])
ff66d28f 458 AC_MSG_RESULT($enable_wchar_t)
b2dad0e3
BK
459])
460
461
b2dad0e3 462dnl
ff66d28f
PE
463dnl Check for headers for, and arguments to, the setrlimit() function.
464dnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE.
6aa43d99 465dnl
ff66d28f
PE
466dnl Defines:
467dnl _GLIBCXX_MEM_LIMITS if we can set artificial limits on memory
468dnl various HAVE_MEMLIMIT_* for individual limit names
6aa43d99 469dnl
f214923c 470AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [
ff66d28f
PE
471 AC_TRY_COMPILE(
472 [#include <unistd.h>
473 #include <sys/time.h>
474 #include <sys/resource.h>
475 ],
476 [ int f = RLIMIT_$1 ; ],
477 [glibcxx_mresult=1], [glibcxx_mresult=0])
478 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcxx_mresult,
479 [Only used in build directory testsuite_hooks.h.])
480])
481
f214923c 482AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [
ff66d28f
PE
483 setrlimit_have_headers=yes
484 AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
485 [],
486 [setrlimit_have_headers=no])
487 # If don't have the headers, then we can't run the tests now, and we
488 # won't be seeing any of these during testsuite compilation.
489 if test $setrlimit_have_headers = yes; then
490 # Can't do these in a loop, else the resulting syntax is wrong.
491 GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA)
492 GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS)
493 GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM)
494 GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS)
495
496 # Check for rlimit, setrlimit.
497 AC_CACHE_VAL(ac_setrlimit, [
498 AC_TRY_COMPILE(
499 [#include <unistd.h>
500 #include <sys/time.h>
501 #include <sys/resource.h>
502 ],
503 [struct rlimit r;
504 setrlimit(0, &r);],
505 [ac_setrlimit=yes], [ac_setrlimit=no])
506 ])
507 fi
508
509 AC_MSG_CHECKING([for testsuite memory limit support])
510 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
511 ac_mem_limits=yes
512 AC_DEFINE(_GLIBCXX_MEM_LIMITS)
513 else
514 ac_mem_limits=no
515 fi
516 AC_MSG_RESULT($ac_mem_limits)
6aa43d99
BK
517])
518
519
6aa43d99 520dnl
ff66d28f
PE
521dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>.
522dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately.
6aa43d99 523dnl
f214923c 524AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [
ff66d28f
PE
525 AC_CACHE_VAL(glibcxx_cv_S_ISREG, [
526 AC_TRY_LINK(
527 [#include <sys/stat.h>],
528 [struct stat buffer;
529 fstat(0, &buffer);
530 S_ISREG(buffer.st_mode);],
531 [glibcxx_cv_S_ISREG=yes],
532 [glibcxx_cv_S_ISREG=no])
533 ])
534 AC_CACHE_VAL(glibcxx_cv_S_IFREG, [
535 AC_TRY_LINK(
536 [#include <sys/stat.h>],
537 [struct stat buffer;
538 fstat(0, &buffer);
539 S_IFREG & buffer.st_mode;],
540 [glibcxx_cv_S_IFREG=yes],
541 [glibcxx_cv_S_IFREG=no])
542 ])
543 if test $glibcxx_cv_S_ISREG = yes; then
544 AC_DEFINE(HAVE_S_ISREG)
545 elif test $glibcxx_cv_S_IFREG = yes; then
546 AC_DEFINE(HAVE_S_IFREG)
547 fi
b2dad0e3
BK
548])
549
550
dcfa0bc8 551dnl
ff66d28f 552dnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
dcfa0bc8 553dnl
f214923c 554AC_DEFUN([GLIBCXX_CHECK_POLL], [
ff66d28f 555 AC_CACHE_VAL(glibcxx_cv_POLL, [
3d05b345 556 AC_TRY_LINK(
ff66d28f
PE
557 [#include <poll.h>],
558 [struct pollfd pfd[1];
559 pfd[0].events = POLLIN;
560 poll(pfd, 1, 0);],
561 [glibcxx_cv_POLL=yes],
562 [glibcxx_cv_POLL=no])
563 ])
564 if test $glibcxx_cv_POLL = yes; then
565 AC_DEFINE(HAVE_POLL)
566 fi
567])
568
569
570dnl
571dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
572dnl
f214923c 573AC_DEFUN([GLIBCXX_CHECK_WRITEV], [
ff66d28f 574 AC_CACHE_VAL(glibcxx_cv_WRITEV, [
3d05b345 575 AC_TRY_LINK(
ff66d28f
PE
576 [#include <sys/uio.h>],
577 [struct iovec iov[2];
578 writev(0, iov, 0);],
579 [glibcxx_cv_WRITEV=yes],
580 [glibcxx_cv_WRITEV=no])
581 ])
582 if test $glibcxx_cv_WRITEV = yes; then
583 AC_DEFINE(HAVE_WRITEV)
584 fi
585])
586
587
3d05b345
PC
588dnl
589dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
590dnl
f214923c 591AC_DEFUN([GLIBCXX_CHECK_INT64_T], [
3d05b345
PC
592 AC_CACHE_VAL(glibcxx_cv_INT64_T, [
593 AC_TRY_COMPILE(
594 [#include <stdint.h>],
595 [int64_t var;],
596 [glibcxx_cv_INT64_T=yes],
597 [glibcxx_cv_INT64_T=no])
598 ])
599 if test $glibcxx_cv_INT64_T = yes; then
600 AC_DEFINE(HAVE_INT64_T)
601 fi
602])
603
604
605dnl
606dnl Check whether LFS support is available.
607dnl
f214923c 608AC_DEFUN([GLIBCXX_CHECK_LFS], [
0c6b814a 609 AC_LANG_SAVE
9d47bc51
PC
610 AC_LANG_CPLUSPLUS
611 ac_save_CXXFLAGS="$CXXFLAGS"
612 CXXFLAGS="$CXXFLAGS -fno-exceptions"
3d05b345
PC
613 AC_CACHE_VAL(glibcxx_cv_LFS, [
614 AC_TRY_LINK(
0c6b814a
PC
615 [#include <unistd.h>
616 #include <stdio.h>
617 ],
5c89246d
PC
618 [FILE* fp;
619 fopen64("t", "w");
620 fseeko64(fp, 0, SEEK_CUR);
621 ftello64(fp);
3d05b345
PC
622 lseek64(1, 0, SEEK_CUR);],
623 [glibcxx_cv_LFS=yes],
624 [glibcxx_cv_LFS=no])
625 ])
626 if test $glibcxx_cv_LFS = yes; then
627 AC_DEFINE(_GLIBCXX_USE_LFS)
628 fi
9d47bc51
PC
629 CXXFLAGS="$ac_save_CXXFLAGS"
630 AC_LANG_RESTORE
3d05b345
PC
631])
632
633
ff66d28f
PE
634dnl
635dnl Does any necessary configuration of the testsuite directory. Generates
636dnl the testsuite_hooks.h header.
637dnl
638dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this.
639dnl
640dnl Sets:
641dnl enable_abi_check / GLIBCXX_TEST_ABI
642dnl Substs:
643dnl baseline_dir
644dnl
f214923c 645AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [
92eabea2 646 if $GLIBCXX_IS_NATIVE && test $is_hosted = yes; then
ff66d28f
PE
647 # Do checks for memory limit functions.
648 GLIBCXX_CHECK_SETRLIMIT
649
650 # Look for setenv, so that extended locale tests can be performed.
651 GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
dbc66058
DJ
652
653 if test $enable_symvers = no; then
654 enable_abi_check=no
655 else
656 case "$host" in
657 *-*-cygwin*)
658 enable_abi_check=no ;;
659 *)
660 enable_abi_check=yes ;;
661 esac
662 fi
663 else
664 # Only build this as native, since automake does not understand
665 # CXX_FOR_BUILD.
666 enable_abi_check=no
ff66d28f
PE
667 fi
668
669 # Export file names for ABI checking.
670 baseline_dir="$glibcxx_srcdir/config/abi/${abi_baseline_pair}\$(MULTISUBDIR)"
671 AC_SUBST(baseline_dir)
672
92eabea2
PE
673 GLIBCXX_CONDITIONAL(GLIBCXX_TEST_WCHAR_T, test $enable_wchar_t = yes)
674 GLIBCXX_CONDITIONAL(GLIBCXX_TEST_ABI, test $enable_abi_check = yes)
ff66d28f
PE
675])
676
677
678dnl
679dnl Set up *_INCLUDES variables for all sundry Makefile.am's.
680dnl
681dnl Substs:
682dnl GLIBCXX_INCLUDES
683dnl TOPLEVEL_INCLUDES
ff66d28f 684dnl
f214923c 685AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
0df3f383
PE
686 # Used for every C++ compile we perform.
687 GLIBCXX_INCLUDES="\
688-I$glibcxx_builddir/include/$host_alias \
689-I$glibcxx_builddir/include \
690-I$glibcxx_srcdir/libsupc++"
ff66d28f 691
0df3f383 692 # For Canadian crosses, pick this up too.
ff66d28f 693 if test $CANADIAN = yes; then
37e0ff11 694 GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}"
ff66d28f
PE
695 fi
696
0df3f383
PE
697 # Stuff in the actual top level. Currently only used by libsupc++ to
698 # get unwind* headers from the gcc dir.
699 #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
700 TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
ff66d28f
PE
701
702 # Now, export this to all the little Makefiles....
703 AC_SUBST(GLIBCXX_INCLUDES)
704 AC_SUBST(TOPLEVEL_INCLUDES)
ff66d28f
PE
705])
706
707
708dnl
709dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
710dnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.)
711dnl
712dnl Substs:
713dnl OPTIMIZE_CXXFLAGS
714dnl WARN_FLAGS
715dnl
f214923c 716AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
ff66d28f
PE
717 # Optimization flags that are probably a good idea for thrill-seekers. Just
718 # uncomment the lines below and make, everything else is ready to go...
719 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
720 OPTIMIZE_CXXFLAGS=
721 AC_SUBST(OPTIMIZE_CXXFLAGS)
722
b2bc3339 723 WARN_FLAGS='-Wall -W -Wwrite-strings -Wcast-qual'
ff66d28f
PE
724 AC_SUBST(WARN_FLAGS)
725])
726
727
728dnl
729dnl All installation directory information is determined here.
730dnl
731dnl Substs:
732dnl gxx_install_dir
733dnl glibcxx_prefixdir
734dnl glibcxx_toolexecdir
735dnl glibcxx_toolexeclibdir
736dnl
737dnl Assumes cross_compiling bits already done, and with_cross_host in
738dnl particular.
739dnl
f214923c 740AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
ff66d28f
PE
741 glibcxx_toolexecdir=no
742 glibcxx_toolexeclibdir=no
743 glibcxx_prefixdir=$prefix
744
745 AC_MSG_CHECKING([for gxx-include-dir])
746 AC_ARG_WITH([gxx-include-dir],
747 AC_HELP_STRING([--with-gxx-include-dir=DIR],
748 [installation directory for include files]),
749 [case "$withval" in
750 yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
751 no) gxx_include_dir=no ;;
752 *) gxx_include_dir=$withval ;;
753 esac],
754 [gxx_include_dir=no])
755 AC_MSG_RESULT($gxx_include_dir)
756
757 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
758 AC_ARG_ENABLE([version-specific-runtime-libs],
759 AC_HELP_STRING([--enable-version-specific-runtime-libs],
760 [Specify that runtime libraries should be installed in a compiler-specific directory]),
761 [case "$enableval" in
762 yes) version_specific_libs=yes ;;
763 no) version_specific_libs=no ;;
764 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
765 esac],
766 [version_specific_libs=no])
767 AC_MSG_RESULT($version_specific_libs)
768
769 # Default case for install directory for include files.
770 if test $version_specific_libs = no && test $gxx_include_dir = no; then
771 gxx_include_dir='${prefix}'/include/c++/${gcc_version}
772 fi
773
774 # Version-specific runtime libs processing.
775 if test $version_specific_libs = yes; then
776 # Need the gcc compiler version to know where to install libraries
777 # and header files if --enable-version-specific-runtime-libs option
0314451d
GK
778 # is selected. FIXME: these variables are misnamed, there are
779 # no executables installed in _toolexecdir or _toolexeclibdir.
ff66d28f 780 if test x"$gxx_include_dir" = x"no"; then
0314451d 781 gxx_include_dir='${libdir}/gcc/${host_alias}/'$gcc_version/include/c++
ff66d28f 782 fi
0314451d 783 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
fbe057bb 784 glibcxx_toolexeclibdir='${toolexecdir}/'$gcc_version'$(MULTISUBDIR)'
ff66d28f
PE
785 fi
786
787 # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
788 # Install a library built with a cross compiler in tooldir, not libdir.
789 if test x"$glibcxx_toolexecdir" = x"no"; then
790 if test -n "$with_cross_host" &&
791 test x"$with_cross_host" != x"no"; then
fbe057bb
PE
792 glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
793 glibcxx_toolexeclibdir='${toolexecdir}/lib'
ff66d28f 794 else
0314451d 795 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
fbe057bb 796 glibcxx_toolexeclibdir='${libdir}'
ff66d28f 797 fi
fbe057bb 798 multi_os_directory=`$CXX -print-multi-os-directory`
ff66d28f
PE
799 case $multi_os_directory in
800 .) ;; # Avoid trailing /.
801 *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
802 esac
803 fi
804
805 AC_MSG_CHECKING([for install location])
806 AC_MSG_RESULT($gxx_include_dir)
807
808 AC_SUBST(glibcxx_prefixdir)
809 AC_SUBST(gxx_include_dir)
810 AC_SUBST(glibcxx_toolexecdir)
811 AC_SUBST(glibcxx_toolexeclibdir)
812])
813
814
815dnl
816dnl GLIBCXX_ENABLE
817dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
818dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
819dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
820dnl
821dnl See docs/html/17_intro/configury.html#enable for documentation.
822dnl
823m4_define([GLIBCXX_ENABLE],[dnl
824m4_define([_g_switch],[--enable-$1])dnl
825m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
826 AC_ARG_ENABLE($1,_g_help,
827 m4_bmatch([$5],
828 [^permit ],
829 [[
830 case "$enableval" in
831 m4_bpatsubst([$5],[permit ])) ;;
832 *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
833 dnl Idea for future: generate a URL pointing to
834 dnl "onlinedocs/configopts.html#whatever"
835 esac
836 ]],
837 [^$],
838 [[
839 case "$enableval" in
840 yes|no) ;;
841 *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
842 esac
843 ]],
844 [[$5]]),
845 [enable_]m4_bpatsubst([$1],-,_)[=][$2])
846m4_undefine([_g_switch])dnl
847m4_undefine([_g_help])dnl
848])
849
850
851dnl
852dnl Check for ISO/IEC 9899:1999 "C99" support.
853dnl
854dnl --enable-c99 defines _GLIBCXX_USE_C99
855dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined
856dnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)]
857dnl Where DEFAULT is either `yes' or `no'.
858dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
859dnl
f214923c 860AC_DEFUN([GLIBCXX_ENABLE_C99], [
ff66d28f
PE
861 GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support])
862
863 AC_LANG_SAVE
864 AC_LANG_CPLUSPLUS
865
866 # Check for the existence of <math.h> functions used if C99 is enabled.
867 ac_c99_math=yes;
868 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
869 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
870 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
871 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
872 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
873 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
874 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
875 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
876 AC_TRY_COMPILE([#include <math.h>],
877 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
878 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
879 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
880 AC_TRY_COMPILE([#include <math.h>],
881 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
882 AC_TRY_COMPILE([#include <math.h>],
883 [isunordered(0.0,0.0);],, [ac_c99_math=no])
884 AC_MSG_RESULT($ac_c99_math)
885
517da0ce
MM
886 if test x"$ac_c99_math" = x"yes"; then
887 AC_DEFINE(_GLIBCXX_USE_C99_MATH)
888 fi
889
ff66d28f
PE
890 # Check for the existence in <stdio.h> of vscanf, et. al.
891 ac_c99_stdio=yes;
892 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
893 AC_TRY_COMPILE([#include <stdio.h>],
894 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
895 AC_TRY_COMPILE([#include <stdio.h>
896 #include <stdarg.h>
897 void foo(char* fmt, ...)
898 {va_list args; va_start(args, fmt);
899 vfscanf(stderr, "%i", args);}],
900 [],, [ac_c99_stdio=no])
901 AC_TRY_COMPILE([#include <stdio.h>
902 #include <stdarg.h>
903 void foo(char* fmt, ...)
904 {va_list args; va_start(args, fmt);
905 vscanf("%i", args);}],
906 [],, [ac_c99_stdio=no])
907 AC_TRY_COMPILE([#include <stdio.h>
908 #include <stdarg.h>
909 void foo(char* fmt, ...)
910 {va_list args; va_start(args, fmt);
911 vsnprintf(fmt, 0, "%i", args);}],
912 [],, [ac_c99_stdio=no])
913 AC_TRY_COMPILE([#include <stdio.h>
914 #include <stdarg.h>
915 void foo(char* fmt, ...)
916 {va_list args; va_start(args, fmt);
917 vsscanf(fmt, "%i", args);}],
918 [],, [ac_c99_stdio=no])
919 AC_MSG_RESULT($ac_c99_stdio)
920
921 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
922 ac_c99_stdlib=yes;
923 AC_MSG_CHECKING([for lldiv_t declaration])
924 AC_CACHE_VAL(ac_c99_lldiv_t, [
925 AC_TRY_COMPILE([#include <stdlib.h>],
926 [ lldiv_t mydivt;],
927 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
928 ])
929 AC_MSG_RESULT($ac_c99_lldiv_t)
930
931 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
932 AC_TRY_COMPILE([#include <stdlib.h>],
933 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
934 AC_TRY_COMPILE([#include <stdlib.h>],
935 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
936 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
937 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
938 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
939 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
940 if test x"$ac_c99_lldiv_t" = x"no"; then
941 ac_c99_stdlib=no;
942 fi;
943 AC_MSG_RESULT($ac_c99_stdlib)
944
945 # Check for the existence of <wchar.h> functions used if C99 is enabled.
946 # XXX the wchar.h checks should be rolled into the general C99 bits.
947 ac_c99_wchar=yes;
948 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
949 AC_TRY_COMPILE([#include <wchar.h>],
950 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
951 AC_TRY_COMPILE([#include <wchar.h>],
952 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
953 AC_TRY_COMPILE([#include <wchar.h>],
954 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
955 AC_MSG_RESULT($ac_c99_wchar)
956
957 AC_MSG_CHECKING([for enabled ISO C99 support])
958 if test x"$ac_c99_math" = x"no" ||
959 test x"$ac_c99_stdio" = x"no" ||
960 test x"$ac_c99_stdlib" = x"no" ||
961 test x"$ac_c99_wchar" = x"no"; then
962 enable_c99=no;
963 fi;
964 AC_MSG_RESULT($enable_c99)
965
517da0ce
MM
966 if test x"$ac_99_math" = x"yes"; then
967 AC_DEFINE(_GLIBCXX_USE_C99_MATH)
968 fi
969
ff66d28f
PE
970 # Option parsed, now set things appropriately
971 if test x"$enable_c99" = x"yes"; then
972 AC_DEFINE(_GLIBCXX_USE_C99)
973 fi
974
975 AC_LANG_RESTORE
dcfa0bc8
PE
976])
977
978
0214010c 979dnl
ff66d28f
PE
980dnl Check for what type of C headers to use.
981dnl
982dnl --enable-cheaders= [does stuff].
983dnl --disable-cheaders [does not do anything, really].
984dnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)]
985dnl Where DEFAULT is either `c' or `c_std'.
986dnl
f214923c 987AC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [
ff66d28f
PE
988 GLIBCXX_ENABLE(cheaders,$1,[=KIND],
989 [construct "C" headers for g++], [permit c|c_std])
990 AC_MSG_NOTICE("C" header strategy set to $enable_cheaders)
991
992 C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders
993
994 AC_SUBST(C_INCLUDE_DIR)
92eabea2
PE
995 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
996 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
997 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
ff66d28f
PE
998])
999
1000
0214010c 1001dnl
ff66d28f
PE
1002dnl Check for which locale library to use. The choice is mapped to
1003dnl a subdirectory of config/locale.
37bc6ca2 1004dnl
ff66d28f 1005dnl Default is generic.
0214010c 1006dnl
f214923c 1007AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
ff66d28f
PE
1008 AC_MSG_CHECKING([for C locale to use])
1009 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
1010 [use MODEL for target locale package],
1011 [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
1012
1013 # If they didn't use this option switch, or if they specified --enable
1014 # with no specific model, we'll have to look for one. If they
1015 # specified --disable (???), do likewise.
1016 if test $enable_clocale = no || test $enable_clocale = yes; then
1017 enable_clocale=auto
1018 fi
0214010c 1019
ff66d28f 1020 # Either a known package, or "auto"
0214010c
BK
1021 enable_clocale_flag=$enable_clocale
1022
ff66d28f
PE
1023 # Probe for locale support if no specific model is specified.
1024 # Default to "generic".
1025 if test $enable_clocale_flag = auto; then
56deb74c 1026 case x${target_os} in
b2398b49 1027 xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
ff66d28f 1028 AC_EGREP_CPP([_GLIBCXX_ok], [
56deb74c 1029 #include <features.h>
37bc6ca2 1030 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
3d7c150e 1031 _GLIBCXX_ok
56deb74c
BK
1032 #endif
1033 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1451a492 1034
ff66d28f
PE
1035 # Test for bugs early in glibc-2.2.x series
1036 if test x$enable_clocale_flag = xgnu; then
1037 AC_TRY_RUN([
1038 #define _GNU_SOURCE 1
1039 #include <locale.h>
1040 #include <string.h>
1041 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
1042 extern __typeof(newlocale) __newlocale;
1043 extern __typeof(duplocale) __duplocale;
1044 extern __typeof(strcoll_l) __strcoll_l;
1045 #endif
1046 int main()
1047 {
1048