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