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