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